Add the UI Prototype skill, and have Quick Task confirm a saved prototype's brief before planning
AI Assisted
No files matched your search
@@ -45,5 +45,5 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web
|
|||||||
| `update-check.mjs` | the dashboard's release check, server-only (never in `SERVABLE`): `compareVersions()` (numeric X.Y.Z, `null` otherwise), `latestTag()` (the highest `refs/tags/vX.Y.Z`, peeled `^{}` and pre-release tags skipped), `checkForUpdate({ installed, cacheFile, now, run })` (never throws) and `runLsRemote()` (`git ls-remote --tags` on the repo: no shell, `GIT_TERMINAL_PROMPT=0`, `GCM_INTERACTIVE=never`, SSH `BatchMode` when `GIT_SSH_COMMAND` is unset, `windowsHide`, killed at 10 s; git authenticates itself, the console never touches a credential). The answer, failures included, is cached for an hour in `~/.plan2code/console/update-check.json` (`UPDATE_CHECK_FILE`, in `PROTECTED_CONSOLE_FILES` so no sweep removes it). `server.mjs` starts it after the ready line and never awaits it; `stateFrame()` carries `update: { installed, latest }` only when a newer release exists (its `latest` is part of `haveKey()`, so a page that connected first still gets it), and `GET /version` returns `{ version, latest }`. Tests seed a fresh cached failure in every console home, so no test server reaches the network. The `plan2code` launcher reads the same cache for its terminal release notice (a copy of this module sits in `~/.plan2code/bin/`) |
|
| `update-check.mjs` | the dashboard's release check, server-only (never in `SERVABLE`): `compareVersions()` (numeric X.Y.Z, `null` otherwise), `latestTag()` (the highest `refs/tags/vX.Y.Z`, peeled `^{}` and pre-release tags skipped), `checkForUpdate({ installed, cacheFile, now, run })` (never throws) and `runLsRemote()` (`git ls-remote --tags` on the repo: no shell, `GIT_TERMINAL_PROMPT=0`, `GCM_INTERACTIVE=never`, SSH `BatchMode` when `GIT_SSH_COMMAND` is unset, `windowsHide`, killed at 10 s; git authenticates itself, the console never touches a credential). The answer, failures included, is cached for an hour in `~/.plan2code/console/update-check.json` (`UPDATE_CHECK_FILE`, in `PROTECTED_CONSOLE_FILES` so no sweep removes it). `server.mjs` starts it after the ready line and never awaits it; `stateFrame()` carries `update: { installed, latest }` only when a newer release exists (its `latest` is part of `haveKey()`, so a page that connected first still gets it), and `GET /version` returns `{ version, latest }`. Tests seed a fresh cached failure in every console home, so no test server reaches the network. The `plan2code` launcher reads the same cache for its terminal release notice (a copy of this module sits in `~/.plan2code/bin/`) |
|
||||||
| `console.md` | the core of the agent-facing contract, read once per conversation (every skill ships the same copy, so a dashboard hop never re-reads it): starting, the turn (`post --wait`, the exit codes, handling a send, `settle`), posting, the payload and its kinds, documents (including `file` blocks), the house rules, and an index of the topic files below with the moment each is read. A test caps it at 24,000 characters |
|
| `console.md` | the core of the agent-facing contract, read once per conversation (every skill ships the same copy, so a dashboard hop never re-reads it): starting, the turn (`post --wait`, the exit codes, handling a send, `settle`), posting, the payload and its kinds, documents (including `file` blocks), the house rules, and an index of the topic files below with the moment each is read. A test caps it at 24,000 characters |
|
||||||
| `console-finish.md` · `console-stop.md` · `console-chat.md` · `console-workspace.md` · `console-subagents.md` · `console-launches.md` · `console-meter.md` · `console-attachments.md` · `console-trouble.md` | topic files, each read only when its moment first comes: finishing (the finish and its buttons), stop requests (the way home mid-workflow, `stopWarning`, resuming a pause), Quick questions, the Workspace, standing instructions and helper reports, dashboard launches and the menu payload, the session meter's `run` events (read only when a `run` is refused: the notes inline every `run`), keeping a cited note attachment, and recovery |
|
| `console-finish.md` · `console-stop.md` · `console-chat.md` · `console-workspace.md` · `console-subagents.md` · `console-launches.md` · `console-meter.md` · `console-attachments.md` · `console-trouble.md` | topic files, each read only when its moment first comes: finishing (the finish and its buttons), stop requests (the way home mid-workflow, `stopWarning`, resuming a pause), Quick questions, the Workspace, standing instructions and helper reports, dashboard launches and the menu payload, the session meter's `run` events (read only when a `run` is refused: the notes inline every `run`), keeping a cited note attachment, and recovery |
|
||||||
| `notes/<workflow>.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`). Each skill's Interface line reads `<D>/console.md` and its own notes file right after `open`; a test checks every skill names one that exists |
|
| `notes/<workflow>.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `ui-prototype`). Each skill's Interface line reads `<D>/console.md` and its own notes file right after `open`; a test checks every skill names one that exists |
|
||||||
| `building.md` · `building-review.md` | the build half of the contract, for `implement`, `implement-review` and `quick-task`: progress posts (`agent.activity`, `agent.quietMinutes`, `file` blocks re-read with `refresh`), the chat check between tasks, questions mid-build and stop requests; `building-review.md` is the review run on the page (the sign-off's `review` verdict, **Review it now**, Implement + Review's Stage 2, Finalize's Step 2.5), read only when asked for |
|
| `building.md` · `building-review.md` | the build half of the contract, for `implement`, `implement-review` and `quick-task`: progress posts (`agent.activity`, `agent.quietMinutes`, `file` blocks re-read with `refresh`), the chat check between tasks, questions mid-build and stop requests; `building-review.md` is the review run on the page (the sign-off's `review` verdict, **Review it now**, Implement + Review's Stage 2, Finalize's Step 2.5), read only when asked for |
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
plan2code/
|
plan2code/
|
||||||
├── src/ # Source workflow prompts (20 markdown files)
|
├── src/ # Source workflow prompts (21 markdown files)
|
||||||
│ ├── plan2code-0-pathfinder-references/ # Reference files for pathfinder skill
|
│ ├── plan2code-0-pathfinder-references/ # Reference files for pathfinder skill
|
||||||
│ │ ├── brief.md # Dated plain-English decision briefs
|
│ │ ├── brief.md # Dated plain-English decision briefs
|
||||||
│ │ ├── chart.md # MODE A: destination + frontier grills, templates
|
│ │ ├── chart.md # MODE A: destination + frontier grills, templates
|
||||||
@@ -32,6 +32,11 @@ plan2code/
|
|||||||
│ │ └── community-feedback-submission.md # STEP 6.5 payload schema + submission tiers
|
│ │ └── community-feedback-submission.md # STEP 6.5 payload schema + submission tiers
|
||||||
│ ├── plan2code-dead-code-references/ # Reference files for dead-code skill
|
│ ├── plan2code-dead-code-references/ # Reference files for dead-code skill
|
||||||
│ │ └── caller-search.md # How to search for a symbol's callers before calling it dead
|
│ │ └── caller-search.md # How to search for a symbol's callers before calling it dead
|
||||||
|
│ ├── plan2code-ui-prototype-references/ # Reference files for ui-prototype skill
|
||||||
|
│ │ ├── ui-prototype-contract.md # The contract between model-written variants and the shipped shell
|
||||||
|
│ │ ├── ui-prototype-design.md # Making each variant look designed: structure, type, color, the dials
|
||||||
|
│ │ ├── ui-prototype-rounds.md # Rounds, the paste back, the save into a spec
|
||||||
|
│ │ └── ui-prototype-shell/ # The page shell the script assembles every round from (shell.html, shell.js, shell.css, base.css)
|
||||||
│ ├── skill-scripts/ # Scripts shared across skills: install.js copies the ones a skill lists into skills/<skill>/scripts/ (specs, commit-msg, review-scope, agents-md, agent-files, glob, test-map, test-match, test-commands, run-check, common)
|
│ ├── skill-scripts/ # Scripts shared across skills: install.js copies the ones a skill lists into skills/<skill>/scripts/ (specs, commit-msg, review-scope, agents-md, agent-files, glob, test-map, test-match, test-commands, run-check, common)
|
||||||
│ └── plan2code-<skill>-scripts/ # A skill's own scripts, same copy rule (pathfinder, finalize, changelog, git, xray, pr-prep, test and dead-code each have one)
|
│ └── plan2code-<skill>-scripts/ # A skill's own scripts, same copy rule (pathfinder, finalize, changelog, git, xray, pr-prep, test and dead-code each have one)
|
||||||
├── plan2code-bot/ # Autonomous end-to-end workflow test runner (TypeScript, tsup, Claude Agent SDK, vitest); user docs in .readme/test-bot.md
|
├── plan2code-bot/ # Autonomous end-to-end workflow test runner (TypeScript, tsup, Claude Agent SDK, vitest); user docs in .readme/test-bot.md
|
||||||
@@ -134,10 +139,10 @@ plan2code/
|
|||||||
| `plan2code.md` | — | The dashboard: opens the web console's skill menu and launches the picked skill into its own session |
|
| `plan2code.md` | — | The dashboard: opens the web console's skill menu and launches the picked skill into its own session |
|
||||||
| `plan2code-init.md` | Init | Generate AGENTS.md as index + `.agents-docs/` section files (progressive discovery) |
|
| `plan2code-init.md` | Init | Generate AGENTS.md as index + `.agents-docs/` section files (progressive discovery) |
|
||||||
| `plan2code-init-update.md` | Update | Update AGENTS.md with learnings; detects and routes edits to `.agents-docs/` files |
|
| `plan2code-init-update.md` | Update | Update AGENTS.md with learnings; detects and routes edits to `.agents-docs/` files |
|
||||||
| `plan2code-0-pathfinder.md` | 0 | Chart a foggy idea as a map (local files, or GitHub Issues) of decision questions under `specs/<idea>/pathfinder/`, resolve them one at a time, hand a seeded PLAN-DRAFT to Step 1 |
|
| `plan2code-0-pathfinder.md` | 0 | Chart a foggy idea as a map (local files, or GitHub Issues) of decision questions under `specs/<idea>/pathfinder/`, resolve them one at a time, hand a seeded PLAN-DRAFT to Step 1; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype, which replaces the runnable UI sketch |
|
||||||
| `plan2code-quick-task.md` | quick | Lightweight planning for small tasks (standalone — not a pipeline step) |
|
| `plan2code-quick-task.md` | quick | Lightweight planning for small tasks (standalone — not a pipeline step); ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype |
|
||||||
| `plan2code-1-plan.md` | 1 | Requirements analysis & architecture |
|
| `plan2code-1-plan.md` | 1 | Requirements analysis & architecture; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype |
|
||||||
| `plan2code-1b-revise-plan.md` | 1b | Mid-implementation revisions |
|
| `plan2code-1b-revise-plan.md` | 1b | Mid-implementation revisions; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype |
|
||||||
| `plan2code-2-document.md` | 2 | Create implementation specs |
|
| `plan2code-2-document.md` | 2 | Create implementation specs |
|
||||||
| `plan2code-3-implement.md` | 3 | Execute implementation (phase by phase) |
|
| `plan2code-3-implement.md` | 3 | Execute implementation (phase by phase) |
|
||||||
| `plan2code-3-implement-review.md` | 3 | Execute one phase, run focused review and fixes, then request approval |
|
| `plan2code-3-implement-review.md` | 3 | Execute one phase, run focused review and fixes, then request approval |
|
||||||
@@ -149,6 +154,7 @@ plan2code/
|
|||||||
| `plan2code-pr-prep.md` | pr-prep | Get a branch ready for review: pick the checks its changes need from the project's `## Test map` (or its config files), let the person trim the plan, run it, give Ready, Ready with notes or Not ready, and write a PR description to copy (following the repo's template) with the create-a-PR link; offers to save `PR-READINESS-<date>.md` into the branch's spec folder; never commits, pushes or opens the PR |
|
| `plan2code-pr-prep.md` | pr-prep | Get a branch ready for review: pick the checks its changes need from the project's `## Test map` (or its config files), let the person trim the plan, run it, give Ready, Ready with notes or Not ready, and write a PR description to copy (following the repo's template) with the create-a-PR link; offers to save `PR-READINESS-<date>.md` into the branch's spec folder; never commits, pushes or opens the PR |
|
||||||
| `plan2code-test.md` | test | Write missing tests: ask where to look, find source files no test covers (matching, plus real coverage when the project already has a coverage tool, offered first), show a plan opening with how this project writes tests, then write and run unit and integration tests; escalates past 8 source files, 8 new test files or 2 runners to a PLAN-DRAFT for Plan, hands a real bug to Diagnose, never changes source code |
|
| `plan2code-test.md` | test | Write missing tests: ask where to look, find source files no test covers (matching, plus real coverage when the project already has a coverage tool, offered first), show a plan opening with how this project writes tests, then write and run unit and integration tests; escalates past 8 source files, 8 new test files or 2 runners to a PLAN-DRAFT for Plan, hands a real bug to Diagnose, never changes source code |
|
||||||
| `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them, then offer a final review of the removals in the same session (Step 7.5, recommended yes; ships `review.md`, `review-in-build.md`, `test-runs.md` and the review references, as Finalize does); never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs`, `specs.mjs`, `commit-msg.mjs`, `review-scope.mjs` |
|
| `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them, then offer a final review of the removals in the same session (Step 7.5, recommended yes; ships `review.md`, `review-in-build.md`, `test-runs.md` and the review references, as Finalize does); never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs`, `specs.mjs`, `commit-msg.mjs`, `review-scope.mjs` |
|
||||||
|
| `plan2code-ui-prototype.md` | ui-prototype | Draw several versions of a screen or flow on one page with live dials (drafts under `~/.plan2code/prototypes/`), bring the pick back by Copy and paste for the next round, and save the pair into `specs/<spec>/prototypes/` only on a yes; never changes code |
|
||||||
| `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer to commit the result through Git |
|
| `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer to commit the result through Git |
|
||||||
| `plan2code-git.md` | git | Branches, pull (with conflict help), push, publish and commits (clear message, suggested splits) on the web console's git board, or plain instructions in the terminal (`switch to main`, `commit and push`); asks before every push, publish and delete |
|
| `plan2code-git.md` | git | Branches, pull (with conflict help), push, publish and commits (clear message, suggested splits) on the web console's git board, or plain instructions in the terminal (`switch to main`, `commit and push`); asks before every push, publish and delete |
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ Anything a workflow step decides with one correct answer (parsing a spec's check
|
|||||||
| `xray.mjs` (own) | xray | `hotspots` (churn, files changed together, often-changed files with no test, from `git log` over a capped window) and `history <path>` (commits following renames, a blame summary, PR titles and first paragraphs through `gh` when signed in, and which sources were used). Read-only |
|
| `xray.mjs` (own) | xray | `hotspots` (churn, files changed together, often-changed files with no test, from `git log` over a capped window) and `history <path>` (commits following renames, a blame summary, PR titles and first paragraphs through `gh` when signed in, and which sources were used). Read-only |
|
||||||
| `changelog-state.mjs` (own) | changelog | `state`, `bump`, `set-package-version`: the default branch's version, whether the branch's entry can be extended (not released, not on another branch), the file's heading style, the gap since the entry was last touched; only `set-package-version` writes, and only the version field |
|
| `changelog-state.mjs` (own) | changelog | `state`, `bump`, `set-package-version`: the default branch's version, whether the branch's entry can be extended (not released, not on another branch), the file's heading style, the gap since the entry was last touched; only `set-package-version` writes, and only the version field |
|
||||||
| `git.mjs` (own) | git | `state`, `plan`, `branch-check`, `init-check`, `delete-check`, `cleanup-list`, `conflicts`, `pr-url`, `classify-error`: the repo snapshot, each action's exact command and confirm text (shared by the terminal and the board), branch-name, delete, cleanup and git init checks, a stopped rebase's conflicts, the pull-request link and git's errors sorted into kinds with a next step. Read-only: the agent runs every command it prints, and `guard()` refuses force push, hook skipping, amend, remote delete and blanket add |
|
| `git.mjs` (own) | git | `state`, `plan`, `branch-check`, `init-check`, `delete-check`, `cleanup-list`, `conflicts`, `pr-url`, `classify-error`: the repo snapshot, each action's exact command and confirm text (shared by the terminal and the board), branch-name, delete, cleanup and git init checks, a stopped rebase's conflicts, the pull-request link and git's errors sorted into kinds with a next step. Read-only: the agent runs every command it prints, and `guard()` refuses force push, hook skipping, amend, remote delete and blanket add |
|
||||||
|
| `ui-prototype.mjs` (shared, with `ui-prototype-round.mjs`, `ui-prototype-page.mjs`, `ui-prototype-drafts.mjs`, `ui-prototype-block.mjs`) | ui-prototype, pathfinder, plan, revise-plan, quick-task (ride-along) | `sweep` (drafts older than 30 days), `new-round`, `assemble` (the page from `round.json`, the variant files and the shell in `references/ui-prototype-shell/`, images and fonts embedded; exit 4 `round-mismatch` when a drafts round's `round.json` names another `name` or `round` than its folder), `check` (the contract's rules, the three image rules `image-type`, `image-size` and `image-missing`, and the size ceiling), `open` (the default browser), `read-block` (a pasted choice block from stdin into fields) and `save` (the pair `specs/<spec>/prototypes/<name>.html` and `.md`, then that prototype's drafts removed). Writes only under `~/.plan2code/prototypes/<project key>/` and, on `save`, the spec's `prototypes/`; never writes project code, never opens a page outside the drafts or `specs/`, never fetches anything over the network. The helper modules are imported only by `ui-prototype.mjs` |
|
||||||
|
|
||||||
**Conventions** (`common.mjs`): Node 18+ built-ins only; one JSON object on stdout (`ok: false` plus `error`, `message`, `next` on a handled failure, the same line on stderr); exit 0 ok, 1 crash, 2 bad arguments, 3 not found, 4 invalid or check failed, 5 refused; `--help` documents commands and exit codes; writes take `--dry-run`; `PLAN2CODE_NOW` pins the clock for tests. A SKILL.md names a script as `node "<S>/<name>.mjs"`, where `<S>` is `scripts/` beside it.
|
**Conventions** (`common.mjs`): Node 18+ built-ins only; one JSON object on stdout (`ok: false` plus `error`, `message`, `next` on a handled failure, the same line on stderr); exit 0 ok, 1 crash, 2 bad arguments, 3 not found, 4 invalid or check failed, 5 refused; `--help` documents commands and exit codes; writes take `--dry-run`; `PLAN2CODE_NOW` pins the clock for tests. A SKILL.md names a script as `node "<S>/<name>.mjs"`, where `<S>` is `scripts/` beside it.
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ The same areas as one-command rows live in the [Test map](./AGENTS-test-map.md),
|
|||||||
| The launcher (`src/launcher/`) | `node --test scripts/test-launcher.mjs` |
|
| The launcher (`src/launcher/`) | `node --test scripts/test-launcher.mjs` |
|
||||||
| A skill's script | `npm run build:skills`, then `node --test scripts/test-script-<skill>.mjs` (and `test-skill-scripts.mjs` for the shared plumbing) |
|
| A skill's script | `npm run build:skills`, then `node --test scripts/test-script-<skill>.mjs` (and `test-skill-scripts.mjs` for the shared plumbing) |
|
||||||
| Dead Code (`src/plan2code-dead-code-scripts/`, `scripts/fixtures/dead-code/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-dead-code.mjs` |
|
| Dead Code (`src/plan2code-dead-code-scripts/`, `scripts/fixtures/dead-code/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-dead-code.mjs` |
|
||||||
|
| UI Prototype (`src/skill-scripts/ui-prototype*.mjs`, `src/plan2code-ui-prototype-references/`, `scripts/fixtures/ui-prototype/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-ui-prototype.mjs scripts/test-ui-prototype-page.mjs` |
|
||||||
| A workflow prompt (`src/plan2code-*.md`) | `node scripts/validate-char-count.js` and `node scripts/check-skill-table.mjs` |
|
| A workflow prompt (`src/plan2code-*.md`) | `node scripts/validate-char-count.js` and `node scripts/check-skill-table.mjs` |
|
||||||
| A new skill or console workflow | First update the hand-written tables that list every workflow: the `SUBAGENT_WORKFLOWS` count and the meter's `WEIGHTS`, `LAUNCH_LABELS` and `RUN_LABELS` in `test-web-console-logic.mjs`, `notesFor` in `test-web-console-speed.mjs`, the event list in `src/web-console/console-meter.md` (checked by `test-web-console-chat-stress.mjs`) and a `BUDGETS.notes` entry in `test-console-wire-budgets.mjs`. Then run those four suites plus `test-web-console-skills.mjs` and `test-web-console-spec-states.mjs`; the PR Prep and Test build missed all five tables and only the full suite caught them |
|
| A new skill or console workflow | First update the hand-written tables that list every workflow: the `SUBAGENT_WORKFLOWS` count and the meter's `WEIGHTS`, `LAUNCH_LABELS` and `RUN_LABELS` in `test-web-console-logic.mjs`, `notesFor` in `test-web-console-speed.mjs`, the event list in `src/web-console/console-meter.md` (checked by `test-web-console-chat-stress.mjs`) and a `BUDGETS.notes` entry in `test-console-wire-budgets.mjs`. Then run those four suites plus `test-web-console-skills.mjs` and `test-web-console-spec-states.mjs`; the PR Prep and Test build missed all five tables and only the full suite caught them |
|
||||||
| Docs or comments only | `node --test scripts/test-us-english.mjs scripts/test-line-endings.mjs` |
|
| Docs or comments only | `node --test scripts/test-us-english.mjs scripts/test-line-endings.mjs` |
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Which checks cover which files, read by PR Prep and Test (`test-map.mjs read` ch
|
|||||||
| Activities games | `src/web-console/public/activities/**`, `src/web-console/public/tones.js`, `src/web-console/public/music.js` | `node --test scripts/test-web-console-tones.mjs scripts/test-web-console-activities.mjs` | no |
|
| Activities games | `src/web-console/public/activities/**`, `src/web-console/public/tones.js`, `src/web-console/public/music.js` | `node --test scripts/test-web-console-tones.mjs scripts/test-web-console-activities.mjs` | no |
|
||||||
| Launcher | `src/launcher/**` | `node --test scripts/test-launcher.mjs` | no |
|
| Launcher | `src/launcher/**` | `node --test scripts/test-launcher.mjs` | no |
|
||||||
| Dead Code script | `src/plan2code-dead-code-scripts/**`, `scripts/fixtures/dead-code/**` | `npm run build:skills && node scripts/node-test.mjs scripts/test-script-dead-code.mjs` | no |
|
| Dead Code script | `src/plan2code-dead-code-scripts/**`, `scripts/fixtures/dead-code/**` | `npm run build:skills && node scripts/node-test.mjs scripts/test-script-dead-code.mjs` | no |
|
||||||
|
| UI Prototype script and shell | `src/skill-scripts/ui-prototype*.mjs`, `src/plan2code-ui-prototype-references/**`, `scripts/fixtures/ui-prototype/**` | `npm run build:skills && node scripts/node-test.mjs scripts/test-script-ui-prototype.mjs scripts/test-ui-prototype-page.mjs` | no |
|
||||||
| Workflow prompts | `src/plan2code-*.md` | `node scripts/validate-char-count.js && node scripts/check-skill-table.mjs` | no |
|
| Workflow prompts | `src/plan2code-*.md` | `node scripts/validate-char-count.js && node scripts/check-skill-table.mjs` | no |
|
||||||
| Desktop app | `plan2code-app/**` | `cd plan2code-app && cargo test` | no |
|
| Desktop app | `plan2code-app/**` | `cd plan2code-app && cargo test` | no |
|
||||||
| Metrics | `plan2code-metrics/**` | `cd plan2code-metrics && npm test` | no |
|
| Metrics | `plan2code-metrics/**` | `cd plan2code-metrics && npm test` | no |
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ Scroll down for the utilities. Outside a git repository the **Git** card says so
|
|||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="../docs/screenshots/dashboard-utilities-dark.webp">
|
<source media="(prefers-color-scheme: dark)" srcset="../docs/screenshots/dashboard-utilities-dark.webp">
|
||||||
<img src="../docs/screenshots/dashboard-utilities-light.webp" alt="The utility cards: Get a PR ready, Write missing tests, Clear out dead code, Changelog, Git, which notes that the folder is not a git repository yet and offers to start one, and Handoff.">
|
<img src="../docs/screenshots/dashboard-utilities-light.webp" alt="The utility cards: Get a PR ready, Write missing tests, Clear out dead code, Prototype a screen, Changelog, and Git, which notes that the folder is not a git repository yet and offers to start one.">
|
||||||
</picture>
|
</picture>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Details: [Status line](./.agents-docs/AGENTS-architecture-statusline.md)
|
|||||||
|
|
||||||
## Web Console
|
## Web Console
|
||||||
|
|
||||||
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console/<version>/` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, setup, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the sixteen helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live in oLine truncated
|
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console/<version>/` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, setup, Changelog, Git, Handoff and UI Prototype) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the sixteen helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill fLine truncated
|
||||||
|
|
||||||
One agent list and one lookup rule serve the launcher, the console and the app: `src/launcher/agents.json` (the built-ins and starter templates with per-OS install data) and `src/web-console/agent-lookup.mjs` (`loadAgentList()` and `findAgent()`, both copied by `install.js` into `~/.plan2code/bin/`); the app carries a Rust twin held to the same cases by `scripts/fixtures/agent-lookup-cases.json`.
|
One agent list and one lookup rule serve the launcher, the console and the app: `src/launcher/agents.json` (the built-ins and starter templates with per-OS install data) and `src/web-console/agent-lookup.mjs` (`loadAgentList()` and `findAgent()`, both copied by `install.js` into `~/.plan2code/bin/`); the app carries a Rust twin held to the same cases by `scripts/fixtures/agent-lookup-cases.json`.
|
||||||
Building or changing an Activities game: follow the game rules in [Activities](./.agents-docs/AGENTS-architecture-activities.md) ("Building an Activities game": lives in the solid lives pill, the endless-lives code (`cheat(on)`) in every game with lives, banners placed away from the player and see-through over what matters, pausing left to the window).
|
Building or changing an Activities game: follow the game rules in [Activities](./.agents-docs/AGENTS-architecture-activities.md) ("Building an Activities game": lives in the solid lives pill, the endless-lives code (`cheat(on)`) in every game with lives, banners placed away from the player and see-through over what matters, pausing left to the window).
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ Every command below is what a dashboard card runs. Typed on its own, each one as
|
|||||||
| pr-prep | /plan2code-pr-prep | Your branch | A readiness verdict (Ready, Ready with notes, Not ready) and a PR description to copy; no commits, no push |
|
| pr-prep | /plan2code-pr-prep | Your branch | A readiness verdict (Ready, Ready with notes, Not ready) and a PR description to copy; no commits, no push |
|
||||||
| test | /plan2code-test | An area, or none | New unit and integration tests in the project's style, run; a bug handed to Diagnose; no source changes |
|
| test | /plan2code-test | An area, or none | New unit and integration tests in the project's style, run; a bug handed to Diagnose; no source changes |
|
||||||
| dead-code | /plan2code-dead-code | A folder, or none | Findings labeled Safe, Check first or Warning, then only the removals you pick, checked by the tests and build; no commits, no installs |
|
| dead-code | /plan2code-dead-code | A folder, or none | Findings labeled Safe, Check first or Warning, then only the removals you pick, checked by the tests and build; no commits, no installs |
|
||||||
|
| ui-prototype | /plan2code-ui-prototype | A screen or flow, or none | One page of several versions with live dials, your pick pasted back; `prototypes/<name>.html` and `.md` in a spec on a yes; no code changes |
|
||||||
| changelog | /plan2code-changelog | Your branch | `CHANGELOG.md` entries and the `package.json` version, from the default branch's latest version |
|
| changelog | /plan2code-changelog | Your branch | `CHANGELOG.md` entries and the `package.json` version, from the default branch's latest version |
|
||||||
| git | /plan2code-git | Your repo | Commits (`<subject>` / `AI Assisted`), branches, pull with conflict help, push, publish |
|
| git | /plan2code-git | Your repo | Commits (`<subject>` / `AI Assisted`), branches, pull with conflict help, push, publish |
|
||||||
|
|
||||||
|
|||||||
@@ -260,9 +260,12 @@ The dashboard's cards, and when each one lights up for the spec you pick:
|
|||||||
| Get a PR ready | Runs the checks your branch needs, says if it is ready, and writes the PR description to copy. Never commits, pushes or opens the PR. | Always |
|
| Get a PR ready | Runs the checks your branch needs, says if it is ready, and writes the PR description to copy. Never commits, pushes or opens the PR. | Always |
|
||||||
| Write missing tests | Finds code with no tests and writes unit and integration tests in your project's own style. Never changes source code. | Always |
|
| Write missing tests | Finds code with no tests and writes unit and integration tests in your project's own style. Never changes source code. | Always |
|
||||||
| Clear out dead code | Finds code nothing uses, says how safe each piece is to remove, and removes only what you pick. Uses the dead-code tools your project already has, and never commits. | Always |
|
| Clear out dead code | Finds code nothing uses, says how safe each piece is to remove, and removes only what you pick. Uses the dead-code tools your project already has, and never commits. | Always |
|
||||||
|
| Prototype a screen | Several versions of a screen on one page, tuned with live dials, and your pick brought back by Copy and paste. Saved into a spec only when you say, and never changes your code. | Always (takes the picked spec as the save folder) |
|
||||||
| Changelog | Checks the CHANGELOG version against the main branch and suggests entries for what is new. | Always |
|
| Changelog | Checks the CHANGELOG version against the main branch and suggests entries for what is new. | Always |
|
||||||
| Git | Branches, pull, push and commits on one board, asking before anything leaves your machine. | Always (offers to start a repository outside one) |
|
| Git | Branches, pull, push and commits on one board, asking before anything leaves your machine. | Always (offers to start a repository outside one) |
|
||||||
|
|
||||||
|
Pathfinder, Plan, Revise the plan and Quick task can each offer a prototype when a decision is about how a screen looks or flows, and run it right there in the same session; nothing is drawn without your yes.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## The four rules that do most of the work
|
## The four rules that do most of the work
|
||||||
@@ -433,6 +436,7 @@ console or the terminal; add `--web` to skip the question and go straight to the
|
|||||||
| `/plan2code-pr-prep` | Before you open a pull request. Picks the checks the branch's changes need from the project's `## Test map` (or its config files), runs the ones you keep, says Ready, Ready with notes or Not ready, and writes a PR description to copy with the create-a-PR link; never commits, pushes or opens the PR |
|
| `/plan2code-pr-prep` | Before you open a pull request. Picks the checks the branch's changes need from the project's `## Test map` (or its config files), runs the ones you keep, says Ready, Ready with notes or Not ready, and writes a PR description to copy with the create-a-PR link; never commits, pushes or opens the PR |
|
||||||
| `/plan2code-test` | Parts of the code have no tests. Asks where to look, finds the untested files (plus real coverage when the project already has a coverage tool), shows a plan in the project's own style, then writes and runs unit and integration tests; never changes source code, hands a real bug to `/plan2code-diagnose` |
|
| `/plan2code-test` | Parts of the code have no tests. Asks where to look, finds the untested files (plus real coverage when the project already has a coverage tool), shows a plan in the project's own style, then writes and runs unit and integration tests; never changes source code, hands a real bug to `/plan2code-diagnose` |
|
||||||
| `/plan2code-dead-code` | Code nothing calls anymore. Uses the project's own dead-code tools, one per language (Knip, vulture, cargo check and others), or searches by itself, checks every item for callers across the project, labels each Safe to remove, Check first or Warning, removes only what you pick, then runs the tests and build and puts back anything that breaks them; never commits, never installs anything |
|
| `/plan2code-dead-code` | Code nothing calls anymore. Uses the project's own dead-code tools, one per language (Knip, vulture, cargo check and others), or searches by itself, checks every item for callers across the project, labels each Safe to remove, Check first or Warning, removes only what you pick, then runs the tests and build and puts back anything that breaks them; never commits, never installs anything |
|
||||||
|
| `/plan2code-ui-prototype` | See a screen before it gets built. Draws several versions of a screen or flow on one page that opens in your browser, with live dials for fonts, colors, spacing and feel; Copy and paste brings your pick back for the next round, and a yes saves it as `specs/<spec>/prototypes/<name>.html` and `.md`; never changes your code |
|
||||||
| `/plan2code-changelog` | Check the CHANGELOG version against the default branch, suggest entries for new work you can edit, keep `package.json` aligned, then hand off to Git to commit |
|
| `/plan2code-changelog` | Check the CHANGELOG version against the default branch, suggest entries for new work you can edit, keep `package.json` aligned, then hand off to Git to commit |
|
||||||
| `/plan2code-git` | Branches, pull, push and commits on one board (or plain instructions in the terminal); asks before every push, publish and delete |
|
| `/plan2code-git` | Branches, pull, push and commits on one board (or plain instructions in the terminal); asks before every push, publish and delete |
|
||||||
|
|
||||||
|
|||||||
@@ -641,6 +641,7 @@ footer .brand { margin-right: auto; }
|
|||||||
<h3>And a drawer of skills for any time</h3>
|
<h3>And a drawer of skills for any time</h3>
|
||||||
<p>Each one is a card on the dashboard and a command in the terminal.</p>
|
<p>Each one is a card on the dashboard and a command in the terminal.</p>
|
||||||
<ul class="skills">
|
<ul class="skills">
|
||||||
|
<li><code>/plan2code-ui-prototype</code>Several versions of a screen on one page, tuned with live dials; never changes your code.</li>
|
||||||
<li><code>/plan2code-quick-task</code>Too small for the full process: a quick plan, then it builds.</li>
|
<li><code>/plan2code-quick-task</code>Too small for the full process: a quick plan, then it builds.</li>
|
||||||
<li><code>/plan2code-diagnose</code>Finds a bug's cause and writes it up, without fixing it.</li>
|
<li><code>/plan2code-diagnose</code>Finds a bug's cause and writes it up, without fixing it.</li>
|
||||||
<li><code>/plan2code-xray</code>Explains how and why an area of the code works.</li>
|
<li><code>/plan2code-xray</code>Explains how and why an area of the code works.</li>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 132 KiB |
@@ -180,9 +180,15 @@ const SOURCE_PROMPTS = [
|
|||||||
name: 'pathfinder',
|
name: 'pathfinder',
|
||||||
displayName: 'Pathfinder Mode',
|
displayName: 'Pathfinder Mode',
|
||||||
description: 'charting of a foggy idea as a map of decision questions, cleared one at a time',
|
description: 'charting of a foggy idea as a map of decision questions, cleared one at a time',
|
||||||
|
// ui-prototype.md rides along (with its references, shell and scripts) for the
|
||||||
|
// offer of a UI prototype, which runs in the same conversation; every carried
|
||||||
|
// name starts with ui-prototype so none collides with this skill's own files.
|
||||||
|
scripts: ['ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'],
|
||||||
additionalReferences: [
|
additionalReferences: [
|
||||||
{ source: 'web-console', target: 'web-console' },
|
{ source: 'web-console', target: 'web-console' },
|
||||||
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }
|
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype-references' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -194,7 +200,10 @@ const SOURCE_PROMPTS = [
|
|||||||
isUtility: true,
|
isUtility: true,
|
||||||
// review.md rides along for the web console's "Review it now" button, which
|
// review.md rides along for the web console's "Review it now" button, which
|
||||||
// runs the review in the same session once the quick task is built.
|
// runs the review in the same session once the quick task is built.
|
||||||
scripts: ['specs.mjs', 'commit-msg.mjs', 'review-scope.mjs', 'glob.mjs', 'test-map.mjs', 'test-match.mjs', 'run-check.mjs'],
|
// ui-prototype.md rides along (with its references, shell and scripts) for the
|
||||||
|
// offer of a UI prototype, which runs in the same conversation; every carried
|
||||||
|
// name starts with ui-prototype so none collides with this skill's own files.
|
||||||
|
scripts: ['specs.mjs', 'commit-msg.mjs', 'review-scope.mjs', 'glob.mjs', 'test-map.mjs', 'test-match.mjs', 'run-check.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'],
|
||||||
additionalReferences: [
|
additionalReferences: [
|
||||||
{ source: 'web-console', target: 'web-console' },
|
{ source: 'web-console', target: 'web-console' },
|
||||||
{ source: 'shared-references/building-habits.md', target: 'building-habits.md' },
|
{ source: 'shared-references/building-habits.md', target: 'building-habits.md' },
|
||||||
@@ -202,7 +211,9 @@ const SOURCE_PROMPTS = [
|
|||||||
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' },
|
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' },
|
||||||
{ source: 'shared-references/test-runs.md', target: 'test-runs.md' },
|
{ source: 'shared-references/test-runs.md', target: 'test-runs.md' },
|
||||||
{ source: 'plan2code-review.md', target: 'review.md' },
|
{ source: 'plan2code-review.md', target: 'review.md' },
|
||||||
{ source: 'plan2code-review-references' }
|
{ source: 'plan2code-review-references' },
|
||||||
|
{ source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype-references' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -211,10 +222,15 @@ const SOURCE_PROMPTS = [
|
|||||||
name: 'plan',
|
name: 'plan',
|
||||||
displayName: 'Planning Mode',
|
displayName: 'Planning Mode',
|
||||||
description: 'Requirements analysis and architecture design',
|
description: 'Requirements analysis and architecture design',
|
||||||
scripts: ['specs.mjs'],
|
// ui-prototype.md rides along (with its references, shell and scripts) for the
|
||||||
|
// offer of a UI prototype, which runs in the same conversation; every carried
|
||||||
|
// name starts with ui-prototype so none collides with this skill's own files.
|
||||||
|
scripts: ['specs.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'],
|
||||||
additionalReferences: [
|
additionalReferences: [
|
||||||
{ source: 'web-console', target: 'web-console' },
|
{ source: 'web-console', target: 'web-console' },
|
||||||
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }
|
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype-references' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -223,10 +239,15 @@ const SOURCE_PROMPTS = [
|
|||||||
name: 'revise-plan',
|
name: 'revise-plan',
|
||||||
displayName: 'Revision Mode',
|
displayName: 'Revision Mode',
|
||||||
description: 'Modify specs mid-implementation when requirements change',
|
description: 'Modify specs mid-implementation when requirements change',
|
||||||
scripts: ['specs.mjs'],
|
// ui-prototype.md rides along (with its references, shell and scripts) for the
|
||||||
|
// offer of a UI prototype, which runs in the same conversation; every carried
|
||||||
|
// name starts with ui-prototype so none collides with this skill's own files.
|
||||||
|
scripts: ['specs.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'],
|
||||||
additionalReferences: [
|
additionalReferences: [
|
||||||
{ source: 'web-console', target: 'web-console' },
|
{ source: 'web-console', target: 'web-console' },
|
||||||
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }
|
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' },
|
||||||
|
{ source: 'plan2code-ui-prototype-references' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -411,6 +432,18 @@ const SOURCE_PROMPTS = [
|
|||||||
{ source: 'plan2code-review-references' }
|
{ source: 'plan2code-review-references' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
source: 'plan2code-ui-prototype.md',
|
||||||
|
stepNumber: 'ui-prototype',
|
||||||
|
name: 'ui-prototype',
|
||||||
|
displayName: 'UI Prototype Mode',
|
||||||
|
description: 'Draw several versions of a screen or flow on one page, tune them with live dials, and bring the choice back',
|
||||||
|
// Shown to the agent in place of the generic header text: when the skill fits and its command.
|
||||||
|
skillDescription: "Use when you want to see several versions of a screen or flow, tune them with live dials and bring your choice back. Run it as /plan2code-ui-prototype.",
|
||||||
|
isUtility: true,
|
||||||
|
scripts: ['ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'],
|
||||||
|
additionalReferences: [{ source: 'web-console', target: 'web-console' }]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
source: 'plan2code-changelog.md',
|
source: 'plan2code-changelog.md',
|
||||||
stepNumber: 'changelog',
|
stepNumber: 'changelog',
|
||||||
@@ -464,6 +497,7 @@ function generateStepLabel(prompt) {
|
|||||||
if (prompt.stepNumber === 'pr-prep') return 'PR Prep';
|
if (prompt.stepNumber === 'pr-prep') return 'PR Prep';
|
||||||
if (prompt.stepNumber === 'test') return 'Test';
|
if (prompt.stepNumber === 'test') return 'Test';
|
||||||
if (prompt.stepNumber === 'dead-code') return 'Dead Code';
|
if (prompt.stepNumber === 'dead-code') return 'Dead Code';
|
||||||
|
if (prompt.stepNumber === 'ui-prototype') return 'UI Prototype';
|
||||||
if (prompt.stepNumber === 'changelog') return 'Changelog';
|
if (prompt.stepNumber === 'changelog') return 'Changelog';
|
||||||
if (prompt.stepNumber === 'quick') return 'Quick Task';
|
if (prompt.stepNumber === 'quick') return 'Quick Task';
|
||||||
return `Step ${prompt.stepNumber}`;
|
return `Step ${prompt.stepNumber}`;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"play": "node scripts/play.mjs",
|
"play": "node scripts/play.mjs",
|
||||||
"pretest": "node scripts/fix-line-endings.mjs",
|
"pretest": "node scripts/fix-line-endings.mjs",
|
||||||
"test:fast": "node scripts/test-fast.mjs",
|
"test:fast": "node scripts/test-fast.mjs",
|
||||||
"test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-dead-code.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-spec-carry.mjs scripts/test-spec-carry-page.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-standalone-check.mjs scripts/test-check-versions.mjs scriptsLine truncated
|
"test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-dead-code.mjs scripts/test-script-ui-prototype.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-spec-carry.mjs scripts/test-spec-carry-page.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-ui-prototype-page.mjs sLine truncated
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gpt-tokenizer": "2.9.0",
|
"gpt-tokenizer": "2.9.0",
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export function check(srcDir) {
|
|||||||
if (!note) problems.push(`${file}: names no <D>/notes/<workflow>.md file`);
|
if (!note) problems.push(`${file}: names no <D>/notes/<workflow>.md file`);
|
||||||
else if (!fs.existsSync(path.join(notesDir, `${note[1]}.md`))) problems.push(`${file}: notes file ${note[1]}.md is not in src/web-console/notes/`);
|
else if (!fs.existsSync(path.join(notesDir, `${note[1]}.md`))) problems.push(`${file}: notes file ${note[1]}.md is not in src/web-console/notes/`);
|
||||||
}
|
}
|
||||||
if (seen !== 19) problems.push(`expected 19 skills with a console opening, found ${seen}`);
|
if (seen !== 20) problems.push(`expected 20 skills with a console opening, found ${seen}`);
|
||||||
return problems;
|
return problems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,5 +87,5 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
|
|||||||
for (const p of problems) console.error(` FAIL ${p}`);
|
for (const p of problems) console.error(` FAIL ${p}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
console.log("All 19 console openings share their sentences.");
|
console.log("All 20 console openings share their sentences.");
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<img src="https://example.com/logo.png" alt="Harbor Supply">
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": [
|
||||||
|
"colors",
|
||||||
|
"fonts",
|
||||||
|
"spacing"
|
||||||
|
],
|
||||||
|
"freed": [
|
||||||
|
"components"
|
||||||
|
],
|
||||||
|
"notFound": [
|
||||||
|
"layout"
|
||||||
|
],
|
||||||
|
"variants": [
|
||||||
|
{
|
||||||
|
"letter": "A",
|
||||||
|
"name": "Variant A",
|
||||||
|
"file": "variant-a.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "B",
|
||||||
|
"name": "Variant B",
|
||||||
|
"file": "variant-b.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "C",
|
||||||
|
"name": "Variant C",
|
||||||
|
"file": "variant-c.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "D",
|
||||||
|
"name": "Variant D",
|
||||||
|
"file": "variant-d.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "E",
|
||||||
|
"name": "Variant E",
|
||||||
|
"file": "variant-e.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "F",
|
||||||
|
"name": "Variant F",
|
||||||
|
"file": "variant-f.html",
|
||||||
|
"what": "One of six",
|
||||||
|
"starts": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{
|
||||||
|
"name": "shadows",
|
||||||
|
"label": "Shadows",
|
||||||
|
"type": "pick",
|
||||||
|
"choices": [
|
||||||
|
"none",
|
||||||
|
"soft",
|
||||||
|
"strong"
|
||||||
|
],
|
||||||
|
"start": "soft",
|
||||||
|
"look": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "columns",
|
||||||
|
"label": "Columns",
|
||||||
|
"type": "slider",
|
||||||
|
"min": 1,
|
||||||
|
"max": 4,
|
||||||
|
"step": 1,
|
||||||
|
"start": 2,
|
||||||
|
"look": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dividers",
|
||||||
|
"label": "Row dividers",
|
||||||
|
"type": "toggle",
|
||||||
|
"start": true,
|
||||||
|
"look": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": [
|
||||||
|
"colors",
|
||||||
|
"fonts",
|
||||||
|
"spacing"
|
||||||
|
],
|
||||||
|
"freed": [
|
||||||
|
"components"
|
||||||
|
],
|
||||||
|
"notFound": [
|
||||||
|
"layout"
|
||||||
|
],
|
||||||
|
"variants": [
|
||||||
|
{
|
||||||
|
"letter": "A",
|
||||||
|
"name": "Dense table",
|
||||||
|
"file": "variant-a.html",
|
||||||
|
"what": "A table with overdue rows tinted",
|
||||||
|
"starts": {
|
||||||
|
"radius": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "B",
|
||||||
|
"name": "Split view",
|
||||||
|
"file": "variant-b.html",
|
||||||
|
"what": "A list on the left, the open invoice on the right",
|
||||||
|
"starts": {
|
||||||
|
"radius": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "C",
|
||||||
|
"name": "Cards",
|
||||||
|
"file": "variant-c.html",
|
||||||
|
"what": "One card per invoice, overdue ones first",
|
||||||
|
"starts": {
|
||||||
|
"radius": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "Comic Sans",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{
|
||||||
|
"name": "shadows",
|
||||||
|
"label": "Shadows",
|
||||||
|
"type": "pick",
|
||||||
|
"choices": [
|
||||||
|
"none",
|
||||||
|
"soft",
|
||||||
|
"strong"
|
||||||
|
],
|
||||||
|
"start": "soft",
|
||||||
|
"look": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "columns",
|
||||||
|
"label": "Columns",
|
||||||
|
"type": "slider",
|
||||||
|
"min": 1,
|
||||||
|
"max": 4,
|
||||||
|
"step": 1,
|
||||||
|
"start": 2,
|
||||||
|
"look": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dividers",
|
||||||
|
"label": "Row dividers",
|
||||||
|
"type": "toggle",
|
||||||
|
"start": true,
|
||||||
|
"look": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
<button onclick="pay()">Pay now</button>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "signup-flow",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "flow",
|
||||||
|
"request": "The three screens of signing up: account, team, done.",
|
||||||
|
"direction": "",
|
||||||
|
"carried": ["colors", "fonts", "spacing", "components", "layout"],
|
||||||
|
"freed": [],
|
||||||
|
"notFound": [],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Single column", "file": "variant-a.html", "what": "One centered form per step", "starts": {} },
|
||||||
|
{ "letter": "B", "name": "Side rail", "file": "variant-b.html", "what": "Steps listed in a rail beside each form", "starts": {} }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Phone 390",
|
||||||
|
"theme": "dark",
|
||||||
|
"accent": "#1a7f37",
|
||||||
|
"neutral": "#5b6170",
|
||||||
|
"fontSet": "Humanist",
|
||||||
|
"textSize": 15,
|
||||||
|
"space": 1.25,
|
||||||
|
"radius": 12,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.step-a { background: var(--p2c-surface); color: var(--p2c-text); font-family: var(--p2c-font); padding: var(--p2c-space-4); border-radius: var(--p2c-radius); }
|
||||||
|
.step-a button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; padding: var(--p2c-space-2); }
|
||||||
|
</style>
|
||||||
|
<section class="step-a" data-p2c-step="1. Account">
|
||||||
|
<h2 data-p2c-text="short">Join</h2>
|
||||||
|
<h2 data-p2c-text="typical">Create your account</h2>
|
||||||
|
<h2 data-p2c-text="long">Create your account to start tracking the invoices of every customer you bill</h2>
|
||||||
|
<p data-p2c-when="ready">Email and a password.</p>
|
||||||
|
<p data-p2c-when="empty">Start with your work email.</p>
|
||||||
|
<p data-p2c-when="loading">Checking...</p>
|
||||||
|
<p data-p2c-when="error">That email is already taken.</p>
|
||||||
|
<button>Continue</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-a" data-p2c-step="2. Team">
|
||||||
|
<h2>Invite your team</h2>
|
||||||
|
<button>Send invites</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-a" data-p2c-step="3. Done">
|
||||||
|
<h2>You are all set</h2>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<style>
|
||||||
|
.step-b { background: var(--p2c-surface); color: var(--p2c-text); font-family: var(--p2c-font); padding: var(--p2c-space-4); border-radius: var(--p2c-radius); }
|
||||||
|
.step-b button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; padding: var(--p2c-space-2); }
|
||||||
|
</style>
|
||||||
|
<section class="step-b" data-p2c-step="1. Account">
|
||||||
|
<h2 data-p2c-text="short">Join</h2>
|
||||||
|
<h2 data-p2c-text="typical">Create your account</h2>
|
||||||
|
<h2 data-p2c-text="long">Create your account to start tracking the invoices of every customer you bill</h2>
|
||||||
|
<p data-p2c-when="ready">Email and a password.</p>
|
||||||
|
<p data-p2c-when="empty">Start with your work email.</p>
|
||||||
|
<p data-p2c-when="loading">Checking...</p>
|
||||||
|
<p data-p2c-when="error">That email is already taken.</p>
|
||||||
|
<button>Continue</button>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
```
|
||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: invoices-screen
|
||||||
|
Round: 2
|
||||||
|
File: <FILE>
|
||||||
|
Chosen: C "Cards" (others: A "Dense table", B "Split view")
|
||||||
|
Carried over: colors, fonts, spacing
|
||||||
|
Freed up: components, layout
|
||||||
|
Screen size: Phone 390 (changed from Desktop 1280)
|
||||||
|
Theme: Light
|
||||||
|
Accent color: #d9480f (changed from #2f6fed)
|
||||||
|
Neutral color: #6b7280
|
||||||
|
Font set: System UI
|
||||||
|
Text size: 16px
|
||||||
|
Spacing: 1
|
||||||
|
Corners: 16px (changed from 8px)
|
||||||
|
State: Empty (changed from Ready)
|
||||||
|
Content length: Long (changed from Typical)
|
||||||
|
Mood: warmer, like the old app
|
||||||
|
Note: keep the overdue badge
|
||||||
|
```
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
I like the second one best, but with a darker header.
|
||||||
|
Theme: Dark
|
||||||
|
Spacing: 1.25
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: invoices-screen
|
||||||
|
File: <FILE>
|
||||||
|
Round: 2
|
||||||
|
Chosen: B "Split view" (others: A "Dense table", C "Cards")
|
||||||
|
Carried over: colors, fonts, spacing
|
||||||
|
Freed up: components, layout
|
||||||
|
Direction: calmer, more room around totals
|
||||||
|
Preset: Airy
|
||||||
|
Screen size: Desktop 1280
|
||||||
|
Theme: Dark (changed from Light)
|
||||||
|
Accent color: #2f6fed
|
||||||
|
Neutral color: #6b7280
|
||||||
|
Font set: Humanist (changed from System UI)
|
||||||
|
Text size: 16px
|
||||||
|
Spacing: 1.25 (changed from 1)
|
||||||
|
Corners: 8px
|
||||||
|
State: Ready
|
||||||
|
Content length: Typical
|
||||||
|
Extra, Shadows: Soft
|
||||||
|
Note: header from A with these cards
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: deploy-status
|
||||||
|
File: <FILE>
|
||||||
|
Round: 1
|
||||||
|
Chosen: A "Progress lines" (others: B "Table")
|
||||||
|
Carried over: none
|
||||||
|
Freed up: none
|
||||||
|
Window size: 80x24 (changed from 120x30)
|
||||||
|
Theme: Dark
|
||||||
|
Palette: Ocean (changed from Graphite)
|
||||||
|
Density: 1.5 (changed from 1.4)
|
||||||
|
State: Ready
|
||||||
|
Content length: Typical
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "team-members",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing the people on a team, with a way to invite someone.",
|
||||||
|
"direction": "",
|
||||||
|
"carried": ["colors", "fonts", "spacing", "components"],
|
||||||
|
"freed": ["layout"],
|
||||||
|
"notFound": [],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Plain list", "file": "variant-a.html", "what": "One row per person, role on the right", "starts": {} },
|
||||||
|
{ "letter": "B", "name": "Card grid", "file": "variant-b.html", "what": "One card per person, invite as the last card", "starts": {} }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#0f766e",
|
||||||
|
"neutral": "#64748b",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<style>
|
||||||
|
.team { padding: var(--p2c-space-5); font-family: var(--p2c-font); font-size: var(--p2c-text-size); color: var(--p2c-text); background: var(--p2c-bg); }
|
||||||
|
.team h1 { font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); text-wrap: balance; }
|
||||||
|
.team ul { list-style: none; margin: 0; padding: 0; background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); }
|
||||||
|
.team li { display: flex; justify-content: space-between; gap: var(--p2c-space-3); padding: var(--p2c-space-3) var(--p2c-space-4); border-top: 1px solid var(--p2c-border); }
|
||||||
|
.team li:first-child { border-top: 0; }
|
||||||
|
.team .role { color: var(--p2c-muted); }
|
||||||
|
.team .bar { height: calc(var(--p2c-text-size) * 1.2); margin: var(--p2c-space-3) var(--p2c-space-4); border-radius: var(--p2c-radius); background: color-mix(in oklab, var(--p2c-neutral) 18%, var(--p2c-surface)); }
|
||||||
|
.team button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); font: inherit; }
|
||||||
|
.team button:focus-visible { outline: 2px solid var(--p2c-accent); outline-offset: 2px; }
|
||||||
|
</style>
|
||||||
|
<section class="team">
|
||||||
|
<h1>Team members</h1>
|
||||||
|
<ul data-p2c-when="ready">
|
||||||
|
<li>
|
||||||
|
<span data-p2c-text="short">Ana Ruiz</span>
|
||||||
|
<span data-p2c-text="typical">Ana Ruiz-Okafor</span>
|
||||||
|
<span data-p2c-text="long">Anastasia Ruiz-Okafor, Regional Accounts Lead, Northern Office</span>
|
||||||
|
<span class="role">Admin</span>
|
||||||
|
</li>
|
||||||
|
<li><span>Tomas Berg</span><span class="role">Editor</span></li>
|
||||||
|
</ul>
|
||||||
|
<div data-p2c-when="loading" aria-label="Loading team members"><div class="bar"></div><div class="bar"></div></div>
|
||||||
|
<p data-p2c-when="empty">No one else is on this team yet. Invite a teammate to share the work.</p>
|
||||||
|
<p data-p2c-when="error">The team list did not load. Check your connection, then reload this page.</p>
|
||||||
|
<button data-p2c-when="ready empty">Invite a teammate</button>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--p2c-space-4); padding: var(--p2c-space-5); font-family: var(--p2c-font); font-size: var(--p2c-text-size); color: var(--p2c-text); }
|
||||||
|
.cards article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
.cards .role { color: var(--p2c-muted); }
|
||||||
|
.cards .add { border-style: dashed; color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<article data-p2c-when="ready">
|
||||||
|
<strong data-p2c-text="short">Ana Ruiz</strong>
|
||||||
|
<strong data-p2c-text="typical">Ana Ruiz-Okafor</strong>
|
||||||
|
<strong data-p2c-text="long">Anastasia Ruiz-Okafor, Regional Accounts Lead, Northern Office</strong>
|
||||||
|
<p class="role">Admin since March 2024</p>
|
||||||
|
</article>
|
||||||
|
<article data-p2c-when="ready"><strong>Tomas Berg</strong><p class="role">Editor since June 2025</p></article>
|
||||||
|
<article data-p2c-when="loading"><p class="role">Loading team members…</p></article>
|
||||||
|
<article data-p2c-when="empty"><p>Just you so far. Invite a teammate to share the work.</p></article>
|
||||||
|
<article data-p2c-when="error"><p>The team did not load. Check your connection, then reload.</p></article>
|
||||||
|
<article class="add" data-p2c-when="ready empty">Invite a teammate</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: signup-flow
|
||||||
|
File: <FILE>
|
||||||
|
Round: 1
|
||||||
|
Chosen: A "Single column" (others: B "Side rail")
|
||||||
|
Carried over: colors, fonts, spacing, components, layout
|
||||||
|
Freed up: none
|
||||||
|
Preset: Compact
|
||||||
|
Screen size: Tablet 820 (changed from Phone 390)
|
||||||
|
Theme: Dark
|
||||||
|
Accent color: #1a7f37
|
||||||
|
Neutral color: #5b6170
|
||||||
|
Font set: Humanist
|
||||||
|
Text size: 14px (changed from 15px)
|
||||||
|
Spacing: 0.75 (changed from 1.25)
|
||||||
|
Corners: 4px (changed from 12px)
|
||||||
|
State: Empty (changed from Ready)
|
||||||
|
Content length: Typical
|
||||||
|
Extra, Progress bar: Off (changed from On)
|
||||||
|
Note: keep the rail
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "signup-flow",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "flow",
|
||||||
|
"request": "The three screens of signing up: account, team, done.",
|
||||||
|
"direction": "",
|
||||||
|
"carried": ["colors", "fonts", "spacing", "components", "layout"],
|
||||||
|
"freed": [],
|
||||||
|
"notFound": [],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Single column", "file": "variant-a.html", "what": "One centered form per step", "starts": {} },
|
||||||
|
{ "letter": "B", "name": "Side rail", "file": "variant-b.html", "what": "Steps listed in a rail beside each form", "starts": {} }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Phone 390",
|
||||||
|
"theme": "dark",
|
||||||
|
"accent": "#1a7f37",
|
||||||
|
"neutral": "#5b6170",
|
||||||
|
"fontSet": "Humanist",
|
||||||
|
"textSize": 15,
|
||||||
|
"space": 1.25,
|
||||||
|
"radius": 12,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.step-a { background: var(--p2c-surface); color: var(--p2c-text); font-family: var(--p2c-font); padding: var(--p2c-space-4); border-radius: var(--p2c-radius); }
|
||||||
|
.step-a button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; padding: var(--p2c-space-2); }
|
||||||
|
</style>
|
||||||
|
<section class="step-a" data-p2c-step="1. Account">
|
||||||
|
<h2 data-p2c-text="short">Join</h2>
|
||||||
|
<h2 data-p2c-text="typical">Create your account</h2>
|
||||||
|
<h2 data-p2c-text="long">Create your account to start tracking the invoices of every customer you bill</h2>
|
||||||
|
<p data-p2c-when="ready">Email and a password.</p>
|
||||||
|
<p data-p2c-when="empty">Start with your work email.</p>
|
||||||
|
<p data-p2c-when="loading">Checking...</p>
|
||||||
|
<p data-p2c-when="error">That email is already taken.</p>
|
||||||
|
<button>Continue</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-a" data-p2c-step="2. Team">
|
||||||
|
<h2>Invite your team</h2>
|
||||||
|
<button>Send invites</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-a" data-p2c-step="3. Done">
|
||||||
|
<h2>You are all set</h2>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.step-b { background: var(--p2c-surface); color: var(--p2c-text); font-family: var(--p2c-font); padding: var(--p2c-space-4); border-radius: var(--p2c-radius); }
|
||||||
|
.step-b button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; padding: var(--p2c-space-2); }
|
||||||
|
</style>
|
||||||
|
<section class="step-b" data-p2c-step="1. Account">
|
||||||
|
<h2 data-p2c-text="short">Join</h2>
|
||||||
|
<h2 data-p2c-text="typical">Create your account</h2>
|
||||||
|
<h2 data-p2c-text="long">Create your account to start tracking the invoices of every customer you bill</h2>
|
||||||
|
<p data-p2c-when="ready">Email and a password.</p>
|
||||||
|
<p data-p2c-when="empty">Start with your work email.</p>
|
||||||
|
<p data-p2c-when="loading">Checking...</p>
|
||||||
|
<p data-p2c-when="error">That email is already taken.</p>
|
||||||
|
<button>Continue</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-b" data-p2c-step="2. Team">
|
||||||
|
<h2>Invite your team</h2>
|
||||||
|
<button>Send invites</button>
|
||||||
|
</section>
|
||||||
|
<section class="step-b" data-p2c-step="3. Done">
|
||||||
|
<h2>You are all set</h2>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: invoices-screen
|
||||||
|
File: <FILE>
|
||||||
|
Round: 1
|
||||||
|
Chosen: B "Split view" (others: A "Dense table", C "Cards")
|
||||||
|
Carried over: colors, fonts, spacing
|
||||||
|
Freed up: components
|
||||||
|
Direction: calm, plenty of room around totals
|
||||||
|
Preset: Airy
|
||||||
|
Screen size: Desktop 1280
|
||||||
|
Theme: Dark (changed from Light)
|
||||||
|
Accent color: #d9480f (changed from #2f6fed)
|
||||||
|
Neutral color: #6b7280
|
||||||
|
Font set: System UI
|
||||||
|
Text size: 17px (changed from 16px)
|
||||||
|
Spacing: 1.5 (changed from 1)
|
||||||
|
Corners: 12px (changed from 10px)
|
||||||
|
State: Ready
|
||||||
|
Content length: Typical
|
||||||
|
Extra, Shadows: strong (changed from soft)
|
||||||
|
Extra, Columns: 2
|
||||||
|
Extra, Row dividers: On
|
||||||
|
Note: header from A with these cards
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
@media (max-width: 500px) { .split { grid-template-columns: 1fr; } }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Plan2Code UI prototype choice
|
||||||
|
Prototype: deploy-status
|
||||||
|
File: <FILE>
|
||||||
|
Round: 2
|
||||||
|
Chosen: A "Progress lines" (others: B "Table")
|
||||||
|
Carried over: none
|
||||||
|
Freed up: none
|
||||||
|
Direction: quiet unless something fails
|
||||||
|
Preset: Bold
|
||||||
|
Window size: 80x24 (changed from 120x30)
|
||||||
|
Theme: Dark
|
||||||
|
Palette: Ocean (changed from Graphite)
|
||||||
|
Density: 1.5 (changed from 1.4)
|
||||||
|
State: Ready
|
||||||
|
Content length: Typical
|
||||||
|
Extra, Spinner: line (changed from dots)
|
||||||
|
Note: fewer lines while it runs
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "deploy-status",
|
||||||
|
"round": 2,
|
||||||
|
"kind": "terminal",
|
||||||
|
"request": "What the deploy command prints while it runs.",
|
||||||
|
"direction": "quiet unless something fails",
|
||||||
|
"carried": [],
|
||||||
|
"freed": [],
|
||||||
|
"notFound": ["colors", "fonts", "spacing", "components", "layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Progress lines", "file": "variant-a.html", "what": "One line per step with a check mark", "starts": {} },
|
||||||
|
{ "letter": "B", "name": "Table", "file": "variant-b.html", "what": "A live table of services and their state", "starts": { "palette": "Amber" } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"window": "120x30",
|
||||||
|
"theme": "dark",
|
||||||
|
"palette": "Graphite",
|
||||||
|
"density": 1.4,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<style>
|
||||||
|
.t-a { color: var(--p2c-term-fg); line-height: var(--p2c-density); }
|
||||||
|
.t-a .ok { color: var(--p2c-term-accent); }
|
||||||
|
</style>
|
||||||
|
<pre class="t-a"><span class="ok">deploy</span> <span data-p2c-text="short">api</span><span data-p2c-text="typical">api-gateway</span><span data-p2c-text="long">api-gateway-northern-region-billing-service-primary-cluster</span>
|
||||||
|
<span data-p2c-when="ready"><span class="ok">ok</span> build 12s
|
||||||
|
<span class="ok">ok</span> upload 4s</span><span data-p2c-when="empty">nothing to deploy</span><span data-p2c-when="loading">waiting for the build...</span><span data-p2c-when="error">failed: upload timed out (try again with --retry)</span></pre>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<style>
|
||||||
|
.t-b { color: var(--p2c-term-fg); line-height: var(--p2c-density); }
|
||||||
|
.t-b .ok { color: var(--p2c-term-accent); }
|
||||||
|
</style>
|
||||||
|
<pre class="t-b"><span class="ok">deploy</span> <span data-p2c-text="short">api</span><span data-p2c-text="typical">api-gateway</span><span data-p2c-text="long">api-gateway-northern-region-billing-service-primary-cluster</span>
|
||||||
|
<span data-p2c-when="ready"><span class="ok">ok</span> build 12s
|
||||||
|
<span class="ok">ok</span> upload 4s</span><span data-p2c-when="empty">nothing to deploy</span><span data-p2c-when="loading">waiting for the build...</span><span data-p2c-when="error">failed: upload timed out (try again with --retry)</span></pre>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "invoices-screen",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": ["colors", "fonts", "spacing"],
|
||||||
|
"freed": ["components"],
|
||||||
|
"notFound": ["layout"],
|
||||||
|
"variants": [
|
||||||
|
{ "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } },
|
||||||
|
{ "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } },
|
||||||
|
{ "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } }
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{ "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true },
|
||||||
|
{ "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false },
|
||||||
|
{ "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true }
|
||||||
|
],
|
||||||
|
"images": [],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<style>
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<p title="Say "hi" & wave">She said "pay now" & left; 3 < 4 > 2.</p>
|
||||||
|
<p>Literal text: </script> and "></iframe> and <b> and 'single'.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
|
After Width: | Height: | Size: 34 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><circle cx="8" cy="8" r="7" fill="#2f6fed"/></svg>
|
||||||
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 70 B |
@@ -0,0 +1 @@
|
|||||||
|
This is a text file with a .png name, not a picture.
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"name": "team-page",
|
||||||
|
"round": 1,
|
||||||
|
"kind": "screen",
|
||||||
|
"request": "A screen listing a customer's invoices, with what is overdue easy to spot.",
|
||||||
|
"direction": "calm, plenty of room around totals",
|
||||||
|
"carried": [
|
||||||
|
"colors",
|
||||||
|
"fonts",
|
||||||
|
"spacing"
|
||||||
|
],
|
||||||
|
"freed": [
|
||||||
|
"components"
|
||||||
|
],
|
||||||
|
"notFound": [
|
||||||
|
"layout"
|
||||||
|
],
|
||||||
|
"variants": [
|
||||||
|
{
|
||||||
|
"letter": "A",
|
||||||
|
"name": "Dense table",
|
||||||
|
"file": "variant-a.html",
|
||||||
|
"what": "A table with overdue rows tinted",
|
||||||
|
"starts": {
|
||||||
|
"radius": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "B",
|
||||||
|
"name": "Split view",
|
||||||
|
"file": "variant-b.html",
|
||||||
|
"what": "A list on the left, the open invoice on the right",
|
||||||
|
"starts": {
|
||||||
|
"radius": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"letter": "C",
|
||||||
|
"name": "Cards",
|
||||||
|
"file": "variant-c.html",
|
||||||
|
"what": "One card per invoice, overdue ones first",
|
||||||
|
"starts": {
|
||||||
|
"radius": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"starts": {
|
||||||
|
"screen": "Desktop 1280",
|
||||||
|
"theme": "light",
|
||||||
|
"accent": "#2f6fed",
|
||||||
|
"neutral": "#6b7280",
|
||||||
|
"fontSet": "System UI",
|
||||||
|
"textSize": 16,
|
||||||
|
"space": 1,
|
||||||
|
"radius": 8,
|
||||||
|
"state": "ready",
|
||||||
|
"length": "typical"
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{
|
||||||
|
"name": "shadows",
|
||||||
|
"label": "Shadows",
|
||||||
|
"type": "pick",
|
||||||
|
"choices": [
|
||||||
|
"none",
|
||||||
|
"soft",
|
||||||
|
"strong"
|
||||||
|
],
|
||||||
|
"start": "soft",
|
||||||
|
"look": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "columns",
|
||||||
|
"label": "Columns",
|
||||||
|
"type": "slider",
|
||||||
|
"min": 1,
|
||||||
|
"max": 4,
|
||||||
|
"step": 1,
|
||||||
|
"start": 2,
|
||||||
|
"look": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dividers",
|
||||||
|
"label": "Row dividers",
|
||||||
|
"type": "toggle",
|
||||||
|
"start": true,
|
||||||
|
"look": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"name": "logo.png",
|
||||||
|
"path": "../images/logo.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hero.jpg",
|
||||||
|
"path": "../images/hero.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "avatar.webp",
|
||||||
|
"path": "../images/avatar.webp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "badge.svg",
|
||||||
|
"path": "../images/badge.svg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "photo.png",
|
||||||
|
"path": "../images/photo.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fonts": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<style>
|
||||||
|
.inv { background-image: url(badge.svg); background-repeat: no-repeat; background-position: right top; }
|
||||||
|
.inv .hero { background: url("hero.jpg") center / cover; height: calc(var(--p2c-space-6) * 3); }
|
||||||
|
.inv { padding: var(--p2c-space-5); color: var(--p2c-text); }
|
||||||
|
.inv h1 { font-family: var(--p2c-font); font-size: calc(var(--p2c-text-size) * 1.5); margin: 0 0 var(--p2c-space-4); }
|
||||||
|
.inv table { width: 100%; border-collapse: collapse; background: var(--p2c-surface); border-radius: var(--p2c-radius); }
|
||||||
|
.inv td { padding: var(--p2c-space-2) var(--p2c-space-3); border-bottom: 1px solid var(--p2c-border); }
|
||||||
|
.inv .late { color: var(--p2c-accent); }
|
||||||
|
.inv button { background: var(--p2c-accent); color: var(--p2c-on-accent); border: 0; border-radius: var(--p2c-radius); padding: var(--p2c-space-2) var(--p2c-space-4); }
|
||||||
|
</style>
|
||||||
|
<div class="inv">
|
||||||
|
<h1>
|
||||||
|
<span data-p2c-text="short">Bills</span>
|
||||||
|
<span data-p2c-text="typical">Invoices for Harbor Supply</span>
|
||||||
|
<span data-p2c-text="long">Invoices for Harbor Supply and Logistics Cooperative, Northern Region</span>
|
||||||
|
</h1>
|
||||||
|
<table data-p2c-when="ready">
|
||||||
|
<tr><td>INV-1042</td><td class="late">Overdue 12 days</td><td>$1,240.00</td></tr>
|
||||||
|
<tr><td>INV-1043</td><td>Due Dec 2</td><td>$310.50</td></tr>
|
||||||
|
</table>
|
||||||
|
<p data-p2c-when="empty">No invoices yet. The first one appears here once it is sent.</p>
|
||||||
|
<p data-p2c-when="loading">Loading invoices...</p>
|
||||||
|
<p data-p2c-when="error">The invoices could not be loaded. Try again in a minute.</p>
|
||||||
|
<button>New invoice</button>
|
||||||
|
</div>
|
||||||
|
<div class="inv-media">
|
||||||
|
<img src="logo.png" alt="Acme logo">
|
||||||
|
<img src="p2c-image:hero.jpg" alt="Office">
|
||||||
|
<img src='avatar.webp' alt="Dana Ruiz">
|
||||||
|
<img src="photo.png">
|
||||||
|
<div class="hero"></div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<style>
|
||||||
|
.split { display: grid; grid-template-columns: 1fr 2fr; gap: var(--p2c-space-4); padding: var(--p2c-space-4); }
|
||||||
|
.split nav, .split article { background: var(--p2c-surface); border: 1px solid var(--p2c-border); border-radius: var(--p2c-radius); padding: var(--p2c-space-3); }
|
||||||
|
.split h2 { font-size: var(--p2c-text-size); color: var(--p2c-muted); }
|
||||||
|
.split .total { color: var(--p2c-accent); font-weight: 700; }
|
||||||
|
@media (max-width: 500px) { .split { grid-template-columns: 1fr; } }
|
||||||
|
</style>
|
||||||
|
<div class="split">
|
||||||
|
<nav>
|
||||||
|
<h2>Invoices</h2>
|
||||||
|
<ul data-p2c-when="ready"><li>INV-1042</li><li>INV-1043</li></ul>
|
||||||
|
<p data-p2c-when="empty">Nothing to show yet.</p>
|
||||||
|
<p data-p2c-when="loading">Loading...</p>
|
||||||
|
<p data-p2c-when="error">Could not load the list.</p>
|
||||||
|
</nav>
|
||||||
|
<article data-p2c-when="ready empty loading error">
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply, net 30</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office</p>
|
||||||
|
<p class="total">$1,240.00</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<style>
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(var(--p2c-x-columns), 1fr); gap: var(--p2c-space-4); padding: var(--p2c-space-5); }
|
||||||
|
.card { background: var(--p2c-surface); border-radius: var(--p2c-radius); padding: var(--p2c-space-4); }
|
||||||
|
:root[data-p2c-x-shadows="soft"] .card { box-shadow: 0 2px 8px color-mix(in srgb, var(--p2c-text) 12%, transparent); }
|
||||||
|
.card strong { font-size: calc(var(--p2c-text-size) * 1.25); }
|
||||||
|
.card .due { color: var(--p2c-accent); }
|
||||||
|
</style>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="card" data-p2c-when="ready">
|
||||||
|
<strong>$1,240.00</strong>
|
||||||
|
<p class="due">Overdue 12 days</p>
|
||||||
|
<p data-p2c-text="short">Harbor</p>
|
||||||
|
<p data-p2c-text="typical">Harbor Supply</p>
|
||||||
|
<p data-p2c-text="long">Harbor Supply and Logistics Cooperative, Northern Region office</p>
|
||||||
|
</div>
|
||||||
|
<div class="card" data-p2c-when="empty">No invoices yet.</div>
|
||||||
|
<div class="card" data-p2c-when="loading">Loading invoices...</div>
|
||||||
|
<div class="card" data-p2c-when="error">Something went wrong loading invoices.</div>
|
||||||
|
</div>
|
||||||
@@ -58,7 +58,7 @@ test("a wrong workflow name or a missing notes file is reported", () => {
|
|||||||
test("a skill that loses its opening is caught by the count", () => {
|
test("a skill that loses its opening is caught by the count", () => {
|
||||||
const dir = copySrc();
|
const dir = copySrc();
|
||||||
fs.rmSync(path.join(dir, "plan2code-pr-prep.md"));
|
fs.rmSync(path.join(dir, "plan2code-pr-prep.md"));
|
||||||
assert.match(check(dir).join("\n"), /expected 19 skills with a console opening, found 18/);
|
assert.match(check(dir).join("\n"), /expected 20 skills with a console opening, found 19/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("helpers", () => {
|
test("helpers", () => {
|
||||||
@@ -67,6 +67,7 @@ test("helpers", () => {
|
|||||||
assert.equal(workflowOf("plan2code-3-implement-review"), "implement-review");
|
assert.equal(workflowOf("plan2code-3-implement-review"), "implement-review");
|
||||||
assert.equal(workflowOf("plan2code-pr-prep"), "pr-prep");
|
assert.equal(workflowOf("plan2code-pr-prep"), "pr-prep");
|
||||||
assert.equal(workflowOf("plan2code-dead-code"), "dead-code");
|
assert.equal(workflowOf("plan2code-dead-code"), "dead-code");
|
||||||
|
assert.equal(workflowOf("plan2code-ui-prototype"), "ui-prototype");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the CLI exits 1 on drift", () => {
|
test("the CLI exits 1 on drift", () => {
|
||||||
|
|||||||
@@ -38,13 +38,14 @@ export const BUDGETS = {
|
|||||||
"implement.md": 5700,
|
"implement.md": 5700,
|
||||||
"init.md": 300,
|
"init.md": 300,
|
||||||
"loop.md": 11600,
|
"loop.md": 11600,
|
||||||
"pathfinder.md": 2400,
|
"pathfinder.md": 2622, // raised by the UI prototype line's bytes only
|
||||||
"plan.md": 800,
|
"plan.md": 1023, // raised by the UI prototype line's bytes only
|
||||||
"pr-prep.md": 4500,
|
"pr-prep.md": 4500,
|
||||||
"quick-task.md": 4100,
|
"quick-task.md": 4589, // raised by the UI prototype line's and the prototype recap line's bytes only
|
||||||
"review.md": 1000,
|
"review.md": 1000,
|
||||||
"revise-plan.md": 1200,
|
"revise-plan.md": 1422, // raised by the UI prototype line's bytes only
|
||||||
"test.md": 5400,
|
"test.md": 5400,
|
||||||
|
"ui-prototype.md": 4000,
|
||||||
"xray.md": 2500,
|
"xray.md": 2500,
|
||||||
},
|
},
|
||||||
// One printed line each, for a session with one choice card.
|
// One printed line each, for a session with one choice card.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"test-script-test-commands.mjs",
|
"test-script-test-commands.mjs",
|
||||||
"test-script-test-map.mjs",
|
"test-script-test-map.mjs",
|
||||||
"test-script-test-match.mjs",
|
"test-script-test-match.mjs",
|
||||||
|
"test-script-ui-prototype.mjs",
|
||||||
"test-script-xray.mjs",
|
"test-script-xray.mjs",
|
||||||
"test-set-version.mjs",
|
"test-set-version.mjs",
|
||||||
"test-skill-scripts.mjs",
|
"test-skill-scripts.mjs",
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
"test-fast.mjs",
|
"test-fast.mjs",
|
||||||
"test-launcher.mjs",
|
"test-launcher.mjs",
|
||||||
"test-standalone-check.mjs",
|
"test-standalone-check.mjs",
|
||||||
|
"test-ui-prototype-page.mjs",
|
||||||
"test-web-console-activities-bounce-cars.mjs",
|
"test-web-console-activities-bounce-cars.mjs",
|
||||||
"test-web-console-activities-bounce-game.mjs",
|
"test-web-console-activities-bounce-game.mjs",
|
||||||
"test-web-console-activities-bounce.mjs",
|
"test-web-console-activities-bounce.mjs",
|
||||||
|
|||||||
@@ -0,0 +1,910 @@
|
|||||||
|
// Page tests for the UI prototype shell: an assembled fixture page opened from
|
||||||
|
// file:// in a real Chrome or Edge, through scripts/browser.mjs. One browser
|
||||||
|
// for the file, a fresh context per test. Run with:
|
||||||
|
// node scripts/node-test.mjs scripts/test-ui-prototype-page.mjs
|
||||||
|
//
|
||||||
|
// The page is built by the built skill's assemble (skill-script-helpers.mjs
|
||||||
|
// rebuilds skills/ first), so these cover the three shell files as shipped.
|
||||||
|
// Nothing else parses shell.js: the "no console error" test is its parse check.
|
||||||
|
|
||||||
|
import { test, after } from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import fs from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
import { pathToFileURL } from "node:url";
|
||||||
|
import { ROOT, runScript, tmp } from "./skill-script-helpers.mjs";
|
||||||
|
import { launchBrowser } from "./browser.mjs";
|
||||||
|
|
||||||
|
const FIXTURES = path.join(ROOT, "scripts", "fixtures", "ui-prototype");
|
||||||
|
const POLICY = "default-src 'none'; img-src data:; font-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'";
|
||||||
|
|
||||||
|
const madeDirs = [];
|
||||||
|
let browser = null;
|
||||||
|
after(async () => {
|
||||||
|
if (browser) await browser.close();
|
||||||
|
for (const dir of madeDirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
const roundJson = (name) => JSON.parse(fs.readFileSync(path.join(FIXTURES, name, "round.json"), "utf8"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assemble a fixture round into a temp folder and open the page from file://.
|
||||||
|
* Waits for window.p2c and for every frame's own document to be complete with
|
||||||
|
* the dials written on its root. Returns { page, url, requests, errors }.
|
||||||
|
*/
|
||||||
|
async function openFixture(t, name, { width = 1400, height = 900, edit, permissions } = {}) {
|
||||||
|
const dir = tmp(`ui-page-${name}`);
|
||||||
|
madeDirs.push(dir);
|
||||||
|
const round = path.join(dir, "round-1");
|
||||||
|
fs.cpSync(path.join(FIXTURES, name), round, { recursive: true });
|
||||||
|
if (edit) edit(round);
|
||||||
|
const r = runScript("plan2code-ui-prototype", "ui-prototype.mjs", ["assemble", "--round", round]);
|
||||||
|
assert.equal(r.code, 0, `assemble ${name}: ${r.stdout} ${r.stderr}`);
|
||||||
|
|
||||||
|
browser ||= await launchBrowser();
|
||||||
|
const context = await browser.newContext({ viewport: { width, height }, ...(permissions ? { permissions } : {}) });
|
||||||
|
t.after(() => context.close());
|
||||||
|
const page = await context.newPage();
|
||||||
|
const requests = [];
|
||||||
|
const errors = [];
|
||||||
|
page.on("request", (q) => requests.push(q.url()));
|
||||||
|
page.on("console", (m) => {
|
||||||
|
if (m.type() === "error") errors.push(m.text());
|
||||||
|
});
|
||||||
|
page.on("pageerror", (e) => errors.push(String(e)));
|
||||||
|
const url = pathToFileURL(r.json.file).href;
|
||||||
|
await page.goto(url);
|
||||||
|
await page.waitForFunction(() => {
|
||||||
|
if (!window.p2c) return false;
|
||||||
|
return [...document.querySelectorAll("iframe.p2c-frame")].every((f) => {
|
||||||
|
const d = f.contentDocument;
|
||||||
|
if (!d || d.readyState !== "complete" || !d.body || !d.body.children.length) return false;
|
||||||
|
const root = d.documentElement;
|
||||||
|
if (!root.hasAttribute("data-p2c-kind")) return false;
|
||||||
|
return root.getAttribute("data-p2c-kind") === "terminal" || root.style.getPropertyValue("--p2c-screen-width") !== "";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return { page, url, requests, errors, file: r.json.file };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Run fn(doc, letter) inside every frame's document; returns { <letter>: result }. */
|
||||||
|
function inFrames(page, fn, arg) {
|
||||||
|
return page.evaluate(
|
||||||
|
([source, a]) => {
|
||||||
|
const run = new Function("doc", "letter", "arg", `return (${source})(doc, letter, arg);`);
|
||||||
|
const out = {};
|
||||||
|
for (const f of document.querySelectorAll("iframe.p2c-frame")) out[f.dataset.variant] = run(f.contentDocument, f.dataset.variant, a);
|
||||||
|
return out;
|
||||||
|
},
|
||||||
|
[fn.toString(), arg]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A computed style value on every frame's root (custom properties trimmed). */
|
||||||
|
const rootValue = (page, prop) => inFrames(page, (doc, _l, p) => getComputedStyle(doc.documentElement).getPropertyValue(p).trim(), prop);
|
||||||
|
const rootAttr = (page, attr) => inFrames(page, (doc, _l, a) => doc.documentElement.getAttribute(a), attr);
|
||||||
|
|
||||||
|
/** Which frames are on show: { <letter>: true|false }. */
|
||||||
|
const shown = (page) =>
|
||||||
|
page.evaluate(() => {
|
||||||
|
const out = {};
|
||||||
|
for (const f of document.querySelectorAll("iframe.p2c-frame")) out[f.dataset.variant] = getComputedStyle(f).visibility === "visible";
|
||||||
|
return out;
|
||||||
|
});
|
||||||
|
|
||||||
|
const every = (map, value) => Object.values(map).every((v) => v === value);
|
||||||
|
const pressed = (page, dial) => page.locator(`[data-dial="${dial}"] button[aria-pressed="true"]`).textContent();
|
||||||
|
const pickChoice = (page, dial, label) => page.locator(`[data-dial="${dial}"] button`, { hasText: label }).click();
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- (a) policy and reach */
|
||||||
|
|
||||||
|
test("the frames render under the policy line, and the page's script reaches each frame's root", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
assert.equal(await page.locator('meta[http-equiv="Content-Security-Policy"]').getAttribute("content"), POLICY);
|
||||||
|
const facts = roundJson("good-screen");
|
||||||
|
assert.equal(await page.locator("iframe.p2c-frame").count(), facts.variants.length);
|
||||||
|
for (const sandbox of await page.locator("iframe.p2c-frame").evaluateAll((els) => els.map((e) => e.getAttribute("sandbox")))) {
|
||||||
|
assert.equal(sandbox, "allow-same-origin");
|
||||||
|
}
|
||||||
|
// The variant's own rules render: the frame's body takes base.css and the dial values.
|
||||||
|
const accents = await rootValue(page, "--p2c-accent");
|
||||||
|
assert.ok(every(accents, facts.starts.accent), JSON.stringify(accents));
|
||||||
|
const fonts = await inFrames(page, (doc) => getComputedStyle(doc.body).fontSize);
|
||||||
|
assert.ok(every(fonts, `${facts.starts.textSize}px`), JSON.stringify(fonts));
|
||||||
|
// window.p2c is the page's one handle: state and apply().
|
||||||
|
const handle = await page.evaluate(() => ({ keys: Object.keys(window.p2c).sort(), variant: window.p2c.state.variant, apply: typeof window.p2c.apply }));
|
||||||
|
assert.deepEqual(handle, { keys: ["apply", "state"], variant: "A", apply: "function" });
|
||||||
|
assert.equal(await page.title(), facts.name);
|
||||||
|
assert.equal(await page.locator("#p2c-name").textContent(), facts.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* --------------------------------------------- (b) no network, no console error */
|
||||||
|
|
||||||
|
for (const name of ["good-screen", "good-flow", "good-terminal", "hostile-text"]) {
|
||||||
|
test(`${name}: no request but the page itself, and no console error`, async (t) => {
|
||||||
|
const { page, url, requests, errors } = await openFixture(t, name);
|
||||||
|
// Move through the page a little so the handlers run too.
|
||||||
|
await page.click("#p2c-compare");
|
||||||
|
await page.click("#p2c-compare");
|
||||||
|
await page.locator('[role="tab"]').last().click();
|
||||||
|
assert.deepEqual(errors, []);
|
||||||
|
assert.deepEqual(
|
||||||
|
requests.filter((u) => u !== url),
|
||||||
|
[],
|
||||||
|
"the page loaded nothing else"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- (c) tabs */
|
||||||
|
|
||||||
|
test("one tab per variant; a click or an arrow key shows only that frame, kept in step with the panel's pick", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const facts = roundJson("good-screen");
|
||||||
|
const tabs = page.locator('#p2c-tabs [role="tab"]');
|
||||||
|
assert.equal(await tabs.count(), facts.variants.length);
|
||||||
|
for (const [i, v] of facts.variants.entries()) assert.equal((await tabs.nth(i).textContent()).replace(/\s+/g, " ").trim(), `${v.letter}${v.name}`);
|
||||||
|
assert.deepEqual(await shown(page), { A: true, B: false, C: false });
|
||||||
|
|
||||||
|
await tabs.nth(1).click();
|
||||||
|
assert.deepEqual(await shown(page), { A: false, B: true, C: false });
|
||||||
|
assert.equal(await tabs.nth(1).getAttribute("aria-selected"), "true");
|
||||||
|
assert.equal(await tabs.nth(0).getAttribute("aria-selected"), "false");
|
||||||
|
assert.equal(await pressed(page, "variant"), "B");
|
||||||
|
assert.equal(await page.evaluate(() => window.p2c.state.variant), "B");
|
||||||
|
|
||||||
|
await page.keyboard.press("ArrowRight");
|
||||||
|
assert.deepEqual(await shown(page), { A: false, B: false, C: true });
|
||||||
|
assert.equal(await page.evaluate(() => document.activeElement.id), "p2c-tab-C");
|
||||||
|
await page.keyboard.press("ArrowRight");
|
||||||
|
assert.deepEqual(await shown(page), { A: true, B: false, C: false }, "the arrow wraps around");
|
||||||
|
await page.keyboard.press("ArrowLeft");
|
||||||
|
assert.deepEqual(await shown(page), { A: false, B: false, C: true });
|
||||||
|
|
||||||
|
// The panel's pick moves the tabs too.
|
||||||
|
await pickChoice(page, "variant", "B");
|
||||||
|
assert.equal(await tabs.nth(1).getAttribute("aria-selected"), "true");
|
||||||
|
assert.deepEqual(await shown(page), { A: false, B: true, C: false });
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ (d) every dial */
|
||||||
|
|
||||||
|
test("each core dial writes its value on every frame's root, and the tool's own look stays put", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const toolLook = () => page.evaluate(() => [document.body, document.getElementById("p2c-bar"), document.getElementById("p2c-panel")].map((e) => `${getComputedStyle(e).backgroundColor} ${getComputedStyle(e).fontFamily} ${getComputedStyle(e).fontSize}`));
|
||||||
|
const before = await toolLook();
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-theme").check();
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-theme"), "dark"));
|
||||||
|
assert.ok(every(await inFrames(page, (doc) => getComputedStyle(doc.documentElement).colorScheme), "dark"));
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-accent").fill("#ff0000");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-accent"), "#ff0000"));
|
||||||
|
const button = await inFrames(page, (doc) => (doc.querySelector(".inv button") ? getComputedStyle(doc.querySelector(".inv button")).backgroundColor : null));
|
||||||
|
assert.equal(button.A, "rgb(255, 0, 0)", "a variant's own rule follows the accent");
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-neutral").fill("#00aa00");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-neutral"), "#00aa00"));
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-fontSet").selectOption("Slab Serif");
|
||||||
|
const families = await inFrames(page, (doc) => getComputedStyle(doc.body).fontFamily);
|
||||||
|
assert.ok(Object.values(families).every((f) => f.startsWith("Rockwell")), JSON.stringify(families));
|
||||||
|
assert.equal(await page.locator('#p2c-dial-fontSet option[value="App font"]').count(), 0, "no App font without appFont in the round facts");
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-textSize").fill("20");
|
||||||
|
assert.ok(every(await inFrames(page, (doc) => getComputedStyle(doc.body).fontSize), "20px"));
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-space").fill("1.5");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-space"), "1.5"));
|
||||||
|
const pad = await inFrames(page, (doc) => (doc.querySelector(".inv") ? getComputedStyle(doc.querySelector(".inv")).paddingTop : null));
|
||||||
|
assert.equal(pad.A, "36px", "--p2c-space-5 follows the spacing dial");
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-radius").fill("20");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), "20px"));
|
||||||
|
|
||||||
|
await pickChoice(page, "state", "Loading");
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-state"), "loading"));
|
||||||
|
await pickChoice(page, "length", "Very long");
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-length"), "long"));
|
||||||
|
|
||||||
|
await pickChoice(page, "screen", "Tablet 820");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-screen-width"), "820px"));
|
||||||
|
|
||||||
|
const dials = await page.evaluate(() => Object.fromEntries(Object.entries(window.p2c.state.dials).map(([k, d]) => [k, [d.value, d.moved]])));
|
||||||
|
assert.deepEqual(dials, {
|
||||||
|
variant: ["A", false],
|
||||||
|
screen: ["Tablet 820", true],
|
||||||
|
theme: ["dark", true],
|
||||||
|
accent: ["#ff0000", true],
|
||||||
|
neutral: ["#00aa00", true],
|
||||||
|
fontSet: ["Slab Serif", true],
|
||||||
|
textSize: [20, true],
|
||||||
|
space: [1.5, true],
|
||||||
|
radius: [20, true],
|
||||||
|
state: ["loading", true],
|
||||||
|
length: ["long", true],
|
||||||
|
"x-shadows": ["soft", false],
|
||||||
|
"x-columns": [2, false],
|
||||||
|
"x-dividers": [true, false],
|
||||||
|
});
|
||||||
|
assert.deepEqual(await toolLook(), before, "no dial touches the tool's own look");
|
||||||
|
|
||||||
|
// The panel holds the dials in the planned order, the extras after them.
|
||||||
|
const order = await page.locator("#p2c-panel-body [data-dial]").evaluateAll((rows) => rows.map((r) => r.dataset.dial));
|
||||||
|
assert.deepEqual(order, ["variant", "screen", "theme", "accent", "neutral", "fontSet", "textSize", "space", "radius", "state", "length", "x-shadows", "x-columns", "x-dividers"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("App font is offered only when the round facts say appFont, and writes the app font value", async (t) => {
|
||||||
|
const dir = tmp("ui-page-appfont");
|
||||||
|
madeDirs.push(dir);
|
||||||
|
const src = path.join(dir, "good-app");
|
||||||
|
fs.cpSync(path.join(FIXTURES, "good-screen"), src, { recursive: true });
|
||||||
|
// The round facts are the page's own JSON: set appFont there after assembling.
|
||||||
|
const round = path.join(dir, "round-1");
|
||||||
|
fs.cpSync(src, round, { recursive: true });
|
||||||
|
const r = runScript("plan2code-ui-prototype", "ui-prototype.mjs", ["assemble", "--round", round]);
|
||||||
|
assert.equal(r.code, 0, r.stdout + r.stderr);
|
||||||
|
// assemble writes "appFont":false itself when no font file was embedded, so
|
||||||
|
// flip that key rather than adding a second one (the later key would win).
|
||||||
|
const before = fs.readFileSync(r.json.file, "utf8");
|
||||||
|
assert.match(before, /"appFont":false/, "the round facts carry appFont");
|
||||||
|
const html = before.replace('"appFont":false', '"appFont":true');
|
||||||
|
fs.writeFileSync(r.json.file, html);
|
||||||
|
|
||||||
|
browser ||= await launchBrowser();
|
||||||
|
const context = await browser.newContext({ viewport: { width: 1400, height: 900 } });
|
||||||
|
t.after(() => context.close());
|
||||||
|
const page = await context.newPage();
|
||||||
|
await page.goto(pathToFileURL(r.json.file).href);
|
||||||
|
await page.waitForFunction(() => window.p2c);
|
||||||
|
await page.locator("#p2c-dial-fontSet").selectOption("App font");
|
||||||
|
const value = await page.evaluate(() => document.getElementById("p2c-frame-A").contentDocument.documentElement.style.getPropertyValue("--p2c-font"));
|
||||||
|
assert.equal(value, "var(--p2c-font-set-app)");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ (e) screen size */
|
||||||
|
|
||||||
|
test("Screen size: a variant's @media rule sees the chosen width, not the window's", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
await page.locator('#p2c-tabs [role="tab"]').nth(1).click();
|
||||||
|
const tracks = async () => (await inFrames(page, (doc) => getComputedStyle(doc.querySelector(".split") || doc.body).gridTemplateColumns.split(" ").length)).B;
|
||||||
|
const innerWidth = async () => page.evaluate(() => document.getElementById("p2c-frame-B").contentWindow.innerWidth);
|
||||||
|
|
||||||
|
assert.equal(await innerWidth(), 1280);
|
||||||
|
assert.equal(await tracks(), 2, "Desktop: the two-column rule");
|
||||||
|
await pickChoice(page, "screen", "Phone 390");
|
||||||
|
assert.equal(await innerWidth(), 390);
|
||||||
|
assert.equal(await tracks(), 1, "Phone: the @media (max-width: 500px) rule matches");
|
||||||
|
await pickChoice(page, "screen", "Tablet 820");
|
||||||
|
assert.equal(await innerWidth(), 820);
|
||||||
|
assert.equal(await tracks(), 2);
|
||||||
|
assert.equal(await page.locator('[data-dial="screen"] .tool-scale').textContent(), "", "no scale shown while the frame fits");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Screen size: a frame wider than the stage is scaled down to fit, and the scale is shown", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen", { width: 1000, height: 800 });
|
||||||
|
const fit = () =>
|
||||||
|
page.evaluate(() => {
|
||||||
|
const stage = document.getElementById("p2c-stage").getBoundingClientRect();
|
||||||
|
const f = document.getElementById("p2c-frame-A").getBoundingClientRect();
|
||||||
|
return { inside: f.left >= stage.left && f.right <= stage.right, inner: document.getElementById("p2c-frame-A").contentWindow.innerWidth };
|
||||||
|
});
|
||||||
|
assert.deepEqual(await fit(), { inside: true, inner: 1280 });
|
||||||
|
assert.match(await page.locator('[data-dial="screen"] .tool-scale').textContent(), /^\d+%$/);
|
||||||
|
await pickChoice(page, "screen", "Phone 390");
|
||||||
|
assert.deepEqual(await fit(), { inside: true, inner: 390 });
|
||||||
|
assert.equal(await page.locator('[data-dial="screen"] .tool-scale').textContent(), "");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------- (f) states and length */
|
||||||
|
|
||||||
|
test("the States and Content length dials show exactly one state's parts and one length's text", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const visibleMarks = (attr) =>
|
||||||
|
inFrames(
|
||||||
|
page,
|
||||||
|
(doc, _l, a) => {
|
||||||
|
const seen = [];
|
||||||
|
for (const el of doc.querySelectorAll(`[${a}]`)) if (getComputedStyle(el).display !== "none") seen.push(el.getAttribute(a));
|
||||||
|
return seen;
|
||||||
|
},
|
||||||
|
attr
|
||||||
|
);
|
||||||
|
for (const [label, value] of [["Ready", "ready"], ["Empty", "empty"], ["Loading", "loading"], ["Error", "error"]]) {
|
||||||
|
await pickChoice(page, "state", label);
|
||||||
|
for (const [letter, marks] of Object.entries(await visibleMarks("data-p2c-when"))) {
|
||||||
|
assert.ok(marks.length > 0, `${letter} shows a ${value} part`);
|
||||||
|
assert.ok(marks.every((m) => m.split(" ").includes(value)), `${letter} at ${value}: ${marks.join(" | ")}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [label, value] of [["Short", "short"], ["Typical", "typical"], ["Very long", "long"]]) {
|
||||||
|
await pickChoice(page, "length", label);
|
||||||
|
for (const [letter, marks] of Object.entries(await visibleMarks("data-p2c-text"))) {
|
||||||
|
assert.ok(marks.length > 0, `${letter} shows ${value} text`);
|
||||||
|
assert.ok(marks.every((m) => m.split(" ").includes(value)), `${letter} at ${value}: ${marks.join(" | ")}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------- (g) Compare all */
|
||||||
|
|
||||||
|
test("Compare all shows every frame in a row, a click picks one, and a dial change reaches all", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const ids = await page.locator("iframe.p2c-frame").evaluateAll((els) => els.map((e) => e.id));
|
||||||
|
await page.click("#p2c-compare");
|
||||||
|
assert.equal(await page.locator("#p2c-compare").getAttribute("aria-pressed"), "true");
|
||||||
|
assert.deepEqual(await shown(page), { A: true, B: true, C: true });
|
||||||
|
const row = await page.evaluate(() => {
|
||||||
|
const stage = document.getElementById("p2c-stage").getBoundingClientRect();
|
||||||
|
const boxes = [...document.querySelectorAll("iframe.p2c-frame")].map((f) => f.getBoundingClientRect());
|
||||||
|
const labels = [...document.querySelectorAll(".tool-label")].map((l) => ({ text: l.textContent, shown: !l.hidden, bottom: l.getBoundingClientRect().bottom }));
|
||||||
|
return { stage: [stage.left, stage.right], boxes: boxes.map((b) => [b.left, b.right, b.top]), labels };
|
||||||
|
});
|
||||||
|
for (let i = 0; i < row.boxes.length; i++) {
|
||||||
|
const [left, right, top] = row.boxes[i];
|
||||||
|
assert.ok(left >= row.stage[0] && right <= row.stage[1], `frame ${i} fits the stage width`);
|
||||||
|
if (i) assert.ok(left > row.boxes[i - 1][1], `frame ${i} sits right of the one before`);
|
||||||
|
assert.ok(row.labels[i].shown && row.labels[i].bottom <= top + 1, `frame ${i} has its label above it`);
|
||||||
|
}
|
||||||
|
assert.deepEqual(
|
||||||
|
row.labels.map((l) => l.text),
|
||||||
|
roundJson("good-screen").variants.map((v) => `${v.letter}${v.name}`)
|
||||||
|
);
|
||||||
|
|
||||||
|
// A click on the third frame makes it current without leaving the row.
|
||||||
|
const box = await page.locator("#p2c-frame-C").boundingBox();
|
||||||
|
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
|
||||||
|
assert.equal(await page.locator("#p2c-tab-C").getAttribute("aria-selected"), "true");
|
||||||
|
assert.equal(await page.locator("#p2c-compare").getAttribute("aria-pressed"), "true");
|
||||||
|
assert.deepEqual(await shown(page), { A: true, B: true, C: true });
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-radius").fill("3");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), "3px"));
|
||||||
|
|
||||||
|
await page.click("#p2c-compare");
|
||||||
|
assert.deepEqual(await shown(page), { A: false, B: false, C: true }, "back to the single view of the current variant");
|
||||||
|
assert.deepEqual(await page.locator("iframe.p2c-frame").evaluateAll((els) => els.map((e) => e.id)), ids, "the same frames, never re-created");
|
||||||
|
// A frame moved or re-created would reload and lose its written values.
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), "3px"));
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- (h) panel */
|
||||||
|
|
||||||
|
test("the panel drags, never covers the top bar, hides to the Dials tab where it was and returns", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const panelBox = () => page.locator("#p2c-panel").boundingBox();
|
||||||
|
const grip = async () => {
|
||||||
|
const b = await page.locator("#p2c-panel-title").boundingBox();
|
||||||
|
return { x: b.x + 10, y: b.y + b.height / 2 };
|
||||||
|
};
|
||||||
|
const dragBy = async (dx, dy) => {
|
||||||
|
const g = await grip();
|
||||||
|
await page.mouse.move(g.x, g.y);
|
||||||
|
await page.mouse.down();
|
||||||
|
await page.mouse.move(g.x + dx / 2, g.y + dy / 2);
|
||||||
|
await page.mouse.move(g.x + dx, g.y + dy);
|
||||||
|
await page.mouse.up();
|
||||||
|
};
|
||||||
|
|
||||||
|
const start = await panelBox();
|
||||||
|
assert.ok(start.width <= 320, "the panel is at most 320px wide");
|
||||||
|
await dragBy(300, 200);
|
||||||
|
const moved = await panelBox();
|
||||||
|
assert.ok(Math.abs(moved.x - start.x - 300) < 2 && Math.abs(moved.y - start.y - 200) < 2, JSON.stringify({ start, moved }));
|
||||||
|
|
||||||
|
const barBottom = (await page.locator("#p2c-bar").boundingBox()).height;
|
||||||
|
await dragBy(0, -2000);
|
||||||
|
assert.ok((await panelBox()).y >= barBottom - 0.5, "the panel stops under the top bar");
|
||||||
|
await dragBy(5000, 5000);
|
||||||
|
const corner = await panelBox();
|
||||||
|
const view = page.viewportSize();
|
||||||
|
const handle = await page.locator("#p2c-panel-handle").boundingBox();
|
||||||
|
assert.ok(corner.x + corner.width <= view.width + 0.5 && handle.y + handle.height <= view.height + 0.5, "the handle stays on screen");
|
||||||
|
|
||||||
|
await dragBy(-400, -300);
|
||||||
|
const before = await panelBox();
|
||||||
|
await page.click("#p2c-hide");
|
||||||
|
assert.equal(await page.locator("#p2c-panel").isVisible(), false);
|
||||||
|
const tab = await page.locator("#p2c-dials-tab").boundingBox();
|
||||||
|
assert.ok(tab && Math.abs(tab.x - before.x) < 1 && Math.abs(tab.y - before.y) < 1, "the Dials tab sits where the panel was");
|
||||||
|
await page.click("#p2c-dials-tab");
|
||||||
|
assert.equal(await page.locator("#p2c-dials-tab").isVisible(), false);
|
||||||
|
const back = await panelBox();
|
||||||
|
assert.ok(Math.abs(back.x - before.x) < 1 && Math.abs(back.y - before.y) < 1, "the panel returns where it was");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------ (i) flow */
|
||||||
|
|
||||||
|
test("a flow lays each variant's screens in one row with their step labels, and the stage scrolls sideways", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-flow", { width: 1000, height: 800 });
|
||||||
|
const facts = roundJson("good-flow");
|
||||||
|
const steps = () =>
|
||||||
|
inFrames(page, (doc) =>
|
||||||
|
[...doc.querySelectorAll("[data-p2c-step]")].map((s) => {
|
||||||
|
const r = s.getBoundingClientRect();
|
||||||
|
return { label: getComputedStyle(s, "::before").content, top: r.top, left: r.left, right: r.right, width: r.width, viewport: doc.defaultView.innerWidth };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const check = (all, width) => {
|
||||||
|
for (const [letter, row] of Object.entries(all)) {
|
||||||
|
assert.deepEqual(
|
||||||
|
row.map((s) => s.label),
|
||||||
|
['"1. Account"', '"2. Team"', '"3. Done"'],
|
||||||
|
letter
|
||||||
|
);
|
||||||
|
for (let i = 0; i < row.length; i++) {
|
||||||
|
assert.equal(Math.round(row[i].width), width, `${letter} step ${i} is one screen wide`);
|
||||||
|
assert.equal(row[i].top, row[0].top, `${letter} step ${i} is in the row`);
|
||||||
|
if (i) assert.ok(row[i].left >= row[i - 1].right, `${letter} step ${i} follows the one before`);
|
||||||
|
}
|
||||||
|
assert.ok(row[row.length - 1].right <= row[0].viewport, `${letter}: the frame holds the whole row`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
assert.equal(facts.starts.screen, "Phone 390");
|
||||||
|
check(await steps(), 390);
|
||||||
|
const scrolls = await page.evaluate(() => {
|
||||||
|
const s = document.getElementById("p2c-stage");
|
||||||
|
return s.scrollWidth > s.clientWidth;
|
||||||
|
});
|
||||||
|
assert.ok(scrolls, "the stage scrolls sideways");
|
||||||
|
|
||||||
|
await pickChoice(page, "screen", "Tablet 820");
|
||||||
|
check(await steps(), 820);
|
||||||
|
await page.locator("#p2c-dial-space").fill("0.75");
|
||||||
|
check(await steps(), 820);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a flow whose variants differ in steps scrolls only as far as the current row, and a variant's own row gap is measured", async (t) => {
|
||||||
|
// Variant B gets a fourth step; variant A sets its own, wider gap between screens.
|
||||||
|
const edit = (round) => {
|
||||||
|
const b = path.join(round, "variant-b.html");
|
||||||
|
fs.writeFileSync(b, fs.readFileSync(b, "utf8") + '\n<section class="step-b" data-p2c-step="4. Tour">\n <h2>Take the tour</h2>\n</section>\n');
|
||||||
|
const a = path.join(round, "variant-a.html");
|
||||||
|
fs.writeFileSync(a, fs.readFileSync(a, "utf8").replace("<style>", '<style>\n :root[data-p2c-kind="flow"] body { gap: 60px; }'));
|
||||||
|
};
|
||||||
|
const { page } = await openFixture(t, "good-flow", { width: 1000, height: 800, edit });
|
||||||
|
const reach = () =>
|
||||||
|
page.evaluate(() => {
|
||||||
|
const stage = document.getElementById("p2c-stage");
|
||||||
|
const current = document.querySelector("iframe.tool-current-frame");
|
||||||
|
const doc = current.contentDocument;
|
||||||
|
const steps = [...doc.querySelectorAll("[data-p2c-step]")];
|
||||||
|
const last = steps[steps.length - 1].getBoundingClientRect();
|
||||||
|
const padRight = parseFloat(getComputedStyle(doc.body).paddingRight);
|
||||||
|
return { scroll: stage.scrollWidth, frameRight: current.offsetLeft + current.offsetWidth, steps: steps.length, spare: doc.defaultView.innerWidth - last.right - padRight };
|
||||||
|
});
|
||||||
|
const a = await reach();
|
||||||
|
assert.equal(a.steps, 3);
|
||||||
|
assert.ok(a.scroll <= a.frameRight + 16 + 1, `the stage scrolls no further than A's row: ${JSON.stringify(a)}`);
|
||||||
|
assert.ok(Math.abs(a.spare) <= 1, `A's frame is exactly as wide as its row with its own gap: ${JSON.stringify(a)}`);
|
||||||
|
await page.locator("#p2c-tab-B").click();
|
||||||
|
const b = await reach();
|
||||||
|
assert.equal(b.steps, 4);
|
||||||
|
assert.ok(b.scroll > a.scroll, "B's longer row widens the scroll area once it is current");
|
||||||
|
assert.ok(Math.abs(b.spare) <= 1, `B's frame is exactly as wide as its row: ${JSON.stringify(b)}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("after the window shrinks, the frame is centered and scaled to the new stage, and a hidden panel's Dials tab stays on screen", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen", { width: 1400, height: 900 });
|
||||||
|
// Hide the panel near the right edge of the wide window.
|
||||||
|
const title = await page.locator("#p2c-panel-title").boundingBox();
|
||||||
|
await page.mouse.move(title.x + 10, title.y + title.height / 2);
|
||||||
|
await page.mouse.down();
|
||||||
|
await page.mouse.move(title.x + 600, title.y + 400);
|
||||||
|
await page.mouse.move(title.x + 2000, title.y + 600);
|
||||||
|
await page.mouse.up();
|
||||||
|
await page.click("#p2c-hide");
|
||||||
|
|
||||||
|
await page.setViewportSize({ width: 960, height: 600 });
|
||||||
|
// Wait for the resize to be laid out: the scale read-out appears once the frame no longer fits.
|
||||||
|
await page.waitForFunction(() => document.querySelector('[data-dial="screen"] .tool-scale').textContent !== "");
|
||||||
|
const fit = await page.evaluate(() => {
|
||||||
|
const stage = document.getElementById("p2c-stage");
|
||||||
|
const s = stage.getBoundingClientRect();
|
||||||
|
const f = document.getElementById("p2c-frame-A").getBoundingClientRect();
|
||||||
|
return { leftGap: f.left - s.left, rightGap: s.left + stage.clientWidth - f.right, scale: document.querySelector('[data-dial="screen"] .tool-scale').textContent, expected: Math.round(((stage.clientWidth - 32) / 1282) * 100) + "%", vbar: stage.clientWidth < s.width };
|
||||||
|
});
|
||||||
|
assert.ok(Math.abs(fit.leftGap - fit.rightGap) <= 1, `centered: ${JSON.stringify(fit)}`);
|
||||||
|
assert.equal(fit.scale, fit.expected);
|
||||||
|
assert.equal(fit.vbar, false, "no stray scroll bar after the shrink");
|
||||||
|
|
||||||
|
const tab = await page.locator("#p2c-dials-tab").boundingBox();
|
||||||
|
assert.ok(tab.x >= 0 && tab.x + tab.width <= 960 && tab.y + tab.height <= 600, `the Dials tab is on screen: ${JSON.stringify(tab)}`);
|
||||||
|
await page.click("#p2c-dials-tab");
|
||||||
|
const panel = await page.locator("#p2c-panel").boundingBox();
|
||||||
|
assert.ok(panel.x >= 0 && panel.x + panel.width <= 960, `the panel returns on screen: ${JSON.stringify(panel)}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ---------------------------------------------------- Phase 3: the helpers */
|
||||||
|
|
||||||
|
const dialsOf = (page) => page.evaluate(() => Object.fromEntries(Object.entries(window.p2c.state.dials).map(([k, d]) => [k, d.value])));
|
||||||
|
const movedOf = (page) => page.evaluate(() => Object.fromEntries(Object.entries(window.p2c.state.dials).map(([k, d]) => [k, d.moved])));
|
||||||
|
const presetOf = (page) => page.evaluate(() => window.p2c.state.preset);
|
||||||
|
const resetShown = (page, dial) => page.locator(`[data-dial="${dial}"] .tool-reset-button`).isVisible();
|
||||||
|
const blockText = (page) => page.locator("#p2c-block").inputValue();
|
||||||
|
const expectedBlock = (name, file) => fs.readFileSync(path.join(FIXTURES, name, "expected-block.txt"), "utf8").replace(/\r?\n$/, "").replace("<FILE>", file);
|
||||||
|
|
||||||
|
/** Every look value on every frame's root, for "nothing else moved" checks. */
|
||||||
|
const looks = async (page) => {
|
||||||
|
const out = {};
|
||||||
|
for (const prop of ["--p2c-accent", "--p2c-neutral", "--p2c-font", "--p2c-text-size", "--p2c-space", "--p2c-radius", "--p2c-screen-width"]) out[prop] = await rootValue(page, prop);
|
||||||
|
for (const attr of ["data-p2c-theme", "data-p2c-state", "data-p2c-length", "data-p2c-x-shadows", "data-p2c-x-columns", "data-p2c-x-dividers"]) out[attr] = await rootAttr(page, attr);
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** An edit for openFixture: one more extra in the temp copy's round.json. */
|
||||||
|
const withExtra = (extra) => (round) => {
|
||||||
|
const file = path.join(round, "round.json");
|
||||||
|
const facts = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||||
|
facts.extras.push(extra);
|
||||||
|
fs.writeFileSync(file, JSON.stringify(facts, null, 2));
|
||||||
|
};
|
||||||
|
const SPINNER = { name: "spinner", label: "Spinner", type: "pick", choices: ["dots", "line", "none"], start: "dots", look: true };
|
||||||
|
const PROGRESS = { name: "progress", label: "Progress bar", type: "toggle", start: true, look: false };
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------- (a) presets */
|
||||||
|
|
||||||
|
test("each preset sets only spacing, text size and corners on every frame, and a hand move keeps the preset", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const facts = roundJson("good-screen");
|
||||||
|
const own = Object.fromEntries(facts.variants.map((v) => [v.letter, `${v.starts.radius}px`]));
|
||||||
|
const before = await looks(page);
|
||||||
|
const order = await page.locator("#p2c-panel-body > *").evaluateAll((els) => els.map((e) => e.className));
|
||||||
|
assert.deepEqual(order, ["tool-presets", "tool-dials", "tool-extras", "tool-panel-foot"], "presets on top, then the dials, Extras and the foot");
|
||||||
|
assert.deepEqual(await page.locator(".tool-presets button").allTextContents(), ["Compact", "Balanced", "Airy", "Bold"]);
|
||||||
|
assert.deepEqual(await page.locator(".tool-panel-foot button").allTextContents(), ["Reset everything", "Surprise me"]);
|
||||||
|
|
||||||
|
const triples = { Compact: ["0.75", "14px", "4px"], Airy: ["1.5", "17px", "12px"], Bold: ["1.25", "20px", "16px"] };
|
||||||
|
for (const [name, [space, size, radius]] of Object.entries(triples)) {
|
||||||
|
await page.click(`#p2c-preset-${name.toLowerCase()}`);
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-space"), space), `${name} spacing`);
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-text-size"), size), `${name} text size`);
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), radius), `${name} corners`);
|
||||||
|
const now = await looks(page);
|
||||||
|
for (const key of Object.keys(before)) {
|
||||||
|
if (!["--p2c-space", "--p2c-text-size", "--p2c-radius"].includes(key)) assert.deepEqual(now[key], before[key], `${name} leaves ${key} alone`);
|
||||||
|
}
|
||||||
|
assert.equal(await presetOf(page), name);
|
||||||
|
assert.equal(await page.locator(`#p2c-preset-${name.toLowerCase()}`).getAttribute("aria-pressed"), "true");
|
||||||
|
}
|
||||||
|
// Balanced is the round's own starts: the freed-up corners go back to each variant's own.
|
||||||
|
await page.click("#p2c-preset-balanced");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-space"), "1"));
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-text-size"), "16px"));
|
||||||
|
assert.deepEqual(await rootValue(page, "--p2c-radius"), own);
|
||||||
|
const moved = await movedOf(page);
|
||||||
|
assert.deepEqual([moved.space, moved.textSize, moved.radius], [false, false, false]);
|
||||||
|
assert.equal(await presetOf(page), "Balanced");
|
||||||
|
|
||||||
|
await page.click("#p2c-preset-compact");
|
||||||
|
await page.locator("#p2c-dial-textSize").fill("18");
|
||||||
|
assert.equal(await presetOf(page), "Compact", "a hand move keeps the preset last clicked");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------- (b) resets */
|
||||||
|
|
||||||
|
test("a moved dial shows its reset, the reset restores the start, and Reset everything restores all but the note", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const starts = await dialsOf(page);
|
||||||
|
assert.equal(await resetShown(page, "textSize"), false, "no reset while the dial is at its start");
|
||||||
|
await page.locator("#p2c-dial-textSize").fill("20");
|
||||||
|
assert.equal(await resetShown(page, "textSize"), true);
|
||||||
|
await page.locator('[data-dial="textSize"] .tool-reset-button').click();
|
||||||
|
assert.equal((await dialsOf(page)).textSize, starts.textSize);
|
||||||
|
assert.equal(await page.locator("#p2c-dial-textSize").inputValue(), String(starts.textSize), "the control shows the start again");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-text-size"), "16px"));
|
||||||
|
assert.equal(await resetShown(page, "textSize"), false);
|
||||||
|
|
||||||
|
await page.click("#p2c-preset-airy");
|
||||||
|
await page.locator("#p2c-dial-theme").check();
|
||||||
|
await page.locator("#p2c-dial-accent").fill("#ff0000");
|
||||||
|
await pickChoice(page, "state", "Error");
|
||||||
|
await pickChoice(page, "x-shadows", "strong");
|
||||||
|
await page.locator("#p2c-tab-B").click();
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
await page.locator("#p2c-note").fill("keep this");
|
||||||
|
assert.equal(await resetShown(page, "accent"), true);
|
||||||
|
assert.equal(await page.locator('[data-dial="variant"] .tool-reset-button').count(), 0, "the variant pick has no reset");
|
||||||
|
|
||||||
|
await page.click("#p2c-reset-all");
|
||||||
|
const after = await dialsOf(page);
|
||||||
|
assert.deepEqual({ ...after, variant: starts.variant, radius: starts.radius }, starts, "every dial back to its start");
|
||||||
|
assert.equal(after.variant, "B", "Reset everything keeps the chosen variant");
|
||||||
|
assert.equal(after.radius, 10, "the freed-up corners show B's own start");
|
||||||
|
assert.ok(Object.entries(await movedOf(page)).every(([k, m]) => k === "variant" || m === false));
|
||||||
|
assert.equal(await presetOf(page), null);
|
||||||
|
assert.equal(await page.locator("#p2c-note").inputValue(), "keep this", "the Note box is left alone");
|
||||||
|
assert.equal(await page.locator(".tool-reset-button:visible").count(), 0);
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-theme"), "light"));
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------- (c) freed-up items */
|
||||||
|
|
||||||
|
test("a freed-up dial starts from each variant's own value, applies to all once moved, and its reset gives each its own back", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
const facts = roundJson("good-screen");
|
||||||
|
assert.deepEqual(facts.freed, ["components"]);
|
||||||
|
const own = Object.fromEntries(facts.variants.map((v) => [v.letter, `${v.starts.radius}px`]));
|
||||||
|
const tag = page.locator('[data-dial="radius"] .tool-own');
|
||||||
|
|
||||||
|
assert.deepEqual(await rootValue(page, "--p2c-radius"), own, "each frame holds its own variant's corners");
|
||||||
|
assert.equal(await tag.isVisible(), true);
|
||||||
|
assert.equal(await tag.textContent(), "each variant's own");
|
||||||
|
assert.equal(await page.locator('[data-dial="accent"] .tool-own').count(), 0, "a carried-over item has no tag");
|
||||||
|
assert.equal(await page.locator("#p2c-dial-radius").inputValue(), "4", "the control shows the current variant's value");
|
||||||
|
await page.locator("#p2c-tab-C").click();
|
||||||
|
assert.equal(await page.locator("#p2c-dial-radius").inputValue(), "16", "and follows the selected tab");
|
||||||
|
|
||||||
|
await page.locator("#p2c-dial-radius").fill("20");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), "20px"), "once moved, one value on every frame");
|
||||||
|
assert.equal(await tag.isVisible(), false);
|
||||||
|
await page.locator("#p2c-tab-A").click();
|
||||||
|
assert.equal(await page.locator("#p2c-dial-radius").inputValue(), "20");
|
||||||
|
|
||||||
|
await page.locator('[data-dial="radius"] .tool-reset-button').click();
|
||||||
|
assert.deepEqual(await rootValue(page, "--p2c-radius"), own, "the reset gives each variant its own back");
|
||||||
|
assert.equal(await tag.isVisible(), true);
|
||||||
|
assert.equal(await page.locator("#p2c-dial-radius").inputValue(), "4");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- (d) extras */
|
||||||
|
|
||||||
|
test("each extra control type writes its --p2c-x- value on every frame, and the Extras group folds", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-shadows"), "soft"));
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-columns"), "2"));
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-dividers"), "1"));
|
||||||
|
|
||||||
|
await pickChoice(page, "x-shadows", "strong");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-shadows"), "strong"));
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-x-shadows"), "strong"));
|
||||||
|
await page.locator("#p2c-dial-x-columns").fill("3");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-columns"), "3"));
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-x-columns"), "3"));
|
||||||
|
await page.locator("#p2c-dial-x-dividers").uncheck();
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-dividers"), "0"));
|
||||||
|
assert.ok(every(await rootAttr(page, "data-p2c-x-dividers"), "off"));
|
||||||
|
assert.equal(await resetShown(page, "x-columns"), true, "extras take part in resets");
|
||||||
|
|
||||||
|
const extras = page.locator("#p2c-extras");
|
||||||
|
assert.equal(await extras.evaluate((d) => d.open), true, "open to start");
|
||||||
|
await page.locator("#p2c-extras > summary").click();
|
||||||
|
assert.equal(await extras.evaluate((d) => d.open), false);
|
||||||
|
assert.equal(await page.locator('[data-dial="x-shadows"]').isVisible(), false, "the group folds");
|
||||||
|
await page.locator("#p2c-extras > summary").click();
|
||||||
|
assert.equal(await page.locator('[data-dial="x-shadows"]').isVisible(), true);
|
||||||
|
|
||||||
|
// A round with no extras has no group.
|
||||||
|
const { page: flow } = await openFixture(t, "good-flow");
|
||||||
|
assert.equal(await flow.locator("#p2c-extras").isVisible(), false);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------- (e) Surprise me */
|
||||||
|
|
||||||
|
test("with the random source fixed, Surprise me moves only the look dials and the look extras", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
await page.click("#p2c-preset-airy");
|
||||||
|
await page.locator("#p2c-tab-B").click();
|
||||||
|
await pickChoice(page, "screen", "Tablet 820");
|
||||||
|
const before = await dialsOf(page);
|
||||||
|
await page.evaluate(() => {
|
||||||
|
window.p2c.random = () => 0.7;
|
||||||
|
});
|
||||||
|
await page.click("#p2c-surprise");
|
||||||
|
const after = await dialsOf(page);
|
||||||
|
for (const id of ["variant", "screen", "theme", "state", "length", "x-columns"]) assert.deepEqual(after[id], before[id], `${id} is not a look`);
|
||||||
|
for (const id of ["accent", "neutral", "fontSet", "textSize", "space", "radius", "x-shadows", "x-dividers"]) assert.notDeepEqual(after[id], before[id], `${id} moved`);
|
||||||
|
assert.deepEqual(
|
||||||
|
[after.fontSet, after.textSize, after.space, after.radius, after["x-shadows"], after["x-dividers"]],
|
||||||
|
["Rounded Sans", 19, 1.25, 17, "strong", false]
|
||||||
|
);
|
||||||
|
assert.match(after.accent, /^#[0-9a-f]{6}$/);
|
||||||
|
assert.match(after.neutral, /^#[0-9a-f]{6}$/);
|
||||||
|
assert.equal(await presetOf(page), null, "Surprise me clears the preset");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-radius"), "17px"), "one value on every frame, the freed-up corners too");
|
||||||
|
|
||||||
|
const { page: term } = await openFixture(t, "good-terminal", { edit: withExtra(SPINNER) });
|
||||||
|
const tBefore = await dialsOf(term);
|
||||||
|
await term.evaluate(() => {
|
||||||
|
window.p2c.random = () => 0.7;
|
||||||
|
});
|
||||||
|
await term.click("#p2c-surprise");
|
||||||
|
const tAfter = await dialsOf(term);
|
||||||
|
const rest = (d) => ({ ...d, palette: 0, density: 0, "x-spinner": 0 });
|
||||||
|
assert.deepEqual(rest(tAfter), rest(tBefore), "only the palette, density and look extras move");
|
||||||
|
assert.deepEqual([tAfter.palette, tAfter.density, tAfter["x-spinner"]], ["Phosphor", 1.7, "none"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ (f) the block */
|
||||||
|
|
||||||
|
/** The clipboard's text, line ends as LF: Chrome on Windows writes CRLF there. */
|
||||||
|
const clipboardText = async (page) => (await page.evaluate(() => navigator.clipboard.readText())).replace(/\r\n/g, "\n");
|
||||||
|
|
||||||
|
/** Wait for the Copy status line, then return it. */
|
||||||
|
async function copyStatus(page) {
|
||||||
|
await page.waitForFunction(() => document.getElementById("p2c-copy-status").textContent !== "");
|
||||||
|
return page.locator("#p2c-copy-status").textContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
// good-screen moves: Airy, tab B, Theme dark, Accent #d9480f, Shadows strong,
|
||||||
|
// Note "header from A" / "with these cards" on two lines.
|
||||||
|
test("good-screen: the copied block equals the stored text after the scripted moves, in the box and on the clipboard", async (t) => {
|
||||||
|
const { page, file } = await openFixture(t, "good-screen", { permissions: ["clipboard-read", "clipboard-write"] });
|
||||||
|
await page.click("#p2c-preset-airy");
|
||||||
|
await page.locator("#p2c-tab-B").click();
|
||||||
|
await page.locator("#p2c-dial-theme").check();
|
||||||
|
await page.locator("#p2c-dial-accent").fill("#d9480f");
|
||||||
|
await pickChoice(page, "x-shadows", "strong");
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
assert.equal(await page.locator("#p2c-copy-pop").isVisible(), true, "Copy opens the popover");
|
||||||
|
await page.locator("#p2c-note").fill("header from A\nwith these cards");
|
||||||
|
await page.evaluate(() => {
|
||||||
|
document.getElementById("p2c-copy-status").textContent = "";
|
||||||
|
});
|
||||||
|
await page.click("#p2c-copy-block");
|
||||||
|
const expected = expectedBlock("good-screen", file);
|
||||||
|
assert.equal(await blockText(page), expected);
|
||||||
|
assert.equal(await copyStatus(page), "Copied. Paste it into the conversation.");
|
||||||
|
assert.equal(await clipboardText(page), expected);
|
||||||
|
assert.equal(await page.locator("#p2c-copy-pop").isVisible(), true, "the popover stays open");
|
||||||
|
assert.equal(await page.locator("#p2c-block").getAttribute("readonly"), "");
|
||||||
|
});
|
||||||
|
|
||||||
|
// good-flow moves: Compact, Screen size Tablet 820, State Empty, an added
|
||||||
|
// Progress bar extra turned off, Note "keep the rail".
|
||||||
|
test("good-flow: the copied block equals the stored text after the scripted moves", async (t) => {
|
||||||
|
const { page, file } = await openFixture(t, "good-flow", { edit: withExtra(PROGRESS), permissions: ["clipboard-read", "clipboard-write"] });
|
||||||
|
await page.click("#p2c-preset-compact");
|
||||||
|
await pickChoice(page, "screen", "Tablet 820");
|
||||||
|
await pickChoice(page, "state", "Empty");
|
||||||
|
await page.locator("#p2c-dial-x-progress").uncheck();
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
await page.locator("#p2c-note").fill("keep the rail");
|
||||||
|
await page.click("#p2c-copy-block");
|
||||||
|
const expected = expectedBlock("good-flow", file);
|
||||||
|
assert.equal(await blockText(page), expected);
|
||||||
|
await copyStatus(page);
|
||||||
|
assert.equal(await clipboardText(page), expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
// good-terminal moves: Bold, Window size 80x24, Palette Ocean, an added
|
||||||
|
// Spinner extra set to line, Note "fewer lines while it runs".
|
||||||
|
test("good-terminal: the copied block equals the stored text after the scripted moves", async (t) => {
|
||||||
|
const { page, file } = await openFixture(t, "good-terminal", { edit: withExtra(SPINNER), permissions: ["clipboard-read", "clipboard-write"] });
|
||||||
|
await page.click("#p2c-preset-bold");
|
||||||
|
await pickChoice(page, "window", "80x24");
|
||||||
|
await pickChoice(page, "palette", "Ocean");
|
||||||
|
await pickChoice(page, "x-spinner", "line");
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
await page.locator("#p2c-note").fill("fewer lines while it runs");
|
||||||
|
await page.click("#p2c-copy-block");
|
||||||
|
const expected = expectedBlock("good-terminal", file);
|
||||||
|
assert.equal(await blockText(page), expected);
|
||||||
|
await copyStatus(page);
|
||||||
|
assert.equal(await clipboardText(page), expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with the clipboard refused, Copy says to select the text, and the block stays visible", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen");
|
||||||
|
await page.evaluate(() => {
|
||||||
|
Object.defineProperty(navigator, "clipboard", { value: { writeText: () => Promise.reject(new Error("denied")) } });
|
||||||
|
document.execCommand = () => false;
|
||||||
|
});
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
assert.equal(await copyStatus(page), "Select the text above and copy it.");
|
||||||
|
assert.equal(await page.locator("#p2c-block").isVisible(), true);
|
||||||
|
assert.match(await blockText(page), /^Plan2Code UI prototype choice\n/);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------- (g) nothing moved, no marks */
|
||||||
|
|
||||||
|
for (const name of ["good-screen", "good-flow", "good-terminal"]) {
|
||||||
|
test(`${name}: the block with nothing moved has no change marks, no Preset and no Note line`, async (t) => {
|
||||||
|
const { page, file } = await openFixture(t, name);
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
const block = await blockText(page);
|
||||||
|
assert.doesNotMatch(block, /changed from/);
|
||||||
|
assert.doesNotMatch(block, /^Preset:/m);
|
||||||
|
assert.doesNotMatch(block, /^Note:/m);
|
||||||
|
assert.ok(block.split("\n").includes(`File: ${file}`), "the File line names the page itself");
|
||||||
|
assert.equal(/^Direction:/m.test(block), roundJson(name).direction !== "", "a Direction line only when the round has one");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------- (h) terminal */
|
||||||
|
|
||||||
|
test("a terminal shows window, palette and density in place of the screen dials, and a window size change resizes the frame", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-terminal");
|
||||||
|
const dials = await page.locator("#p2c-panel-body [data-dial]").evaluateAll((rows) => rows.map((r) => r.dataset.dial));
|
||||||
|
assert.deepEqual(dials, ["variant", "window", "theme", "palette", "density", "state", "length"]);
|
||||||
|
for (const gone of ["screen", "accent", "neutral", "fontSet", "textSize", "space", "radius"]) assert.ok(!dials.includes(gone), `no ${gone} dial`);
|
||||||
|
|
||||||
|
// The title strip with the variant's name sits right above the frame.
|
||||||
|
const strip = await page.evaluate(() => {
|
||||||
|
const title = [...document.querySelectorAll(".tool-term-title")].find((e) => getComputedStyle(e).visibility === "visible");
|
||||||
|
const frame = document.getElementById("p2c-frame-A").getBoundingClientRect();
|
||||||
|
const r = title.getBoundingClientRect();
|
||||||
|
return { text: title.textContent, near: Math.abs(frame.top - r.bottom) <= 1 && Math.abs(frame.left - r.left) <= 1 };
|
||||||
|
});
|
||||||
|
assert.deepEqual(strip, { text: "Progress lines", near: true });
|
||||||
|
|
||||||
|
const size = () =>
|
||||||
|
page.evaluate(() => {
|
||||||
|
const doc = document.getElementById("p2c-frame-A").contentDocument;
|
||||||
|
const probe = doc.createElement("span");
|
||||||
|
probe.textContent = "0000000000";
|
||||||
|
probe.style.cssText = "position:absolute;white-space:pre";
|
||||||
|
doc.body.appendChild(probe);
|
||||||
|
const ch = probe.getBoundingClientRect().width / 10;
|
||||||
|
probe.remove();
|
||||||
|
const cs = getComputedStyle(doc.body);
|
||||||
|
return {
|
||||||
|
w: doc.defaultView.innerWidth,
|
||||||
|
h: doc.defaultView.innerHeight,
|
||||||
|
ch,
|
||||||
|
line: parseFloat(cs.lineHeight),
|
||||||
|
padX: parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight),
|
||||||
|
padY: parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const holds = (s, cols, rows) => {
|
||||||
|
assert.ok(Math.abs(s.w - (cols * s.ch + s.padX)) <= 1, `${cols} columns wide: ${JSON.stringify(s)}`);
|
||||||
|
assert.ok(Math.abs(s.h - (rows * s.line + s.padY)) <= 1, `${rows} rows tall: ${JSON.stringify(s)}`);
|
||||||
|
};
|
||||||
|
holds(await size(), 120, 30);
|
||||||
|
await pickChoice(page, "window", "80x24");
|
||||||
|
const small = await size();
|
||||||
|
holds(small, 80, 24);
|
||||||
|
await pickChoice(page, "window", "160x48");
|
||||||
|
const big = await size();
|
||||||
|
holds(big, 160, 48);
|
||||||
|
assert.ok(big.w > small.w && big.h > small.h);
|
||||||
|
await page.locator("#p2c-dial-density").fill("2");
|
||||||
|
holds(await size(), 160, 48);
|
||||||
|
|
||||||
|
await pickChoice(page, "palette", "Amber");
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-term-bg"), "#1a1408"), "the Amber palette's dark background");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ------------------------------------------------------- review regressions */
|
||||||
|
|
||||||
|
test("free text with line breaks stays on its own labeled line in the block", async (t) => {
|
||||||
|
const edit = (round) => {
|
||||||
|
const file = path.join(round, "round.json");
|
||||||
|
const facts = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||||
|
facts.direction = "calm\nNote: not a note";
|
||||||
|
facts.variants[0].name = "Dense\ntable";
|
||||||
|
facts.extras[0].label = "Soft\nshadows";
|
||||||
|
fs.writeFileSync(file, JSON.stringify(facts, null, 2));
|
||||||
|
};
|
||||||
|
const { page } = await openFixture(t, "good-screen", { edit });
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
const lines = (await blockText(page)).split("\n");
|
||||||
|
assert.ok(lines.includes("Direction: calm Note: not a note"), lines.join(" | "));
|
||||||
|
assert.ok(lines.includes('Chosen: A "Dense table" (others: B "Split view", C "Cards")'), lines.join(" | "));
|
||||||
|
assert.ok(lines.includes("Extra, Soft shadows: soft"), lines.join(" | "));
|
||||||
|
assert.ok(!lines.some((l) => l.startsWith("Note:")), "no line pretends to be the Note");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Surprise me never sets a slider past its max when the range is not a whole number of steps", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen", { edit: withExtra({ name: "lift", type: "slider", min: 0, max: 1, step: 0.35, start: 0, look: true }) });
|
||||||
|
await page.evaluate(() => {
|
||||||
|
window.p2c.random = () => 0.99;
|
||||||
|
});
|
||||||
|
await page.click("#p2c-surprise");
|
||||||
|
const value = (await dialsOf(page))["x-lift"];
|
||||||
|
assert.ok(value <= 1, `inside the range: ${value}`);
|
||||||
|
assert.equal(value, 0.7);
|
||||||
|
assert.ok(every(await rootValue(page, "--p2c-x-lift"), "0.7"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Escape closes the Copy popover opened from the top bar", async (t) => {
|
||||||
|
const { page } = await openFixture(t, "good-screen", { permissions: ["clipboard-read", "clipboard-write"] });
|
||||||
|
await page.click("#p2c-copy");
|
||||||
|
assert.equal(await page.locator("#p2c-copy-pop").isVisible(), true);
|
||||||
|
assert.equal(await copyStatus(page), "Copied. Paste it into the conversation.");
|
||||||
|
assert.equal(await page.evaluate(() => document.activeElement.id), "p2c-copy", "focus is still outside the popover");
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
|
assert.equal(await page.locator("#p2c-copy-pop").isVisible(), false);
|
||||||
|
assert.equal(await page.locator("#p2c-copy").getAttribute("aria-expanded"), "false");
|
||||||
|
});
|
||||||
@@ -1257,6 +1257,14 @@ test("the dashboard matrix lights only the cards a spec state allows", () => {
|
|||||||
assert.equal(launchTarget(entry("plan2code-1-plan"), sel("diagnosed")).dir, "specs/x");
|
assert.equal(launchTarget(entry("plan2code-1-plan"), sel("diagnosed")).dir, "specs/x");
|
||||||
assert.equal(launchTarget(entry("plan2code-review"), sel("diagnosed")), null);
|
assert.equal(launchTarget(entry("plan2code-review"), sel("diagnosed")), null);
|
||||||
assert.equal(launchTarget(entry("plan2code-1-plan"), null), null);
|
assert.equal(launchTarget(entry("plan2code-1-plan"), null), null);
|
||||||
|
// A folder holding only saved prototypes rides along on Quick Task too, as
|
||||||
|
// what to build from; a plain folder of files, or a mid-pipeline spec that
|
||||||
|
// also has prototypes (Implement builds those), still launches untargeted.
|
||||||
|
assert.equal(launchTarget(entry("plan2code-quick-task"), { ...sel("unrecognized"), prototypes: 1 }).dir, "specs/x");
|
||||||
|
assert.equal(launchTarget(entry("plan2code-quick-task"), { ...sel("unrecognized"), prototypes: 0 }), null);
|
||||||
|
assert.equal(launchTarget(entry("plan2code-quick-task"), sel("unrecognized")), null);
|
||||||
|
assert.equal(launchTarget(entry("plan2code-quick-task"), { ...sel("building"), prototypes: 2 }), null);
|
||||||
|
assert.equal(launchTarget(entry("plan2code-review"), { ...sel("unrecognized"), prototypes: 1 }), null);
|
||||||
|
|
||||||
// A fixed bug is finished: no pipeline card, and Quick Task starts fresh.
|
// A fixed bug is finished: no pipeline card, and Quick Task starts fresh.
|
||||||
for (const skill of [
|
for (const skill of [
|
||||||
@@ -2090,7 +2098,7 @@ test("subagents: only the sixteen opted-in workflows offer the switch", () => {
|
|||||||
assert.equal(offered(w), true, w);
|
assert.equal(offered(w), true, w);
|
||||||
assert.ok(defaultInstruction(w).length > 0, `${w} has a default instruction`);
|
assert.ok(defaultInstruction(w).length > 0, `${w} has a default instruction`);
|
||||||
}
|
}
|
||||||
for (const w of ["dashboard", "changelog", "git", "handoff", "constructor", "toString", undefined]) {
|
for (const w of ["dashboard", "changelog", "git", "handoff", "ui-prototype", "constructor", "toString", undefined]) {
|
||||||
assert.equal(offered(w), false, String(w));
|
assert.equal(offered(w), false, String(w));
|
||||||
assert.equal(defaultInstruction(w), "");
|
assert.equal(defaultInstruction(w), "");
|
||||||
}
|
}
|
||||||
@@ -2385,6 +2393,7 @@ test("meter: the weights and labels built from the skill list are the ones writt
|
|||||||
plan: 2, "revise-plan": 1, document: 2, "implement-phase": 2, "implement-review-phase": 3,
|
plan: 2, "revise-plan": 1, document: 2, "implement-phase": 2, "implement-review-phase": 3,
|
||||||
review: 2, "quick-task": 1, init: 2, "init-update": 2, finalize: 1, handoff: 0, git: 1,
|
review: 2, "quick-task": 1, init: 2, "init-update": 2, finalize: 1, handoff: 0, git: 1,
|
||||||
"git-commits": 0, "git-conflict": 1, changelog: 1, xray: 1, diagnose: 1, "pr-prep": 1, test: 1, "dead-code": 1,
|
"git-commits": 0, "git-conflict": 1, changelog: 1, xray: 1, diagnose: 1, "pr-prep": 1, test: 1, "dead-code": 1,
|
||||||
|
"ui-prototype-round": 1,
|
||||||
});
|
});
|
||||||
assert.deepEqual({ ...LAUNCH_LABELS }, {
|
assert.deepEqual({ ...LAUNCH_LABELS }, {
|
||||||
plan: "Plan started", "revise-plan": "Revise plan started", document: "Document started",
|
plan: "Plan started", "revise-plan": "Revise plan started", document: "Document started",
|
||||||
@@ -2402,6 +2411,7 @@ test("meter: the weights and labels built from the skill list are the ones writt
|
|||||||
finalize: "Finalize run", handoff: "Handoff written", git: "Git run", "git-commits": "Commits in Git",
|
finalize: "Finalize run", handoff: "Handoff written", git: "Git run", "git-commits": "Commits in Git",
|
||||||
"git-conflict": "Git conflict help", changelog: "Changelog run", xray: "X-ray run", diagnose: "Diagnose run",
|
"git-conflict": "Git conflict help", changelog: "Changelog run", xray: "X-ray run", diagnose: "Diagnose run",
|
||||||
"pr-prep": "PR Prep run", test: "Test run", "dead-code": "Dead Code run",
|
"pr-prep": "PR Prep run", test: "Test run", "dead-code": "Dead Code run",
|
||||||
|
"ui-prototype-round": "Prototype round drawn",
|
||||||
});
|
});
|
||||||
for (const t of [WEIGHTS, LAUNCH_LABELS, RUN_LABELS]) assert.ok(Object.isFrozen(t));
|
for (const t of [WEIGHTS, LAUNCH_LABELS, RUN_LABELS]) assert.ok(Object.isFrozen(t));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -270,6 +270,39 @@ test("the Dead Code card sits in Useful any time with its skull, is lit with or
|
|||||||
assert.ok(!launch.spec, `a Dead Code launch names no spec: ${JSON.stringify(launch)}`);
|
assert.ok(!launch.spec, `a Dead Code launch names no spec: ${JSON.stringify(launch)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("the UI Prototype card sits in Useful any time with its screen icon, is lit with or without a spec, and launches with the picked spec", async (t) => {
|
||||||
|
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", payload: MENU, project: tempProject(DRAFT_PROJECT) });
|
||||||
|
const main = await toTheMenu(s);
|
||||||
|
await hideUnavailable(main, false);
|
||||||
|
const card = lightOf(main, "/plan2code-ui-prototype");
|
||||||
|
await card.waitFor();
|
||||||
|
|
||||||
|
const group = main.locator("section.dash-group").filter({ has: s.page.locator("h3", { hasText: /^Useful any time$/ }) });
|
||||||
|
assert.equal(await group.locator("code", { hasText: /^\/plan2code-ui-prototype$/ }).count(), 1, "the card is in the Useful any time group");
|
||||||
|
assert.match(await textOf(card), /Utility/i, "it wears the Utility chip (drawn in capitals)");
|
||||||
|
assert.match(await textOf(card), /Prototype a screen/, "it has its title");
|
||||||
|
assert.equal(await card.locator("use").getAttribute("href"), "#ci-ui-prototype", "its icon is the framed screen");
|
||||||
|
assert.equal(await s.page.locator("symbol#ci-ui-prototype").count(), 1, "the screen symbol is drawn in the icon sheet");
|
||||||
|
|
||||||
|
// Lit with no spec picked, and with one.
|
||||||
|
await chipFor(main, "Start from scratch").click();
|
||||||
|
await pickedChip(main, "Start from scratch").waitFor();
|
||||||
|
assert.equal(await card.isEnabled(), true, "lit with no spec picked");
|
||||||
|
await chipFor(main, "demo").click();
|
||||||
|
await pickedChip(main, "demo").waitFor();
|
||||||
|
assert.equal(await card.isEnabled(), true, "lit with a spec picked");
|
||||||
|
|
||||||
|
// A launch with the spec picked carries it: the save list starts there.
|
||||||
|
await card.click();
|
||||||
|
await main.getByRole("button", { name: "Start Prototype a screen" }).click();
|
||||||
|
const launch = collect(s).actions.find((a) => a.i === "__launch");
|
||||||
|
assert.ok(launch, "the send carries a launch");
|
||||||
|
assert.deepEqual(
|
||||||
|
{ skill: launch.skill, workflow: launch.workflow, spec: launch.spec },
|
||||||
|
{ skill: "plan2code-ui-prototype", workflow: "ui-prototype", spec: "specs/demo" }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// What a person would see break: a spec not documented yet offers nothing to
|
// What a person would see break: a spec not documented yet offers nothing to
|
||||||
// read, or its Map and Plan draft tabs stay up for a spec that has an
|
// read, or its Map and Plan draft tabs stay up for a spec that has an
|
||||||
// overview (or for no spec at all).
|
// overview (or for no spec at all).
|
||||||
|
|||||||
@@ -466,6 +466,9 @@ test("cleanup finds old sessions and strays in both folders, and keeps every pro
|
|||||||
backdate(path.join(plan2code, "app"));
|
backdate(path.join(plan2code, "app"));
|
||||||
backdate(put(path.join(plan2code, "app.json")));
|
backdate(put(path.join(plan2code, "app.json")));
|
||||||
backdate(put(path.join(plan2code, "agents.json")));
|
backdate(put(path.join(plan2code, "agents.json")));
|
||||||
|
// UI Prototype drafts are swept by age by the skill's own script, never offered here.
|
||||||
|
backdate(put(path.join(plan2code, "prototypes", "my-app-0123456789ab", "invoices", "invoices-round-1.html"), "x"));
|
||||||
|
backdate(path.join(plan2code, "prototypes"));
|
||||||
// In use right now: a held lock and a temp between its write and rename.
|
// In use right now: a held lock and a temp between its write and rename.
|
||||||
const live = [put(path.join(consoleDir, "workspaces.json.lock"), ""), put(path.join(plan2code, "models.json.123.tmp"))];
|
const live = [put(path.join(consoleDir, "workspaces.json.lock"), ""), put(path.join(plan2code, "models.json.123.tmp"))];
|
||||||
kept.push(...live);
|
kept.push(...live);
|
||||||
@@ -482,7 +485,7 @@ test("cleanup finds old sessions and strays in both folders, and keeps every pro
|
|||||||
"session:20250801-101010-aaaaaa",
|
"session:20250801-101010-aaaaaa",
|
||||||
]);
|
]);
|
||||||
assert.equal(items.some((i) => i.id === "root:handoffs"), false, "the handoffs folder is never a stray");
|
assert.equal(items.some((i) => i.id === "root:handoffs"), false, "the handoffs folder is never a stray");
|
||||||
for (const id of ["root:app", "root:app.json", "root:agents.json"]) assert.equal(items.some((i) => i.id === id), false, `${id} is never a stray`);
|
for (const id of ["root:app", "root:app.json", "root:agents.json", "root:prototypes"]) assert.equal(items.some((i) => i.id === id), false, `${id} is never a stray`);
|
||||||
assert.equal(STRAY_GRACE_MS, 60 * 60 * 1000);
|
assert.equal(STRAY_GRACE_MS, 60 * 60 * 1000);
|
||||||
assert.equal(items.find((i) => i.id === "console:p1.json").bytes, 5);
|
assert.equal(items.find((i) => i.id === "console:p1.json").bytes, 5);
|
||||||
assert.equal(items.find((i) => i.id === "root:console-dev").kind, "folder");
|
assert.equal(items.find((i) => i.id === "root:console-dev").kind, "folder");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { spawnSync } from "node:child_process";
|
|||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { SPEC_STATES as TABLE, stateFor } from "../src/web-console/public/spec-states.js";
|
import { SPEC_STATES as TABLE, stateFor } from "../src/web-console/public/spec-states.js";
|
||||||
import { SKILLS } from "../src/web-console/public/skills.js";
|
import { SKILLS } from "../src/web-console/public/skills.js";
|
||||||
import { SKILL_CATALOG, cardAvailability, defaultSpec, launchVariant } from "../src/web-console/public/answers.js";
|
import { SKILL_CATALOG, cardAvailability, defaultSpec, launchTarget, launchVariant } from "../src/web-console/public/answers.js";
|
||||||
import { scanProject } from "../src/web-console/scan.mjs";
|
import { scanProject } from "../src/web-console/scan.mjs";
|
||||||
import { MARKERS, TASK_LINE_RE, TASK_ID_RE, CHECKBOX_RE, STATUS_RE, statusOf, countTasks, deriveSpecState, pickPhaseFiles } from "../src/web-console/spec-files.mjs";
|
import { MARKERS, TASK_LINE_RE, TASK_ID_RE, CHECKBOX_RE, STATUS_RE, statusOf, countTasks, deriveSpecState, pickPhaseFiles } from "../src/web-console/spec-files.mjs";
|
||||||
|
|
||||||
@@ -314,6 +314,18 @@ const CARDS = {
|
|||||||
built: { on: true },
|
built: { on: true },
|
||||||
unrecognized: { on: true },
|
unrecognized: { on: true },
|
||||||
},
|
},
|
||||||
|
"plan2code-ui-prototype": {
|
||||||
|
"none": { on: true },
|
||||||
|
diagnosed: { on: true },
|
||||||
|
fixed: { on: true },
|
||||||
|
exploring: { on: true },
|
||||||
|
mapped: { on: true },
|
||||||
|
planned: { on: true },
|
||||||
|
documented: { on: true },
|
||||||
|
building: { on: true },
|
||||||
|
built: { on: true },
|
||||||
|
unrecognized: { on: true },
|
||||||
|
},
|
||||||
"plan2code-changelog": {
|
"plan2code-changelog": {
|
||||||
"none": { on: true },
|
"none": { on: true },
|
||||||
diagnosed: { on: true },
|
diagnosed: { on: true },
|
||||||
@@ -478,6 +490,43 @@ test("the scan: a PR-READINESS report changes no spec's state, and alone it stay
|
|||||||
assert.equal(scanOf({ only: REPORT }).only[0], "unrecognized");
|
assert.equal(scanOf({ only: REPORT }).only[0], "unrecognized");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("the scan: saved prototypes are counted in every spec's detail, and alone they stay files on disk", () => {
|
||||||
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "p2c-spec-prototypes-"));
|
||||||
|
const SAVED = (n) => Object.fromEntries(Array.from({ length: n }, (_, i) => [[`prototypes/screen-${i + 1}.html`, "<!doctype html>\n"], [`prototypes/screen-${i + 1}.md`, "# Screen\n"]]).flat());
|
||||||
|
const specs = {
|
||||||
|
one: SAVED(1),
|
||||||
|
two: SAVED(2),
|
||||||
|
planned: { ...FIXTURES.planned, ...SAVED(2) },
|
||||||
|
building: { ...FIXTURES.building, ...SAVED(2) },
|
||||||
|
empty: { ...FIXTURES.planned },
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
for (const [name, files] of Object.entries(specs))
|
||||||
|
for (const [rel, text] of Object.entries(files)) {
|
||||||
|
const file = path.join(root, "specs", name, rel);
|
||||||
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||||
|
fs.writeFileSync(file, text);
|
||||||
|
}
|
||||||
|
fs.mkdirSync(path.join(root, "specs", "empty", "prototypes"));
|
||||||
|
const by = Object.fromEntries(scanProject(root).specs.map((sp) => [sp.name, sp]));
|
||||||
|
assert.deepEqual([by.one.state, by.one.detail], ["unrecognized", "1 prototype saved"]);
|
||||||
|
assert.deepEqual([by.two.state, by.two.detail], ["unrecognized", "2 prototypes saved"]);
|
||||||
|
assert.deepEqual([by.planned.state, by.planned.detail], ["planned", "plan drafted · 2 prototypes"]);
|
||||||
|
assert.deepEqual([by.building.state, by.building.detail], ["building", "1 of 2 tasks done · 2 prototypes"]);
|
||||||
|
assert.deepEqual([by.empty.state, by.empty.detail], ["planned", "plan drafted"], "an empty prototypes/ folder changes nothing");
|
||||||
|
// A prototype-only spec lights only Pathfinder and Plan among the pipeline cards.
|
||||||
|
const lit = CARD_ENTRIES.filter((e) => e.group === "pipeline" && cardAvailability(e, SCAN, by.one).on).map((e) => e.skill);
|
||||||
|
assert.deepEqual(lit, ["plan2code-0-pathfinder", "plan2code-1-plan"]);
|
||||||
|
// Each spec carries its count, and a prototype-only folder rides along on Quick Task.
|
||||||
|
assert.deepEqual([by.one.prototypes, by.two.prototypes, by.building.prototypes, by.empty.prototypes], [1, 2, 2, 0]);
|
||||||
|
const quick = CARD_ENTRIES.find((e) => e.skill === "plan2code-quick-task");
|
||||||
|
assert.equal(launchTarget(quick, by.one).dir, "specs/one");
|
||||||
|
assert.equal(launchTarget(quick, by.building), null);
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(root, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("the scan: an assumed task counts as done and is named, and numbered task lines count", () => {
|
test("the scan: an assumed task counts as done and is named, and numbered task lines count", () => {
|
||||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "p2c-spec-assumed-"));
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), "p2c-spec-assumed-"));
|
||||||
const specs = {
|
const specs = {
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ test("every console workflow has its notes, and its skill's Interface reads them
|
|||||||
init: "init", "init-update": "init", pathfinder: "pathfinder", plan: "plan", "revise-plan": "revise-plan",
|
init: "init", "init-update": "init", pathfinder: "pathfinder", plan: "plan", "revise-plan": "revise-plan",
|
||||||
document: "document", implement: "implement", "implement-review": "implement", "quick-task": "quick-task",
|
document: "document", implement: "implement", "implement-review": "implement", "quick-task": "quick-task",
|
||||||
review: "review", finalize: "finalize", handoff: "handoff", changelog: "changelog", git: "git", xray: "xray",
|
review: "review", finalize: "finalize", handoff: "handoff", changelog: "changelog", git: "git", xray: "xray",
|
||||||
diagnose: "diagnose", "pr-prep": "pr-prep", test: "test", "dead-code": "dead-code",
|
diagnose: "diagnose", "pr-prep": "pr-prep", test: "test", "dead-code": "dead-code", "ui-prototype": "ui-prototype",
|
||||||
};
|
};
|
||||||
const skills = fs.readdirSync(path.join(ROOT, "src")).filter((f) => /^plan2code(-.*)?\.md$/.test(f));
|
const skills = fs.readdirSync(path.join(ROOT, "src")).filter((f) => /^plan2code(-.*)?\.md$/.test(f));
|
||||||
for (const f of skills) {
|
for (const f of skills) {
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ Every other plan2code step forbids writing code during planning. **Pathfinder is
|
|||||||
**All three gates must open before you write a line of code:**
|
**All three gates must open before you write a line of code:**
|
||||||
|
|
||||||
1. The paper sketch was tried and did not settle it. Not skipped — tried. Say what the paper sketch failed to resolve.
|
1. The paper sketch was tried and did not settle it. Not skipped — tried. Say what the paper sketch failed to resolve.
|
||||||
2. There is an obvious way to run it in this project — an existing runtime and task runner. Do not add a package manager, language, or framework for a sketch.
|
2. There is an obvious way to run it in this project — an existing runtime and task runner. Do not add a package manager, language, or framework for a sketch. (Logic sketches only: a UI prototype runs on this skill's own scripts, so only gates 1 and 3 apply to it.)
|
||||||
3. The user says go. Ask explicitly: *"Paper didn't settle row 5. I can build a throwaway terminal app under `specs/audit-export/pathfinder/sketch-01/` that lets you drive the state machine by hand — about 60 lines, one command, deleted after. Go?"*
|
3. The user says go. Ask explicitly: *"Paper didn't settle row 5. I can build a throwaway terminal app under `specs/audit-export/pathfinder/sketch-01/` that lets you drive the state machine by hand — about 60 lines, one command, deleted after. Go?"*
|
||||||
|
|
||||||
Any gate that stays shut: stay on paper, or convert the question to a `grill`.
|
Any gate that stays shut: stay on paper, or convert the question to a `grill`.
|
||||||
@@ -324,11 +324,11 @@ Any gate that stays shut: stay on paper, or convert the question to a `grill`.
|
|||||||
#### Rules for a runnable sketch
|
#### Rules for a runnable sketch
|
||||||
|
|
||||||
1. **Throwaway from day one, and clearly marked.** Its README's first line is the banner, and its second says what question it exists to answer.
|
1. **Throwaway from day one, and clearly marked.** Its README's first line is the banner, and its second says what question it exists to answer.
|
||||||
2. **It lives ONLY at `specs/<idea>/pathfinder/sketch-NN/`** — never in the project's own source tree, never beside the module it is sketching for. This is where pathfinder deliberately departs from upstream: upstream co-locates prototypes with the real code; pathfinder quarantines them, because `specs/` is gitignored scratch and the project tree is not.
|
2. **It lives ONLY at `specs/<idea>/pathfinder/sketch-NN/`** (logic sketches only; a UI prototype keeps its drafts outside the project and saves into `specs/<idea>/prototypes/`) — never in the project's own source tree, never beside the module it is sketching for. This is where pathfinder deliberately departs from upstream: upstream co-locates prototypes with the real code; pathfinder quarantines them, because `specs/` is gitignored scratch and the project tree is not.
|
||||||
3. **One command to run.** Print the exact command to the user. They must not have to remember a path or a flag. If the project has a task runner, use the runner's own idiom, but keep the entry point inside `sketch-NN/`.
|
3. **One command to run.** Print the exact command to the user. They must not have to remember a path or a flag. If the project has a task runner, use the runner's own idiom, but keep the entry point inside `sketch-NN/`.
|
||||||
4. **No persistence.** State lives in memory. Persistence is what the sketch is checking, not something it leans on. If the question is specifically about storage, use a local file named so its disposability is obvious.
|
4. **No persistence.** State lives in memory. Persistence is what the sketch is checking, not something it leans on. If the question is specifically about storage, use a local file named so its disposability is obvious.
|
||||||
5. **Skip all polish.** No tests, no error handling beyond what makes it run, no abstractions, no "we might want X later."
|
5. **Skip all polish.** No tests, no error handling beyond what makes it run, no abstractions, no "we might want X later."
|
||||||
6. **Surface the full relevant state after every action** (logic) **or on every variant switch** (UI). The user must see the whole picture change, not a delta.
|
6. **Surface the full relevant state after every action.** The user must see the whole picture change, not a delta.
|
||||||
7. **Never merged.** The sketch is not lifted into the project. Only the validated decision it produced survives, in the `## Answer`. Reference the sketch directory from `## Evidence` so a later reader can re-run it, but the code is scaffolding, not output.
|
7. **Never merged.** The sketch is not lifted into the project. Only the validated decision it produced survives, in the `## Answer`. Reference the sketch directory from `## Evidence` so a later reader can re-run it, but the code is scaffolding, not output.
|
||||||
|
|
||||||
#### Pick the branch: logic or UI
|
#### Pick the branch: logic or UI
|
||||||
@@ -336,13 +336,13 @@ Any gate that stays shut: stay on paper, or convert the question to a `grill`.
|
|||||||
| Question shape | Branch | Artifact |
|
| Question shape | Branch | Artifact |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| "Does this state model / data model / rule hold?" | **Logic** | One tiny interactive terminal app |
|
| "Does this state model / data model / rule hold?" | **Logic** | One tiny interactive terminal app |
|
||||||
| "What should this look like?" | **UI** | Several radically different variations, switchable |
|
| "What should this look like?" | **UI** | UI prototype |
|
||||||
|
|
||||||
Getting this wrong wastes the entire sketch. If the question is genuinely ambiguous and the user is unreachable, default by what the question touches — a backend module or a rules engine points to logic, a page or component points to UI — and **state the assumption in the first lines of the sketch's README**, so the human can reject the framing before reading the code.
|
Getting this wrong wastes the entire sketch. If the question is genuinely ambiguous and the user is unreachable, default by what the question touches — a backend module or a rules engine points to logic, a page or component points to UI — and **state the assumption in the first lines of the sketch's README** (for a UI prototype, in the line that offers it), so the human can reject the framing before reading the code.
|
||||||
|
|
||||||
**Logic branch.** Build the smallest interactive terminal app that pushes the machine through the cases that are hard to reason about on paper. Keep the logic itself pure — a reducer, a state machine, or a small set of pure functions over a plain data type — with the terminal shell as a thin wrapper that imports it and never the reverse. Each frame: clear the screen, print the whole current state one field per line, then print the key legend, e.g. `[f] flag [c] clear [e] escalate [h] hold [t] advance clock 1d [q] quit`. Re-render the entire frame after every keystroke; never append to scrollback. The whole frame fits on one screen. The interesting moment is the user saying "wait, that shouldn't have been possible" — that is a bug in the *idea*, which is the entire point. Add actions on request; sketches evolve.
|
**Logic branch.** Build the smallest interactive terminal app that pushes the machine through the cases that are hard to reason about on paper. Keep the logic itself pure — a reducer, a state machine, or a small set of pure functions over a plain data type — with the terminal shell as a thin wrapper that imports it and never the reverse. Each frame: clear the screen, print the whole current state one field per line, then print the key legend, e.g. `[f] flag [c] clear [e] escalate [h] hold [t] advance clock 1d [q] quit`. Re-render the entire frame after every keystroke; never append to scrollback. The whole frame fits on one screen. The interesting moment is the user saying "wait, that shouldn't have been possible" — that is a bug in the *idea*, which is the entire point. Add actions on request; sketches evolve.
|
||||||
|
|
||||||
**UI branch.** Generate **several radically different variations side by side, switchable** — not one polished take. Default to 3, cap at 5. They must disagree about structure: different layout, different information hierarchy, different primary affordance. Three tweaked card grids is wallpaper, not a sketch. If two drafts come out similar, redo one with an explicit constraint against the shape they share. Switch by a URL search param plus a small floating bar (previous / current variant name / next), following whatever routing convention the project already uses — but with the files under `sketch-NN/`. Wire variants to stubbed data, never to real mutations; the question is what it should look like, not whether the backend works. The most valuable feedback is usually "I want the header from B with the list from C" — that hybrid IS the answer, and it goes in the `## Answer`.
|
**UI branch.** Offer a UI prototype instead of building a sketch. On a yes, open `references/ui-prototype.md` and follow it from its Step 1, with the question's own wording as the request. Each round drawn posts the `ui-prototype-round` meter event. On a yes to saving, the pair goes straight into `specs/<idea>/prototypes/`; you only propose the name. Record the outcome in the question file being answered: the choices from the block in its `## Answer`, a link to the saved pair (`prototypes/<name>.md` and `prototypes/<name>.html`) in its `## Evidence`. The most valuable feedback is usually "I want the header from B with the list from C": that hybrid IS the answer.
|
||||||
|
|
||||||
#### After a runnable sketch
|
#### After a runnable sketch
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ Load `./AGENTS.md` if it exists — its conventions govern; never re-ask what it
|
|||||||
- **HITL questions are never self-answered.** Ask and wait; an agent that answers its own grill has broken the skill.
|
- **HITL questions are never self-answered.** Ask and wait; an agent that answers its own grill has broken the skill.
|
||||||
- **Questions are ground truth; the map is a rebuildable index.** A filled `## Answer` beats any state marker; detail lives in one place.
|
- **Questions are ground truth; the map is a rebuildable index.** A filled `## Answer` beats any state marker; detail lives in one place.
|
||||||
- **Never write implementation code** into the project. Sketches are throwaway, living only under `pathfinder/sketch-NN/`.
|
- **Never write implementation code** into the project. Sketches are throwaway, living only under `pathfinder/sketch-NN/`.
|
||||||
|
- A question about how a screen looks or flows that paper did not settle: offer a UI prototype (`references/ui-prototype.md`, run in this conversation). Nothing is built without a yes; it stays a draft outside the project unless saved.
|
||||||
- **Reserved names — never create inside `pathfinder/`:** `overview.md`, `phase-<N>.md`, `PLAN-DRAFT-*.md`, `PLAN-CONVERSATION-*.md`.
|
- **Reserved names — never create inside `pathfinder/`:** `overview.md`, `phase-<N>.md`, `PLAN-DRAFT-*.md`, `PLAN-CONVERSATION-*.md`.
|
||||||
- **Never emit completion tokens under `specs/`** — `TASK_COMPLETE`, `PHASE_COMPLETE`, `ALL_TASKS_COMPLETE`, `IMPLEMENTATION_COMPLETE`, `SPEC_COMPLETE`, `WORK_COMPLETE`. They are reserved; a stray one would read as a finished run.
|
- **Never emit completion tokens under `specs/`** — `TASK_COMPLETE`, `PHASE_COMPLETE`, `ALL_TASKS_COMPLETE`, `IMPLEMENTATION_COMPLETE`, `SPEC_COMPLETE`, `WORK_COMPLETE`. They are reserved; a stray one would read as a finished run.
|
||||||
- **No `- [ ]` checkboxes inside question files**, and no `METRICS_JSON` anywhere.
|
- **No `- [ ]` checkboxes inside question files**, and no `METRICS_JSON` anywhere.
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ Before Phase 1, run `node "<S>/specs.mjs" list` from the project root (`<S>`: `s
|
|||||||
- Status "Draft" or "Complete": Ask user how to proceed
|
- Status "Draft" or "Complete": Ask user how to proceed
|
||||||
- Before going on with any existing draft (a Pathfinder handoff, a Quick Task escalation, a Draft or Complete one), read its 2.4: `| Status | Deferred to Plan |`, empty or `Not discussed` means ask the Phase 1 testing question now and write the answer into 2.4; a cadence with no `Full Suite` row means ask only the full-suite part.
|
- Before going on with any existing draft (a Pathfinder handoff, a Quick Task escalation, a Draft or Complete one), read its 2.4: `| Status | Deferred to Plan |`, empty or `Not discussed` means ask the Phase 1 testing question now and write the answer into 2.4; a cadence with no `Full Suite` row means ask only the full-suite part.
|
||||||
- A spec folder holding a `DIAGNOSIS-*.md` (Diagnose's write-up of a bug): read it first, as the Phase 1 brief (the bug, its cause, the suggested fix); that folder's name is the feature name (do not ask for one), so the PLAN-DRAFT lands beside the diagnosis
|
- A spec folder holding a `DIAGNOSIS-*.md` (Diagnose's write-up of a bug): read it first, as the Phase 1 brief (the bug, its cause, the suggested fix); that folder's name is the feature name (do not ask for one), so the PLAN-DRAFT lands beside the diagnosis
|
||||||
|
- A spec folder holding `prototypes/*.md` has saved prototype choices: read each as a reference to build from
|
||||||
- No PLAN-DRAFT: Begin at Phase 1. Console: its idea card carries `"templates": "idea"` (console.md → A patch)
|
- No PLAN-DRAFT: Begin at Phase 1. Console: its idea card carries `"templates": "idea"` (console.md → A patch)
|
||||||
|
|
||||||
`node "<S>/specs.mjs" check-draft specs/<feature-name>` checks a written PLAN-DRAFT (Phase 7).
|
`node "<S>/specs.mjs" check-draft specs/<feature-name>` checks a written PLAN-DRAFT (Phase 7).
|
||||||
@@ -102,6 +103,8 @@ Report each sub-score with overall percentage.
|
|||||||
2. Reference materials? (designs, mockups, API specs)
|
2. Reference materials? (designs, mockups, API specs)
|
||||||
3. External systems/APIs to integrate?
|
3. External systems/APIs to integrate?
|
||||||
|
|
||||||
|
When a requirement or an architecture choice turns on how a screen looks or flows, offer a UI prototype (`references/ui-prototype.md`, run in this conversation): nothing is built without a yes, and a yes to saving puts `prototypes/<name>.html` and `<name>.md` in this spec (no spec folder yet: ask the kebab-case feature name then, and keep it for the checkpoint and Phase 7).
|
||||||
|
|
||||||
After confirmation, proceed with analysis:
|
After confirmation, proceed with analysis:
|
||||||
|
|
||||||
1. Read all provided information; research the domain for standards and unstated needs
|
1. Read all provided information; research the domain for standards and unstated needs
|
||||||
@@ -259,7 +262,7 @@ File: `specs/<feature-name>/PLAN-DRAFT-<YYYYMMDD>.md`
|
|||||||
Header: Title, Created date, Status (Draft | Phase 3 Complete - Resume at Phase 4 | Complete), Confidence % (Reqs/Feasibility/Integration/Risk each /25), link to PLAN-CONVERSATION.
|
Header: Title, Created date, Status (Draft | Phase 3 Complete - Resume at Phase 4 | Complete), Confidence % (Reqs/Feasibility/Integration/Risk each /25), link to PLAN-CONVERSATION.
|
||||||
|
|
||||||
Sections:
|
Sections:
|
||||||
1. **Executive Summary** — 2-3 sentences
|
1. **Executive Summary** — 2-3 sentences, then a **Prototypes** line naming each saved `prototypes/<name>.md` as a reference to build from (only when there are any)
|
||||||
2. **Requirements** — 2.1 Functional (FR-N checklist), 2.2 Non-Functional (NFR-N checklist), 2.3 Out of Scope, 2.4 Testing Strategy table (Types, Phase Testing, Full Suite, Coverage, plus a `| Approach | Test first |` row only when picked; absent means code first). Phase Testing is `Targeted per phase`, `Dedicated phase only` or `None` (an old `Run after each phase` reads as `Targeted per phase`; 'skip testing' writes `None` and `Never`); Full Suite is `Offered at Finalize`, `At Phase N` or `Never`
|
2. **Requirements** — 2.1 Functional (FR-N checklist), 2.2 Non-Functional (NFR-N checklist), 2.3 Out of Scope, 2.4 Testing Strategy table (Types, Phase Testing, Full Suite, Coverage, plus a `| Approach | Test first |` row only when picked; absent means code first). Phase Testing is `Targeted per phase`, `Dedicated phase only` or `None` (an old `Run after each phase` reads as `Targeted per phase`; 'skip testing' writes `None` and `Never`); Full Suite is `Offered at Finalize`, `At Phase N` or `Never`
|
||||||
3. **Tech Stack** — table: Category / Technology / Version / Justification
|
3. **Tech Stack** — table: Category / Technology / Version / Justification
|
||||||
4. **Architecture** — 4.1 Pattern (name + rationale), 4.2 System Context Diagram, 4.3 Components table, 4.4 Data Model, 4.5 API Design
|
4. **Architecture** — 4.1 Pattern (name + rationale), 4.2 System Context Diagram, 4.3 Components table, 4.4 Data Model, 4.5 API Design
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ The FIRST thing you do, before anything else in this file — before Step 1, bef
|
|||||||
- This mode modifies **`specs/` paths only** — do NOT implement code or modify any file outside `specs/`
|
- This mode modifies **`specs/` paths only** — do NOT implement code or modify any file outside `specs/`
|
||||||
- **Allowed file paths:** ONLY paths under `specs/`. Forbidden: `skills/`, `src/`, `.claude/`, `.agents/`, `.codeium/`, configs, source code. Creating, modifying, or deleting any file outside `specs/` is a violation.
|
- **Allowed file paths:** ONLY paths under `specs/`. Forbidden: `skills/`, `src/`, `.claude/`, `.agents/`, `.codeium/`, configs, source code. Creating, modifying, or deleting any file outside `specs/` is a violation.
|
||||||
- **Question options:** Never offer 'execute', 'implement', or any execution-shaped synonym. Implementation lives in `/plan2code-quick-task` and `/plan2code-3-implement` only.
|
- **Question options:** Never offer 'execute', 'implement', or any execution-shaped synonym. Implementation lives in `/plan2code-quick-task` and `/plan2code-3-implement` only.
|
||||||
- **Web console exception:** the console's temporary payload files (outside the repo, in the session folder `open` prints) are the one allowed write outside `specs/`. They are messages to the page, never project files.
|
- **Web console exception:** the console's temporary payload files (outside the repo, in the session folder `open` prints) are the one allowed write outside `specs/`. They are messages to the page, never project files. A UI prototype's drafts (the round folders its scripts make and sweep under `~/.plan2code/prototypes/`) are allowed too: they sit outside the project.
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
@@ -61,6 +61,8 @@ Do not proceed without spec files.
|
|||||||
|---------------|-------|----------|
|
|---------------|-------|----------|
|
||||||
| [Component] | [File list] | [Section names] |
|
| [Component] | [File list] | [Section names] |
|
||||||
|
|
||||||
|
4. When the change is about how a screen looks or flows, offer a UI prototype before the impact assessment (`references/ui-prototype.md`, run in this conversation): nothing is built without a yes, and a yes to saving puts `prototypes/<name>.html` and `<name>.md` in this spec.
|
||||||
|
|
||||||
Present findings and confirm understanding before continuing.
|
Present findings and confirm understanding before continuing.
|
||||||
|
|
||||||
### STEP 2: Impact Assessment
|
### STEP 2: Impact Assessment
|
||||||
@@ -141,6 +143,8 @@ Approve the spec-update plan? (approve / refine / abort). Implementation of any
|
|||||||
|
|
||||||
6. **A waiting brief:** rewrite its `**Plan change:**` line to `**Plan change (applied <YYYY-MM-DD>):**` when this revision covers it, or `**Plan change (dropped <YYYY-MM-DD>):**` when the person replaced or declined it at Step 1, so the dashboard and Implement stop pointing back here.
|
6. **A waiting brief:** rewrite its `**Plan change:**` line to `**Plan change (applied <YYYY-MM-DD>):**` when this revision covers it, or `**Plan change (dropped <YYYY-MM-DD>):**` when the person replaced or declined it at Step 1, so the dashboard and Implement stop pointing back here.
|
||||||
|
|
||||||
|
7. **A saved prototype:** point each revised task that builds the screen at its `prototypes/<name>.md`.
|
||||||
|
|
||||||
### STEP 4: Consistency Check
|
### STEP 4: Consistency Check
|
||||||
|
|
||||||
`🔄 [REVISION] Step 4: Consistency Check`
|
`🔄 [REVISION] Step 4: Consistency Check`
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ Needs the spec files. `specs/` is gitignored, so never search it with a file sea
|
|||||||
|
|
||||||
Then read overview.md and act on `next` (Parallel Phase Selection below). Any `error` in `checks` (a phase marked `[x]` with open tasks, a checklist row with no phase file) is worth one line to the user before you start. Do not proceed without a readable overview.md and a `next` verdict.
|
Then read overview.md and act on `next` (Parallel Phase Selection below). Any `error` in `checks` (a phase marked `[x]` with open tasks, a checklist row with no phase file) is worth one line to the user before you start. Do not proceed without a readable overview.md and a `next` verdict.
|
||||||
|
|
||||||
|
A spec with `prototypes/*.md` (saved prototype choices): read the ones overview.md or the phase's tasks name, and open the matching `.html` only when a task says to match it.
|
||||||
|
|
||||||
## Phase Status Tracking
|
## Phase Status Tracking
|
||||||
|
|
||||||
| Checkbox | Status | Meaning |
|
| Checkbox | Status | Meaning |
|
||||||
|
|||||||