diff --git a/packages/docs/public/images/lighthouse-viewer-drop.png b/packages/docs/public/images/lighthouse-viewer-drop.png new file mode 100644 index 00000000..63f921b1 Binary files /dev/null and b/packages/docs/public/images/lighthouse-viewer-drop.png differ diff --git a/packages/docs/public/images/report-steps.png b/packages/docs/public/images/report-steps.png new file mode 100644 index 00000000..53a6faa5 Binary files /dev/null and b/packages/docs/public/images/report-steps.png differ diff --git a/packages/docs/src/app/app.routes.ts b/packages/docs/src/app/app.routes.ts index 3a232abe..d7960c00 100644 --- a/packages/docs/src/app/app.routes.ts +++ b/packages/docs/src/app/app.routes.ts @@ -1,15 +1,14 @@ import { Route } from '@angular/router'; import { Home } from './home/home'; -import { DocPage } from './docs/doc-page'; import { NotFound } from './not-found'; -import { docResolver } from './docs/doc.resolver'; export const appRoutes: Route[] = [ { path: '', component: Home, pathMatch: 'full' }, { + // Loaded on demand: the Markdown renderer and the highlighter are only + // needed on doc pages, so the landing page ships without them. path: 'docs/:section/:page', - component: DocPage, - resolve: { doc: docResolver }, + loadChildren: () => import('./docs/docs.routes').then((m) => m.DOCS_ROUTES), }, { path: 'docs', redirectTo: 'docs/getting-started/introduction' }, { path: 'not-found', component: NotFound }, diff --git a/packages/docs/src/app/docs/_diagrams.scss b/packages/docs/src/app/docs/_diagrams.scss index 7dd2c409..fa29e9be 100644 --- a/packages/docs/src/app/docs/_diagrams.scss +++ b/packages/docs/src/app/docs/_diagrams.scss @@ -244,3 +244,531 @@ vertical-align: -4px; color: var(--link); } + +/* Screenshots: a standalone image becomes a framed, captioned figure. */ +.prose .figure { + margin: var(--space-6) 0 var(--space-8); + + img { + margin: 0; + width: 100%; + border: 1px solid var(--border-strong); + border-radius: var(--radius-xl); + box-shadow: var(--shadow-md); + } + + figcaption { + margin-top: var(--space-3); + font-size: 0.8125rem; + line-height: 1.25rem; + text-align: center; + color: var(--text-muted); + } +} + +/* Report formats: the code tab chrome on the doc surface, so the HTML and + Markdown panels sit on a light (or dark) page rather than in a terminal. */ +.prose .format-tabs { + border-color: var(--border-strong); + background: var(--surface-raised); + + > .code-title { + justify-content: space-between; + background: var(--surface-subtle); + border-bottom-color: var(--border); + color: var(--text-muted); + } + + .code-tab { + color: var(--text-muted); + + &:hover, + &[aria-selected='true'] { + color: var(--text-heading); + } + } + + .code-tab-indicator { + background: var(--accent); + } + + .code-tabpanel { + padding: var(--space-5); + } + + .code-tabpanel:has(.code-scroll) { + padding: 0; + } +} + +.format-tabs-hint { + font-family: var(--font-mono); + font-size: 0.6875rem; + color: var(--text-subtle); +} + +.rf-report { + font-size: 0.875rem; +} + +.rf-head { + display: flex; + flex-wrap: wrap; + align-items: flex-start; + justify-content: space-between; + gap: var(--space-2) var(--space-4); + margin-bottom: var(--space-4); +} + +.rf-kicker { + margin: 0 !important; + font-size: 0.75rem; + color: var(--text-muted); +} + +.rf-title { + margin: 0 !important; + font-size: 1.125rem; + font-weight: 600; + line-height: 1.5rem; + color: var(--text-heading); +} + +.rf-badge { + padding: 2px var(--space-2); + border: 1px solid var(--accent-outline); + border-radius: var(--radius-full); + background: var(--accent-soft); + color: var(--accent-soft-text); + font-family: var(--font-mono); + font-size: 0.6875rem; +} + +.rf-steps { + display: flex; + flex-direction: column; + gap: var(--space-3); + margin: 0 !important; + padding: 0 !important; + list-style: none; +} + +.rf-step { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-3); + margin: 0 !important; + padding: var(--space-3) var(--space-4); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + background: var(--surface); + + @media (min-width: 640px) { + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + } +} + +.rf-step-head { + display: flex; + align-items: center; + gap: var(--space-3); + + .img-icon { + margin: 0; + width: 1.25rem; + height: 1.25rem; + } + + span { + display: flex; + flex-direction: column; + } + + b { + color: var(--text-heading); + font-weight: 600; + } + + small { + font-size: 0.75rem; + color: var(--text-muted); + } +} + +.rf-gauges { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: var(--space-2); +} + +.rf-score { + display: flex; + flex-direction: column; + align-items: center; + gap: var(--space-1); + width: 4.25rem; + + small { + font-size: 0.625rem; + line-height: 0.875rem; + text-align: center; + color: var(--text-muted); + } +} + +.rf-gauge { + --ok: var(--color-success-700); + --ok-tint: var(--color-success-100); + position: relative; + display: grid; + place-items: center; + width: 2.5rem; + height: 2.5rem; + font-family: var(--font-mono); + font-size: 0.6875rem; + font-weight: 600; + color: var(--ok); + + &[data-rating='average'] { + --ok: var(--color-warning-700); + --ok-tint: var(--color-warning-100); + } + + &[data-rating='fail'] { + --ok: var(--color-error-700); + --ok-tint: var(--color-error-100); + } + + svg { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + rotate: -90deg; + } + + circle { + fill: none; + stroke-width: 3; + } + + .rf-track { + stroke: var(--ok-tint); + } + + .rf-arc { + stroke: var(--ok); + stroke-linecap: round; + stroke-dasharray: var(--pct) 100; + } + + b { + position: relative; + font-weight: 600; + } +} + +.rf-gauge-none { + color: var(--text-subtle); +} + +.reveal-pending:not(.reveal-in) .rf-arc { + stroke-dasharray: 0 100; +} + +.reveal-in .rf-arc { + transition: stroke-dasharray 1s var(--ease-out) 300ms; +} + +.rf-md-title { + margin: 0 0 var(--space-1) !important; + font-size: 1.125rem; + font-weight: 600; + color: var(--text-heading); +} + +.rf-md-date { + margin: 0 0 var(--space-3) !important; + font-size: 0.875rem; + color: var(--text-muted); +} + +.prose .rf-md .table-wrap, +.prose .prc .table-wrap { + margin: 0; + + table { + font-size: 0.75rem; + line-height: 1.125rem; + } + + th, + td { + padding: var(--space-2) var(--space-3); + } + + .img-icon { + width: 14px; + height: 14px; + margin-right: var(--space-1); + vertical-align: -3px; + } +} + +.rf-cell { + font-family: var(--font-mono); + text-align: center; + + &[data-rating='pass'] { + color: var(--color-success-700); + } + &[data-rating='average'] { + color: var(--color-warning-700); + } + &[data-rating='fail'] { + color: var(--color-error-700); + } +} + +/* The pull request comment */ +.diagram-pr { + padding: var(--space-4); +} + +.prc { + border: 1px solid var(--border-strong); + border-radius: var(--radius-lg); + background: var(--surface-raised); + overflow: hidden; +} + +.prc-head { + display: flex; + align-items: center; + gap: var(--space-2); + padding: var(--space-2-5) var(--space-4); + border-bottom: 1px solid var(--border); + background: var(--surface-subtle); + font-size: 0.8125rem; + color: var(--text-muted); + + b { + color: var(--text-heading); + } +} + +.prc-avatar { + display: inline-grid; + place-items: center; + width: 1.5rem; + height: 1.5rem; + border-radius: 50%; + background: var(--accent-soft); + color: var(--accent-soft-text); + + svg { + width: 0.9rem; + height: 0.9rem; + } +} + +.prc-bot { + padding: 0 var(--space-1-5); + border: 1px solid var(--border-strong); + border-radius: var(--radius-full); + font-size: 0.6875rem; +} + +.prc-time { + margin-left: auto; + white-space: nowrap; +} + +.prc-body { + padding: var(--space-4); +} + +/* SVG figures: shared text and icon styles */ +.dg-strong { + fill: var(--text-heading); + font-family: var(--font-sans); + font-size: 15px; + font-weight: 600; +} + +.dg-note { + fill: var(--text-muted); + font-family: var(--font-sans); + font-size: 12px; +} + +.dg-item { + fill: var(--text); + font-family: var(--font-mono); + font-size: 11.5px; +} + +.dg-icon { + color: var(--dg-stroke, var(--link)); + overflow: visible; +} + +.dg-arrowhead, +.dg-loop { + stroke: var(--border-strong); +} + +.diagram-ci, +.diagram-cli { + padding: var(--space-4) var(--space-5); +} + +/* Measurement modes: three cards with the categories each one can score. */ +.modes { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-3); + + @media (min-width: 640px) { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } +} + +.mode { + display: flex; + flex-direction: column; + gap: var(--space-1-5); + padding: var(--space-4); + border: 1px solid var(--border-strong); + border-radius: var(--radius-lg); + background: var(--surface-raised); + font-size: 0.8125rem; + line-height: 1.25rem; + + b { + color: var(--text-heading); + font-size: 0.9375rem; + } +} + +.mode-icon { + display: inline-grid; + place-items: center; + width: 2.25rem; + height: 2.25rem; + margin-bottom: var(--space-1); + border-radius: var(--radius-lg); + background: var(--accent-soft); + color: var(--accent-soft-text); + + .img-icon { + margin: 0; + width: 1.25rem; + height: 1.25rem; + color: inherit; + } +} + +.mode-what { + color: var(--text); + font-weight: 500; +} + +.mode-note { + color: var(--text-muted); +} + +.mode-cats { + display: flex; + flex-wrap: wrap; + gap: var(--space-1-5); + margin: var(--space-2) 0 0 !important; + padding: 0 !important; + list-style: none; + + li { + margin: 0 !important; + padding: 0 var(--space-2); + border-radius: var(--radius-full); + font-size: 0.6875rem; + line-height: 1.25rem; + font-family: var(--font-mono); + } + + .on { + background: color-mix(in srgb, var(--color-success-500) 16%, transparent); + color: var(--color-success-700); + } + + .off { + background: var(--surface-subtle); + color: var(--text-subtle); + text-decoration: line-through; + } +} + +/* The call to action at the end of a guide */ +.prose .cta-band-doc { + margin: var(--space-10) 0 0; + + .cta-title { + margin: 0; + } + + .cta-body { + margin: var(--space-2) 0 0; + font-size: 0.9375rem; + line-height: 1.5rem; + } + + a.cta-btn { + text-decoration: none; + color: var(--btn-color); + } + + code { + padding: 0; + background: none; + color: inherit; + font-size: inherit; + } +} + +@mixin dark-figures { + .rf-gauge { + --ok: var(--color-success-400); + --ok-tint: color-mix(in srgb, var(--color-success-500) 18%, transparent); + + &[data-rating='average'] { + --ok: var(--color-warning-400); + --ok-tint: color-mix(in srgb, var(--color-warning-500) 18%, transparent); + } + + &[data-rating='fail'] { + --ok: var(--color-error-400); + --ok-tint: color-mix(in srgb, var(--color-error-500) 18%, transparent); + } + } + + .rf-cell[data-rating='pass'], + .mode-cats .on { + color: var(--color-success-400); + } + .rf-cell[data-rating='average'] { + color: var(--color-warning-400); + } + .rf-cell[data-rating='fail'] { + color: var(--color-error-400); + } +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme='light']) { + @include dark-figures; + } +} + +:root[data-theme='dark'] { + @include dark-figures; +} diff --git a/packages/docs/src/app/docs/diagrams.ts b/packages/docs/src/app/docs/diagrams.ts index 218111cc..d0ba4dd9 100644 --- a/packages/docs/src/app/docs/diagrams.ts +++ b/packages/docs/src/app/docs/diagrams.ts @@ -4,6 +4,56 @@ * follow the theme, and they animate in through the reveal styles in * `_diagrams.scss`. */ +import hljs from 'highlight.js/lib/core'; +import json from 'highlight.js/lib/languages/json'; + +hljs.registerLanguage('json', json); + +/** The sample flow every figure shows, with the scores the landing page uses. */ +const SAMPLE_STEPS = [ + { + mode: 'navigation', + name: 'Navigate to coffee cart', + kind: 'navigation', + scores: { performance: '92', accessibility: '100', 'best-practices': '96', seo: '83' }, + }, + { + mode: 'timespan', + name: 'Select coffee', + kind: 'timespan', + scores: { performance: '9/10', accessibility: '-', 'best-practices': '6/6', seo: '-' }, + }, + { + mode: 'snapshot', + name: 'Checkout form', + kind: 'snapshot', + scores: { performance: '3/4', accessibility: '18/19', 'best-practices': '5/5', seo: '9/9' }, + }, +] as const; + +const CATEGORIES = [ + ['performance', 'Performance'], + ['accessibility', 'Accessibility'], + ['best-practices', 'Best practices'], + ['seo', 'SEO'], +] as const; + +/** Lighthouse colours: 90+ or every audit passed is green, 50+ is orange, the rest red. */ +function rating(value: string): 'pass' | 'average' | 'fail' | 'none' { + if (value === '-') { + return 'none'; + } + const [a, b] = value.split('/').map(Number); + const ratio = b ? a / b : a / 100; + if (b) { + return ratio === 1 ? 'pass' : ratio >= 0.5 ? 'average' : 'fail'; + } + return ratio >= 0.9 ? 'pass' : ratio >= 0.5 ? 'average' : 'fail'; +} + +function escape(value: string): string { + return value.replace(/&/g, '&').replace(//g, '>'); +} /** One bar of a code row: its kind and its length in units. */ type Seg = [kind: 'm' | 'g' | 'r' | 'i' | 'h', length: number]; @@ -189,9 +239,176 @@ ${reports.map(([x, label]) => box(x, rowY.reports, label, 'report')).join('')} `; } +/** A Lighthouse-style gauge: a ring with the score, or a pill for audit counts. */ +function gauge(value: string): string { + const r = rating(value); + if (r === 'none') { + return '–'; + } + const [a, b] = value.split('/').map(Number); + const pct = b ? Math.round((a / b) * 100) : a; + return `${value}`; +} + +/** The table every text format carries, as the Markdown report prints it. */ +const reportRows = () => + SAMPLE_STEPS.map( + (step) => + `${modeIcon(step.mode)}${escape(step.name)}${step.kind}${CATEGORIES.map( + ([key]) => `${step.scores[key]}`, + ).join('')}`, + ).join(''); + +const reportTable = () => + `
${CATEGORIES.map(([, label]) => ``).join('')}${reportRows()}
StepGather mode${label}
`; + +/** The four report formats of one run, switchable like the code tabs. */ +function reportFormats(): string { + const html = `

Lighthouse user flow report

Order Coffee

order-coffee.uf.html
    ${SAMPLE_STEPS.map( + (step) => + `
  1. ${modeIcon(step.mode)}${escape(step.name)}${step.kind} report${CATEGORIES.map( + ([key, label]) => `${gauge(step.scores[key])}${label}`, + ).join('')}
  2. `, + ).join('')}
`; + const jsonSource = JSON.stringify( + { + name: 'Order Coffee', + steps: SAMPLE_STEPS.slice(0, 2).map((step) => ({ + name: step.name, + lhr: { + gatherMode: step.kind, + finalDisplayedUrl: 'https://coffee-cart.netlify.app/', + categories: Object.fromEntries( + CATEGORIES.filter(([key]) => step.scores[key] !== '-').map(([key]) => [ + key, + { score: step.scores[key].includes('/') ? null : Number(step.scores[key]) / 100 }, + ]), + ), + audits: { '…': '…' }, + }, + })), + }, + null, + 2, + ); + const jsonPanel = `
${hljs.highlight(jsonSource, { language: 'json' }).value}
`; + const md = `

☕ Order Coffee ☕

Date/Time: 2026-11-07 14:02

${reportTable()}
`; + const stdoutLines = [ + '☕ Order Coffee ☕', + '', + '| Step Name | Gather Mode | Performance | Accessibility | Best Practices | Seo |', + '|:-------------------------|:-----------:|:-----------:|:-------------:|:--------------:|:---:|', + ...SAMPLE_STEPS.map( + (step) => + `| ${step.name.padEnd(24)} | ${step.kind.padStart(7).padEnd(11)} | ${step.scores.performance.padStart(7).padEnd(11)} | ${step.scores.accessibility.padStart(8).padEnd(13)} | ${step.scores['best-practices'].padStart(8).padEnd(14)} | ${step.scores.seo.padStart(2).padEnd(3)} |`, + ), + ]; + const stdout = `
npx user-flow collect --format stdout\n${escape(stdoutLines.join('\n'))}
`; + const tabs: [string, string][] = [ + ['HTML', html], + ['JSON', jsonPanel], + ['Markdown', md], + ['stdout', stdout], + ]; + const buttons = tabs + .map( + ([name], i) => + ``, + ) + .join(''); + const panels = tabs + .map( + ([name, body], i) => + `
${body}
`, + ) + .join(''); + return `
${buttons}
one run, four formats
${panels}
`; +} + +/** Pull request → action → report → comment, in one line. */ +function ciFlow(): string { + const nodes = [ + ['Pull request', 'opened or updated', 'M6 3a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 6a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM6 9v6M15 9a9 9 0 0 1-9 9'], + ['user-flow collect', 'CI mode, no prompts', 'm6 4 14 8-14 8V4z'], + ['Markdown report', 'measures/*.uf.md', 'M3 3v18h18M8 17V9M13 17V5M18 17v-3'], + ['Sticky comment', 'replaced on every run', 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'], + ]; + const W = 190; + const gap = 46; + const boxes = nodes + .map( + ([title, note, icon], i) => + `${title}${note}`, + ) + .join(''); + const arrows = nodes + .slice(1) + .map((_, i) => { + const x1 = i * (W + gap) + W; + const x2 = x1 + gap; + return ``; + }) + .join(''); + const loop = `the next push runs it again`; + return ``; +} + +/** The comment the action leaves on a pull request. */ +function prComment(): string { + return ``; +} + +/** A command box of the command map, with its name, purpose and a few notes. */ +const commandBox = (x: number, kind: string, title: string, note: string, items: string[]) => + `${title}${note}${items + .map((item, i) => `${item}`) + .join('')}`; + +/** The CLI: one entry point, two commands, and what each one does. */ +function commandMap(): string { + return ``; +} + +/** The three kinds of step and which categories each one can score. */ +function measurementModes(): string { + const modes = [ + ['navigation', 'Navigation', 'A page load, cold or warm', 'The classic Lighthouse run.', [true, true, true, true]], + ['timespan', 'Timespan', 'An interaction over time', 'The only mode that sees runtime work: long tasks, layout shifts, requests.', [true, false, true, false]], + ['snapshot', 'Snapshot', 'The page as it is right now', 'Audits the current DOM without loading or interacting.', [true, true, true, true]], + ] as const; + return ``; +} + export const DIAGRAMS: Record string> = { 'code-reduction': codeReduction, 'ufo-architecture': ufoArchitecture, + 'report-formats': reportFormats, + 'ci-flow': ciFlow, + 'pr-comment': prComment, + 'command-map': commandMap, + 'measurement-modes': measurementModes, }; /** The Lighthouse icon for a measurement mode, inline, for use in tables and text. */ diff --git a/packages/docs/src/app/docs/doc-page.scss b/packages/docs/src/app/docs/doc-page.scss index c0a2791e..0fe59edd 100644 --- a/packages/docs/src/app/docs/doc-page.scss +++ b/packages/docs/src/app/docs/doc-page.scss @@ -280,7 +280,7 @@ } .pager-section { - color: var(--text-subtle); + color: var(--text-muted); font-weight: 500; } diff --git a/packages/docs/src/app/docs/doc-page.ts b/packages/docs/src/app/docs/doc-page.ts index 17cc28cf..21aa917d 100644 --- a/packages/docs/src/app/docs/doc-page.ts +++ b/packages/docs/src/app/docs/doc-page.ts @@ -28,7 +28,9 @@ const REVEAL_BLOCKS = [ ':scope > .table-wrap', ':scope > .options', ':scope > .diagram', - 'img:not(.img-icon)', + ':scope > .figure', + ':scope > .cta-band', + '.step img:not(.img-icon)', '.link-card', '.step', ].join(', '); @@ -159,6 +161,12 @@ export class DocPage { return; } + const command = target.closest('.cta-command'); + if (command) { + this.copyCommand(command); + return; + } + const image = target.closest('img:not(.img-icon)'); if (image) { this.openLightbox(image); @@ -465,6 +473,26 @@ export class DocPage { this.toastTimer = setTimeout(() => this.toast.set(null), 1800); } + /** The call-to-action band's install command. */ + private copyCommand(button: HTMLButtonElement) { + const state = button.querySelector('.cta-copy-state'); + const markCopied = () => { + button.classList.add('copied'); + if (state) { + state.textContent = 'Copied'; + } + setTimeout(() => { + button.classList.remove('copied'); + if (state) { + state.textContent = 'Copy'; + } + }, 1800); + }; + navigator.clipboard + ?.writeText(button.dataset['copy'] ?? '') + .then(markCopied, () => undefined); + } + private copyCode(button: HTMLButtonElement) { const block = button.closest('.code-block'); const code = diff --git a/packages/docs/src/app/docs/docs.routes.ts b/packages/docs/src/app/docs/docs.routes.ts new file mode 100644 index 00000000..0e4d0a74 --- /dev/null +++ b/packages/docs/src/app/docs/docs.routes.ts @@ -0,0 +1,8 @@ +import { Route } from '@angular/router'; +import { DocPage } from './doc-page'; +import { docResolver } from './doc.resolver'; + +/** The doc page route, loaded on demand from `app.routes.ts`. */ +export const DOCS_ROUTES: Route[] = [ + { path: '', component: DocPage, resolve: { doc: docResolver } }, +]; diff --git a/packages/docs/src/app/docs/markdown.ts b/packages/docs/src/app/docs/markdown.ts index 9f014f9d..1fb61cdb 100644 --- a/packages/docs/src/app/docs/markdown.ts +++ b/packages/docs/src/app/docs/markdown.ts @@ -291,6 +291,25 @@ function renderTerminal(text: string, title?: string): string { return `
${header}
${lines.join('\n')}
\n`; } +/** Pixel sizes of the screenshots under `public/images`, so they reserve their space before they load. */ +const IMAGE_SIZES: Record = { + 'images/chrome-recorder-export-json.png': [1020, 336], + 'images/chrome-recorder-start-new.png': [1269, 622], + 'images/getting-started-resulting-navigation-report.png': [1920, 926], + 'images/github-report-comment.png': [918, 811], + 'images/lhr-replay-example-results-1.png': [2576, 975], + 'images/lhr-replay-example-results-2.png': [2724, 1965], + 'images/lhr-replay-example-results-3.png': [2724, 1971], + 'images/lighthouse-viewer-drop.png': [1181, 361], + 'images/report-steps.png': [1904, 978], +}; + +/** The landing page's call to action, for the end of a guide. */ +function ctaBand(quickStartAttrs: string): string { + const command = 'npm i @push-based/user-flow --save-dev'; + return `\n`; +} + /** The highlighted `
` for a fenced block, plus its language and title. */
 function codeBody({ text, lang }: Tokens.Code) {
   const [language, ...meta] = (lang ?? '').trim().split(/\s+/);
@@ -565,7 +584,29 @@ export function renderMarkdown(
         // `` draws one of the inline diagrams.
         const name = raw.match(/^\s*$/)?.[1];
         const diagram = name ? DIAGRAMS[name] : undefined;
-        return diagram ? diagram() + '\n' : false;
+        if (diagram) {
+          return diagram() + '\n';
+        }
+        // `` adds the landing page's call to action.
+        if (/^\s*$/.test(raw)) {
+          return ctaBand(linkTarget('/docs/getting-started/quick-start').attrs);
+        }
+        return false;
+      },
+      paragraph({ tokens }: Tokens.Paragraph) {
+        const inner = this.parser.parseInline(tokens);
+        // A paragraph that is just an image becomes a captioned figure.
+        const [only, ...rest] = tokens.filter(
+          (t) => !(t.type === 'text' && !t.raw.trim()),
+        );
+        if (
+          only?.type === 'image' &&
+          !rest.length &&
+          (only as Tokens.Image).title !== 'icon'
+        ) {
+          return `
${inner}
${escapeHtml((only as Tokens.Image).text)}
\n`; + } + return `

${inner}

\n`; }, image({ href, title, text }: Tokens.Image) { // A title of "icon" marks small inline images, such as the measurement @@ -575,10 +616,12 @@ export function renderMarkdown( if (inline) { return inline; } + const size = IMAGE_SIZES[href]; const attrs = [ `src="${href}"`, `alt="${escapeHtml(text)}"`, icon ? 'class="img-icon" width="20" height="20"' : '', + !icon && size ? `width="${size[0]}" height="${size[1]}"` : '', !icon && title ? `title="${escapeHtml(title)}"` : '', 'loading="lazy"', ] diff --git a/packages/docs/src/app/home/_flow-browser.scss b/packages/docs/src/app/home/_flow-browser.scss index 213d4e2e..4371d5ee 100644 --- a/packages/docs/src/app/home/_flow-browser.scss +++ b/packages/docs/src/app/home/_flow-browser.scss @@ -359,7 +359,7 @@ padding: 0 var(--space-2); border-radius: var(--radius-full); background: color-mix(in srgb, var(--color-success-500) 16%, transparent); - color: var(--color-success-600); + color: var(--ok); font-family: var(--font-mono); font-size: 0.6875rem; } @@ -431,3 +431,142 @@ opacity: 1; } } + +/* The step list: one button per step, the active one with a bar that fills + over the step. */ +.stepper { + align-content: start; + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-2); + margin: 0; + padding: 0; + list-style: none; +} + +.stepper-btn { + position: relative; + display: flex; + align-items: center; + gap: var(--space-2-5); + width: 100%; + padding: var(--space-2-5) var(--space-3); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + background: var(--surface-raised); + color: var(--text-muted); + font: inherit; + text-align: left; + cursor: pointer; + overflow: hidden; + transition: + border-color var(--duration-base) ease-out, + color var(--duration-base) ease-out, + background-color var(--duration-base) ease-out; + + &:hover { + border-color: var(--accent-outline); + color: var(--text-heading); + } + + &:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; + } +} + +.stepper-active { + border-color: var(--accent-outline); + background: var(--accent-soft); + color: var(--text-heading); +} + +.stepper-done .stepper-icon { + color: var(--ok); +} + +.stepper-icon { + flex: none; + display: grid; + place-items: center; + width: 1.75rem; + height: 1.75rem; + border-radius: var(--radius-md); + background: var(--surface-subtle); + color: var(--text-subtle); + + .stepper-active & { + background: var(--accent); + color: #fff; + } + + svg, + docs-mode-icon { + width: 1rem; + height: 1rem; + } +} + +.stepper-text { + display: flex; + flex-direction: column; + min-width: 0; +} + +.stepper-kind { + font-size: 0.6875rem; + line-height: 1rem; + text-transform: uppercase; + letter-spacing: 0.04em; + font-family: var(--font-mono); +} + +.stepper-name { + font-size: 0.8125rem; + line-height: 1.125rem; + font-weight: 500; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.stepper-score { + margin-left: auto; + font-family: var(--font-mono); + font-size: 0.75rem; + opacity: 0; + transition: opacity var(--duration-base) ease-out; + + .stepper-done & { + opacity: 1; + color: var(--ok); + } +} + +.stepper-bar { + position: absolute; + left: 0; + bottom: 0; + height: 2px; + width: 100%; + background: var(--accent); + transform-origin: left; + animation: fill 3600ms linear forwards; + + .stage-paused & { + animation-play-state: paused; + } +} + +@keyframes fill { + from { + transform: scaleX(0); + } +} + + +@media (prefers-reduced-motion: reduce) { + .stepper-bar { + display: none; + } +} diff --git a/packages/docs/src/app/home/flow-walkthrough.scss b/packages/docs/src/app/home/flow-walkthrough.scss index b3417506..3d829580 100644 --- a/packages/docs/src/app/home/flow-walkthrough.scss +++ b/packages/docs/src/app/home/flow-walkthrough.scss @@ -1,7 +1,6 @@ // The stage reads the current step from `data-step` on `.stage`, so the // browser mock and the stepper are pure CSS; only the lit code lines and the // stepper's active class come from the component. -$step: 3600ms; :host { display: block; @@ -124,140 +123,8 @@ $step: 3600ms; grid-area: browser; } -/* The stepper: four buttons, the active one with a bar that fills over the step. */ +/* The step list is styled in `_flow-browser.scss` as well. */ .stepper { grid-area: stepper; - align-content: start; - display: grid; - grid-template-columns: minmax(0, 1fr); - gap: var(--space-2); - margin: 0; - padding: 0; - list-style: none; -} - -.stepper-btn { - position: relative; - display: flex; - align-items: center; - gap: var(--space-2-5); - width: 100%; - padding: var(--space-2-5) var(--space-3); - border: 1px solid var(--border); - border-radius: var(--radius-lg); - background: var(--surface-raised); - color: var(--text-muted); - font: inherit; - text-align: left; - cursor: pointer; - overflow: hidden; - transition: - border-color var(--duration-base) ease-out, - color var(--duration-base) ease-out, - background-color var(--duration-base) ease-out; - - &:hover { - border-color: var(--accent-outline); - color: var(--text-heading); - } - - &:focus-visible { - outline: 2px solid var(--accent); - outline-offset: 2px; - } -} - -.stepper-active { - border-color: var(--accent-outline); - background: var(--accent-soft); - color: var(--text-heading); } -.stepper-done .stepper-icon { - color: var(--color-success-600); -} - -.stepper-icon { - flex: none; - display: grid; - place-items: center; - width: 1.75rem; - height: 1.75rem; - border-radius: var(--radius-md); - background: var(--surface-subtle); - color: var(--text-subtle); - - .stepper-active & { - background: var(--accent); - color: #fff; - } - - svg, - docs-mode-icon { - width: 1rem; - height: 1rem; - } -} - -.stepper-text { - display: flex; - flex-direction: column; - min-width: 0; -} - -.stepper-kind { - font-size: 0.6875rem; - line-height: 1rem; - text-transform: uppercase; - letter-spacing: 0.04em; - font-family: var(--font-mono); -} - -.stepper-name { - font-size: 0.8125rem; - line-height: 1.125rem; - font-weight: 500; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.stepper-score { - margin-left: auto; - font-family: var(--font-mono); - font-size: 0.75rem; - opacity: 0; - transition: opacity var(--duration-base) ease-out; - - .stepper-done & { - opacity: 1; - color: var(--color-success-600); - } -} - -.stepper-bar { - position: absolute; - left: 0; - bottom: 0; - height: 2px; - width: 100%; - background: var(--accent); - transform-origin: left; - animation: fill $step linear forwards; - - .stage-paused & { - animation-play-state: paused; - } -} - -@keyframes fill { - from { - transform: scaleX(0); - } -} - -@media (prefers-reduced-motion: reduce) { - .stepper-bar { - display: none; - } -} diff --git a/packages/docs/src/app/home/flow-walkthrough.ts b/packages/docs/src/app/home/flow-walkthrough.ts index f60fccd6..9bf3a2e5 100644 --- a/packages/docs/src/app/home/flow-walkthrough.ts +++ b/packages/docs/src/app/home/flow-walkthrough.ts @@ -8,13 +8,9 @@ import { signal, } from '@angular/core'; import { RouterLink } from '@angular/router'; -import hljs from 'highlight.js/lib/core'; -import typescript from 'highlight.js/lib/languages/typescript'; import { Reveal } from '../shared/reveal'; import { Mode, ModeIcon } from '../shared/mode-icon'; -hljs.registerLanguage('typescript', typescript); - /** How long each step of the walkthrough stays on screen. */ export const STEP_MS = 3600; @@ -34,6 +30,40 @@ export default { }, } satisfies UserFlowProvider;`; +const KEYWORDS = new Set(['import', 'from', 'export', 'default', 'async', 'await', 'satisfies']); + +/** + * Highlights one line of the sample flow with the classes the site's + * highlight.js theme styles. The snippet is fixed and small, so a few + * patterns cover it and the real highlighter can stay out of this bundle. + */ +function highlightLine(line: string): string { + const escaped = line.replace(/&/g, '&').replace(//g, '>'); + return ( + escaped.replace( + /('[^']*')|\b([A-Za-z_]\w*)(?=\s*:)|\b([A-Za-z_]\w*)(?=\()|\b([A-Za-z_]\w*)\b/g, + (match, string, property, call, word) => { + if (string) { + return `${string}`; + } + if (property) { + return `${property}`; + } + if (call) { + return `${call}`; + } + if (KEYWORDS.has(word)) { + return `${word}`; + } + if (word === 'UserFlowProvider') { + return `${word}`; + } + return match; + }, + ) || ' ' + ); +} + interface Step { mode: Mode | 'collect' | 'report'; name: string; @@ -103,9 +133,7 @@ export class FlowWalkthrough { readonly measured = this.steps.filter((step) => step.score); /** The source, highlighted one line at a time so each line can be lit on its own. */ - readonly lines = SOURCE.split('\n').map( - (line) => hljs.highlight(line, { language: 'typescript' }).value || ' ', - ); + readonly lines = SOURCE.split('\n').map(highlightLine); readonly active = signal(0); /** True while a mouse hovers the walkthrough. Touch never pauses it. */ diff --git a/packages/docs/src/app/home/hero-scene.scss b/packages/docs/src/app/home/hero-scene.scss index 69b42cb9..6ae08f98 100644 --- a/packages/docs/src/app/home/hero-scene.scss +++ b/packages/docs/src/app/home/hero-scene.scss @@ -153,18 +153,6 @@ $ring: 106.8; ); opacity: 0; animation: beam $cycle ease-in-out infinite; - - &::after { - content: ''; - position: absolute; - inset: 0; - background: linear-gradient( - to bottom, - color-mix(in srgb, var(--accent) 34%, transparent), - transparent 60% - ); - animation: beam-pulse 1.6s ease-in-out infinite alternate; - } } /* The three targets, one per column, lit in turn. */ @@ -202,13 +190,13 @@ $ring: 106.8; right: 8px; padding: 1px 7px; border-radius: var(--radius-full); - background: var(--color-success-500); - color: #fff; + background: var(--ok-bg); + color: var(--ok-fg); font-family: var(--font-mono); font-size: 0.6875rem; line-height: 1rem; font-weight: 600; - box-shadow: 0 2px 8px color-mix(in srgb, var(--color-success-500) 50%, transparent); + box-shadow: 0 2px 8px color-mix(in srgb, var(--ok-bg) 50%, transparent); opacity: 0; transform: translateY(6px) scale(0.6); } @@ -260,7 +248,7 @@ $ring: 106.8; margin-top: calc(-1 * var(--space-1)); font-size: 0.6875rem; line-height: 1rem; - color: var(--text-subtle); + color: var(--text-muted); } @keyframes flight { @@ -332,15 +320,6 @@ $ring: 106.8; } } -@keyframes beam-pulse { - from { - opacity: 0.35; - } - to { - opacity: 1; - } -} - @keyframes orbit { to { rotate: 360deg; @@ -469,7 +448,6 @@ $ring: 106.8; .ufo-tilt, .ufo-bob, .beam, - .beam::after, .target, .gauge-fill, .chip { diff --git a/packages/docs/src/app/home/home.html b/packages/docs/src/app/home/home.html index fed8254a..3a458e32 100644 --- a/packages/docs/src/app/home/home.html +++ b/packages/docs/src/app/home/home.html @@ -72,6 +72,18 @@

Terminal +
- + + @for (run of [runs()]; track run) {
# install, set up and run your first flow
 @for (line of commands; track line.text) {$ {{ line.text }}
 } running order-coffee.uf.mts✔ order-coffee.uf.mts · 1 navigation · 2 timespans · 2 snapshots
 → measures/order-coffee.uf.html
 $ 
+ } diff --git a/packages/docs/src/app/home/home.scss b/packages/docs/src/app/home/home.scss index ead7330c..d21fa753 100644 --- a/packages/docs/src/app/home/home.scss +++ b/packages/docs/src/app/home/home.scss @@ -61,32 +61,32 @@ } } +// Soft radial gradients rather than blur filters, which cost a lot on phones. .hero-blob { position: absolute; border-radius: 50%; - filter: blur(70px); - opacity: 0.55; + opacity: 0.7; animation: blob 18s ease-in-out infinite alternate; } .hero-blob-1 { - top: -10%; - left: 55%; - width: 46vw; - height: 30vw; - max-width: 620px; - max-height: 400px; - background: var(--hero-blob-1); + top: -30%; + left: 45%; + width: 70vw; + height: 50vw; + max-width: 900px; + max-height: 620px; + background: radial-gradient(closest-side, var(--hero-blob-1), transparent); } .hero-blob-2 { - top: 30%; - left: -8%; - width: 34vw; - height: 26vw; - max-width: 440px; - max-height: 340px; - background: var(--hero-blob-2); + top: 15%; + left: -25%; + width: 56vw; + height: 44vw; + max-width: 680px; + max-height: 540px; + background: radial-gradient(closest-side, var(--hero-blob-2), transparent); animation-delay: -9s; animation-duration: 24s; } @@ -113,6 +113,14 @@ margin: 0; max-width: 40rem; box-shadow: var(--shadow-md); + + .terminal-replay { + margin-left: auto; + } + + .terminal-replay + .code-copy { + margin-left: 0; + } } /* The package pill: a live dot, the name and the version on npm. */ @@ -188,8 +196,8 @@ .word-inner { display: inline-block; - animation: word-up 1s var(--ease-out) both; - animation-delay: calc(160ms + var(--w, 0) * 80ms); + animation: word-up 0.8s var(--ease-out) both; + animation-delay: calc(80ms + var(--w, 0) * 60ms); } .word-accent { @@ -205,13 +213,12 @@ background-clip: text; color: transparent; animation: - word-up 1s var(--ease-out) both, - shimmer 2.4s var(--ease-in-out) 1.4s both; + word-up 0.8s var(--ease-out) both, + shimmer 2.4s var(--ease-in-out) 1.2s both; } @keyframes word-up { from { - opacity: 0; transform: translateY(105%) rotate(2deg); } } diff --git a/packages/docs/src/app/home/home.ts b/packages/docs/src/app/home/home.ts index 5cfab078..cb123ddc 100644 --- a/packages/docs/src/app/home/home.ts +++ b/packages/docs/src/app/home/home.ts @@ -77,6 +77,13 @@ export class Home { readonly copied = signal(false); + /** Bumped by the replay button; the terminal re-renders and types again. */ + readonly runs = signal(0); + + replay() { + this.runs.update((n) => n + 1); + } + readonly benefits = [ { icon: 'gauge', diff --git a/packages/docs/src/app/search/search-index.ts b/packages/docs/src/app/search/search-index.ts index 93b1a621..efff9937 100644 --- a/packages/docs/src/app/search/search-index.ts +++ b/packages/docs/src/app/search/search-index.ts @@ -1,6 +1,5 @@ import { DOCUMENT, inject, Injectable } from '@angular/core'; import { ALL_DOC_PAGES } from '../docs/nav'; -import { renderMarkdown } from '../docs/markdown'; /** One searchable chunk: a page's intro, or one of its h2/h3 sections. */ export interface SearchEntry { @@ -39,6 +38,7 @@ export class SearchIndex { } private async build(): Promise { + const { renderMarkdown } = await import('../docs/markdown'); const baseHref = this.document.querySelector('base')?.getAttribute('href') ?? '/'; const parser = new DOMParser(); diff --git a/packages/docs/src/app/shared/_building-blocks.scss b/packages/docs/src/app/shared/_building-blocks.scss index 78b39e9f..0fc6f913 100644 --- a/packages/docs/src/app/shared/_building-blocks.scss +++ b/packages/docs/src/app/shared/_building-blocks.scss @@ -3,8 +3,8 @@ /* First paint: the hero copy rises in line by line, then the scene follows. */ .enter { - animation: enter var(--duration-reveal) var(--ease-out) both; - animation-delay: calc(80ms + var(--enter, 0) * 90ms); + animation: enter var(--duration-slow) var(--ease-out) both; + animation-delay: calc(60ms + var(--enter, 0) * 50ms); } @keyframes enter { diff --git a/packages/docs/src/content/cli/overview.md b/packages/docs/src/content/cli/overview.md index b6da287c..5c39edcd 100644 --- a/packages/docs/src/content/cli/overview.md +++ b/packages/docs/src/content/cli/overview.md @@ -4,6 +4,8 @@ The CLI has two commands, `init` and `collect`, and a handful of global options npx user-flow [command] [options] ``` + + | Command | Purpose | | ------------------------------ | --------------------------------------------------------------------------------------- | | [`init`](/docs/cli/init) | Create or update `.user-flowrc.json` and scaffold an example flow or a GitHub workflow. | diff --git a/packages/docs/src/content/cli/reports.md b/packages/docs/src/content/cli/reports.md index 0684ba28..f1ba2619 100644 --- a/packages/docs/src/content/cli/reports.md +++ b/packages/docs/src/content/cli/reports.md @@ -26,9 +26,9 @@ npx user-flow collect --format html --format json | `md` | `.uf.md` | Pull request comments and chat messages. It summarises each step and its category scores in a table. | | `stdout` | | Quick checks in the terminal and CI logs. Same content as `md`, printed to the console. | -| HTML | JSON | Markdown | -| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| ![HTML report](https://user-images.githubusercontent.com/10064416/219036514-98568103-c182-44cf-bc5c-e5dbc61d76ed.png) | ![JSON report](https://user-images.githubusercontent.com/10064416/219036583-2cd3e116-91d7-4dbf-847d-95de0a0363ab.png) | ![Markdown report](https://user-images.githubusercontent.com/10064416/219036654-b26c0f44-1c5d-479c-845b-007537b86028.png) | +The same run, in each format: + + Example files from the repository: [order-coffee.json](https://github.com/push-based/user-flow/blob/main/packages/cli/docs/raw/order-coffee.json), [order-coffee.html](https://github.com/push-based/user-flow/blob/main/packages/cli/docs/raw/order-coffee.html) and [order-coffee.md](https://github.com/push-based/user-flow/blob/main/packages/cli/docs/raw/order-coffee.md). @@ -43,12 +43,12 @@ By default the CLI opens the report as soon as the run finishes. HTML opens in t A JSON report can be dragged and dropped into the [Lighthouse viewer](https://googlechrome.github.io/lighthouse/viewer/) at any time. This is handy for reports that were produced in CI and stored as artefacts. -![Lighthouse viewer file drop area](https://user-images.githubusercontent.com/10064416/168185615-3ed66255-5287-4de3-a32a-cb9b053589de.PNG) +![The Lighthouse viewer, waiting for a JSON report to be dropped](images/lighthouse-viewer-drop.png) ## Reading a report Each step in a flow appears in the report with the icon of its measurement mode and the category scores that mode supports. -![A user flow report with navigation, timespan and snapshot steps](https://user-images.githubusercontent.com/10064416/166849157-f1d799f5-1f05-481b-8234-ec6645827791.PNG) +![The summary of a user flow report: one navigation, three timespans and three snapshots, each with its mode icon and scores](images/report-steps.png) See [Basic user flows](/docs/user-flows/basics) for what each mode measures and [Understanding the Lighthouse result](https://github.com/GoogleChrome/lighthouse/blob/master/docs/understanding-results.md) for the structure of the JSON. diff --git a/packages/docs/src/content/getting-started/installation.md b/packages/docs/src/content/getting-started/installation.md index 412d174c..f6e293ed 100644 --- a/packages/docs/src/content/getting-started/installation.md +++ b/packages/docs/src/content/getting-started/installation.md @@ -100,3 +100,5 @@ nx generate @push-based/user-flow-nx-plugin:init pnpm add -D @push-based/user-flow-nx-plugin nx generate @push-based/user-flow-nx-plugin:init ``` + + diff --git a/packages/docs/src/content/getting-started/introduction.md b/packages/docs/src/content/getting-started/introduction.md index 1f54e79b..c8f08307 100644 --- a/packages/docs/src/content/getting-started/introduction.md +++ b/packages/docs/src/content/getting-started/introduction.md @@ -38,3 +38,5 @@ The rc file holds project defaults. Every value in it can be overridden on the c - [Installation](/docs/getting-started/installation): Install the CLI in your project, or start from an empty folder. - [Quick start](/docs/getting-started/quick-start): Initialise a config and run your first flow in minutes. - [Basic user flows](/docs/user-flows/basics): Learn the navigation, timespan and snapshot measurement modes. + + diff --git a/packages/docs/src/content/integrations/github-workflow.md b/packages/docs/src/content/integrations/github-workflow.md index 285e4879..c29186e3 100644 --- a/packages/docs/src/content/integrations/github-workflow.md +++ b/packages/docs/src/content/integrations/github-workflow.md @@ -1,6 +1,6 @@ With a few steps your user flows run on every pull request and the Markdown report is posted as a comment. Reviewers see the performance impact of a change next to the code. -![A pull request with a user flow report comment](https://user-images.githubusercontent.com/10064416/216605948-b8fffdda-3459-48c9-975a-75ec95544d30.png) + If GitHub Actions are new to you, start with the [GitHub Actions features](https://github.com/features/actions) page. The action used here is published on the [marketplace](https://github.com/marketplace/actions/lighthouse-user-flow-ci-action). @@ -67,14 +67,11 @@ What the pieces do: ## 3. Test the setup -Open a pull request. The workflow appears in the checks of the PR and runs your flows: +Open a pull request. The workflow appears in the checks of the PR, runs your flows and, when it finishes, attaches the Markdown report to the pull request as a comment: -![The action is executing](https://user-images.githubusercontent.com/10064416/216594684-ea9e3a5e-007e-47d6-b438-c16d2158f940.PNG) -![The action completed](https://user-images.githubusercontent.com/10064416/216594803-65cb2cfd-1924-44ae-84ec-8b1d09e49ada.PNG) + -When it finishes, the Markdown report is attached to the pull request as a comment: - -![The report comment on the pull request](https://user-images.githubusercontent.com/10064416/216596391-35a041e2-9839-4cf5-b8c5-b55e93cb622e.PNG) +Every later push updates the same comment, so the report always reflects the latest commit. ## Alternative: post the report yourself diff --git a/packages/docs/src/content/user-flows/basics.md b/packages/docs/src/content/user-flows/basics.md index b3b27a87..6f3efa71 100644 --- a/packages/docs/src/content/user-flows/basics.md +++ b/packages/docs/src/content/user-flows/basics.md @@ -48,6 +48,8 @@ The `UserFlowContext` passed to `interactions` contains: Lighthouse offers three kinds of steps. Each covers a different question and supports a different set of audits. + + | Mode | Measures | Performance | Accessibility | Best practices | SEO | PWA | | ------------------------------------------------------------------------- | ----------------------------- | ----------- | ------------- | -------------- | --------- | ----- | | ![Navigation](images/user-flow_navigation-icon.png 'icon') **Navigation** | A page load | 100% / 30 | 100% / 30 | 100% / 30 | 100% / 30 | ✔ / 7 | @@ -62,7 +64,7 @@ The numbers are the audits each mode supports per category, with the share of th The report shows the icon next to each step so you can tell the modes apart at a glance. -![A report with navigation, timespan and snapshot steps](https://user-images.githubusercontent.com/10064416/166849157-f1d799f5-1f05-481b-8234-ec6645827791.PNG) +![The summary of a user flow report, with the mode icon next to each step](images/report-steps.png) ## Choosing selectors diff --git a/packages/docs/src/styles.scss b/packages/docs/src/styles.scss index b470de22..5ef5f1e4 100644 --- a/packages/docs/src/styles.scss +++ b/packages/docs/src/styles.scss @@ -33,6 +33,8 @@ --link-underline: var(--color-primary-200); --accent: var(--color-primary-600); --accent-hover: var(--color-primary-700); + /* White text needs the 600 shade for 4.5:1, in both themes. */ + --btn-primary-bg: var(--color-primary-600); --accent-soft: var(--color-primary-50); --accent-soft-text: var(--color-primary-700); --accent-outline: var(--color-primary-300); @@ -72,6 +74,9 @@ --spot: color-mix(in srgb, var(--color-primary-200) 55%, transparent); --grad-a: var(--color-primary-600); --grad-b: var(--color-secondary-500); + --ok: var(--color-success-700); + --ok-bg: var(--color-success-700); + --ok-fg: #fff; /* Motion. Every animation on the site reads from these so they stay in step. */ --ease-out: cubic-bezier(0.22, 1, 0.36, 1); @@ -98,6 +103,7 @@ --link-underline: var(--color-primary-800); --accent: var(--color-primary-500); --accent-hover: var(--color-primary-400); + --btn-primary-bg: var(--color-primary-600); --accent-soft: var(--color-primary-950); --accent-soft-text: var(--color-primary-200); --accent-outline: var(--color-primary-700); @@ -135,6 +141,9 @@ --spot: color-mix(in srgb, var(--color-primary-400) 18%, transparent); --grad-a: var(--color-primary-300); --grad-b: var(--color-secondary-300); + --ok: var(--color-success-400); + --ok-bg: var(--color-success-400); + --ok-fg: var(--color-neutral-950); } @media (prefers-color-scheme: dark) { @@ -244,7 +253,7 @@ pre { padding: var(--space-3) var(--space-5); } .pb-btn-primary { - --btn-bg: var(--accent); + --btn-bg: var(--btn-primary-bg); --btn-bg-hover: var(--accent-hover); --btn-color: #ffffff; } @@ -1117,7 +1126,7 @@ pre { } .term-comment { - color: var(--color-neutral-500); + color: var(--color-neutral-400); font-style: italic; .hljs-comment {