@invisibleloop/pulse 0.20.11 → 0.20.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/public/.pulse-ui-version +1 -1
- package/scripts/build.js +26 -0
- package/scripts/release-version.js +17 -8
- package/scripts/strip-server.test.js +60 -0
- package/src/agent/checklist.md +8 -12
- package/src/agent/commands/pulse-start.md +2 -0
- package/src/agent/commands/verify.md +30 -8
- package/src/agent/guide-components.md +7 -25
- package/src/agent/guide-routing.md +0 -12
- package/src/agent/guide-server.md +102 -1
- package/src/agent/guide-spec.md +8 -1
- package/src/agent/guide-styles.md +23 -0
- package/src/agent/identity.md +9 -0
- package/src/agent/workflow.md +4 -23
- package/src/cli/check-bundles.js +113 -0
- package/src/cli/check-bundles.test.js +137 -0
- package/src/cli/cli.test.js +105 -0
- package/src/cli/dev.js +48 -3
- package/src/cli/diagnose.js +105 -0
- package/src/cli/diagnose.test.js +124 -0
- package/src/cli/discover.js +9 -2
- package/src/cli/index.js +171 -9
- package/src/cli/process-utils.js +57 -0
- package/src/cli/process-utils.test.js +114 -0
- package/src/cli/review.js +391 -0
- package/src/cli/review.test.js +143 -0
- package/src/cli/scaffold.js +9 -4
- package/src/cli/stamp.js +102 -0
- package/src/cli/stamp.test.js +149 -0
- package/src/cli/start.js +15 -2
- package/src/cli/validate.js +184 -0
- package/src/cli/validate.test.js +153 -0
- package/src/mcp/mcp.test.js +261 -30
- package/src/mcp/server.js +207 -515
- package/src/mcp/validate-worker.js +18 -1
- package/src/runtime/index.js +144 -11
- package/src/runtime/runtime.test.js +199 -0
- package/src/runtime/ssr.js +13 -6
- package/src/runtime/ssr.test.js +31 -0
- package/src/server/index.js +162 -9
- package/src/server/server.test.js +225 -2
- package/src/spec/schema.js +1 -1
- package/src/ui/index.js +0 -5
- package/src/ui/ui.test.js +0 -75
- package/types/ui.d.ts +0 -21
- package/.claude/commands/build-page.md +0 -63
- package/.claude/commands/new-doc-page.md +0 -45
- package/.claude/commands/pulse-start.md +0 -11
- package/.claude/commands/pulse-stop.md +0 -5
- package/.claude/commands/verify.md +0 -118
- package/.claude/pulse-checklist.md +0 -189
- package/.github/workflows/ci.yml +0 -25
- package/.github/workflows/publish.yml +0 -45
- package/.pulse/load-reports/home/1773432711417.json +0 -22
- package/.pulse-verified +0 -1
- package/AGENTS.md +0 -697
- package/CLAUDE.md +0 -697
- package/README.md +0 -95
- package/benchmark/public/dist/counter.boot-PO6SNSJZ.js +0 -8
- package/benchmark/public/dist/home.boot-YK6VAEQI.js +0 -6
- package/benchmark/public/dist/manifest.json +0 -5
- package/benchmark/public/dist/runtime-5Y7ESAIB.js +0 -2
- package/benchmark/public/dist/runtime-KO4BHUQ3.js +0 -49
- package/benchmark/results/2026-03-27-09-20.json +0 -188
- package/benchmark/results/2026-03-27-09-21.json +0 -188
- package/benchmark/results/2026-03-27-09-29.json +0 -188
- package/benchmark/results/2026-03-27-10-14.json +0 -188
- package/benchmark/results/2026-03-27-10-18.json +0 -232
- package/benchmark/src/pages/counter.js +0 -37
- package/benchmark/src/pages/home.js +0 -21
- package/docs/.claude/commands/pulse-build.md +0 -7
- package/docs/.claude/commands/pulse-dev.md +0 -7
- package/docs/.claude/commands/pulse-start.md +0 -9
- package/docs/.claude/commands/pulse-stop.md +0 -5
- package/docs/.claude/commands/verify.md +0 -84
- package/docs/.claude/coverage-check.js +0 -196
- package/docs/.claude/pulse-checklist.md +0 -189
- package/docs/public/.pulse-ui-version +0 -1
- package/docs/public/andypixel.css +0 -237
- package/docs/public/bookworms.css +0 -422
- package/docs/public/coutumes.css +0 -561
- package/docs/public/docs.css +0 -2388
- package/docs/public/favicon.svg +0 -4
- package/docs/public/home-brut.css +0 -982
- package/docs/public/images/bookworms/hero-books.jpg +0 -0
- package/docs/public/images/bookworms/how-we-read-now.jpg +0 -0
- package/docs/public/images/bookworms/lantern-keepers.jpg +0 -0
- package/docs/public/images/bookworms/provincial-bookseller.jpg +0 -0
- package/docs/public/images/journey/178.jpg +0 -0
- package/docs/public/images/journey/29.jpg +0 -0
- package/docs/public/images/retrowheels/hero.jpg +0 -0
- package/docs/public/images/shop/devbook-pro.jpg +0 -0
- package/docs/public/images/suzukibento/1015.jpg +0 -0
- package/docs/public/images/suzukibento/1025.jpg +0 -0
- package/docs/public/images/suzukibento/1043.jpg +0 -0
- package/docs/public/images/suzukibento/1059.jpg +0 -0
- package/docs/public/images/suzukibento/1062.jpg +0 -0
- package/docs/public/images/suzukibento/1084.jpg +0 -0
- package/docs/public/images/swish/1469334031218-e382a71b716b.jpg +0 -0
- package/docs/public/images/swish/1483985988355-763728e1935b.jpg +0 -0
- package/docs/public/images/swish/1485518882345-15568b007407.jpg +0 -0
- package/docs/public/images/swish/1490481651871-ab68de25d43d.jpg +0 -0
- package/docs/public/images/swish/1496747611176-843222e1e57c.jpg +0 -0
- package/docs/public/images/swish/1502716119720-b23a93e5fe1b.jpg +0 -0
- package/docs/public/images/swish/1539109136881-3be0616acf4b.jpg +0 -0
- package/docs/public/images/swish/1551803091-e20673f15770.jpg +0 -0
- package/docs/public/images/swish/1558769132-cb1aea458c5e.jpg +0 -0
- package/docs/public/images/swish/1572804013309-59a88b7e92f1.jpg +0 -0
- package/docs/public/img/heic1501a.jpg +0 -0
- package/docs/public/img/placeholder-landscape.svg +0 -18
- package/docs/public/img/placeholder-square.svg +0 -14
- package/docs/public/img/placeholder-tall.svg +0 -22
- package/docs/public/journey.css +0 -528
- package/docs/public/menu.js +0 -327
- package/docs/public/pulse-ui.css +0 -3028
- package/docs/public/pulse-ui.js +0 -257
- package/docs/public/retrowheels.css +0 -425
- package/docs/public/shop.css +0 -269
- package/docs/public/sparkys.css +0 -382
- package/docs/public/suzukibento.css +0 -517
- package/docs/public/swish.css +0 -394
- package/docs/public/theme.css +0 -52
- package/docs/public/themes/lumio.css +0 -50
- package/docs/public/themes/observatory.css +0 -104
- package/docs/server.js +0 -161
- package/docs/src/lib/component-page.js +0 -49
- package/docs/src/lib/highlight.js +0 -2
- package/docs/src/lib/layout.js +0 -190
- package/docs/src/lib/metrics-store.js +0 -6
- package/docs/src/lib/nav.js +0 -171
- package/docs/src/lib/stats.js +0 -81
- package/docs/src/pages/accessibility.js +0 -157
- package/docs/src/pages/actions.js +0 -194
- package/docs/src/pages/auth.js +0 -176
- package/docs/src/pages/caching.js +0 -95
- package/docs/src/pages/components/accordion.js +0 -48
- package/docs/src/pages/components/alert.js +0 -35
- package/docs/src/pages/components/app-badge.js +0 -41
- package/docs/src/pages/components/avatar.js +0 -35
- package/docs/src/pages/components/badge.js +0 -36
- package/docs/src/pages/components/breadcrumbs.js +0 -94
- package/docs/src/pages/components/button.js +0 -84
- package/docs/src/pages/components/card.js +0 -225
- package/docs/src/pages/components/charts.js +0 -283
- package/docs/src/pages/components/checkbox.js +0 -129
- package/docs/src/pages/components/cluster.js +0 -47
- package/docs/src/pages/components/container.js +0 -40
- package/docs/src/pages/components/cta.js +0 -54
- package/docs/src/pages/components/divider.js +0 -37
- package/docs/src/pages/components/empty.js +0 -36
- package/docs/src/pages/components/feature.js +0 -60
- package/docs/src/pages/components/fieldset.js +0 -65
- package/docs/src/pages/components/fileupload.js +0 -128
- package/docs/src/pages/components/footer.js +0 -58
- package/docs/src/pages/components/grid.js +0 -169
- package/docs/src/pages/components/heading.js +0 -107
- package/docs/src/pages/components/hero.js +0 -123
- package/docs/src/pages/components/icons.js +0 -410
- package/docs/src/pages/components/image.js +0 -71
- package/docs/src/pages/components/input.js +0 -51
- package/docs/src/pages/components/media.js +0 -51
- package/docs/src/pages/components/modal.js +0 -111
- package/docs/src/pages/components/nav.js +0 -136
- package/docs/src/pages/components/phone-frame.js +0 -74
- package/docs/src/pages/components/progress.js +0 -102
- package/docs/src/pages/components/prose.js +0 -111
- package/docs/src/pages/components/pullquote.js +0 -71
- package/docs/src/pages/components/radio.js +0 -194
- package/docs/src/pages/components/rating.js +0 -106
- package/docs/src/pages/components/search.js +0 -61
- package/docs/src/pages/components/section.js +0 -98
- package/docs/src/pages/components/segmented.js +0 -121
- package/docs/src/pages/components/select.js +0 -45
- package/docs/src/pages/components/slider.js +0 -115
- package/docs/src/pages/components/spinner.js +0 -73
- package/docs/src/pages/components/stack.js +0 -48
- package/docs/src/pages/components/stat.js +0 -55
- package/docs/src/pages/components/stepper.js +0 -66
- package/docs/src/pages/components/table.js +0 -45
- package/docs/src/pages/components/textarea.js +0 -31
- package/docs/src/pages/components/toggle.js +0 -84
- package/docs/src/pages/components/tooltip.js +0 -48
- package/docs/src/pages/components.js +0 -200
- package/docs/src/pages/config.js +0 -193
- package/docs/src/pages/constraints.js +0 -100
- package/docs/src/pages/deploy.js +0 -233
- package/docs/src/pages/error-pages.js +0 -99
- package/docs/src/pages/extending.js +0 -198
- package/docs/src/pages/faq.js +0 -99
- package/docs/src/pages/forms.js +0 -129
- package/docs/src/pages/getting-started.js +0 -147
- package/docs/src/pages/guard.js +0 -120
- package/docs/src/pages/home.js +0 -350
- package/docs/src/pages/how-it-works.js +0 -244
- package/docs/src/pages/hydration.js +0 -108
- package/docs/src/pages/images.js +0 -120
- package/docs/src/pages/markdown.js +0 -156
- package/docs/src/pages/meta.js +0 -193
- package/docs/src/pages/mutations.js +0 -107
- package/docs/src/pages/navigation.js +0 -85
- package/docs/src/pages/performance.js +0 -157
- package/docs/src/pages/persist.js +0 -89
- package/docs/src/pages/project-structure.js +0 -91
- package/docs/src/pages/prompt-examples.js +0 -186
- package/docs/src/pages/raw-responses.js +0 -122
- package/docs/src/pages/routing.js +0 -120
- package/docs/src/pages/server-api.js +0 -291
- package/docs/src/pages/server-data.js +0 -203
- package/docs/src/pages/slash-commands.js +0 -55
- package/docs/src/pages/spec.js +0 -207
- package/docs/src/pages/state.js +0 -102
- package/docs/src/pages/store.js +0 -203
- package/docs/src/pages/streaming.js +0 -107
- package/docs/src/pages/stripe.js +0 -194
- package/docs/src/pages/supabase.js +0 -324
- package/docs/src/pages/templates/andypixel.js +0 -260
- package/docs/src/pages/templates/blog-post.js +0 -226
- package/docs/src/pages/templates/bookworms.js +0 -227
- package/docs/src/pages/templates/coutumes.js +0 -237
- package/docs/src/pages/templates/journey.js +0 -186
- package/docs/src/pages/templates/mobile-app.js +0 -371
- package/docs/src/pages/templates/retrowheels.js +0 -355
- package/docs/src/pages/templates/shop.js +0 -268
- package/docs/src/pages/templates/sparkys.js +0 -264
- package/docs/src/pages/templates/suzukibento.js +0 -200
- package/docs/src/pages/templates/swish.js +0 -313
- package/docs/src/pages/templates.js +0 -534
- package/docs/src/pages/testing.js +0 -199
- package/docs/src/pages/validation.js +0 -138
- package/examples/.claude/commands/pulse-build.md +0 -7
- package/examples/.claude/commands/pulse-dev.md +0 -7
- package/examples/.claude/commands/pulse-start.md +0 -9
- package/examples/.claude/commands/pulse-stop.md +0 -5
- package/examples/.claude/commands/verify.md +0 -84
- package/examples/.claude/coverage-check.js +0 -196
- package/examples/.claude/pulse-checklist.md +0 -189
- package/examples/andypixel.css +0 -237
- package/examples/andypixel.js +0 -258
- package/examples/bookworms.css +0 -422
- package/examples/bookworms.js +0 -225
- package/examples/contact.js +0 -166
- package/examples/counter.js +0 -94
- package/examples/dev.server.js +0 -110
- package/examples/examples.test.js +0 -394
- package/examples/journey.css +0 -528
- package/examples/journey.js +0 -186
- package/examples/pricing.js +0 -262
- package/examples/products.js +0 -190
- package/examples/public/.pulse-ui-version +0 -1
- package/examples/public/pulse-ui.css +0 -3028
- package/examples/public/pulse-ui.js +0 -257
- package/examples/quiz.js +0 -208
- package/examples/retrowheels.css +0 -425
- package/examples/retrowheels.js +0 -353
- package/examples/shared.js +0 -84
- package/examples/suzukibento.css +0 -513
- package/examples/suzukibento.js +0 -200
- package/examples/swish.css +0 -394
- package/examples/swish.js +0 -311
- package/examples/todos.js +0 -162
- package/src/ui/fieldset.js +0 -37
- package/src/ui/phone-frame.js +0 -40
- package/src/ui/search.js +0 -78
- package/src/ui/segmented.js +0 -50
- package/src/ui/tooltip.js +0 -28
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Verify
|
|
2
|
-
|
|
3
|
-
Run the full verification loop on the current page or the page specified in $ARGUMENTS.
|
|
4
|
-
|
|
5
|
-
## Steps
|
|
6
|
-
|
|
7
|
-
### 1. Identify the target
|
|
8
|
-
|
|
9
|
-
If $ARGUMENTS is provided, use it as the file path or route. Otherwise, identify the most recently edited spec file from context.
|
|
10
|
-
|
|
11
|
-
### 2. Validate the spec
|
|
12
|
-
|
|
13
|
-
Use `pulse_validate` with the spec file content. If validation fails, report every error clearly and stop — do not proceed to screenshot until the spec is valid.
|
|
14
|
-
|
|
15
|
-
### 3. Check the dev server
|
|
16
|
-
|
|
17
|
-
Use `pulse_fetch_page` to confirm the server is responding for the route. If it errors, use `pulse_restart_server` and retry once.
|
|
18
|
-
|
|
19
|
-
**If `pulse_fetch_page` returns unexpected HTML (e.g. a different project's page title, a Next.js 404, or any non-Pulse response):** check the `X-Pulse` response header — Pulse servers always send this. If it is absent, the wrong server is running on that port. Stop and inform the user before continuing.
|
|
20
|
-
|
|
21
|
-
### 4. Screenshot
|
|
22
|
-
|
|
23
|
-
Use `mcp__chrome-devtools__navigate_page` to load the page route, then `mcp__chrome-devtools__take_screenshot` to capture the result. Describe what you see — layout, content, any obvious rendering issues.
|
|
24
|
-
|
|
25
|
-
### 5. Lighthouse — desktop
|
|
26
|
-
|
|
27
|
-
Run `mcp__chrome-devtools__lighthouse_audit` on the route with `{ "strategy": "desktop" }`.
|
|
28
|
-
|
|
29
|
-
**Pass bar: Accessibility, Best Practices, and SEO must all be 100.** Performance is measured and reported but is not a hard requirement (it varies with machine load). Report the actual scores. If Accessibility, Best Practices, or SEO is below 100, identify the failing audit(s), fix the issue, and restart from step 2.
|
|
30
|
-
|
|
31
|
-
### 6. Lighthouse — mobile
|
|
32
|
-
|
|
33
|
-
Run `mcp__chrome-devtools__lighthouse_audit` on the same route with `{ "strategy": "mobile" }`.
|
|
34
|
-
|
|
35
|
-
**Same pass bar: Accessibility, Best Practices, and SEO must all be 100.** Fix any failures and restart from step 2.
|
|
36
|
-
|
|
37
|
-
**If you need to visually inspect the layout at a mobile viewport width** (e.g. to debug a wrapping or overflow issue), use `mcp__chrome-devtools__emulate` with `viewport: "390x844x2,mobile,touch"` — not `resize_page`. The `emulate` tool reliably sets the viewport; `resize_page` does not reliably trigger responsive layout changes. Reset afterward with `emulate` using the desktop viewport: `"1440x900x1"`.
|
|
38
|
-
|
|
39
|
-
### 7. Performance
|
|
40
|
-
|
|
41
|
-
Navigate to the page route, then run `mcp__chrome-devtools__performance_start_trace` with `reload: true` and `autoStop: true`. Report LCP and CLS. Flag any LCP insight that suggests a fixable problem (render-blocking resources, large image load delay, etc.).
|
|
42
|
-
|
|
43
|
-
### 8. Console errors
|
|
44
|
-
|
|
45
|
-
Use `mcp__chrome-devtools__list_console_messages` — report any errors or unexpected warnings.
|
|
46
|
-
|
|
47
|
-
### 9. Code review
|
|
48
|
-
|
|
49
|
-
Call `pulse_review` with the absolute path to the spec file. Read the source, rendered HTML, validator output, and checklist it returns. Fix every issue before proceeding. This is the structured review — do not skip it or replace it with a manual checklist read.
|
|
50
|
-
|
|
51
|
-
### 10. Close the browser
|
|
52
|
-
|
|
53
|
-
Use `mcp__chrome-devtools__list_pages` to get all open pages, then call `mcp__chrome-devtools__close_page` for every page ID returned. This closes the entire browser, not just the tab. `pageId` must be a number, not a string.
|
|
54
|
-
|
|
55
|
-
### 11. Write verification stamp
|
|
56
|
-
|
|
57
|
-
Run:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
date +%s > .pulse-verified
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**This must be the last write operation before stopping.** The stop hook compares each edited spec's modification time against this stamp — if any spec is newer than the stamp, the hook blocks. Do not edit any spec file after writing the stamp.
|
|
64
|
-
|
|
65
|
-
### 12. Report
|
|
66
|
-
|
|
67
|
-
Summarise:
|
|
68
|
-
- Validation: pass or fail (with errors if any)
|
|
69
|
-
- Visual: what was visible in the screenshot
|
|
70
|
-
- Lighthouse desktop: scores for all four categories
|
|
71
|
-
- Lighthouse mobile: scores for all four categories
|
|
72
|
-
- Performance: LCP and CLS values, any flagged insights
|
|
73
|
-
- Console: any errors
|
|
74
|
-
- Review: pass or issues found and fixed
|
|
75
|
-
|
|
76
|
-
**Pass bar — all of these must be met before the page is confirmed good:**
|
|
77
|
-
- Validation: clean (no errors, no warnings)
|
|
78
|
-
- Lighthouse desktop: Accessibility, Best Practices, SEO all 100
|
|
79
|
-
- Lighthouse mobile: same
|
|
80
|
-
- CLS: 0.00 — any layout shift is a blocker
|
|
81
|
-
- LCP: report the value; flag and fix any insight that identifies a fixable cause
|
|
82
|
-
- Console: no errors
|
|
83
|
-
|
|
84
|
-
If any gate fails, fix the issue and run `/verify` again.
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* coverage-check.js
|
|
4
|
-
*
|
|
5
|
-
* Called by the Stop hook in .claude/settings.json to enforce test coverage.
|
|
6
|
-
* Runs `npm run test:coverage` and blocks the agent if any src/pages/ file
|
|
7
|
-
* has uncovered lines — except code that cannot be unit-tested without mocking
|
|
8
|
-
* real APIs:
|
|
9
|
-
*
|
|
10
|
-
* - server fetchers (`server:` blocks) and store fetchers
|
|
11
|
-
* - action `run:` functions
|
|
12
|
-
* - `guard:`, `submit:`, and `sitemap:` handlers
|
|
13
|
-
* - `meta:` blocks (async meta functions hit real data sources)
|
|
14
|
-
*
|
|
15
|
-
* Also honours c8-style ignore comments, which Node's built-in coverage
|
|
16
|
-
* (--experimental-test-coverage) does NOT support natively. In a block or line
|
|
17
|
-
* comment, write:
|
|
18
|
-
*
|
|
19
|
-
* "c8 ignore next" — exempts the following line
|
|
20
|
-
* "c8 ignore next 3" — exempts the following 3 lines
|
|
21
|
-
* "c8 ignore start" ... "c8 ignore stop" — exempts the range
|
|
22
|
-
* ("coverage-ignore" works as a synonym for "c8 ignore")
|
|
23
|
-
*
|
|
24
|
-
* Outputs a Claude Code hook JSON decision to stdout.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { execSync } from 'child_process'
|
|
28
|
-
import fs from 'fs'
|
|
29
|
-
import { pathToFileURL } from 'url'
|
|
30
|
-
|
|
31
|
-
// Property blocks that are exempt — all server-side-only code paths that call
|
|
32
|
-
// real external APIs and cannot run in unit tests.
|
|
33
|
-
const EXEMPT_BLOCK_STARTS = [
|
|
34
|
-
/^server\s*:/,
|
|
35
|
-
/^run\s*:/, /^run\s*\(/,
|
|
36
|
-
/^guard\s*:/,
|
|
37
|
-
/^submit\s*:/,
|
|
38
|
-
/^sitemap\s*:/,
|
|
39
|
-
/^meta\s*:/,
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Build the set of exempt (1-based) line numbers for a source string:
|
|
44
|
-
* lines inside exempt property blocks, plus c8-ignore-annotated lines.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} src
|
|
47
|
-
* @returns {Set<number>}
|
|
48
|
-
*/
|
|
49
|
-
export function computeExemptLines(src) {
|
|
50
|
-
const srcLines = src.split('\n')
|
|
51
|
-
const exemptLines = new Set()
|
|
52
|
-
|
|
53
|
-
// 1. Exempt property blocks — scan tracking brace/paren depth from block start
|
|
54
|
-
let i = 0
|
|
55
|
-
while (i < srcLines.length) {
|
|
56
|
-
const trimmed = srcLines[i].trimStart()
|
|
57
|
-
if (EXEMPT_BLOCK_STARTS.some(re => re.test(trimmed))) {
|
|
58
|
-
let depth = 0
|
|
59
|
-
let started = false
|
|
60
|
-
while (i < srcLines.length) {
|
|
61
|
-
exemptLines.add(i + 1) // 1-based
|
|
62
|
-
for (const ch of srcLines[i]) {
|
|
63
|
-
if (ch === '{' || ch === '(') { depth++; started = true }
|
|
64
|
-
if (ch === '}' || ch === ')') { depth-- }
|
|
65
|
-
}
|
|
66
|
-
if (started && depth <= 0) break
|
|
67
|
-
i++
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
i++
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 2. c8-style ignore comments (Node's built-in coverage ignores these, so we
|
|
74
|
-
// honour them here — the marker line itself is always exempt too)
|
|
75
|
-
const IGNORE = /(?:c8 ignore|coverage-ignore)(?:\s+(next|start|stop))?(?:\s+(\d+))?/
|
|
76
|
-
let rangeOpen = false
|
|
77
|
-
for (let n = 0; n < srcLines.length; n++) {
|
|
78
|
-
if (rangeOpen) exemptLines.add(n + 1)
|
|
79
|
-
const m = srcLines[n].match(IGNORE)
|
|
80
|
-
if (!m) continue
|
|
81
|
-
exemptLines.add(n + 1)
|
|
82
|
-
const keyword = m[1]
|
|
83
|
-
if (keyword === 'start') { rangeOpen = true; continue }
|
|
84
|
-
if (keyword === 'stop') { rangeOpen = false; continue }
|
|
85
|
-
// 'next' (or bare marker) — exempt the following N lines (default 1)
|
|
86
|
-
const count = m[2] ? parseInt(m[2], 10) : 1
|
|
87
|
-
for (let k = 1; k <= count; k++) exemptLines.add(n + 1 + k)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return exemptLines
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns true if all uncovered line numbers fall on exempt lines.
|
|
95
|
-
*
|
|
96
|
-
* @param {string} filePath
|
|
97
|
-
* @param {string} uncoveredSpec - e.g. "30-36 50"
|
|
98
|
-
* @returns {boolean}
|
|
99
|
-
*/
|
|
100
|
-
export function allLinesExempt(filePath, uncoveredSpec) {
|
|
101
|
-
let src
|
|
102
|
-
try { src = fs.readFileSync(filePath, 'utf8') } catch { return false }
|
|
103
|
-
|
|
104
|
-
// Expand "30-36 50" → [30, 31, 32, 33, 34, 35, 36, 50]
|
|
105
|
-
const lineNums = []
|
|
106
|
-
for (const part of uncoveredSpec.split(/\s+/)) {
|
|
107
|
-
const range = part.match(/^(\d+)-(\d+)$/)
|
|
108
|
-
if (range) {
|
|
109
|
-
for (let i = parseInt(range[1]); i <= parseInt(range[2]); i++) lineNums.push(i)
|
|
110
|
-
} else if (/^\d+$/.test(part)) {
|
|
111
|
-
lineNums.push(parseInt(part))
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const exemptLines = computeExemptLines(src)
|
|
116
|
-
return lineNums.every(n => exemptLines.has(n))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// Main — only when executed directly (the exports above are unit-tested)
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
|
|
123
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
124
|
-
main()
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function main() {
|
|
128
|
-
// Agent is ending its turn to wait for the user's answer (approval gate or a
|
|
129
|
-
// mid-flow pause) — let the turn end. The marker is consumed on the user's
|
|
130
|
-
// next prompt, so the gates return in full force afterwards.
|
|
131
|
-
if (fs.existsSync('.pulse-awaiting-approval')) process.exit(0)
|
|
132
|
-
|
|
133
|
-
// No test files → nothing to check
|
|
134
|
-
const hasTests = fs.existsSync('src/pages') && (function scan(d) {
|
|
135
|
-
for (const f of fs.readdirSync(d)) {
|
|
136
|
-
const p = `${d}/${f}`
|
|
137
|
-
if (fs.statSync(p).isDirectory()) { if (scan(p)) return true }
|
|
138
|
-
else if (f.endsWith('.test.js')) return true
|
|
139
|
-
}
|
|
140
|
-
return false
|
|
141
|
-
})('src/pages')
|
|
142
|
-
|
|
143
|
-
if (!hasTests) process.exit(0)
|
|
144
|
-
|
|
145
|
-
let out = ''
|
|
146
|
-
try {
|
|
147
|
-
out = execSync('npm run test:coverage 2>&1', { encoding: 'utf8', timeout: 60000 })
|
|
148
|
-
} catch (e) {
|
|
149
|
-
out = e.stdout || e.message
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Parse the coverage report — look for lines with uncovered line numbers
|
|
153
|
-
const lines = out.split('\n')
|
|
154
|
-
let inReport = false
|
|
155
|
-
const rawGaps = []
|
|
156
|
-
|
|
157
|
-
for (const line of lines) {
|
|
158
|
-
if (line.includes('start of coverage report')) { inReport = true; continue }
|
|
159
|
-
if (!inReport) continue
|
|
160
|
-
|
|
161
|
-
// Match: # filename.js | line% | branch% | func% | 30-36 50
|
|
162
|
-
const m = line.match(/^[#ℹ]\s+([\w./[\]-]+\.js)\s*\|\s*[\d.]+\s*\|\s*[\d.]+\s*\|\s*[\d.]+\s*\|\s*([^|\n]+)$/)
|
|
163
|
-
if (m) {
|
|
164
|
-
const uncov = m[2].trim()
|
|
165
|
-
if (uncov && uncov !== 'uncovered lines') {
|
|
166
|
-
rawGaps.push({ file: m[1].trim(), uncovered: uncov })
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const gaps = []
|
|
172
|
-
for (const { file, uncovered } of rawGaps) {
|
|
173
|
-
// Try to resolve relative to cwd (coverage reports use relative paths)
|
|
174
|
-
const candidates = [file, `src/pages/${file}`, file.replace(/^.*src\/pages\//, 'src/pages/')]
|
|
175
|
-
const resolved = candidates.find(p => fs.existsSync(p))
|
|
176
|
-
|
|
177
|
-
if (resolved && allLinesExempt(resolved, uncovered)) continue // auto-exempt
|
|
178
|
-
|
|
179
|
-
gaps.push(` ${file} — uncovered lines: ${uncovered}`)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (gaps.length) {
|
|
183
|
-
process.stdout.write(JSON.stringify({
|
|
184
|
-
decision: 'block',
|
|
185
|
-
reason: [
|
|
186
|
-
'COVERAGE GAPS detected. Add tests for these uncovered lines before finishing:',
|
|
187
|
-
...gaps,
|
|
188
|
-
'',
|
|
189
|
-
'Run `npm run test:coverage` to see the full report.',
|
|
190
|
-
'Auto-exempt: server fetchers, action run(), guard, submit, sitemap, and meta blocks — these call real APIs and need no tests.',
|
|
191
|
-
'For anything else that genuinely cannot be tested, annotate it: /* c8 ignore next */ (or next N, or start/stop for a range) — this hook honours those comments even though Node\'s built-in coverage does not.',
|
|
192
|
-
'Everything else — view branches, mutations, onViewError, pure helper functions — must be covered.',
|
|
193
|
-
].join('\n'),
|
|
194
|
-
}))
|
|
195
|
-
}
|
|
196
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
## Spec review checklist
|
|
2
|
-
|
|
3
|
-
Before finishing any spec, verify every point below. Fix anything that fails.
|
|
4
|
-
|
|
5
|
-
### Critical
|
|
6
|
-
|
|
7
|
-
- **`meta` must be a plain object — never a function.** Individual fields (`title`, `description`, `styles`) can be `async (ctx) => value` functions, but `meta` itself is always `{}`.
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
// WRONG — meta is not a function factory
|
|
11
|
-
meta: async (ctx) => ({ title: '...', styles: [...] })
|
|
12
|
-
|
|
13
|
-
// CORRECT — meta is a plain object; individual fields are functions
|
|
14
|
-
meta: {
|
|
15
|
-
title: async (ctx) => (await post(ctx)).frontmatter.title,
|
|
16
|
-
description: async (ctx) => (await post(ctx)).frontmatter.description,
|
|
17
|
-
styles: ['/pulse-ui.css', '/app.css'],
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
- **Do not set `hydrate` in specs.** It is auto-derived by the framework from the URL entry passed to `createServer`. Specs with `mutations`, `actions`, or `persist` are hydrated automatically. Purely server-rendered specs get zero JavaScript — no configuration needed.
|
|
22
|
-
|
|
23
|
-
- **The default theme is DARK.** When `meta.theme` is unset, the page renders with the dark palette. If the design calls for a light page, set `meta.theme: 'light'` when you **first write the spec** — do not assume light and discover dark at the screenshot, which costs an edit → restart → re-approval cycle. Declare the theme in your plan/build brief, and ask the user if the brief doesn't say.
|
|
24
|
-
|
|
25
|
-
- **Always restart the server and reload the browser after every file edit — before checking the result.** The dev server restarts on file changes but the browser tab stays stale. The required sequence is: `pulse_restart_server` → `navigate_page`. Never attempt to debug a visual problem without doing both steps first.
|
|
26
|
-
|
|
27
|
-
### Components first — or creative override
|
|
28
|
-
|
|
29
|
-
- **Before writing any HTML by hand, check `src/ui/index.js`.** There are 50+ components. Use `button`, `card`, `alert`, `input`, `spinner`, `badge`, `modal`, `nav`, `pagination`, `table`, etc. before writing equivalent HTML from scratch.
|
|
30
|
-
- **Do not reinvent component patterns.** These patterns have dedicated components — never write custom HTML for them unless a creative override applies (see below):
|
|
31
|
-
- Hero sections → `hero({ title, subtitle, actions, image, ... })`
|
|
32
|
-
- Product/service cards → `card({ title, body, image, footer, ... })`
|
|
33
|
-
- Image + text two-column layouts → `media({ image, content, reverse })`
|
|
34
|
-
- Feature tiles → `feature({ icon, title, description })`
|
|
35
|
-
- Testimonials → `card({ content, footer })` with quote + avatar/name in the content slot
|
|
36
|
-
- CTAs → `cta({ title, subtitle, actions })`
|
|
37
|
-
- Navigation → `nav({ logo, links, actions })`
|
|
38
|
-
- Footers → `footer({ logo, links, columns, legal, ... })`
|
|
39
|
-
|
|
40
|
-
- **Creative override — raw HTML throughout is permitted** when the design intent genuinely calls for it: a highly custom visual identity, an asymmetric or typographically-driven layout, a brutalist/editorial/retro/neon/paper vibe where components would constrain the expression, or a layout that requires features a component simply doesn't support (e.g. full-viewport height, custom gradient glows, clamp-scaled display type). This is a deliberate design decision, not a shortcut. When taking this path:
|
|
41
|
-
- **Declare it in a comment at the top of the spec** so the reviewer recognises it: `// component-free — creative override: <reason>`. This is the signal the review tool reads.
|
|
42
|
-
- Functional atoms (`button`, `input`, `badge`, `modal`) should still come from components unless there is a specific design reason not to.
|
|
43
|
-
- `/pulse-ui.css` is always required — it provides the token system your custom CSS will use.
|
|
44
|
-
- The quality gate replaces the component checklist: **Lighthouse 100 on Accessibility, Best Practices, and SEO — desktop and mobile — plus CLS 0.00 is the pass bar.** (Performance is reported but not gated; it varies with machine load.) A component-free page that passes every audit is correct. A component-heavy page that fails accessibility is not.
|
|
45
|
-
|
|
46
|
-
- **When reviewing**: before flagging a class name like `.hero` as a violation, first ask whether the `hero()` component could actually reproduce the layout. If the answer is no, it is a creative override — check Lighthouse instead of refactoring. Do not flatten a good custom layout into a generic component just to clear a pattern-match.
|
|
47
|
-
|
|
48
|
-
- **The review tool auto-detects creative override** from the spec comment. When detected, component pattern checks are shown as advisory (`⚡`) not as failures, and the Lighthouse gate is the stated pass bar.
|
|
49
|
-
|
|
50
|
-
- **Never write App Store or Google Play download buttons by hand.** Always use `appBadge({ store: 'apple', href })` and `appBadge({ store: 'google', href })`. Raw `<a>` tags with badge images are incorrect — `appBadge` renders the correct accessible, styled badge for each store.
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
import { appBadge } from '@invisibleloop/pulse/ui'
|
|
54
|
-
|
|
55
|
-
// In a hero() actions slot:
|
|
56
|
-
${hero({
|
|
57
|
-
actions: `
|
|
58
|
-
${appBadge({ store: 'apple', href: 'https://apps.apple.com/...' })}
|
|
59
|
-
${appBadge({ store: 'google', href: 'https://play.google.com/...' })}
|
|
60
|
-
`,
|
|
61
|
-
})}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Reuse (DRY)
|
|
65
|
-
|
|
66
|
-
- **Extract a view helper when the same HTML pattern appears 3 or more times in a single spec.** A plain JS function returning an HTML string is sufficient — no framework needed:
|
|
67
|
-
```js
|
|
68
|
-
const card = ({ title, body }) => `<div class="card"><h3>${title}</h3><p>${body}</p></div>`
|
|
69
|
-
```
|
|
70
|
-
- **Create a shared component in `src/components/` when the same pattern is needed across 2 or more different specs.** A named export that returns an HTML string — same shape as the `layout()` pattern in the routing guide. Never paste a section's HTML into a second spec: extract it at the second use, then import it from both. (`src/ui/` is the framework's own library inside the package — project-level shared code always goes in `src/components/`.)
|
|
71
|
-
- **Do not abstract a pattern that appears only once.** Duplication is cheaper than the wrong abstraction. Within a single spec, wait until the third use before extracting a helper; across specs, extract at the second use.
|
|
72
|
-
|
|
73
|
-
### Correctness
|
|
74
|
-
|
|
75
|
-
- Mutations return plain partial-state objects and have no side effects (no fetch, no DOM access).
|
|
76
|
-
- `persist` contains only serialisable state that should survive a page reload — not ephemeral UI state like a loading flag or temporary selection.
|
|
77
|
-
- `e.target` assumptions in mutations are safe if the element has child nodes — use `e.target.closest('[data-index]')` rather than assuming `e.target` is the element with the attribute.
|
|
78
|
-
- State shape is consistent — avoid a single field that is sometimes `null`, sometimes a string, sometimes a boolean. Use a dedicated `status` field instead.
|
|
79
|
-
- **Never use `state.modalOpen` or conditional modal rendering.** This destroys the `<dialog>` on every render, breaking focus, animation, and native ESC handling. Instead, always render the `<dialog>` in the DOM and use `data-dialog-open="id"` to open it — the runtime handles this without any spec state:
|
|
80
|
-
```html
|
|
81
|
-
<!-- always in the view, never conditional -->
|
|
82
|
-
${modal({ id: 'confirm', title: 'Confirm', content: '...' })}
|
|
83
|
-
<!-- anywhere on the page — opens the dialog, no mutation needed -->
|
|
84
|
-
${modalTrigger({ target: 'confirm', label: 'Open' })}
|
|
85
|
-
<!-- or inline: -->
|
|
86
|
-
<button data-dialog-open="confirm">Open</button>
|
|
87
|
-
```
|
|
88
|
-
Close is handled natively by `<form method="dialog">` (inside the modal), ESC key, backdrop click, or `data-dialog-close` on any element.
|
|
89
|
-
|
|
90
|
-
### Defensive data handling
|
|
91
|
-
|
|
92
|
-
- **Always check `res.ok` before parsing fetch responses.** Never call `res.json()` on a response that may have failed. Never use `await res.text()` as an error message — on a 404 or 500, this returns raw HTML which surfaces directly in toasts and error alerts. The correct pattern:
|
|
93
|
-
```js
|
|
94
|
-
const res = await fetch('/api/...')
|
|
95
|
-
if (!res.ok) {
|
|
96
|
-
let message = `Request failed: ${res.status}`
|
|
97
|
-
try { const j = await res.json(); message = j.message || j.error || message } catch {}
|
|
98
|
-
throw new Error(message)
|
|
99
|
-
}
|
|
100
|
-
return await res.json()
|
|
101
|
-
```
|
|
102
|
-
- **Never assume the shape of data from external APIs or server fetchers.** Use optional chaining (`?.`) and nullish coalescing (`??`) at every access point. If a server fetcher can return `null`, the view must handle it — `server.user?.name ?? 'Guest'` not `server.user.name`.
|
|
103
|
-
- **Validate FormData fields before use.** `formData.get('email')` returns `null` if the field is missing. Check for null/empty before passing to an API or database.
|
|
104
|
-
- **Do not trust URL params.** `ctx.params.id` is a raw string from the URL. Validate it before use — check it exists, is the right type, and refers to a real resource. Return a 404 or redirect if it doesn't.
|
|
105
|
-
|
|
106
|
-
### CSS
|
|
107
|
-
|
|
108
|
-
- **`app.css` must contain no hex values or raw colour values.** A lint hook enforces this and will block the build. Hex values belong in `public/theme.css` as token definitions; `app.css` references them via `var()` only.
|
|
109
|
-
- **Load order in `meta.styles`:** `pulse-ui.css` → `theme.css` → `app.css`. Theme tokens must be defined before `app.css` references them.
|
|
110
|
-
- **CSS for a shared section lives in the shared `app.css`, once.** Every spec that renders the section lists the same file in `meta.styles`. Never copy a CSS block into a second per-page stylesheet — two copies drift apart. Per-page stylesheets are for styles only one page uses.
|
|
111
|
-
|
|
112
|
-
### Security
|
|
113
|
-
|
|
114
|
-
- Any value from user input (URL params, form fields, external APIs) interpolated into view HTML must be escaped.
|
|
115
|
-
- **Every `<form method="POST">` on a `submit` page includes `${server.csrf}`.** CSRF is enforced — a form without the hidden token field gets 403 on submit. Never set `csrf: false` to "fix" a 403; that disables the protection. `csrf: false` is only for endpoints with their own authentication (e.g. signed webhooks).
|
|
116
|
-
- **`submit` returns `{ redirect }` after a successful mutation** (POST-redirect-GET). Rendering success directly from the POST means browser refresh resubmits the form.
|
|
117
|
-
|
|
118
|
-
### Server-side forms & error pages
|
|
119
|
-
|
|
120
|
-
- **Forms that must work without JavaScript use `spec.submit`** + `<form method="POST">` with `${server.csrf}` inside. Hydrated `data-action` on the same form is the enhancement, not the requirement.
|
|
121
|
-
- On a validation re-render, show `server.form?.errors` and echo `server.form?.values` back into the inputs via `value=` — failed validation must not wipe what the user typed.
|
|
122
|
-
- **Every site has a custom 404 page** — a spec with `route: '*'`, using the shared `layout()` so it carries the site's nav and footer. Without it, bad URLs show the framework's unbranded default.
|
|
123
|
-
|
|
124
|
-
### Tests
|
|
125
|
-
|
|
126
|
-
- Pure logic functions extracted from a spec (e.g. `checkResult`, `validate`, `formatPrice`) must have unit tests in a corresponding `.test.js` file.
|
|
127
|
-
- **When fixing a bug, write a failing test first.** The test must reproduce the bug before the fix is applied, then pass after. This pins the behaviour so the bug cannot silently return. A fix without a regression test is incomplete.
|
|
128
|
-
- **Use `renderSync` / `render` from `@invisibleloop/pulse/testing` to test view HTML output.** Do not test views with raw `html.includes()` — use the query helpers instead:
|
|
129
|
-
```js
|
|
130
|
-
import { renderSync, render } from '@invisibleloop/pulse/testing'
|
|
131
|
-
|
|
132
|
-
// Sync — call view directly with mock state/server
|
|
133
|
-
const result = renderSync(mySpec, { state: { count: 5 }, server: { items: [] } })
|
|
134
|
-
assert(result.has('button'))
|
|
135
|
-
assert.equal(result.get('#count').text, '5')
|
|
136
|
-
assert.equal(result.count('li'), 0)
|
|
137
|
-
|
|
138
|
-
// Async — run real server fetchers (integration), or pass server to skip them
|
|
139
|
-
const result = await render(mySpec, { server: { product: mockProduct } })
|
|
140
|
-
assert.equal(result.get('h1').text, mockProduct.name)
|
|
141
|
-
assert.equal(result.attr('img', 'src'), mockProduct.image)
|
|
142
|
-
```
|
|
143
|
-
Supported selectors: `tag`, `.class`, `#id`, `[attr]`, `[attr="value"]`, combinations (`button.primary[disabled]`), and **descendant combinators** (`result.count('.parent li')`, `result.find('tbody tr')`). Descendant selectors match the rightmost token within the ancestor context — they do not return 0 if the ancestor doesn't exist, they simply find no matching descendants.
|
|
144
|
-
|
|
145
|
-
### Markdown
|
|
146
|
-
|
|
147
|
-
- **Use `md()` from `@invisibleloop/pulse/md` for `.md` file content.** Never read and parse markdown manually. Pass the result's `html` to `prose()`.
|
|
148
|
-
- **Call the same `md()` fetcher in both `meta` and `server`** — it caches on `ctx._mdCache` so the file is only read once per request. Do not create two separate fetchers for the same file.
|
|
149
|
-
- **Always add `onViewError` on dynamic markdown routes** (routes with `:param` segments loading `.md` files). A missing file throws `{ status: 404 }` which must be caught gracefully.
|
|
150
|
-
|
|
151
|
-
### View error handling
|
|
152
|
-
|
|
153
|
-
- **Define `onViewError` on any page where the view could throw due to bad or missing data.** Without it, a runtime view error returns a 500 on the server and shows a generic inline message on the client. With it, the server returns 200 with your fallback HTML instead of a 500, and the client renders your fallback:
|
|
154
|
-
```js
|
|
155
|
-
onViewError: (err, state, serverState) => `
|
|
156
|
-
<div class="u-p-4 u-text-center">
|
|
157
|
-
<p>Something went wrong. <a href="">Reload</a></p>
|
|
158
|
-
</div>
|
|
159
|
-
`
|
|
160
|
-
```
|
|
161
|
-
Use this on pages that render data from external APIs or user-supplied content — any path where the view can encounter `null`, `undefined`, or unexpected shapes that would cause a crash. It is not required on simple pages with predictable data.
|
|
162
|
-
|
|
163
|
-
### Store updates from actions
|
|
164
|
-
|
|
165
|
-
- **Use `_storeUpdate` to push changes to the global store from an action.** Return it from `onSuccess` alongside the local state update — it is stripped from page state and forwarded to the store. All mounted pages that subscribe to the affected keys re-render immediately:
|
|
166
|
-
```js
|
|
167
|
-
onSuccess: (state, theme) => ({
|
|
168
|
-
saved: true,
|
|
169
|
-
_storeUpdate: { settings: { theme } }, // ← merged into store state
|
|
170
|
-
}),
|
|
171
|
-
```
|
|
172
|
-
`_storeUpdate` only merges into the store — it does not appear in the page's own state. The rest of the return is merged into local state as normal. Use this instead of a full-page reload when a user action changes shared data (theme, cart count, user profile, etc.).
|
|
173
|
-
|
|
174
|
-
### Accessibility
|
|
175
|
-
|
|
176
|
-
- Interactive elements without visible text have an `aria-label`.
|
|
177
|
-
- Disabled state is reflected with the `disabled` attribute, not just CSS.
|
|
178
|
-
- The page has a `<main id="main-content">` landmark.
|
|
179
|
-
- **Every element with `data-event`, `data-store-event`, `data-dialog-open`, or `data-dialog-close` is natively interactive (`button`, `a`, `input`, `select`, `textarea`, `summary`) or has `tabindex="0"`.** Non-interactive tags (`div`, `span`, `li`, `td`, etc.) with these attributes are not keyboard reachable. Prefer `<button>` — it is focusable, fires on Enter/Space, and carries the correct ARIA role for free. Only use `tabindex="0"` on a non-interactive element when a `<button>` genuinely cannot be used.
|
|
180
|
-
- **Every interactive element communicates its purpose and state:**
|
|
181
|
-
- Buttons have visible text or `aria-label`. Links use descriptive text — "click here", "here", "read more" are failures.
|
|
182
|
-
- Form inputs have an associated `<label for="id">` or `aria-label`. `placeholder` alone is not a label.
|
|
183
|
-
- Toggle controls (open/close, show/hide, expand/collapse) carry `aria-expanded="true|false"` or `aria-pressed="true|false"`.
|
|
184
|
-
- While an action is in flight, the trigger button has `aria-busy="true"` or its label changes (e.g. "Saving…"). A spinner alone is not enough.
|
|
185
|
-
- Active nav items have `aria-current="page"`. Selected items in a list, tab set, or option group have `aria-selected="true"`.
|
|
186
|
-
- **The page has a logical tab order:**
|
|
187
|
-
- No `tabindex` value greater than 0. Positive tabindex values override the natural DOM order and create a broken tab sequence. Remove them and reorder the DOM instead.
|
|
188
|
-
- Visually hidden interactive content (off-canvas menus, collapsed panels, `opacity:0` elements) is removed from the tab order with `tabindex="-1"` or the `inert` attribute — CSS alone does not remove an element from tab order.
|
|
189
|
-
- DOM order matches the visual reading order. When flexbox `order` or CSS grid placement visually reposition elements, the tab sequence still follows the DOM — author the DOM in the order a user would read and interact with the page.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.14.2
|