+`;
+}
+
+/** 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 `
+
# 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 |
-| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
-|  |  |  |
+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.
-
+
## 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.
-
+
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.
-
+
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:
-
-
+
-When it finishes, the Markdown report is attached to the pull request as a comment:
-
-
+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** | 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.
-
+
## 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 {