mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-29 21:21:18 -08:00
Add text size buttons to the console's top bar (v3.2.1)
AI Assisted
This commit is contained in:
1 parent
8277c8b548
commit
634e4df10e
25 files changed
+188
-40
No files matched your search
@@ -45,7 +45,7 @@ One row per file of every game but Ghoul Rush (which has its own files: [core](.
|
||||
| `public/activities/snake-music.js` | Snake's ten music tracks as data (no imports): `SNAKE_MUSIC`, `{ bpm, rush, voices, patterns, order }` each, named `snake<Place>` and listed in `MUSIC_TRACKS` in `snake.js`. A round deals them in a fresh order, one to each level, so a run hears a different track at every level and none twice. They were picked on the pages in `prototypes/music/snake` (rhythm-first folk and world tunes led by something plucked or reedy, mostly dark or modal), and their bars are not all sixteen steps: 6/8 is 12, 7/8 is 14, ten beats is 20, twelve beats is 24, each pattern a whole number of its bars; merged by `snake-sfx.js` |
|
||||
| `public/activities/light-trails/1.mp3` to `5.mp3` | Light Trails' five background songs, named `trailsSong1` to `trailsSong5` under `songs` in `trails-sfx.js` and listed in `SERVABLE`; re-encoded for size with ffmpeg (80 kbps stereo MP3 at 44.1 kHz, loudness-normalized to -16 LUFS with `loudnorm`, metadata stripped), about 7.6 MB together, and copied into every skill with the rest of the console. The server leaves them out of its start-up cache warm |
|
||||
| `public/activities/flock-dash/1.mp3` to `5.mp3` | Flock Dash's five background songs, named `flockSong1` to `flockSong5` under `songs` in `flock-sfx.js` and listed in `SERVABLE`; re-encoded for size with ffmpeg the way Light Trails' were (80 kbps stereo MP3 at 44.1 kHz, loudness-normalized to -16 LUFS with `loudnorm`, metadata stripped), about 6.4 MB together, and copied into every skill with the rest of the console. The server leaves them out of its start-up cache warm; `flock.js` deals all five in a fresh order each round with `dealMusic()`, plays each in full one after another and deals again after the last, never opening on the song that just ended |
|
||||
| `public/screens/activities.js` | Activities: `#btn-activities` (the die right of the megaphone), `#activities-modal`, the one frame timer (`requestAnimationFrame`, swappable with `setTickSource()` for the page tests), the keys (arrows, W/A/S/D, space, P, Esc; stopped at the dialog so none reach the page behind; `CHEAT_CODE`, typed on a game's board, turns on endless lives through the game's `cheat(on)` until the round starts over, and `dropCheats()` turns it off on leaving for the picker or closing; `STAGE_CODE`, the same arrows then S, calls the game's `stageSelect()` where it has one, Ghoul Rush's practice stage select) and `pauseAll()`, which a new question, a finish, a hidden page, a window blur and a close all go through and which never resumes a game (it also sends a pointer game a cancel, dropping a drag). Canvas pointer events (down, move, up, cancel, with pointer capture) go to a game with `pointer()`, and key releases to a game with `release()`; a press on a paused board resumes without starting a drag. While paused, any game key or a board click resumes, except while a round is `held`: a question or finish that pauses a round on an open window holds it, the banner adds `#activities-unpause` (**Unpause game**) beside **Go to it**, and only that button plays on (`play()` refuses a held round), since a key or click already on its way used to dismiss the banner unread. Go to it, or closing the window any other way, lets the hold go, and a banner with nothing left to say drops it. Every start and play-on first counts down 3, 2, 1 (`COUNT_FROM`, 700 ms a number, `setCountdownMs()` for the page tests, which set 0 unless they test it): the game is already `running`, the frame timer just does not tick it, and game keys, overlay clicks and board presses wait, while P and Esc still pause. With two or more games listed the window opens on the picker (`view`: `"picker"` or `"game"`, `applyView()`): a picker of game rows in two columns (`drawPicker()`: an Order bar with **Recently played** and **A to Z**, saved in `activityOrder`, and the game count; one grid of `.activities-row` buttons from `orderGames()`, with never-picked games under a **Not played yet** heading that spans both columns; covers in `COVERS` drawn as SVG with `cv-*` token classes, since the page's policy refuses a style attribute) with each game's blurb, a best chip (thousands separators) and a **Last played** or **Paused at N** tag, arrows walking the rows and the course cards by position (`moveFocus()`: left and right through the list, up and down to the nearest button in the next line; an Order button keeps its arrows), and `#activities-back` (**All games**) back to it. One game at a time: `pick()` drops the last game from `games` when another is picked, and `openActivities()` goes straight back into a paused round. The last pick is kept as `lastActivity` and gets the focus; `lowerIsBetter` games keep the lowest round as the best; the header shows the current game's best (`paintTitle()`). `renderActivities()` in the render pass compares `myTurn()` and `finish()` with the last render and shows the banner with **Go to it**. Loads a game with `import()` when it is picked and keeps it until another is picked; `setActivityList()` lets a test list a stub second game, which brings up the picker |
|
||||
| `public/screens/activities.js` | Activities: `#btn-activities` (the die, right of the text size control), `#activities-modal`, the one frame timer (`requestAnimationFrame`, swappable with `setTickSource()` for the page tests), the keys (arrows, W/A/S/D, space, P, Esc; stopped at the dialog so none reach the page behind; `CHEAT_CODE`, typed on a game's board, turns on endless lives through the game's `cheat(on)` until the round starts over, and `dropCheats()` turns it off on leaving for the picker or closing; `STAGE_CODE`, the same arrows then S, calls the game's `stageSelect()` where it has one, Ghoul Rush's practice stage select) and `pauseAll()`, which a new question, a finish, a hidden page, a window blur and a close all go through and which never resumes a game (it also sends a pointer game a cancel, dropping a drag). Canvas pointer events (down, move, up, cancel, with pointer capture) go to a game with `pointer()`, and key releases to a game with `release()`; a press on a paused board resumes without starting a drag. While paused, any game key or a board click resumes, except while a round is `held`: a question or finish that pauses a round on an open window holds it, the banner adds `#activities-unpause` (**Unpause game**) beside **Go to it**, and only that button plays on (`play()` refuses a held round), since a key or click already on its way used to dismiss the banner unread. Go to it, or closing the window any other way, lets the hold go, and a banner with nothing left to say drops it. Every start and play-on first counts down 3, 2, 1 (`COUNT_FROM`, 700 ms a number, `setCountdownMs()` for the page tests, which set 0 unless they test it): the game is already `running`, the frame timer just does not tick it, and game keys, overlay clicks and board presses wait, while P and Esc still pause. With two or more games listed the window opens on the picker (`view`: `"picker"` or `"game"`, `applyView()`): a picker of game rows in two columns (`drawPicker()`: an Order bar with **Recently played** and **A to Z**, saved in `activityOrder`, and the game count; one grid of `.activities-row` buttons from `orderGames()`, with never-picked games under a **Not played yet** heading that spans both columns; covers in `COVERS` drawn as SVG with `cv-*` token classes, since the page's policy refuses a style attribute) with each game's blurb, a best chip (thousands separators) and a **Last played** or **Paused at N** tag, arrows walking the rows and the course cards by position (`moveFocus()`: left and right through the list, up and down to the nearest button in the next line; an Order button keeps its arrows), and `#activities-back` (**All games**) back to it. One game at a time: `pick()` drops the last game from `games` when another is picked, and `openActivities()` goes straight back into a paused round. The last pick is kept as `lastActivity` and gets the focus; `lowerIsBetter` games keep the lowest round as the best; the header shows the current game's best (`paintTitle()`). `renderActivities()` in the render pass compares `myTurn()` and `finish()` with the last render and shows the banner with **Go to it**. Loads a game with `import()` when it is picked and keeps it until another is picked; `setActivityList()` lets a test list a stub second game, which brings up the picker |
|
||||
| `public/styles/activities.css` | the Activities rules: the die in the top bar, the Notebook-sized dialog, the board and its state overlay, the your-turn banner in the highlight color, the picker and the notes |
|
||||
|
||||
**Building an Activities game:** the rules every game follows, so a new one plays like the rest.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Key design points:
|
||||
|
||||
- **First-run Welcome.** The first dashboard a person sees (after the wake-up finishes) opens `#welcome-modal`. Any close (button, Esc, backdrop) saves `looks.welcomeSeen: true` to `looks.json`, which survives "Reset this tab". The four columns teach Pick a card, Answer then Send, Watch the terminal (the in-app wording names the terminal panel) and Get help; the session meter's one-time tip lives in the meter popover (`looks.meterTipSeen`). `looks.skillLaunched` is set by the first skill launch from this machine (`launchSkill()`) and, like `welcomeSeen`, is never reset: until it is set the dashboard holds the role line and draws Learning "Not set up" at the bottom, and after it one quiet line offers the two optional extras. Help's first tab has a **Show the welcome again** link (`data-action="welcome"`). Logic: `maybeWelcome()` / `openWelcome()` in `screens/help-dialog.js`.
|
||||
- **Top-bar icons.** `#btn-looks` (gear) opens `#looks-modal`, titled User Preferences (see User Preferences below). `#btn-feedback` (megaphone) is a plain link to `https://github.com/jparkerweb/plan2code/issues/new/choose`, backed by `.github/ISSUE_TEMPLATE/bug.yml` and `idea.yml` (`config.yml` sets `blank_issues_enabled: false`). `DEFAULT_ACCENT` in `palette.js` is `ocean`.
|
||||
- **Top-bar icons.** `#btn-looks` (gear) opens `#looks-modal`, titled User Preferences (see User Preferences below). `#btn-feedback` (megaphone) is a plain link to `https://github.com/jparkerweb/plan2code/issues/new/choose`, backed by `.github/ISSUE_TEMPLATE/bug.yml` and `idea.yml` (`config.yml` sets `blank_issues_enabled: false`). `#text-size` (right of the megaphone, left of the die) is `[-]`, a size label and `[+]`: seven steps in `TEXT_SIZES` (`palette.js`, 80 to 150%), saved as `looks.textSize`, painted as `data-text-size` on `<html>` (the server writes it into the first paint too) and read by `tokens.css`, whose `--fs-*` steps multiply by `--text-scale`; the label returns to 100%, and a button at an end of the range is `aria-disabled`. `DEFAULT_ACCENT` in `palette.js` is `ocean`.
|
||||
- **Version in Help.** `GET /version` reads `version.json` beside `server.mjs`, falling back to `../../version.json` for a run from `src/` (the `/version` route in `routes.mjs`). `renderHelpVersion()` in `screens/help-dialog.js` fills `#help-version`. `computeExpectedSkills()` in `install.js` injects the root `version.json` into every `references/web-console/`, so a version bump changes every skill.
|
||||
- **User Preferences is four tabs in a side list.** Appearance (Theme, Card width, Highlight color, Role), Agents & models, System (Cleanup, and Desktop app inside the app only) and Sounds & activities (Sounds, Activities), a sideways strip below 720 px. The tabs are the static `<section class="prefs-panel">` panels in `#looks-modal`, each fieldset in exactly one (its `data-section`, listed in `PREFS_TABS`), wired by the shared `public/tabs.js` (`wireTabs()`, the same helper Help uses: `helpKeyTarget()` re-exports its `tabKeyTarget()`). `public/prefs.js` is the pure part: `PREFS_TABS`, `prefsOpenTab()` (the gear and the dashboard's Set up preferences both open Appearance; nothing is remembered between opens) and `prefsResetScope()` (Reset this tab, with an "Reset. Undo" mark for eight seconds, resets only the shown tab's looks keys, and is hidden on Agents & models and System). `screens/prefs-dialog.js` owns `openPrefs(tab)`, the one way in, the Saved mark and the unsaved prompt; `screens/looks.js` keeps the look and sound controls, which save to `looks.json` as they change; `screens/agents-view.js` mounts the Agents & models tab, a master-detail split over today's `models.json` and `agents.json` (formats unchanged) whose per-agent form has its own Save and Discard: Save sends the last saved list with only that form's draft swapped in, so another form's half-typed edit is never written. The split's components live under `screens/agents/` (data, list editor, summary, form); the mount owns all state and every fetch and hands them one `ctx`.
|
||||
- **Models in User Preferences.** `GET` / `POST /models` in `routes.mjs` read the shipped `~/.plan2code/bin/models.json` and read/write the user's `~/.plan2code/models.json` (`SHIPPED_MODELS_FILE` / `USER_MODELS_FILE` in `files.mjs`), edited from each built-in agent's form on the Agents & models tab. `PLAN2CODE_MODELS_DIR` relocates both for tests. The launcher reads the same two files for its model menu.
|
||||
|
||||
@@ -104,16 +104,11 @@
|
||||
- About: plan2code-app/ui/theme-early.js
|
||||
- Noted: 2026-11-17, implement-review
|
||||
|
||||
### The launcher's prompts each open a new readline on stdin, so a test piping several answers at once loses all but the first; drive a multi-prompt flow by writing each answer after a short delay.
|
||||
### To drive several launcher prompts in scripts/test-launcher.mjs, use runAtTerminal(): each prompt opens a new readline on stdin, so piping all answers at once loses every one after the first.
|
||||
- Kind: how-it-works
|
||||
- About: src/launcher/plan2code.js
|
||||
- Noted: 2026-11-15, implement-review
|
||||
|
||||
### To drive launcher prompts in scripts/test-launcher.mjs, use runAtTerminal(): it marks stdin as a terminal with a preload file and answers each prompt only once it shows on stdout.
|
||||
- Kind: convention
|
||||
- About: scripts/test-launcher.mjs
|
||||
- About: src/launcher/plan2code.js, scripts/test-launcher.mjs
|
||||
- Why: Each launcher prompt opens a new readline, so piping all answers at once loses every answer after the first.
|
||||
- Noted: 2026-11-17, implement-review, checked 2026-11-28
|
||||
- Noted: 2026-11-15, implement-review
|
||||
|
||||
### To run plan2code-app/ui/app.js in a page test, serve the ui folder over HTTP and stub window.__TAURI__, with platform_info answering { os }; from file:// the module never loads.
|
||||
- Kind: how-it-works
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
The small games behind the die in the web console's top bar. This is the full guide to each game and to the rules they share; the console guide has the short version. Back to [the web console guide](web-console.md#activities).
|
||||
|
||||
|
||||
The **die** in the top bar, right of the megaphone, opens **Activities**: small
|
||||
The **die** in the top bar, right of the text size buttons, opens **Activities**: small
|
||||
games to play while you wait, say through a long build. Thirteen ship today,
|
||||
**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**. The window opens on a
|
||||
**picker**: a row per game, in two columns on a wide window, with a small cover
|
||||
|
||||
@@ -4,6 +4,12 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
|
||||
<!-- Format from 3.1.0 on: `## vX.Y.Z (YYYY-MM-DD)` with the date from version.json; a minor release opens with a three-bullet `### Highlights`; sections run Added, Changed, Fixed; game changes sit under one Activities line; tooling and test lines go under "For contributors". Older headings have no date and are not backfilled. -->
|
||||
|
||||
## v3.2.1 (2026-11-29)
|
||||
|
||||
### ✨ Added
|
||||
|
||||
- **Web console**: text size buttons in the top bar, between the megaphone and the die: [-], the current size and [+] scale all the console's text in seven steps from 80% to 150%, the size returns to 100% when you click it, your choice is kept with your other looks, and Back to default on the Appearance tab resets it.
|
||||
|
||||
## v3.2.0 (2026-11-29)
|
||||
|
||||
### Highlights
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
Plan2Code is a spec-driven workflow for AI coding agents. You work through it on a page in your browser: the dashboard lists every step as a card, and each step's questions, progress and sign-offs arrive on that same page while your agent does the work. An approved plan becomes phase documents, and the agent builds to them one phase at a time.
|
||||
|
||||
Version 3.2.0 · Apache 2.0 · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com)
|
||||
Version 3.2.1 · Apache 2.0 · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com)
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "plan2code",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
|
||||
Generated
+2
-2
@@ -957,7 +957,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fake-agent"
|
||||
version = "3.2.0"
|
||||
version = "3.2.1"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
"terminal_size",
|
||||
@@ -2647,7 +2647,7 @@ checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
|
||||
|
||||
[[package]]
|
||||
name = "plan2code-app"
|
||||
version = "3.2.0"
|
||||
version = "3.2.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"libc",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fake-agent"
|
||||
version = "3.2.0"
|
||||
version = "3.2.1"
|
||||
description = "A stand-in agent program for the Plan2Code app's tests"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "plan2code-app",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "plan2code-app",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.12.4",
|
||||
"@xterm/addon-fit": "0.11.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "plan2code-app",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"private": true,
|
||||
"description": "Plan2Code desktop app (Tauri). Separate from the repo root so the root and the web console stay dependency-free.",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "plan2code-app"
|
||||
version = "3.2.0"
|
||||
version = "3.2.1"
|
||||
description = "Plan2Code desktop app"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Plan2Code",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"identifier": "com.plan2code.desktop",
|
||||
"build": {
|
||||
"frontendDist": "../ui",
|
||||
|
||||
@@ -170,7 +170,8 @@ test("the die sits right of the megaphone and opens on the picker, a ledger row
|
||||
await pastTheIntro(s);
|
||||
await iconUsable(s, "the dashboard");
|
||||
const next = await s.page.evaluate(() => document.getElementById("btn-feedback").nextElementSibling?.id);
|
||||
assert.equal(next, "btn-activities");
|
||||
assert.equal(next, "text-size", "the text size control sits between the megaphone and the die");
|
||||
assert.equal(await s.page.evaluate(() => document.getElementById("text-size").nextElementSibling?.id), "btn-activities");
|
||||
await openPicker(s);
|
||||
// Snake's seeded best makes it the one played row; the rest sit under Not played yet, A to Z.
|
||||
assert.deepEqual(await cardTitles(s), ["Snake", "Bounce Road", "Bug Hunt", "Bumper Ring", "Crossing Rush", "Flock Dash", "Ghoul Rush", "Hot Potato", "Light Trails", "Mini golf", "Rapids Run", "Stack Deploy", "Sunset Drive"]);
|
||||
|
||||
@@ -85,6 +85,59 @@ test("the violet highlight and dark theme chosen in preferences stick across a r
|
||||
assert.deepEqual(await firstPaintAttrs(s), { theme: null, accent: null }, "the first paint still carries the old looks");
|
||||
});
|
||||
|
||||
// The top bar's text size buttons: seven steps, saved with the looks, in the first paint.
|
||||
const bodySize = (s) => s.page.evaluate(() => getComputedStyle(document.body).fontSize);
|
||||
const sizeLabel = (s) => s.page.locator("#btn-text-size").innerText();
|
||||
const savedTextSize = (s) => s.page.evaluate(async () => ((await (await fetch("/looks")).json()).looks || {}).textSize);
|
||||
|
||||
test("the text size buttons step the console's type up and down between the megaphone and the die, stop at the ends, and the label returns to 100%", async (t) => {
|
||||
noSavedLooks(t);
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||
const order = await s.page.evaluate(() => [...document.getElementById("btn-feedback").parentElement.children].map((n) => n.id));
|
||||
assert.deepEqual(order.slice(order.indexOf("btn-feedback"), order.indexOf("btn-feedback") + 3), ["btn-feedback", "text-size", "btn-activities"], "the control sits between the megaphone and the die");
|
||||
assert.equal(await sizeLabel(s), "100%");
|
||||
assert.equal(await root(s, "data-text-size"), null, "the default size leaves the page unmarked");
|
||||
assert.equal(await bodySize(s), "15px");
|
||||
|
||||
await s.page.click("#btn-text-larger");
|
||||
assert.equal(await sizeLabel(s), "110%");
|
||||
assert.equal(await root(s, "data-text-size"), "110");
|
||||
assert.equal(await s.page.locator("#btn-text-size").getAttribute("aria-label"), "Text size 110%, back to 100%", "a screen reader hears the size");
|
||||
assert.equal(await bodySize(s), "16.5px");
|
||||
await s.page.waitForFunction(async () => ((await (await fetch("/looks")).json()).looks || {}).textSize === 110);
|
||||
|
||||
// The first paint carries it, and so does a reload.
|
||||
const html = await (await s.context.request.get(s.url)).text();
|
||||
assert.match(html.match(/<html\b[^>]*>/i)?.[0] ?? `no html tag in: ${html.slice(0, 200)}`, /data-text-size="110"/, "the first paint carries the saved size");
|
||||
await s.page.reload({ waitUntil: "domcontentloaded" });
|
||||
await drawn(s.page);
|
||||
assert.equal(await sizeLabel(s), "110%");
|
||||
assert.equal(await bodySize(s), "16.5px");
|
||||
|
||||
// The label puts it back.
|
||||
await s.page.click("#btn-text-size");
|
||||
assert.equal(await sizeLabel(s), "100%");
|
||||
assert.equal(await root(s, "data-text-size"), null);
|
||||
assert.equal(await bodySize(s), "15px");
|
||||
|
||||
// Largest and smallest: the button at the end is spent, not wrapped.
|
||||
for (let i = 0; i < 6; i++) if (await s.page.locator("#btn-text-larger").isEnabled()) await s.page.click("#btn-text-larger");
|
||||
assert.equal(await sizeLabel(s), "150%");
|
||||
assert.equal(await s.page.locator("#btn-text-larger").getAttribute("aria-disabled"), "true");
|
||||
await s.page.click("#btn-text-size");
|
||||
for (let i = 0; i < 6; i++) if ((await s.page.locator("#btn-text-smaller").getAttribute("aria-disabled")) !== "true") await s.page.click("#btn-text-smaller");
|
||||
assert.equal(await sizeLabel(s), "80%");
|
||||
assert.equal(await bodySize(s), "12px");
|
||||
await s.page.waitForFunction(async () => ((await (await fetch("/looks")).json()).looks || {}).textSize === 80);
|
||||
|
||||
// Back to default in Preferences returns it too.
|
||||
await s.page.click("#btn-looks");
|
||||
await s.page.click("#looks-reset");
|
||||
await s.page.waitForFunction(() => !document.documentElement.hasAttribute("data-text-size"));
|
||||
assert.equal(await sizeLabel(s), "100%");
|
||||
assert.equal(await savedTextSize(s) ?? 100, 100);
|
||||
});
|
||||
|
||||
// The Agents & models tab: a roster of agent cards, the picked agent's form in
|
||||
// a drawer over it (Models & strengths and Launch tabs), and the Add agent
|
||||
// chooser, where the starter templates are an opt-in.
|
||||
|
||||
@@ -869,7 +869,7 @@ test("prefs: the dialog opens on the tab asked for, else Appearance", () => {
|
||||
});
|
||||
|
||||
test("prefs: Back to default resets Appearance or Sounds & activities only, and nothing on the other two", () => {
|
||||
assert.deepEqual(prefsResetScope("appearance"), ["theme", "width", "accent", "role", "skipIntro"]);
|
||||
assert.deepEqual(prefsResetScope("appearance"), ["theme", "width", "textSize", "accent", "role", "skipIntro"]);
|
||||
const sounds = prefsResetScope("sounds");
|
||||
assert.deepEqual(sounds, ["sound", ...Object.keys(SOUND_EVENTS).map(soundKey), ...PICKABLE_SOUNDS.map(soundFileKey), "hideActivities", "activitySounds", "gameMusic"]);
|
||||
for (const key of [...prefsResetScope("appearance"), ...sounds]) {
|
||||
|
||||
@@ -207,6 +207,17 @@
|
||||
<path class="mg-line" d="M7 14.5l1.2 5h2.4l-.9-3.8M17.5 9.5a4 4 0 0 1 0 5M20 7a7.5 7.5 0 0 1 0 10" />
|
||||
</svg>
|
||||
</a>
|
||||
<!-- Text size: [-], the size (a click returns to 100%), [+]. Saved with
|
||||
the looks; the page's type tokens scale from it (tokens.css). -->
|
||||
<div class="text-size" id="text-size" role="group" aria-label="Text size">
|
||||
<button type="button" class="icon-btn" id="btn-text-smaller" title="Smaller text" aria-label="Smaller text">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 12h12" /></svg>
|
||||
</button>
|
||||
<button type="button" class="text-size-label" id="btn-text-size" title="Back to 100%" aria-label="Text size, back to 100%">100%</button>
|
||||
<button type="button" class="icon-btn" id="btn-text-larger" title="Larger text" aria-label="Larger text">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 12h12M12 6v12" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Activities: small games for a long wait. Opens a dialog that pauses
|
||||
the moment Plan2Code needs the person; nothing in it reaches the agent. -->
|
||||
<button type="button" class="icon-btn" id="btn-activities" title="Activities" aria-label="Activities">
|
||||
@@ -1542,6 +1553,12 @@
|
||||
The <strong>megaphone</strong> button opens Plan2Code's
|
||||
GitHub issues, where you can report a bug or suggest an idea.
|
||||
</li>
|
||||
<li>
|
||||
The <strong>[-]</strong> and <strong>[+]</strong> buttons make the
|
||||
whole page's text smaller or larger, in seven steps from 80% to 150%;
|
||||
the size between them (click it) returns to 100%. Your choice is kept, and
|
||||
Back to default on the Appearance tab resets it.
|
||||
</li>
|
||||
<li>
|
||||
The <strong>die</strong> beside it opens <strong>Activities</strong>,
|
||||
small games to play while you wait. See "Activities".
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// `looks` is a live binding: every file reads the current object, and only
|
||||
// this file replaces it.
|
||||
|
||||
import { DEFAULT_ACCENT, soundPrefs, soundFilePrefs, DEFAULT_CARD_WIDTH, ACCENTS, accentId, cardWidth, soundKey, soundFileKey } from "./palette.js";
|
||||
import { DEFAULT_ACCENT, soundPrefs, soundFilePrefs, DEFAULT_CARD_WIDTH, DEFAULT_TEXT_SIZE, TEXT_SIZES, ACCENTS, accentId, cardWidth, textSize, soundKey, soundFileKey } from "./palette.js";
|
||||
import { normalizeRole, ROLE_NOT_SET } from "./starters.js";
|
||||
import { bootData, hooks } from "./state.js";
|
||||
import { el } from "./render.js";
|
||||
@@ -32,6 +32,8 @@ export const DEFAULT_LOOKS = {
|
||||
// Which sound file each pickable cue plays (soundFileQuestion: "sound-03").
|
||||
...soundFilePrefs(null),
|
||||
width: DEFAULT_CARD_WIDTH,
|
||||
// The top bar's text size, in percent (palette.js TEXT_SIZES).
|
||||
textSize: DEFAULT_TEXT_SIZE,
|
||||
hideUnavailable: true,
|
||||
// Skip the wake-up intro: never play the dashboard's first-open wake-up (Planny asleep), off by default.
|
||||
skipIntro: false,
|
||||
@@ -77,6 +79,7 @@ export function adoptLooks(saved) {
|
||||
Object.assign(looks, soundFilePrefs(looks));
|
||||
if (typeof looks.hideUnavailable !== "boolean") looks.hideUnavailable = DEFAULT_LOOKS.hideUnavailable;
|
||||
looks.width = cardWidth(looks.width);
|
||||
looks.textSize = textSize(looks.textSize);
|
||||
if (typeof looks.skipIntro !== "boolean") looks.skipIntro = DEFAULT_LOOKS.skipIntro;
|
||||
if (typeof looks.skillLaunched !== "boolean") looks.skillLaunched = DEFAULT_LOOKS.skillLaunched;
|
||||
if (typeof looks.meterTipSeen !== "boolean") looks.meterTipSeen = DEFAULT_LOOKS.meterTipSeen;
|
||||
@@ -190,6 +193,18 @@ const systemDark = () => matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
|
||||
const effectiveTheme = () => (looks.theme === "system" ? (systemDark() ? "dark" : "light") : looks.theme);
|
||||
|
||||
// The top bar's text size control: the label says the size, and a button at an end of the range is spent.
|
||||
function paintTextSize() {
|
||||
const at = TEXT_SIZES.indexOf(looks.textSize);
|
||||
const label = $("btn-text-size");
|
||||
if (!label) return;
|
||||
label.textContent = looks.textSize + "%";
|
||||
// The accessible name replaces the visible text, so it carries the size too.
|
||||
label.setAttribute("aria-label", `Text size ${looks.textSize}%, back to 100%`);
|
||||
$("btn-text-smaller").setAttribute("aria-disabled", String(at <= 0));
|
||||
$("btn-text-larger").setAttribute("aria-disabled", String(at >= TEXT_SIZES.length - 1));
|
||||
}
|
||||
|
||||
export function applyLooks() {
|
||||
const root = document.documentElement;
|
||||
// The desktop app's shell wears this page's theme and highlight: the resolved
|
||||
@@ -208,6 +223,9 @@ export function applyLooks() {
|
||||
// Before the accent's early return, so a default accent never skips it.
|
||||
if (looks.width === DEFAULT_CARD_WIDTH) root.removeAttribute("data-width");
|
||||
else root.dataset.width = looks.width;
|
||||
if (looks.textSize === DEFAULT_TEXT_SIZE) root.removeAttribute("data-text-size");
|
||||
else root.dataset.textSize = String(looks.textSize);
|
||||
paintTextSize();
|
||||
|
||||
// The default lives in the stylesheet, where it is written once per theme.
|
||||
// Clearing the override is how it gets its own values back.
|
||||
|
||||
@@ -249,6 +249,17 @@ export function cardWidth(value) {
|
||||
return typeof value === "string" && Object.hasOwn(CARD_WIDTHS, value) ? value : DEFAULT_CARD_WIDTH;
|
||||
}
|
||||
|
||||
// The text size steps, in percent, for the top bar's [-] and [+]. Here for the
|
||||
// same reason the card widths are: the page validates a saved `looks.textSize`
|
||||
// with textSize(), and the server paints the first-load `data-text-size`.
|
||||
export const TEXT_SIZES = [80, 90, 100, 110, 120, 135, 150];
|
||||
|
||||
export const DEFAULT_TEXT_SIZE = 100;
|
||||
|
||||
export function textSize(value) {
|
||||
return TEXT_SIZES.includes(value) ? value : DEFAULT_TEXT_SIZE;
|
||||
}
|
||||
|
||||
// The sound files a person can give a cue, sound-01 to sound-19, served from
|
||||
// /sounds/<name>.mp3 (static.mjs).
|
||||
export const SOUND_FILES = Array.from({ length: 19 }, (_, i) => `sound-${String(i + 1).padStart(2, "0")}`);
|
||||
|
||||
@@ -25,7 +25,7 @@ export function prefsOpenTab(asked) {
|
||||
// The looks keys Back to default resets on a tab, or null where it has
|
||||
// nothing to reset (and is hidden).
|
||||
export function prefsResetScope(tab) {
|
||||
if (tab === "appearance") return ["theme", "width", "accent", "role", "skipIntro"];
|
||||
if (tab === "appearance") return ["theme", "width", "textSize", "accent", "role", "skipIntro"];
|
||||
if (tab === "sounds") return ["sound", ...Object.keys(SOUND_EVENTS).map(soundKey), ...PICKABLE_SOUNDS.map(soundFileKey), "hideActivities", "activitySounds", "gameMusic"];
|
||||
return null;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { adoptLooks, applyLooks, loadLooks, looks, renderSwatches, saveLooks, sy
|
||||
import { dropHeldSound, previewSound, releaseHeldSound, sound, soundOn } from "../sound.js";
|
||||
import { hushTones, tone, unlockTones } from "../tones.js";
|
||||
import { hushMusic } from "../music.js";
|
||||
import { SOUND_EVENTS, soundFileKey, soundKey } from "../palette.js";
|
||||
import { DEFAULT_TEXT_SIZE, SOUND_EVENTS, TEXT_SIZES, soundFileKey, soundKey } from "../palette.js";
|
||||
import { ROLES, ROLE_NOT_SET, ROLE_NOT_SET_LABEL, needsRoleNudge, normalizeRole } from "../starters.js";
|
||||
import { isDashboard } from "../selectors.js";
|
||||
import { el } from "../render.js";
|
||||
@@ -63,6 +63,19 @@ export function wireLooks() {
|
||||
hooks.markSaved(fieldsetOf(radio), saveLooks());
|
||||
});
|
||||
}
|
||||
// The top bar's text size: one step each way, the label back to 100%.
|
||||
const stepText = (by) => {
|
||||
const at = TEXT_SIZES.indexOf(looks.textSize) + by;
|
||||
if (at < 0 || at >= TEXT_SIZES.length) return;
|
||||
looks.textSize = TEXT_SIZES[at];
|
||||
saveLooks();
|
||||
};
|
||||
$("btn-text-smaller").addEventListener("click", () => stepText(-1));
|
||||
$("btn-text-larger").addEventListener("click", () => stepText(1));
|
||||
$("btn-text-size").addEventListener("click", () => {
|
||||
looks.textSize = DEFAULT_TEXT_SIZE;
|
||||
saveLooks();
|
||||
});
|
||||
for (const radio of document.querySelectorAll('input[name="looks-width"]')) {
|
||||
radio.addEventListener("change", () => {
|
||||
looks.width = radio.value;
|
||||
|
||||
@@ -28,6 +28,28 @@
|
||||
.icon-btn:hover svg .ab-dot, .icon-btn:hover svg .dc-pip { fill: var(--accent); stroke: none; }
|
||||
|
||||
a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
||||
|
||||
/* The text size control: [-] size [+], one group in the tools. The label is the
|
||||
reset, so it reads as text and gets the same hover as an icon. */
|
||||
.text-size { display: flex; align-items: center; gap: 0; }
|
||||
.text-size-label {
|
||||
appearance: none;
|
||||
min-width: 44px;
|
||||
height: 36px;
|
||||
padding: 0 4px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius-md);
|
||||
background: transparent;
|
||||
color: var(--ink-2);
|
||||
font: 600 var(--fs-xs)/1 var(--sans);
|
||||
font-variant-numeric: tabular-nums;
|
||||
cursor: pointer;
|
||||
}
|
||||
.text-size-label:hover { background: var(--panel-2); border-color: var(--rule); color: var(--accent); }
|
||||
/* An end of the range: dimmed, not disabled, so Playwright and keyboards still reach it. */
|
||||
.text-size .icon-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
|
||||
.text-size .icon-btn[aria-disabled="true"]:hover { background: transparent; border-color: transparent; }
|
||||
.text-size .icon-btn[aria-disabled="true"]:hover svg * { stroke: var(--ink-2); }
|
||||
/* A link in a dialog (the update modal's release, Help's version) keeps the
|
||||
accent once visited: the browser's purple is unreadable on the dark theme. */
|
||||
.modal a:not(.btn), .modal a:not(.btn):visited { color: var(--accent); }
|
||||
|
||||
@@ -76,17 +76,19 @@
|
||||
/* The column's width: the card, the pager and the documents. */
|
||||
--card-width: 880px;
|
||||
/* Type: text steps, h1 to h4, one poster size; weights 400, 600, 700 only. */
|
||||
--fs-2xs: 11px;
|
||||
--fs-xs: 12px;
|
||||
--fs-sm: 13px;
|
||||
--fs-md: 14px;
|
||||
--fs-base: 15px;
|
||||
--fs-lg: 17px;
|
||||
--fs-h4: 16px;
|
||||
--fs-h3: 18px;
|
||||
--fs-h2: 21px;
|
||||
--fs-h1: 25px;
|
||||
--fs-poster: 38px;
|
||||
--fs-2xs: calc(11px * var(--text-scale));
|
||||
--fs-xs: calc(12px * var(--text-scale));
|
||||
--fs-sm: calc(13px * var(--text-scale));
|
||||
--fs-md: calc(14px * var(--text-scale));
|
||||
--fs-base: calc(15px * var(--text-scale));
|
||||
--fs-lg: calc(17px * var(--text-scale));
|
||||
--fs-h4: calc(16px * var(--text-scale));
|
||||
--fs-h3: calc(18px * var(--text-scale));
|
||||
--fs-h2: calc(21px * var(--text-scale));
|
||||
--fs-h1: calc(25px * var(--text-scale));
|
||||
--fs-poster: calc(38px * var(--text-scale));
|
||||
/* The top bar's text size: 1 until [data-text-size] says otherwise (rules below). */
|
||||
--text-scale: 1;
|
||||
--lh-tight: 1.25;
|
||||
--lh-ui: 1.4;
|
||||
--lh-body: 1.55;
|
||||
@@ -101,6 +103,12 @@
|
||||
:root[data-width="narrow"] { --card-width: 720px; }
|
||||
:root[data-width="wide"] { --card-width: 1080px; }
|
||||
:root[data-width="ultrawide"] { --card-width: 1440px; }
|
||||
:root[data-text-size="80"] { --text-scale: 0.8; }
|
||||
:root[data-text-size="90"] { --text-scale: 0.9; }
|
||||
:root[data-text-size="110"] { --text-scale: 1.1; }
|
||||
:root[data-text-size="120"] { --text-scale: 1.2; }
|
||||
:root[data-text-size="135"] { --text-scale: 1.35; }
|
||||
:root[data-text-size="150"] { --text-scale: 1.5; }
|
||||
|
||||
/* Dark is written twice on purpose. The first copy follows the system unless
|
||||
light was chosen; the second is the explicit ask. Without the `:not()` a
|
||||
|
||||
@@ -50,7 +50,7 @@ import {
|
||||
import { DOC_TYPES, MAX_ATTACHMENTS, MAX_DOC_BYTES, docExt, workflowLabel, workflowTitle } from "./public/answers.js";
|
||||
import { CHAT_LIMIT, CHAT_MAX_CHARS } from "./public/chat.js";
|
||||
import { cleanSetting, offered } from "./public/subagents.js";
|
||||
import { DEFAULT_ACCENT, DEFAULT_CARD_WIDTH, accentId, cardWidth } from "./public/palette.js";
|
||||
import { DEFAULT_ACCENT, DEFAULT_CARD_WIDTH, DEFAULT_TEXT_SIZE, accentId, cardWidth, textSize } from "./public/palette.js";
|
||||
import { SERVABLE, TYPES, asset } from "./static.mjs";
|
||||
import { handoffsDir, isHandoffId } from "./handoffs.mjs";
|
||||
import { followCounts, learningScan, learningState, writePause } from "./learning.mjs";
|
||||
@@ -370,6 +370,10 @@ function renderIndex(ctx) {
|
||||
if (looks && cardWidth(looks.width) !== DEFAULT_CARD_WIDTH) {
|
||||
htmlAttrs += ` data-width="${cardWidth(looks.width)}"`;
|
||||
}
|
||||
// Likewise the text size: a fixed list of whole numbers, nothing to escape.
|
||||
if (looks && textSize(looks.textSize) !== DEFAULT_TEXT_SIZE) {
|
||||
htmlAttrs += ` data-text-size="${textSize(looks.textSize)}"`;
|
||||
}
|
||||
const title = (state && state.title) || "Session";
|
||||
const workflow = state && state.workflow;
|
||||
const json = JSON.stringify(boot).replace(/</g, "\\u003c");
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Plan2Code",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"description": "A structured workflow of six steps (Pathfinder, Plan, Document, Implement, Review, Finalize) for AI-assisted software development",
|
||||
"keywords": [
|
||||
"ai",
|
||||
@@ -17,6 +17,6 @@
|
||||
"url": "https://github.com/jparkerweb/plan2code"
|
||||
},
|
||||
"homepage": "https://github.com/jparkerweb/plan2code",
|
||||
"releaseDate": "2026-11-28",
|
||||
"releaseDate": "2026-11-29",
|
||||
"mode": "utility"
|
||||
}
|
||||
Reference in new issue
Block a user