From 26e7f59d3678fd81dd81ad57c57a551c372445dc Mon Sep 17 00:00:00 2001 From: Divij <148875733+divijg19@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:02:04 +0530 Subject: [PATCH] v2.9.0: Continuous replacement, competitive themes and smaller WASM Session schedule: - Numbers now replace one another continuously: remove INTER_NUMBER_GAP_MS and the per-number ClearScreen step from both runtimes; the remaining clears are global (start/stop) and carry no delay. Plans are ~2N steps shorter and sessions ~N*100ms shorter. - Remove ClearScreen.index from the wire format and all consumers; the driver's clear event and collision-prone branches are gone. - Pin the new timing and wire shape in Rust, WASM, and browser tests, with non-vacuity probes for reintroduced gaps. Themes and typography: - Six coherent schemes carried from the interface through flashing: Ocean (default, ultramarine with a green tint), Midnight (near-black) with Dawn, Aqua, Ivory/Sepia, Rose/Blush, Forest/Sage. All surfaces clear 7:1. - Large lining tabular numerals at regular weight in a plain monospace stack; the number uses the active theme's own foreground. - Native sliders get a mode-scoped accent so they do not disappear into blue themes; the attribution block is forced to black on light themes, with the mode mirrored onto for the sibling DOM node. - New themeStyles test pins the wire-relevant CSS contracts. Build, dependencies, and size: - Drop ThreadRng from shipped builds; seed StdRng from SysRng, keeping thread_rng only as a test dependency on both targets. - wasm-only opt-level 3, --remap-path-prefix in CI/release, prebuilt wasm-pack in release, documented rejected flags; lockfile patch updates. - Revert solid-js 2.0 to 1.9.20: the official 2.0 migration is application-level and the testing library has no stable 2.0 release. - WASM: 82465 -> ~76600 bytes raw (~-7%), gzip 37524 -> 35145. Verification: 173 Vitest, 211 Rust, 106 WASM, 17 parity tests, clippy pedantic host + wasm32, fmt, lint, typecheck, build and headless Chromium smoke of continuous replacement and theme behaviour. The vacuous clear screen WASM test was replaced with one against the real SessionStep type. --- .github/workflows/ci.yml | 6 + .github/workflows/release.yml | 8 +- README.md | 6 +- bun.lock | 68 ++-- package.json | 14 +- src-tauri/Cargo.lock | 191 ++++++---- src-tauri/Cargo.toml | 24 +- src-tauri/src/core/engine.rs | 65 ++-- src-tauri/src/core/tests.rs | 36 +- src-tauri/src/core/timing.rs | 15 +- src-tauri/src/core/types.rs | 46 +-- src-tauri/src/core/validate.rs | 4 +- src-tauri/src/main.rs | 24 +- src-tauri/src/session.rs | 130 +++---- src-tauri/src/wasm_bridge_tests.rs | 85 +++-- src-tauri/tauri.conf.json | 2 +- src/App.css | 445 ++++++++++++---------- src/App.tsx | 28 +- src/__tests__/__mocks__/fakeWasmPlan.ts | 22 +- src/__tests__/__mocks__/mockRuntime.ts | 4 +- src/__tests__/browserFallbackPlan.test.ts | 3 +- src/__tests__/countdownStyles.test.ts | 2 - src/__tests__/flashExposure.test.tsx | 22 +- src/__tests__/flashTiming.test.ts | 48 +-- src/__tests__/themeStyles.test.ts | 131 +++++++ src/__tests__/wasmParity.test.ts | 6 +- src/__tests__/wasmPlan.test.ts | 49 ++- src/components/AdvancedSettings.tsx | 16 +- src/runtime/browser.ts | 37 +- src/runtime/localPlanner.ts | 2 +- src/runtime/types.ts | 15 +- src/timing.ts | 6 +- src/wasm/coreBridge.ts | 1 - 33 files changed, 853 insertions(+), 708 deletions(-) create mode 100644 src/__tests__/themeStyles.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77d6145..1af1c8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,7 +308,13 @@ jobs: # # After the tests rather than before them, because it is this job's most # expensive step and a failing test should not pay for it first. + # Remap the runner's home out of the shipped artefact: Rust embeds + # `#[track_caller]` source paths in the data section, and the static + # prefix keeps those paths from identifying the build machine. The + # release opt-level override itself lives in `build:wasm`. - name: Build the release WASM package + env: + RUSTFLAGS: "--remap-path-prefix=/home/runner=/U" run: bun run build:wasm # `src/wasm/pkg` only exists here, so this is the one place the JS/WASM diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index afb80a8..38cc6d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -279,10 +279,16 @@ jobs: - name: Add wasm target run: rustup target add wasm32-unknown-unknown + # Prebuilt binary, matching CI. `cargo install wasm-pack --locked` + # compiled binaryen and the whole tool from source on every release. - name: Install wasm-pack - run: cargo install wasm-pack --locked + uses: taiki-e/install-action@v2 + with: + tool: wasm-pack - name: Build web (WASM + Vite) + env: + RUSTFLAGS: "--remap-path-prefix=/home/runner=/U" run: bun run build:web - name: Package web bundle diff --git a/README.md b/README.md index 61a98f8..3001776 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ Ascent Flash is a desktop flash-mental-math trainer. It shows a sequence of numb ## Features - Fast, consistent flashing: on desktop, timing is driven by the Rust backend; the browser build uses the same fixed schedule -- Configurable session settings: digits per number (1–15), flash duration, count, optional negative numbers; numbers are separated by a fixed 100ms blank +- Configurable session settings: digits per number (1–15), flash duration, count, optional negative numbers; numbers replace one another continuously with no blank frame between them - Audio cues: beep during flashes, applause/buzzer on validation (toggleable) - Auto-repeat: optionally run multiple rounds with a countdown between sessions -- Theme + color schemes +- Theme + color schemes carried consistently from the interface through every + flashing session; large tabular lining numerals at regular weight, sized for + children ## Install (from Release) diff --git a/bun.lock b/bun.lock index 3fcafc1..949f3f1 100644 --- a/bun.lock +++ b/bun.lock @@ -6,20 +6,20 @@ "name": "flashspan", "dependencies": { "@tauri-apps/api": "^2.12.5", - "solid-js": "^1.9.19", + "solid-js": "1.9.20", }, "devDependencies": { "@biomejs/biome": "^2.6.8", "@solidjs/testing-library": "^0.8.10", "@testing-library/dom": "^10.4.2", - "@testing-library/user-event": "^14.6.12", + "@testing-library/user-event": "^14.6.13", "@types/node": "^26.6.6", - "@vitest/coverage-v8": "5.1.0", + "@vitest/coverage-v8": "5.1.1", "jsdom": "^31.0.1", "typescript": "^7.0.2", "vite": "^8.3.8", - "vite-plugin-solid": "^2.11.16", - "vitest": "^5.1.0", + "vite-plugin-solid": "^2.11.17", + "vitest": "^5.1.1", }, }, }, @@ -30,7 +30,7 @@ "@babel/core": ["@babel/core@7.29.13", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.13", "@babel/helper-compilation-targets": "^7.29.13", "@babel/helper-module-transforms": "^7.29.13", "@babel/helpers": "^7.29.13", "@babel/parser": "^7.29.13", "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.13", "@babel/types": "^7.29.11", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-j1nvOQCZYSgp7HLmisnCXFTpVvFODiijQ9QHkORfGKWH6YDtskTEeCJS7eV545GZ9UBzrq0e2xsOd5QQ5PjIqw=="], - "@babel/generator": ["@babel/generator@7.29.14", "", { "dependencies": { "@babel/parser": "^7.29.14", "@babel/types": "^7.29.14", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g=="], + "@babel/generator": ["@babel/generator@7.29.15", "", { "dependencies": { "@babel/parser": "^7.29.15", "@babel/types": "^7.29.15", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-gNWJUX0FlevflramOkaInywOMhU1lkln38gAC7TFZv2tsWbLYbN/2WZFGcq8zbX0Z55e4vGa27IB/NaeZoauWQ=="], "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.29.13", "", { "dependencies": { "@babel/compat-data": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-8WxJ4/Vmes3ghacj8VOJy3NW8eyHiFY/4thU/LSBuBE470+igjR/j1ZTNn8fV5VdNrLx6iXUwig526UdOvfP0w=="], @@ -42,25 +42,25 @@ "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.29.7", "", {}, "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw=="], - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.14", "", {}, "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.15", "", {}, "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], "@babel/helper-validator-option": ["@babel/helper-validator-option@7.29.7", "", {}, "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw=="], - "@babel/helpers": ["@babel/helpers@7.29.14", "", { "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.14" } }, "sha512-6E3Mi1r0B0umq6vmZa4/78q+64fqO2YY0THUdjDPKUCKhNb0yQy5NQIaPHCSD3ryTgiTss//P4JsWS80AsZ6LQ=="], + "@babel/helpers": ["@babel/helpers@7.29.15", "", { "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.15" } }, "sha512-l+ezV2czw3t2d2ELq+3CwPL4WLKK5O8IywBXb9/gpmbCOVZFmRYJPmHVqSCv2k+8iKbE30Zf54siOoIZ52XOxA=="], - "@babel/parser": ["@babel/parser@7.29.14", "", { "dependencies": { "@babel/types": "^7.29.14" }, "bin": "./bin/babel-parser.js" }, "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w=="], + "@babel/parser": ["@babel/parser@7.29.15", "", { "dependencies": { "@babel/types": "^7.29.15" }, "bin": "./bin/babel-parser.js" }, "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA=="], "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A=="], - "@babel/runtime": ["@babel/runtime@7.29.14", "", {}, "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw=="], + "@babel/runtime": ["@babel/runtime@7.29.15", "", {}, "sha512-304gsbbGVmQc+cNGHzwHBlqepYdWLKj3VXCQBGt/EGcV7PUPfKI7kAUNW1FZEOCwlQiLvQjg1JEaAlRQ616h+Q=="], "@babel/template": ["@babel/template@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg=="], - "@babel/traverse": ["@babel/traverse@7.29.14", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.14", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.14", "@babel/template": "^7.29.7", "@babel/types": "^7.29.14", "debug": "^4.3.1" } }, "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA=="], + "@babel/traverse": ["@babel/traverse@7.29.15", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.15", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.15", "@babel/template": "^7.29.7", "@babel/types": "^7.29.15", "debug": "^4.3.1" } }, "sha512-ZfawBo2i8vvt+BTt37dWDKBPjUfm/H+bw+ltwsCRhW7gPtyNVwUXuNo54eO2Xo+P4VXpalPFfFISbBTRKC8SOQ=="], - "@babel/types": ["@babel/types@7.29.14", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.14", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w=="], + "@babel/types": ["@babel/types@7.29.15", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.15", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ=="], "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], @@ -148,7 +148,7 @@ "@testing-library/dom": ["@testing-library/dom@10.4.2", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q=="], - "@testing-library/user-event": ["@testing-library/user-event@14.6.12", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-8yQV8v+eToBhsUO4oYrZY7fzhpTEMZx4IDx0/iuER/x0Xuy0NdqQOhsaaUNlvXE03N7vQ+4RCXUieKC0NJty9w=="], + "@testing-library/user-event": ["@testing-library/user-event@14.6.13", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-2LVZGptuB5un1Cu/u31o9adkCwbsUTMp4B4p04xupI7uobvTIpgKidSdShqZiReo/mQmvR9xjgdgTgge4oAbYA=="], "@tybys/wasm-util": ["@tybys/wasm-util@0.10.5", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA=="], @@ -210,15 +210,15 @@ "@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="], - "@vitest/coverage-v8": ["@vitest/coverage-v8@5.1.0", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^2.1.0", "@vitest/istanbul-lib-report": "^2.1.0", "ast-v8-to-istanbul": "^1.0.7", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.1.0", "vitest": "5.1.0" }, "optionalPeers": ["@vitest/browser"] }, "sha512-OY9aShBQG5KOIw2zCo9fDoCHI9RHliNHJ//nM7m6jGg41Hyke9JOGWmeMlK74xYErsxMoK8mIB3gAeEyFVA7LA=="], + "@vitest/coverage-v8": ["@vitest/coverage-v8@5.1.1", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^2.1.0", "@vitest/istanbul-lib-report": "^2.1.0", "ast-v8-to-istanbul": "^1.0.7", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.1.1", "vitest": "5.1.1" }, "optionalPeers": ["@vitest/browser"] }, "sha512-xL4NkbVx/UqqDHaXSOyvB8qsSoLQ+dVNGR9H2Bh/4ggQtmaPFNPUC9gZQwKZePLOQ6WDcgwXVnPulFW9eCHt0w=="], - "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@2.1.0", "", {}, "sha512-WOjuS+xcjSIy7ruYBQ+9BUcV7XZQ0FyVcbWbWxW9TRx/kLGx5SQaeFRIFDJxjNplb6YsT7SpKo2zuXXUo91OIQ=="], + "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@2.1.1", "", {}, "sha512-pF9nMHHuyQzyEXdkWX3d4wElEKjymfL5TEoofegJn/jK2WjmTLOcJKfJ7/YwYGYdbZf8Ebrt4VDUoBPiTuO9zg=="], - "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@2.1.0", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "2.1.0" } }, "sha512-+ZFta25nWtGCOBG9/IET8w1RO5Oawsd6H8Uf6AJ9EA/StFuKVtKAEJEJ6uRt84OH+T4YkI0ASmIHAhRA+0KVxw=="], + "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@2.1.1", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "2.1.1" } }, "sha512-Qba+8OpQQAbWrmq3u1olh6jqE/vyW4OYJe6TLrrTBpXhjJhbY7Os69wyVvMQmNA64KJhGd5nQ/c7l4io8tPCHQ=="], - "@vitest/mocker": ["@vitest/mocker@5.1.0", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.1.0", "estree-walker": "^3.0.3", "magic-string": "^1.4.3" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ=="], + "@vitest/mocker": ["@vitest/mocker@5.1.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.1.1", "estree-walker": "^3.0.3", "magic-string": "^1.4.5" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg=="], - "@vitest/spy": ["@vitest/spy@5.1.0", "", {}, "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A=="], + "@vitest/spy": ["@vitest/spy@5.1.1", "", {}, "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ=="], "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], @@ -234,13 +234,13 @@ "babel-preset-solid": ["babel-preset-solid@1.9.19", "", { "dependencies": { "babel-plugin-jsx-dom-expressions": "^0.40.14" }, "peerDependencies": { "@babel/core": "^7.0.0", "solid-js": "^1.9.16" }, "optionalPeers": ["solid-js"] }, "sha512-2rKUVbaYtjA1xSrRac537GA5g+Ug4v8dCDSZC/8sleosFQPo5pVxvAu1SdKZpSGoOL4A2zM5OLT5PRPPzjU6rA=="], - "baseline-browser-mapping": ["baseline-browser-mapping@2.11.37", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-QYph+vfurmaxhNwi9FprfmtkT5cx2Keg8FzZ0vnjO8ukscIybVyZGMFwdllKGlTI6qyU8ck43OM9UXh+IFJihQ=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.11.39", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-Q9buOYhr2ggrEZpImICecZTJHCCd8yXkRUokFlUEQ8uiD6oP82F4W4jWnhOHZYV+wlvrC51V7Wy0ULyWjil5Wg=="], "bcp-47": ["bcp-47@2.1.2", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-wsv86UuNFuPnVieKLyECTT+CP1WSAHeoIg5P3xu2kA9Z+7fVPoKt7dxzSeEhtJel0AI+NW3fIW3KtTKQKUCngg=="], "bcp-47-match": ["bcp-47-match@2.0.3", "", {}, "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ=="], - "browserslist": ["browserslist@4.29.5", "", { "dependencies": { "baseline-browser-mapping": "^2.11.33", "caniuse-lite": "^1.0.30001819", "electron-to-chromium": "^1.5.464", "node-releases": "^2.0.60", "update-browserslist-db": "^1.3.4" }, "bin": { "browserslist": "cli.js" } }, "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ=="], + "browserslist": ["browserslist@4.29.6", "", { "dependencies": { "baseline-browser-mapping": "^2.11.37", "caniuse-lite": "^1.0.30001826", "electron-to-chromium": "^1.5.486", "node-releases": "^2.0.64", "update-browserslist-db": "^1.4.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w=="], "caniuse-lite": ["caniuse-lite@1.0.30001826", "", {}, "sha512-wTB+9tIbLro/BCXwLuNV1meHE4L9dS6dArMDwgYfNBPMYScqClHyGunhkCSDtHhe/69Xl0sHlKgBVZ+fNsYtWA=="], @@ -248,7 +248,7 @@ "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], + "csstype": ["csstype@3.2.4", "", {}, "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ=="], "data-urls": ["data-urls@8.0.0", "", { "dependencies": { "whatwg-mimetype": "^5.0.0", "whatwg-url": "^17.1.2" } }, "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ=="], @@ -262,7 +262,7 @@ "dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], - "electron-to-chromium": ["electron-to-chromium@1.5.486", "", {}, "sha512-rpybw4Ac4ak/An6G1Me2+61xzwobowDGyuJe71QHHOVpkZv4fPVobsLl7WH6zHSKusAMpaHxGKTpOvpy7+r3dQ=="], + "electron-to-chromium": ["electron-to-chromium@1.5.492", "", {}, "sha512-4uMs7omhajKiud0GqALLTazS/zyvHLTLmDWVTR+e6BnyJo5bSNrph/JoRWEFJJmY75ct9hCiSGsbFF9fLe5gDw=="], "entities": ["entities@9.0.0", "", {}, "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg=="], @@ -340,7 +340,7 @@ "nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], - "node-releases": ["node-releases@2.0.64", "", {}, "sha512-zAPCKqMcnqs2nGy6nlkm7JduFseiBJy3EXHGLh+8pFR+TxGCBxxiEN21+UROU5CKwX/f4TlUcYjiM+vs/tsyxw=="], + "node-releases": ["node-releases@2.0.65", "", {}, "sha512-PfvofsGQ+MiOQIPkX9fU8ELUWmy5zL74CdQaph/ismKszfFkfwXaw0cGiwbwym2hT9k5+mdyl8O5WQ1MD8EHmA=="], "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], @@ -370,15 +370,15 @@ "seroval-plugins": ["seroval-plugins@1.6.12", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-+reiwp/lYxiyctSrdvX7OQ1YLrcbWYgBiZrhSFL+V43b0/DGRLNVSDyZINbQe+tWplPOI2fw2dPrdv6hcc09kQ=="], - "solid-js": ["solid-js@1.9.19", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "~1.6.11", "seroval-plugins": "~1.6.8" } }, "sha512-NIrV/6o1FtmrA9iuAAYvnQJZaHrGcaH3LKSVj4kCiZfwqjCtJNDgIgR9XcqYl6KR/Lb3oRx1HrlyswPWR8SRvw=="], + "solid-js": ["solid-js@1.9.20", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "~1.6.11", "seroval-plugins": "~1.6.8" } }, "sha512-7zEbPxRU5/hHX8O/rYtQ34p/wq44w09gv0u4+myOW5Ode8unKhoG5FbcGlqRXKqqDuDW9yOJ1OXoHgUUl/1f3Q=="], "solid-refresh": ["solid-refresh@0.6.3", "", { "dependencies": { "@babel/generator": "^7.23.6", "@babel/helper-module-imports": "^7.22.15", "@babel/types": "^7.23.6" }, "peerDependencies": { "solid-js": "^1.3" } }, "sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA=="], - "source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="], + "source-map-js": ["source-map-js@1.2.4", "", {}, "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA=="], "std-env": ["std-env@4.3.0", "", {}, "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag=="], - "tinybench": ["tinybench@6.2.3", "", {}, "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw=="], + "tinybench": ["tinybench@6.2.4", "", {}, "sha512-SQ52jEncXxbMCzJuY2A/jGIbbAu6NYsBWW7grz2pNE+EnzQdoGaoBfpk4qC/opE7qiUcGmGgaGIz5EoHdS1O9w=="], "tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], @@ -386,9 +386,9 @@ "tinyrainbow": ["tinyrainbow@3.2.0", "", {}, "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A=="], - "tldts": ["tldts@7.5.4", "", { "dependencies": { "tldts-core": "^7.5.4" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-Rn2ABgjHZrA+jzqom5zhxA0hLohzYrIgfCPyhpTUxqsUrcsBYuab49LseR9waB9Jr8/MxdodvMHA91oRiGLO3Q=="], + "tldts": ["tldts@7.5.5", "", { "dependencies": { "tldts-core": "^7.5.5" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-Hy6IImaWALzJOgCIss4gIFi4G0M9lqk95pFKCUVxQPZw+biZ1Pv6f28JpYgahpJB+BufA0HYsIU/aP/WIx3KRg=="], - "tldts-core": ["tldts-core@7.5.4", "", {}, "sha512-9+4zWtKEDZ3V3FoZ1B97rv+5z5oqp7yeXGVze3CxgQ+CJro9do9DCPD00wxstYZDXDMXsurkBerFfiB6GYtPbA=="], + "tldts-core": ["tldts-core@7.5.5", "", {}, "sha512-rEJz/8cJFY/bdF354gl14yxavbrIbvM+FcbkYVQ6CSCMQTJdUFUIm39TTWSiGPvcpQh7/F6qHrD3SkwwdgtDCw=="], "tough-cookie": ["tough-cookie@6.1.0", "", { "dependencies": { "tldts": "^7.0.5" } }, "sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w=="], @@ -398,19 +398,19 @@ "typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="], - "undici": ["undici@8.12.4", "", {}, "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA=="], + "undici": ["undici@8.13.1", "", {}, "sha512-Kt7EaPjh0s93lJH/PmW3d5rhkcpUa6fS3jqZ7+YGxNd9L7Xy/i827xe4C2uhhq+pJebM4tQOl5AgHmW11G5Skg=="], "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], - "update-browserslist-db": ["update-browserslist-db@1.3.4", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A=="], + "update-browserslist-db": ["update-browserslist-db@1.4.0", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-WPJuOnjI9FWDct4fB+ej4Mz8opLaw5CDcZ2t44tFZ0vIQVYWzBhWR3mkixuUj/A7+vY4V9+ApOZ2YYLwdgq46w=="], "vite": ["vite@8.3.8", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.32", "rolldown": "~1.2.18", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA=="], - "vite-plugin-solid": ["vite-plugin-solid@2.11.16", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.1.1" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-qguFUmqY2ICuoGHrZjm+cWpvKkqVyWDMptipC/BIEGr9q6wEzwTWYOjM9pEWJ+yoTuF6T5OpysI2Okdy7rsVlQ=="], + "vite-plugin-solid": ["vite-plugin-solid@2.11.17", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.1.1" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.0.0 || ^7.0.0", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-RBFS1nSdsL+X9zQ6gXdQ6SZJJnGykmQ5GIlFHcX/rD+9wfR69Ip+vhAFyWEgk9ya74VRPLjo544gCTyju4diqw=="], - "vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="], + "vitefu": ["vitefu@1.1.4", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-qbEIDswfXH3x3IYRMScl/bf1AVW0dn7Z8qkr7g7nohkusfuC7tcFa7t5EoTOz60AunosLM9sDrDjHxsX+Up+CQ=="], - "vitest": ["vitest@5.1.0", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.1.0", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.3", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.2", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.1.0", "@vitest/browser-preview": "5.1.0", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.1.0", "@vitest/coverage-v8": "5.1.0", "@vitest/ui": "5.1.0", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA=="], + "vitest": ["vitest@5.1.1", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.1.1", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.5", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.1.1", "@vitest/browser-preview": "5.1.1", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.1.1", "@vitest/coverage-v8": "5.1.1", "@vitest/ui": "5.1.1", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-trVmzUFOSraCZcI3uZIMD5FqBh4atFkC/XuJP/IU7qtyQay0FCs3Ia+0QiQ2JJwGyWG/xrcBoJNel2+O7kEZ0g=="], "w3c-xmlserializer": ["w3c-xmlserializer@6.0.0", "", { "dependencies": { "xml-name-validator": "^5.0.0" } }, "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q=="], @@ -430,7 +430,7 @@ "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "ast-v8-to-istanbul/js-tokens": ["js-tokens@10.0.0", "", {}, "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q=="], + "ast-v8-to-istanbul/js-tokens": ["js-tokens@10.0.1", "", {}, "sha512-XMt+uh+yEs6srFvEb/pEe4IMvbtoXVdNxF7lZFU+I9sdWI641L97L+gXQMTGm1x3RjPUVizNVjHueclXr0U7sw=="], "babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="], diff --git a/package.json b/package.json index bbfd375..115f398 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "flashspan", "private": true, - "version": "2.8.2", + "version": "2.9.0", "type": "module", "scripts": { "dev": "vite", @@ -10,26 +10,26 @@ "lint:check": "biome check", "typecheck": "tsc --noEmit", "format": "biome format --write", - "build:wasm": "wasm-pack build ./src-tauri --release --target web --out-dir ../src/wasm/pkg --out-name flashspan_core", + "build:wasm": "CARGO_PROFILE_RELEASE_OPT_LEVEL=3 wasm-pack build ./src-tauri --release --target web --out-dir ../src/wasm/pkg --out-name flashspan_core", "build:web": "bun run build:wasm && bun run build", "preview": "vite preview", "test": "vitest --run" }, "dependencies": { "@tauri-apps/api": "^2.12.5", - "solid-js": "^1.9.19" + "solid-js": "1.9.20" }, "devDependencies": { "@biomejs/biome": "^2.6.8", "@solidjs/testing-library": "^0.8.10", "@testing-library/dom": "^10.4.2", - "@testing-library/user-event": "^14.6.12", + "@testing-library/user-event": "^14.6.13", "@types/node": "^26.6.6", - "@vitest/coverage-v8": "5.1.0", + "@vitest/coverage-v8": "5.1.1", "jsdom": "^31.0.1", "typescript": "^7.0.2", "vite": "^8.3.8", - "vite-plugin-solid": "^2.11.16", - "vitest": "^5.1.0" + "vite-plugin-solid": "^2.11.17", + "vitest": "^5.1.1" } } diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 3d7b2c3..143d9cb 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "Flashspan" -version = "2.8.2" +version = "2.9.0" dependencies = [ "getrandom 0.4.3", "image", @@ -315,9 +315,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.12.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" dependencies = [ "serde", ] @@ -387,7 +387,7 @@ checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" dependencies = [ "semver", "serde", - "toml 1.2.1+spec-1.1.0", + "toml 1.2.2+spec-1.1.0", ] [[package]] @@ -398,9 +398,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.11.2" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69" dependencies = [ "find-msvc-tools", "shlex", @@ -934,7 +934,7 @@ dependencies = [ "cc", "memchr", "rustc_version", - "toml 1.2.1+spec-1.1.0", + "toml 1.2.2+spec-1.1.0", "vswhom", "winreg", ] @@ -1094,9 +1094,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" dependencies = [ "percent-encoding", ] @@ -1463,9 +1463,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" [[package]] name = "heck" @@ -1772,7 +1772,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", - "hashbrown 0.17.1", + "hashbrown 0.17.2", "serde", "serde_core", ] @@ -1827,9 +1827,25 @@ version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" dependencies = [ - "jiff-core", - "jiff-static", - "jiff-tzdb-platform", + "jiff-core 0.1.8", + "jiff-static 0.2.46", + "jiff-tzdb-platform 0.1.3", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e77cbfb9fff4798e283c2d69dff39fc2c45e7da017e5ce95b654e46ea41236" +dependencies = [ + "jiff-core 1.0.1", + "jiff-static 1.0.2", + "jiff-tzdb-platform 1.0.0", "log", "portable-atomic", "portable-atomic-util", @@ -1846,31 +1862,67 @@ dependencies = [ "log", ] +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + [[package]] name = "jiff-static" version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" dependencies = [ - "jiff-core", + "jiff-core 0.1.8", "proc-macro2", "quote", "syn 2.0.119", ] +[[package]] +name = "jiff-static" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9067a0b23e5be3147d56b2dcf652b18e6b1364caca93fb157653b6fbcab23a9" +dependencies = [ + "jiff-core 1.0.1", + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "jiff-tzdb" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + [[package]] name = "jiff-tzdb-platform" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" dependencies = [ - "jiff-tzdb", + "jiff-tzdb 0.1.10", +] + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb 1.0.0", ] [[package]] @@ -2781,9 +2833,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" [[package]] name = "pkg-config" @@ -2793,9 +2845,9 @@ checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "plist" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" +checksum = "d86a77b7d9cdebd9643c180c158748db7d894b24a3935ed4b5843e698ae086eb" dependencies = [ "base64 0.23.1", "indexmap 2.14.2", @@ -2879,7 +2931,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit 0.25.19+spec-1.1.0", + "toml_edit 0.25.20+spec-1.1.0", ] [[package]] @@ -3060,9 +3112,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" dependencies = [ "aho-corasick", "memchr", @@ -3072,9 +3124,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" dependencies = [ "aho-corasick", "memchr", @@ -3083,9 +3135,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" [[package]] name = "reqwest" @@ -3409,9 +3461,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.24.0" +version = "3.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" +checksum = "56cb1ca7c93ae63d6439b5250f6b6b040f7e121f32e5dd2f5d523dd4149b3204" dependencies = [ "base64 0.23.1", "bs58", @@ -3419,7 +3471,8 @@ dependencies = [ "hex", "indexmap 1.9.3", "indexmap 2.14.2", - "jiff", + "jiff 0.2.46", + "jiff 1.0.2", "schemars 0.9.0", "schemars 1.2.3", "serde_core", @@ -3430,9 +3483,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.24.0" +version = "3.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" +checksum = "cff15a7c864bbec77d9586ca6822bc7c369bdf19e9243134a62b0b51ce26b31f" dependencies = [ "darling", "proc-macro2", @@ -3544,9 +3597,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.16.5" +version = "1.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" [[package]] name = "socket2" @@ -3897,9 +3950,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.37.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548" +checksum = "02ca9c0ce2a2fd70dc4ef4449ca5e8d30e6fa0db111cd8008594602a06a68371" dependencies = [ "bitflags 2.13.2", "block2", @@ -3954,9 +4007,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.12.6" +version = "2.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2a5cad3827d1fa46c206a6bcaee8ca14203e9b0aaabe447dd4acef33ecd065" +checksum = "30fbfbb9dc9a2697b0e96d909ddc295fb18d2d82a58ed542ab8d9eba2edbe6da" dependencies = [ "anyhow", "bytes", @@ -4005,9 +4058,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e03658bfc9cb60f96a05b7d07a7f7cdfbf4c30b1bbfcb5cf6b5342cc2c9e0bc" +checksum = "73d80784e874fa117b9b00a6680cf2f9b8a51bbd14406bea980cf8f328b00646" dependencies = [ "anyhow", "cargo_toml", @@ -4028,9 +4081,9 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c454a15120b885bf57d0cb9ab218c01e12bc672f793452cb6527b460db883aa" +checksum = "c5dc6caab4da5646f57648f39b794bae118f0dd4a4305eeb8c892966171f4852" dependencies = [ "base64 0.23.1", "brotli", @@ -4055,9 +4108,9 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f7513896f637528ec27ff76effd90638b1cdfa77499fae3db078043aed7ecb" +checksum = "2831c5da8603a96b1efc0b650c2cb6decc69b6cda257d815fe70c7f5be53818e" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -4069,9 +4122,9 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bf2a10dc09e68324a8227b3ec785bd8b61872ddb978c3447b07bc7dd180b25" +checksum = "6c18076d9b04211cb4899387aab97497e8edd0d02cd21710623afcdde27145d1" dependencies = [ "anyhow", "glob", @@ -4106,9 +4159,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.12.3" +version = "2.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c4b2a71c4bf51cde5cdcf1b45d7943282c7c669d3d26f7a324cce25f1b53e75" +checksum = "60c2b14bd5265b63993cdc34ad526fb836e0fd0cf64a4634a895db0784844d5e" dependencies = [ "cookie", "dpi", @@ -4131,9 +4184,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.12.4" +version = "2.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d9be5e7af9560a4a60cdd441389a066cdd3e7c5d464a006ae34cb276cc78abd" +checksum = "b8c14a025255cc9816d401635035075b09b6cc9973b7b8fd7b8fcb8753f30f92" dependencies = [ "gtk", "http", @@ -4156,9 +4209,9 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.10.3" +version = "2.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bf649f12d6fb11e1867214973cd37d89786ae2c0904f79b787b1db4fdcd14c" +checksum = "28d1d33d4453c5df0bf1672dbc7ada69d8ed74f56a4316d964a4aa73d4ecd3ad" dependencies = [ "anyhow", "brotli", @@ -4185,7 +4238,7 @@ dependencies = [ "serde_with", "swift-rs", "thiserror 2.0.21", - "toml 1.2.1+spec-1.1.0", + "toml 1.2.2+spec-1.1.0", "url", "urlpattern", "uuid", @@ -4200,7 +4253,7 @@ checksum = "c52bb6904475a6ca662f15ef787f18ade61d5740a1ee12c45d3b748efdb6f796" dependencies = [ "dunce", "embed-resource", - "toml 1.2.1+spec-1.1.0", + "toml 1.2.2+spec-1.1.0", ] [[package]] @@ -4354,9 +4407,9 @@ dependencies = [ [[package]] name = "toml" -version = "1.2.1+spec-1.1.0" +version = "1.2.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" +checksum = "5426cb1b964690d913f6c5c1a1ae0b42f428ec506bb4d452876d7a209c9bca3b" dependencies = [ "indexmap 2.14.2", "serde_core", @@ -4411,9 +4464,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.19+spec-1.1.0" +version = "0.25.20+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218" +checksum = "e76360e201d6dbd6583e17795ba71a88f47365a9139c8450a7979c32303b8e73" dependencies = [ "indexmap 2.14.2", "toml_datetime 1.1.3+spec-1.1.0", @@ -4423,9 +4476,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.1.5+spec-1.1.0" +version = "1.1.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31" dependencies = [ "winnow 1.0.5", ] @@ -4560,9 +4613,9 @@ checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "url" -version = "2.5.8" +version = "2.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" dependencies = [ "form_urlencoded", "idna", @@ -4600,9 +4653,9 @@ checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" [[package]] name = "uuid" -version = "1.29.2" +version = "1.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed99139f7dac9b5cfe5f17be4d66dc7079a34dee1d74bcc77217119240e267c" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -4653,9 +4706,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" dependencies = [ "same-file", "winapi-util", @@ -5196,9 +5249,9 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "wry" -version = "0.57.2" +version = "0.57.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490119196d02a51d0871df7b9119a1f3e46d75b7e90053a801454d5c6b3491c" +checksum = "ceb43f824178e8110e3181bfd478359c43b041452a9560d321bd8d121e468f86" dependencies = [ "base64 0.23.1", "block2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 67ca727..345c8f0 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,9 +1,8 @@ [package] name = "Flashspan" -version = "2.8.2" +version = "2.9.0" description = "Mental Maths training simulator" authors = ["you"] -license = "" repository = "" edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -19,7 +18,11 @@ image = { version = "0.25", default-features = false, features = ["png"] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -rand = "0.10" +# Only the seeded StdRng and the OS seed source are shipped. The default +# `thread_rng` feature pulls in a thread-local state machine that adds ~1.8KB +# to the wasm even though the browser always supplies an explicit seed. Tests +# still need `rand::rng()`, so they re-enable it as a dev-dependency below. +rand = { version = "0.10", default-features = false, features = ["std_rng", "sys_rng"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] log = "0.4" @@ -35,9 +38,11 @@ getrandom = { version = "0.4", features = ["wasm_js"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3" getrandom = { version = "0.4", features = ["wasm_js"] } +rand = { version = "0.10", features = ["thread_rng"] } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] proptest = "1.4" +rand = { version = "0.10", features = ["thread_rng"] } # Release tuning applies to both shipped targets: the desktop bundle and the # wasm32 bundle. `strip` is the dominant size win (both shipped unstripped @@ -45,10 +50,15 @@ proptest = "1.4" # `opt-level = "s"` suits both: the heaviest work is one bounded number # generation per session, so size beats speed here. # -# `panic = "abort"` is deliberately not set. Tauri's own template enables it and -# it would save a little more, but it turns any panic in an audio or UI thread -# into a hard abort rather than an unwind, which cannot be exercised across all -# three release platforms from a single machine. Add it deliberately if wanted. +# `panic = "abort"` is deliberately not set: measured at zero size saving on +# wasm, and on desktop it would turn a panic in an audio or UI thread into a +# hard abort rather than an unwind. Likewise rejected after measurement: +# `opt-level = "z"` (+2.6KB wasm), extra `wasm-opt` strip passes (+118B), and +# `-C target-cpu=mvp` (+1.9KB). `lto = "thin"` gives the same size for a faster +# build if build time ever matters more than max optimization. The browser +# build alone raises the release opt level to 3 (see `build:wasm`); that produced +# a *smaller* wasm than "s" by giving LLVM more inlining to dead-code-eliminate +# before wasm-bindgen and `wasm-opt -Oz` see it. [profile.release] lto = true codegen-units = 1 diff --git a/src-tauri/src/core/engine.rs b/src-tauri/src/core/engine.rs index 3b8738b..22747d7 100644 --- a/src-tauri/src/core/engine.rs +++ b/src-tauri/src/core/engine.rs @@ -1,7 +1,5 @@ use crate::core::generate::{magnitude_bounds, random_number_with_constraints}; -use crate::core::timing::{ - COUNTDOWN_FROM, COUNTDOWN_TICK_MS, INTER_NUMBER_GAP_MS, PRE_FLASH_SETTLE_MS, -}; +use crate::core::timing::{COUNTDOWN_FROM, COUNTDOWN_TICK_MS, PRE_FLASH_SETTLE_MS}; use crate::core::types::{SessionConfig, SessionConfigEffective, SessionPlan, SessionStep}; use crate::core::validate::effective_from; use rand::SeedableRng; @@ -63,15 +61,20 @@ pub fn build_session_plan( "config_snapshot must be the effective view of the config it is built from" ); - let mut rng: StdRng = - seed_opt.map_or_else(|| StdRng::from_rng(&mut rand::rng()), StdRng::seed_from_u64); + // An explicit seed is used verbatim; otherwise take one draw straight from + // the OS source. This avoids ThreadRng's thread-local state machine while + // keeping the same CSPRNG quality, and it works identically on wasm (where + // the OS source is `crypto.getRandomValues`). + let mut rng: StdRng = seed_opt.map_or_else( + || StdRng::try_from_rng(&mut rand::rngs::SysRng).expect("OS entropy"), + StdRng::seed_from_u64, + ); let mut steps: Vec = Vec::new(); // Phase 1: Initial clear screen steps.push(SessionStep::ClearScreen { session_id, - index: None, delay_ms_before_next: 0, }); @@ -142,7 +145,9 @@ pub fn build_session_plan( .expect("value exceeds i64; normalization bound violated"); numbers.push(value_i64); - // Add show_number step + // Add show_number step. The next number replaces this one in place as + // soon as the exposure is over — continuous replacement, no blank + // frame in between (see crate::core::timing). steps.push(SessionStep::ShowNumber { session_id, index: i + 1, @@ -153,19 +158,11 @@ pub fn build_session_plan( .expect("running_sum exceeds i64; normalization bound violated"), delay_ms_before_next: config.number_duration_ms, }); - - // Add clear_screen step with the fixed inter-number gap. - steps.push(SessionStep::ClearScreen { - session_id, - index: Some(i + 1), - delay_ms_before_next: INTER_NUMBER_GAP_MS, - }); } // Phase 4: Global clear before complete steps.push(SessionStep::ClearScreen { session_id, - index: None, delay_ms_before_next: 0, }); @@ -319,9 +316,10 @@ mod tests { let plan = build_session_plan(1, &config, config_eff, Some(999u64)); // Verify step sequence structure - // Expected: ClearScreen (initial) + 3x CountdownTick + 3x (ShowNumber + ClearScreen) + ClearScreen (final) + Complete - // = 1 + 3 + 6 + 1 + 1 = 12 steps - let expected_step_count = 1 + 3 + (3 * 2) + 1 + 1; + // Expected: ClearScreen (initial) + 3x CountdownTick + 3x ShowNumber + // + ClearScreen (final) + Complete = 1 + 3 + 3 + 1 + 1 = 9 steps. + // Numbers replace one another directly, with no clear step between. + let expected_step_count = 1 + 3 + 3 + 1 + 1; assert_eq!( plan.steps.len(), expected_step_count, @@ -422,8 +420,8 @@ mod tests { let (config, config_eff) = normalize_session_config(&input); let plan = build_session_plan(1, &config, config_eff, Some(456u64)); - // With total_numbers=1: 1 + 3 + 2 + 1 + 1 = 8 steps - assert_eq!(plan.steps.len(), 8); + // With total_numbers=1: 1 + 3 + 1 + 1 + 1 = 7 steps + assert_eq!(plan.steps.len(), 7); assert_eq!(plan.numbers_generated.len(), 1); assert!( plan.numbers_generated[0] >= 0, @@ -446,13 +444,13 @@ mod tests { allow_negative_numbers: false, }; let (config, config_eff) = normalize_session_config(&input); - // number_duration_ms = 500, fixed gap = 100 (INTER_NUMBER_GAP_MS) + // number_duration_ms = 500, continuous replacement (no gap). let plan = build_session_plan(1, &config, config_eff, Some(789u64)); // total_duration_ms = initial_clear(0) + 3*1000(countdown) + PRE_FLASH_SETTLE_MS(100) - // + 3*500(number_durations) + 3*100(delays) + final_clear(0) + complete(0) - // = 0 + 3000 + 100 + 1500 + 300 = 4900 - assert_eq!(plan.total_duration_ms, 4900); + // + 3*500(number_durations) + final_clear(0) + complete(0) + // = 0 + 3000 + 100 + 1500 + 0 + 0 = 4600 + assert_eq!(plan.total_duration_ms, 4600); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] @@ -509,8 +507,8 @@ mod tests { // Should not panic let plan = build_session_plan(1, &config, config_eff, Some(42u64)); - // Step count: 1(clear) + 3(countdown) + 2*9(show+clear) + 1(final clear) + 1(complete) = 24 - assert_eq!(plan.steps.len(), 24); + // Step count: 1(clear) + 3(countdown) + 9(shows) + 1(final clear) + 1(complete) = 15 + assert_eq!(plan.steps.len(), 15); assert_eq!(plan.numbers_generated.len(), 9); assert!(plan.expected_sum >= 0, "sum should be non-negative"); // Every value and the sum must stay exactly representable in f64. @@ -565,9 +563,10 @@ mod tests { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] - fn inter_number_gap_is_fixed_and_exposure_is_uniform() { - // The gap is fixed by the timing budget (see crate::core::timing), - // not by user input: any session must produce it. + fn continuous_replacement_keeps_exposure_uniform() { + // Numbers replace one another directly (see crate::core::timing): + // every exposure is the configured duration, and the only clears are + // the initial and final ones, both with zero delay. for total in [1, 3] { let input = SessionConfigInput { digits_per_number: 1, @@ -596,23 +595,19 @@ mod tests { vec![500; usize::try_from(total).expect("test total fits usize")] ); - // Each indexed clear must carry the fixed 100ms blank gap. + // Exactly two clears remain (start and end), neither waits. let clear_delays: Vec = plan .steps .iter() .filter_map(|s| match s { SessionStep::ClearScreen { - index: Some(_), delay_ms_before_next, .. } => Some(*delay_ms_before_next), _ => None, }) .collect(); - assert_eq!( - clear_delays, - vec![100; usize::try_from(total).expect("test total fits usize")] - ); + assert_eq!(clear_delays, vec![0, 0]); } } diff --git a/src-tauri/src/core/tests.rs b/src-tauri/src/core/tests.rs index 67ea03c..d76408e 100644 --- a/src-tauri/src/core/tests.rs +++ b/src-tauri/src/core/tests.rs @@ -432,14 +432,10 @@ mod validation_tests { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] - fn timing_budget_constants_are_100ms() { - // The inter-number gap is no longer configurable; both executors - // share these fixed values (see crate::core::timing). - assert_eq!( - crate::core::timing::INTER_NUMBER_GAP_MS, - 100, - "inter-number gap must stay 100ms" - ); + fn pre_flash_settle_is_100ms() { + // Both executors share this fixed value (see crate::core::timing). + // There is deliberately no inter-number gap constant any more: numbers + // replace one another continuously. assert_eq!( crate::core::timing::PRE_FLASH_SETTLE_MS, 100, @@ -564,13 +560,13 @@ mod validation_tests { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn plan_matches_golden_vectors_for_fixed_seeds() { - // Total: 0 + 3*1000 + 100 (settle) + 2*(100 flash + 100 gap) = 3500. + // Total: 0 + 3*1000 + 100 (settle) + 2*100 (flash, no gap) = 3300. /// (digits, total, seed, expected numbers, expected sum, expected duration) type Vector = (u32, u32, u64, &'static [i64], i64, u64); let cases: [Vector; 3] = [ - (1, 2, 1, &[9, 7], 16, 3500), - (2, 2, 1, &[97, 72], 169, 3500), - (1, 2, 99, &[6, 7], 13, 3500), + (1, 2, 1, &[9, 7], 16, 3300), + (2, 2, 1, &[97, 72], 169, 3300), + (1, 2, 99, &[6, 7], 13, 3300), ]; for (digits, total, seed, numbers, sum, duration) in cases { @@ -618,7 +614,7 @@ mod validation_tests { let mut last: Option = None; for step in &plan.steps { match step { - SessionStep::ClearScreen { index: None, .. } => { + SessionStep::ClearScreen { .. } => { at += step.delay_ms(); } SessionStep::Complete { .. } => {} @@ -670,7 +666,6 @@ mod validation_tests { assert!(matches!( steps[0], SessionStep::ClearScreen { - index: None, delay_ms_before_next: 0, .. } @@ -697,7 +692,7 @@ mod validation_tests { // no delay of its own. assert!(matches!( steps[steps.len() - 2], - SessionStep::ClearScreen { index: None, .. } + SessionStep::ClearScreen { .. } )); assert!(matches!( steps[steps.len() - 1], @@ -817,8 +812,7 @@ mod validation_tests { .map(|step| match step { SessionStep::CountdownTick { value, .. } => format!("countdown({value})"), SessionStep::ShowNumber { index, .. } => format!("show({index})"), - SessionStep::ClearScreen { index: Some(i), .. } => format!("clear({i})"), - SessionStep::ClearScreen { index: None, .. } => "clear".to_string(), + SessionStep::ClearScreen { .. } => "clear".to_string(), SessionStep::Complete { .. } => "complete".to_string(), }) .collect(); @@ -831,20 +825,18 @@ mod validation_tests { "countdown(2)", "countdown(1)", "show(1)", - "clear(1)", "show(2)", - "clear(2)", "clear", "complete", ], ); // The delay each step waits before the next: 0, the countdown (with the - // settle on the final tick), the exposure, the fixed inter-number gap, + // settle on the final tick), the exposures with no gap between them, // then the closing clear and completion. let delays: Vec = plan.steps.iter().map(SessionStep::delay_ms).collect(); - assert_eq!(delays, vec![0, 1000, 1000, 1100, 500, 100, 500, 100, 0, 0]); - assert_eq!(plan.total_duration_ms, 4300); + assert_eq!(delays, vec![0, 1000, 1000, 1100, 500, 500, 0, 0]); + assert_eq!(plan.total_duration_ms, 4100); // The per-number fields the label hides: the session id, the total, and // a running sum that accumulates across the sequence. diff --git a/src-tauri/src/core/timing.rs b/src-tauri/src/core/timing.rs index 906331e..71e0f3b 100644 --- a/src-tauri/src/core/timing.rs +++ b/src-tauri/src/core/timing.rs @@ -10,16 +10,16 @@ //! ```text //! countdown("3") --1000ms--> countdown("2") --1000ms--> countdown("1") //! --1000ms + PRE_FLASH_SETTLE_MS (100ms)--> show(1) -//! --number_duration_ms--> clear(1) -//! --INTER_NUMBER_GAP_MS (100ms)--> show(2) --> ... -//! --INTER_NUMBER_GAP_MS (100ms)--> complete +//! --number_duration_ms--> show(2) --> ... +//! --number_duration_ms--> complete //! ``` //! //! Invariants: -//! - I1: every `show(i) -> clear(i)` equals the configured number duration, +//! - I1: every `show(i) -> show(i+1)` equals the configured number duration, //! including the first flash (no first-flash bonus). -//! - I2: every `clear(i) -> show(i+1)` is exactly `INTER_NUMBER_GAP_MS`, so no -//! two events share a timestamp and a blank frame always separates numbers. +//! - I2: numbers replace one another continuously: no blank frame, no extra +//! delay, and no two events share a timestamp. This is the continuous +//! replacement policy used by competitive flash-number presentations. //! - I3: the pre-first-flash settle is a pause *before* exposure, never an //! extension of it. @@ -33,6 +33,3 @@ pub const COUNTDOWN_TICK_MS: u64 = 1000; /// Absorbs the fullscreen-transition grace so the first number paints late /// rather than short. pub const PRE_FLASH_SETTLE_MS: u64 = 100; - -/// Fixed blank gap between a clear and the next flash (ms). -pub const INTER_NUMBER_GAP_MS: u64 = 100; diff --git a/src-tauri/src/core/types.rs b/src-tauri/src/core/types.rs index ff6d38c..b560f03 100644 --- a/src-tauri/src/core/types.rs +++ b/src-tauri/src/core/types.rs @@ -3,9 +3,6 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize)] pub struct ClearScreen { pub session_id: u64, - /// When set, indicates which flashed number index is being cleared. - /// When None, represents a global clear (e.g. session start/stop/complete). - pub index: Option, pub emitted_at_ms: u64, } @@ -80,10 +77,10 @@ pub enum SessionStep { delay_ms_before_next: u64, }, - /// Clear the screen: hide the current display + /// Clear the screen: hide the current display (session start/stop only; + /// numbers now replace one another without a blank in between). ClearScreen { session_id: u64, - index: Option, delay_ms_before_next: u64, }, @@ -199,20 +196,19 @@ mod schema_tests { #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] - fn clear_screen_index_is_null_when_absent() { - // `index` is `Option`; as a JSON null here and as `undefined` - // through serde-wasm-bindgen, the browser must treat the initial and - // trailing clears as global (no index), never as clearing a number. + fn clear_screen_has_no_index_field() { + // Clears are now global only: numbers replace one another without a + // blank in between, so no per-number index crosses the wire. The step + // carries just the session id and its delay. let json = serde_json::to_value(SessionStep::ClearScreen { session_id: 1, - index: None, delay_ms_before_next: 0, }) .expect("serialize"); assert_eq!( json, serde_json::json!({ - "ClearScreen": { "session_id": 1, "index": null, "delay_ms_before_next": 0 }, + "ClearScreen": { "session_id": 1, "delay_ms_before_next": 0 }, }) ); } @@ -225,7 +221,6 @@ mod schema_tests { // finds `null`/`undefined` and must treat it as zero. let json = serde_json::to_value(SessionStep::ClearScreen { session_id: 1, - index: Some(4), delay_ms_before_next: 100, }) .expect("serialize"); @@ -301,7 +296,6 @@ mod schema_tests { assert_eq!( SessionStep::ClearScreen { session_id: 1, - index: Some(0), delay_ms_before_next: 100, } .delay_ms(), @@ -369,17 +363,15 @@ mod schema_tests { // The global clear arrives as an explicit `null`, not a missing key. let clear: SessionStep = serde_json::from_value(serde_json::json!({ - "ClearScreen": { "session_id": 1, "index": null, "delay_ms_before_next": 0 }, + "ClearScreen": { "session_id": 1, "delay_ms_before_next": 0 }, })) .expect("global clear"); match clear { SessionStep::ClearScreen { session_id, - index, delay_ms_before_next, } => { assert_eq!(session_id, 1); - assert_eq!(index, None); assert_eq!(delay_ms_before_next, 0); } other => panic!("expected ClearScreen, got {other:?}"), @@ -538,32 +530,20 @@ mod payload_schema_tests { ); } - /// A global clear (session start/stop/complete) carries `index: null`; the - /// UI distinguishes it from a per-number clear by exactly that. A missing key - /// would read as `undefined` too, so pin the explicit `null`. + /// Numbers now replace one another continuously, so the only clears are + /// global (session start, stop, complete). The payload therefore carries + /// no index at all — pin that the UI never has to distinguish one. #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] - fn clear_screen_emits_null_index_for_a_global_clear() { + fn clear_screen_carries_no_index() { let global = serde_json::to_value(ClearScreen { session_id: 1, - index: None, emitted_at_ms: 5, }) .expect("serialize global clear"); assert_eq!( global, - serde_json::json!({ "session_id": 1, "index": null, "emitted_at_ms": 5 }), - ); - - let indexed = serde_json::to_value(ClearScreen { - session_id: 1, - index: Some(4), - emitted_at_ms: 6, - }) - .expect("serialize indexed clear"); - assert_eq!( - indexed, - serde_json::json!({ "session_id": 1, "index": 4, "emitted_at_ms": 6 }), + serde_json::json!({ "session_id": 1, "emitted_at_ms": 5 }), ); } diff --git a/src-tauri/src/core/validate.rs b/src-tauri/src/core/validate.rs index 97fc299..34a6e6a 100644 --- a/src-tauri/src/core/validate.rs +++ b/src-tauri/src/core/validate.rs @@ -144,8 +144,8 @@ pub fn normalize_session_config( allow_negative_numbers: input.allow_negative_numbers, }; - // The inter-number gap is fixed (see crate::core::timing) and no longer - // part of the config wire format. + // There is no inter-number gap: numbers replace one another continuously + // (see crate::core::timing), so no gap is part of the config wire format. let effective = effective_from(&config); (config, effective) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 2c761ba..d4f25a2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -192,12 +192,12 @@ mod native_app { #[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] enum ColorScheme { + Ocean, Midnight, - Ivory, - Crimson, Aqua, - Violet, - Amber, + Ivory, + Rose, + Sage, } #[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)] @@ -219,7 +219,7 @@ mod native_app { impl Default for AppSettings { fn default() -> Self { Self { - color_scheme: ColorScheme::Midnight, + color_scheme: ColorScheme::Ocean, theme_mode: ThemeMode::Dark, } } @@ -725,12 +725,12 @@ mod native_app { #[test] fn color_scheme_round_trips_as_snake_case() { for (scheme, wire) in [ + (ColorScheme::Ocean, "ocean"), (ColorScheme::Midnight, "midnight"), - (ColorScheme::Ivory, "ivory"), - (ColorScheme::Crimson, "crimson"), (ColorScheme::Aqua, "aqua"), - (ColorScheme::Violet, "violet"), - (ColorScheme::Amber, "amber"), + (ColorScheme::Ivory, "ivory"), + (ColorScheme::Rose, "rose"), + (ColorScheme::Sage, "sage"), ] { assert_eq!( serde_json::to_value(scheme).expect("serialize scheme"), @@ -773,15 +773,15 @@ mod native_app { } #[test] - fn app_settings_default_is_midnight_dark_with_the_frontend_keys() { + fn app_settings_default_is_ocean_dark_with_the_frontend_keys() { let settings = AppSettings::default(); - assert!(matches!(settings.color_scheme, ColorScheme::Midnight)); + assert!(matches!(settings.color_scheme, ColorScheme::Ocean)); assert!(matches!(settings.theme_mode, ThemeMode::Dark)); // The UI reads these two exact keys off `get_app_settings`. assert_eq!( serde_json::to_value(&settings).expect("serialize settings"), - serde_json::json!({ "color_scheme": "midnight", "theme_mode": "dark" }), + serde_json::json!({ "color_scheme": "ocean", "theme_mode": "dark" }), ); } diff --git a/src-tauri/src/session.rs b/src-tauri/src/session.rs index d20cf05..ef193ae 100644 --- a/src-tauri/src/session.rs +++ b/src-tauri/src/session.rs @@ -471,7 +471,6 @@ fn run_session_plan( if stop.is_requested() { emitter.clear_screen(ClearScreen { session_id: plan.session_id, - index: None, emitted_at_ms: now_epoch_ms(), }); let mut st = recover_lock(&*state, "state"); @@ -519,12 +518,10 @@ fn run_session_plan( SessionStep::ClearScreen { session_id, - index, delay_ms_before_next, } => { emitter.clear_screen(ClearScreen { session_id: *session_id, - index: *index, emitted_at_ms: now_epoch_ms(), }); @@ -585,7 +582,6 @@ fn run_session_plan( if stop.is_requested() { emitter.clear_screen(ClearScreen { session_id: plan.session_id, - index: None, emitted_at_ms: now_epoch_ms(), }); let mut st = recover_lock(&*state, "state"); @@ -1327,6 +1323,16 @@ mod tests { .map_or_else(|| panic!("{label} was never emitted"), |(_, t)| *t) } + /// The nth emission with this label. Clears are global only now, so the + /// one that ends the last number's exposure is the second `clear`. + fn at_nth(&self, label: &str, n: usize) -> u64 { + recover_lock(&self.events, "events") + .iter() + .filter(|(l, _)| l == label) + .nth(n - 1) + .map_or_else(|| panic!("{label} #{n} was never emitted"), |(_, t)| *t) + } + fn labels(&self) -> Vec { recover_lock(&self.events, "events") .iter() @@ -1337,11 +1343,7 @@ mod tests { impl SessionEmitter for TimingEmitter { fn clear_screen(&self, payload: ClearScreen) { - let label = match payload.index { - Some(i) => format!("clear({i})"), - None => "clear".to_string(), - }; - self.record(label, payload.emitted_at_ms); + self.record("clear".to_string(), payload.emitted_at_ms); } fn countdown_tick(&self, value: String) { let t = now_epoch_ms(); @@ -1357,7 +1359,7 @@ mod tests { /// A two-number plan whose delays are non-zero, so the executor's waiting is /// observable. - fn timed_plan(session_id: u64, exposure_ms: u64, gap_ms: u64) -> SessionPlan { + fn timed_plan(session_id: u64, exposure_ms: u64, countdown_gap_ms: u64) -> SessionPlan { SessionPlan { session_id, config_snapshot: SessionConfigEffective { @@ -1369,20 +1371,19 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { value: "3".into(), - delay_ms_before_next: gap_ms, + delay_ms_before_next: countdown_gap_ms, }, SessionStep::CountdownTick { value: "2".into(), - delay_ms_before_next: gap_ms, + delay_ms_before_next: countdown_gap_ms, }, SessionStep::CountdownTick { value: "1".into(), - delay_ms_before_next: gap_ms + exposure_ms / 4, + delay_ms_before_next: countdown_gap_ms + exposure_ms / 4, }, SessionStep::ShowNumber { session_id, @@ -1392,11 +1393,6 @@ mod tests { running_sum: 5, delay_ms_before_next: exposure_ms, }, - SessionStep::ClearScreen { - session_id, - index: Some(1), - delay_ms_before_next: gap_ms, - }, SessionStep::ShowNumber { session_id, index: 2, @@ -1407,12 +1403,6 @@ mod tests { }, SessionStep::ClearScreen { session_id, - index: Some(2), - delay_ms_before_next: gap_ms, - }, - SessionStep::ClearScreen { - session_id, - index: None, delay_ms_before_next: 0, }, SessionStep::Complete { @@ -1430,20 +1420,20 @@ mod tests { /// Wall-clock floor for `timed_plan`: the sum of every delay the executor /// waits on. /// - /// Countdown contributes `gap` twice plus `gap + exposure/4` on the final - /// tick (which carries the pre-flash settle), and each number contributes - /// `exposure` then `gap`. The leading and trailing global clears and the - /// completion carry no delay. - fn timed_plan_delay_floor(exposure_ms: u64, gap_ms: u64) -> Duration { - let countdown = gap_ms * 3 + exposure_ms / 4; - let numbers = 2 * (exposure_ms + gap_ms); + /// Countdown contributes the gap twice plus `gap + exposure/4` on the final + /// tick (which carries the pre-flash settle). Each number contributes just + /// its exposure: replacement is continuous, so there is no gap to wait. + /// The leading and trailing global clears and the completion carry no delay. + fn timed_plan_delay_floor(exposure_ms: u64, countdown_gap_ms: u64) -> Duration { + let countdown = countdown_gap_ms * 3 + exposure_ms / 4; + let numbers = 2 * exposure_ms; Duration::from_millis(countdown + numbers) } /// Runs `timed_plan` and returns the elapsed time alongside the emitter. fn run_timed_plan( exposure_ms: u64, - gap_ms: u64, + countdown_gap_ms: u64, lag: Option<(usize, u64)>, ) -> (Duration, TimingEmitter) { let emitter = TimingEmitter::new(lag); @@ -1455,7 +1445,7 @@ mod tests { let started = Instant::now(); run_session_plan( &emitter, - timed_plan(7, exposure_ms, gap_ms), + timed_plan(7, exposure_ms, countdown_gap_ms), state, stop, recent_results, @@ -1491,11 +1481,12 @@ mod tests { /// production: the previous event's lateness used to be deducted from this /// number's window, so a flash came up short. /// - /// The lag is injected on `clear(1)` - the event that *ends* number 1's - /// window - so that under the historical absolute-grid scheduling it would - /// eat into number 2's exposure. Injecting it on `show(1)` instead would - /// not show the symptom: that payload is stamped before the callback runs, - /// so number 1's own measured exposure stays intact either way. + /// The lag is injected on `show(2)` - the event that *ends* number 1's + /// window under continuous replacement - so that under the historical + /// absolute-grid scheduling it would eat into number 2's exposure. Injecting + /// it on `show(1)` instead would not show the symptom: that payload is + /// stamped before the callback runs, so number 1's own exposure stays intact + /// either way. /// /// The executor re-anchors each deadline to `Instant::now() + delay`, so /// burning the time can only push the rest of the session later. @@ -1503,11 +1494,13 @@ mod tests { fn run_session_plan_lateness_does_not_shorten_exposure() { let (exposure, gap) = (60u64, 20u64); let lag_ms = 150u64; - // Emission 6 is `clear(1)`: 1 global clear, 3 countdowns, show(1). + // Emission 6 is `show(2)`: 1 global clear, 3 countdowns, show(1). let (elapsed, emitter) = run_timed_plan(exposure, gap, Some((6, lag_ms))); let second_shown = emitter.at("show(2)"); - let second_cleared = emitter.at("clear(2)"); + // With no per-number clears, the second `clear` (the closing one) is + // what ends the last number's exposure. + let second_cleared = emitter.at_nth("clear", 2); let on_screen = Duration::from_millis(second_cleared.saturating_sub(second_shown)); assert!( @@ -1595,14 +1588,8 @@ mod tests { impl SessionEmitter for StateObservingEmitter { fn clear_screen(&self, payload: ClearScreen) { self.observe(); - // Index-aware labels, matching `TimingEmitter`, so a test can tell - // the global clear from the one that ends a specific number's - // exposure. - let label = match payload.index { - Some(i) => format!("clear({i})"), - None => "clear".to_string(), - }; - recover_lock(&self.events, "events").push(label); + let _ = payload.session_id; + recover_lock(&self.events, "events").push("clear".to_string()); } fn countdown_tick(&self, value: String) { self.observe(); @@ -1666,10 +1653,13 @@ mod tests { show.1, ); + // The closing clear is the last one: the leading clear happens before + // any number is shown and correctly observes Idle. let cleared = trace .iter() - .find(|(label, _)| *label == "clear(1)") - .unwrap_or_else(|| panic!("expected clear(1) in {trace:?}")); + .rev() + .find(|(label, _)| *label == "clear") + .unwrap_or_else(|| panic!("expected clear in {trace:?}")); assert!( matches!(cleared.1, SessionState::ShowingNumbers), "the clear that ends the exposure must observe ShowingNumbers, got {:?}", @@ -1739,7 +1729,6 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id: 99, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { @@ -1764,7 +1753,6 @@ mod tests { }, SessionStep::ClearScreen { session_id: 99, - index: Some(1), delay_ms_before_next: 0, }, SessionStep::Complete { @@ -1846,7 +1834,6 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { @@ -1869,11 +1856,6 @@ mod tests { running_sum: 5, delay_ms_before_next: 0, }, - SessionStep::ClearScreen { - session_id, - index: Some(1), - delay_ms_before_next: 0, - }, SessionStep::ShowNumber { session_id, index: 2, @@ -1884,12 +1866,6 @@ mod tests { }, SessionStep::ClearScreen { session_id, - index: Some(2), - delay_ms_before_next: 0, - }, - SessionStep::ClearScreen { - session_id, - index: None, delay_ms_before_next: 0, }, SessionStep::Complete { @@ -1939,10 +1915,8 @@ mod tests { "countdown(2)", "countdown(1)", "show_number(5)", - "clear_screen", "show_number(3)", "clear_screen", - "clear_screen", "session_complete", ], "Events should be emitted in plan order" @@ -2116,7 +2090,6 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id: 77, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { @@ -2141,7 +2114,6 @@ mod tests { }, SessionStep::ClearScreen { session_id: 77, - index: Some(1), delay_ms_before_next: 0, }, SessionStep::ShowNumber { @@ -2154,12 +2126,10 @@ mod tests { }, SessionStep::ClearScreen { session_id: 77, - index: Some(2), delay_ms_before_next: 0, }, SessionStep::ClearScreen { session_id: 77, - index: None, delay_ms_before_next: 0, }, SessionStep::Complete { @@ -2230,7 +2200,6 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id: 100, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { @@ -2247,7 +2216,6 @@ mod tests { }, SessionStep::ClearScreen { session_id: 100, - index: None, delay_ms_before_next: 0, }, SessionStep::Complete { @@ -2313,7 +2281,6 @@ mod tests { steps: vec![ SessionStep::ClearScreen { session_id: 50, - index: None, delay_ms_before_next: 0, }, SessionStep::CountdownTick { @@ -2338,12 +2305,10 @@ mod tests { }, SessionStep::ClearScreen { session_id: 50, - index: Some(1), delay_ms_before_next: 0, }, SessionStep::ClearScreen { session_id: 50, - index: None, delay_ms_before_next: 0, }, SessionStep::Complete { @@ -2764,11 +2729,8 @@ mod tests { impl SessionEmitter for ChannelEmitter { fn clear_screen(&self, payload: ClearScreen) { - let label = match payload.index { - Some(index) => format!("clear({index})"), - None => "clear".to_string(), - }; - recover_lock(&self.events, "events").push(label); + let _ = payload.session_id; + recover_lock(&self.events, "events").push("clear".to_string()); } fn countdown_tick(&self, value: String) { recover_lock(&self.events, "events").push(format!("countdown({value})")); @@ -2836,8 +2798,8 @@ mod tests { )); // The emitted sequence is exactly the plan: a leading global clear, the - // countdown, one flash-then-clear per number, a trailing clear and the - // completion. + // countdown, the flashes replacing one another continuously, a trailing + // clear and the completion. assert_eq!( *recover_lock(&events, "events"), vec![ @@ -2846,9 +2808,7 @@ mod tests { "countdown(2)", "countdown(1)", "show(1)", - "clear(1)", "show(2)", - "clear(2)", "clear", "complete", ], diff --git a/src-tauri/src/wasm_bridge_tests.rs b/src-tauri/src/wasm_bridge_tests.rs index e6d0ca5..53707b1 100644 --- a/src-tauri/src/wasm_bridge_tests.rs +++ b/src-tauri/src/wasm_bridge_tests.rs @@ -4,7 +4,7 @@ mod wasm_tests { SessionConfig, SessionConfigEffective, SessionConfigInput, SessionPlan, SessionStep, }; use crate::{build_session_plan_wasm, normalize_session_config_wasm, ping, wasm_version}; - use serde::{Deserialize, Serialize}; + use serde::Deserialize; use serde_wasm_bindgen::{from_value, to_value}; use wasm_bindgen::JsValue; use wasm_bindgen_test::*; @@ -218,10 +218,10 @@ mod wasm_tests { let plan = plan(77777, &input, None); - // 1 initial clear + 3 countdown ticks + 2 per number + 1 final clear - // + 1 complete. - assert_eq!(plan.steps.len(), 1 + 3 + (2 * 5) + 1 + 1); - assert_eq!(plan.total_duration_ms, 3_000 + 100 + 5 * (1_000 + 100)); + // 1 initial clear + 3 countdown ticks + 1 show per number + // + 1 final clear + 1 complete (continuous replacement, no gap). + assert_eq!(plan.steps.len(), 1 + 3 + 5 + 1 + 1); + assert_eq!(plan.total_duration_ms, 3_000 + 100 + 5 * 1_000); } /// Malformed input must surface as a thrown value, never a wasm trap. A @@ -359,40 +359,42 @@ mod wasm_tests { from_value::(value).expect("decode"); } - /// `ClearScreen { index: None }` is the one field whose shape differs between - /// serializers: `serde-wasm-bindgen` emits `null` where `serde_json` emits - /// `undefined`. The browser guards with `== null`, but nothing proved what the - /// wasm side actually produces. Round-tripping through the real serializer is - /// stronger than inspecting it with reflection. + /// The bridge's `ClearScreen` wire shape is the contract the browser's + /// `planStepsToEvents` validates: an externally-tagged `{ ClearScreen: ... }` + /// step carrying only `session_id` and `delay_ms_before_next`. The old + /// `index` field is gone now that numbers replace one another continuously, + /// and a foreign or stale module that still sends it must be rejected by + /// the browser rather than silently accepted. Serialize the *real* type + /// through the real serializer so a future field change cannot pass a test + /// built around a hand-written look-alike struct. #[wasm_bindgen_test] - fn wasm_clear_screen_index_none_round_trips() { - #[derive(Debug, Deserialize, Serialize)] - struct ClearScreenWire { - session_id: u64, - index: Option, - delay_ms_before_next: u64, - } - #[derive(Debug, Deserialize, Serialize)] - struct StepWire { - #[serde(rename = "ClearScreen")] - clear: ClearScreenWire, - } - - let step = StepWire { - clear: ClearScreenWire { - session_id: 1, - index: None, - delay_ms_before_next: 0, - }, + fn wasm_clear_screen_wire_shape_has_no_index() { + let step = SessionStep::ClearScreen { + session_id: 1, + delay_ms_before_next: 0, }; - let encoded = to_value(&step).expect("encode"); - let decoded: StepWire = from_value(encoded).expect("decode"); - assert_eq!( - decoded.clear.index, None, - "index: None must survive as None" + let encoded = to_value(&step).expect("encode real SessionStep"); + + let shape: serde_json::Value = from_value(encoded.clone()).expect("decode shape"); + let body = &shape["ClearScreen"]; + assert_eq!(body["session_id"], 1); + assert_eq!(body["delay_ms_before_next"], 0); + assert!( + body.get("index").is_none(), + "a per-number index must never cross the wire: {shape}" ); - assert_eq!(decoded.clear.session_id, 1); - assert_eq!(decoded.clear.delay_ms_before_next, 0); + + // And the same bytes must decode back into the production type. + match from_value::(encoded).expect("decode real SessionStep") { + SessionStep::ClearScreen { + session_id, + delay_ms_before_next, + } => { + assert_eq!(session_id, 1); + assert_eq!(delay_ms_before_next, 0); + } + other => panic!("expected ClearScreen, got {other:?}"), + } } /// `normalize_session_config_wasm` shares the JS decode boundary with /// `build_session_plan_wasm`, so it must reject the same malformed inputs as @@ -437,7 +439,6 @@ mod wasm_tests { let mut countdown_values: Vec = Vec::new(); let mut countdown_delays: Vec = Vec::new(); let mut show_count = 0; - let mut indexed_clears = 0; let mut global_clears = 0; let mut completes = 0; @@ -472,14 +473,15 @@ mod wasm_tests { ); } SessionStep::ClearScreen { - index: Some(_), delay_ms_before_next, .. } => { - indexed_clears += 1; - assert_eq!(*delay_ms_before_next, 100, "the inter-number gap is fixed"); + global_clears += 1; + assert_eq!( + *delay_ms_before_next, 0, + "a global clear never waits: replacement is continuous" + ); } - SessionStep::ClearScreen { index: None, .. } => global_clears += 1, SessionStep::Complete { numbers, sum, .. } => { completes += 1; assert_eq!(numbers, &plan.numbers_generated); @@ -493,7 +495,6 @@ mod wasm_tests { // paints late rather than short. assert_eq!(countdown_delays, vec![1000, 1000, 1100]); assert_eq!(show_count, 1); - assert_eq!(indexed_clears, 1); // One global clear before the countdown, one after the last number. assert_eq!(global_clears, 2); assert_eq!(completes, 1); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b2c31f9..eb184bf 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Ascent Flash", - "version": "2.8.2", + "version": "2.9.0", "identifier": "com.divijg19.ascentflash", "build": { "frontendDist": "../dist", diff --git a/src/App.css b/src/App.css index 429cdcc..08b64d4 100644 --- a/src/App.css +++ b/src/App.css @@ -31,25 +31,41 @@ --ui-scale: 1; } +/* + * Native range sliders default to the browser's blue, which is nearly the + * same hue as several of our blue-ish themes (Ocean especially) and so + * disappears into the background. Drive `accent-color` from a mode-scoped + * neutral instead: a light control on dark surfaces, a dark one on light. + * The problem is luminance similarity, which tracks the mode, not the hue, + * so two tokens cover all six schemes without per-theme churn. + */ +.app.theme-dark { + --control-accent: #eef4ff; +} + +.app.theme-light { + --control-accent: #0b1a2e; +} + :root { /* Preview colors for the color panel (dark / light) */ - --preview-midnight-dark: #000000; - --preview-midnight-light: #9fdce6; + --preview-ocean-dark: #1c5094; + --preview-ocean-light: #bccdf8; - --preview-crimson-dark: #5c0f0f; - --preview-crimson-light: #ffe6e8; + --preview-midnight-dark: #05070a; + --preview-midnight-light: #9fdce6; - --preview-aqua-dark: #006d63; - --preview-aqua-light: #c7fff4; + --preview-aqua-dark: #0b4b62; + --preview-aqua-light: #d8f5ef; - --preview-violet-dark: #2b0f3a; - --preview-violet-light: #f0e0ff; + --preview-ivory-dark: #2a231d; + --preview-ivory-light: #f9fafb; - --preview-amber-dark: #5a2a07; - --preview-amber-light: #ffdf9c; + --preview-rose-dark: #3a2028; + --preview-rose-light: #f7e6ea; - --preview-ivory-dark: #f9fafb; - --preview-ivory-light: #ffffff; + --preview-sage-dark: #173326; + --preview-sage-light: #dcefe1; /* UI scale (updated by JS on resize) */ --ui-scale: 1; @@ -103,13 +119,25 @@ } .bottomInfo a { - color: var(--accent); + color: var(--app-fg); text-decoration: none; font-weight: 600; font-size: calc(clamp(14px, 1.4vw, 18px) * var(--ui-scale)); /* +2px larger */ } +/* On light surfaces the attribution stays pure black: the accent and the + translucent theme foreground can both fall below the small-text contrast + threshold, while black is unambiguously compliant on every light theme. */ +body.theme-light .bottomInfo, +body.theme-light .bottomInfo a { + color: #000000; +} + +body.theme-light .bottomInfo a:hover { + color: var(--accent); +} + .isoRow { display: inline-flex; gap: calc(8px * var(--ui-scale)); @@ -121,19 +149,21 @@ opacity: 0.9; } -.app.theme-midnight { - --app-bg: #000000; - --app-fg: #ffffff; - --app-bg-rgb: 0, 0, 0; - --app-fg-rgb: 255, 255, 255; - --accent: #4fd1ff; - --accent-contrast: #00121a; - --sw-midnight: #000000; - --sw-crimson: #2a0b0b; - --sw-aqua: #052027; - --sw-violet: #1a0825; - --sw-amber: #241400; +/* Ocean is the default: a deep ultramarine, the family used by Memoriad's + Flash Anzan competition software. */ +.app.theme-ocean { + --app-bg: #1c5094; + --app-fg: #eef4ff; + --app-bg-rgb: 28, 80, 148; + --app-fg-rgb: 238, 244, 255; + --accent: #93b8ff; + --accent-contrast: #0a1642; + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; } .app.theme-ivory { @@ -143,186 +173,181 @@ --app-fg-rgb: 17, 24, 39; --accent: #1d4ed8; --accent-contrast: #f8fafc; + --sw-ocean: #bccdf8; --sw-midnight: #111827; - --sw-crimson: #ffdede; --sw-aqua: #e6fffb; - --sw-violet: #f3e8ff; - --sw-amber: #fff4d6; - --sw-ivory: #ffffff; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; } /* Ivory dark-mode variant: a tasteful dark shell while keeping Ivory previews light */ .app.theme-ivory.theme-dark { - --app-bg: #1f2937; - /* Obsidian (lighter, greyer) */ - --app-fg: #f8fafc; - --app-bg-rgb: 31, 41, 55; - --app-fg-rgb: 248, 250, 252; - --accent: #60a5fa; - --accent-contrast: #171e28; - --sw-midnight: #06121a; - --sw-crimson: #2a0b0b; - --sw-aqua: #052027; - --sw-violet: #1a0825; - --sw-amber: #241400; + --app-bg: #2a231d; + --app-fg: #f5efe6; + --app-bg-rgb: 42, 35, 29; + --app-fg-rgb: 245, 239, 230; + --accent: #d9a86c; + --accent-contrast: #241c14; + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; } -.app.theme-crimson { - --app-bg: #5c0f0f; - --app-fg: #fff4f5; - --app-bg-rgb: 92, 15, 15; - --app-fg-rgb: 255, 244, 245; - --accent: #ff4b5c; - --accent-contrast: #3f0000; - --sw-midnight: #070607; - --sw-crimson: #5c0f0f; - --sw-aqua: #083437; - --sw-violet: #2b052f; - --sw-amber: #3b1600; - --sw-ivory: #fff6f7; +/* Matte black, not pure black: less halation against light digits. */ +.app.theme-midnight { + --app-bg: #05070a; + --app-fg: #f2f6fa; + --app-bg-rgb: 5, 7, 10; + --app-fg-rgb: 242, 246, 250; + --accent: #8fb6d9; + --accent-contrast: #0c1015; + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; + --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; } .app.theme-aqua { - --app-bg: #006d63; - --app-fg: #e6fffb; - --app-bg-rgb: 0, 109, 99; - --app-fg-rgb: 230, 255, 251; + --app-bg: #0b4b62; + --app-fg: #eafaf7; + --app-bg-rgb: 11, 75, 98; + --app-fg-rgb: 234, 250, 247; --accent: #08b7a8; --accent-contrast: #002926; - --sw-midnight: #001018; - --sw-crimson: #2b0b0b; - --sw-aqua: #006d63; - --sw-violet: #0f0520; - --sw-amber: #241400; - --sw-ivory: #dffbff; -} - -.app.theme-violet { - --app-bg: #2b0f3a; - --app-fg: #f6e9ff; - --app-bg-rgb: 43, 15, 58; - --app-fg-rgb: 246, 233, 255; - --accent: #b786ff; - --accent-contrast: #190819; - --sw-midnight: #07020b; - --sw-crimson: #2a0b0b; - --sw-aqua: #031018; - --sw-violet: #2b0f3a; - --sw-amber: #2b1400; - --sw-ivory: #f6e9ff; -} - -.app.theme-amber { - --app-bg: #5a2a07; - --app-fg: #fff4d6; - --app-bg-rgb: 90, 42, 7; - --app-fg-rgb: 255, 244, 214; - --accent: #ff7a2d; - --accent-contrast: #3b1f00; - --sw-midnight: #060404; - --sw-crimson: #3a0b07; - --sw-aqua: #041616; - --sw-violet: #2a0718; - --sw-amber: #5a2a07; - --sw-ivory: #fff4d6; -} - -/* Light-mode variants for each color theme (keeps accent but swaps background/foreground) */ -.app.theme-midnight.theme-light { - --app-bg: #9fdce6; - /* Dawn - lighter cerulean */ + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; + --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; +} + +.app.theme-rose { + --app-bg: #3a2028; + --app-fg: #f5e6ea; + --app-bg-rgb: 58, 32, 40; + --app-fg-rgb: 245, 230, 234; + --accent: #e39aae; + --accent-contrast: #2a1018; + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; + --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; +} + +.app.theme-sage { + --app-bg: #173326; + --app-fg: #e2f0e7; + --app-bg-rgb: 23, 51, 38; + --app-fg-rgb: 226, 240, 231; + --accent: #7fc9a0; + --accent-contrast: #0d2016; + --sw-ocean: #1c5094; + --sw-midnight: #05070a; + --sw-aqua: #0b4b62; + --sw-ivory: #f9fafb; + --sw-rose: #3a2028; + --sw-sage: #173326; +} + +/* Light-mode variants for each colour theme (keeps accent but swaps surfaces). */ +.app.theme-ocean.theme-light { + --app-bg: #bccdf8; --app-fg: #062331; - --app-bg-rgb: 159, 220, 230; + --app-bg-rgb: 188, 205, 248; --app-fg-rgb: 6, 35, 49; - --accent: #0284c7; - --accent-contrast: #9fdce6; + --accent: #2c58c4; + --accent-contrast: #f2f6ff; + --sw-ocean: #bccdf8; --sw-midnight: #9fdce6; - --sw-crimson: #ffdede; - --sw-aqua: #dafaf8; - --sw-violet: #f2e9ff; - --sw-amber: #fff5db; - --sw-ivory: #ffffff; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; } .app.theme-ivory.theme-light { - --app-bg: #ffffff; - /* keep Ivory as pure white theme */ - --app-fg: #071020; - --app-bg-rgb: 255, 255, 255; - --app-fg-rgb: 7, 16, 32; + --app-bg: #f9fafb; + --app-fg: #111827; + --app-bg-rgb: 249, 250, 251; + --app-fg-rgb: 17, 24, 39; --accent: #1e40af; --accent-contrast: #ffffff; - --sw-midnight: #111827; - --sw-crimson: #ffdede; - --sw-aqua: #e6fffb; - --sw-violet: #f3e8ff; - --sw-amber: #fff4d6; - --sw-ivory: #ffffff; -} - -.app.theme-crimson.theme-light { - --app-bg: #ffe6e8; - /* lighter Blush */ - --app-fg: #3a0b0f; - --app-bg-rgb: 255, 230, 232; - --app-fg-rgb: 58, 11, 15; - --accent: #e11d48; - --accent-contrast: #fff6f6; - --sw-midnight: #fdeef0; - --sw-crimson: #ffe6e8; - --sw-aqua: #e6fbfa; - --sw-violet: #f7eefe; - --sw-amber: #fff3e6; - --sw-ivory: #fff6f7; + --sw-ocean: #bccdf8; + --sw-midnight: #9fdce6; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; +} + +/* Dawn keeps its original cool blue, paired with the new matte Midnight. */ +.app.theme-midnight.theme-light { + --app-bg: #9fdce6; + --app-fg: #062331; + --app-bg-rgb: 159, 220, 230; + --app-fg-rgb: 6, 35, 49; + --accent: #0284c7; + --accent-contrast: #f2fbff; + --sw-ocean: #bccdf8; + --sw-midnight: #9fdce6; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; } .app.theme-aqua.theme-light { - --app-bg: #c7fff4; - /* lighter teal-sea glass */ + --app-bg: #d8f5ef; --app-fg: #013733; - --app-bg-rgb: 199, 255, 244; + --app-bg-rgb: 216, 245, 239; --app-fg-rgb: 1, 55, 51; --accent: #0ea5a4; - --accent-contrast: #c7fff4; - --sw-midnight: #e6f9fb; - --sw-crimson: #fff0f1; - --sw-aqua: #c7fff4; - --sw-violet: #f6f0ff; - --sw-amber: #fff8e6; - --sw-ivory: #fffaf7; -} - -.app.theme-violet.theme-light { - --app-bg: #f0e0ff; - /* stronger Lilac */ - --app-fg: #2b0f32; - --app-bg-rgb: 240, 224, 255; - --app-fg-rgb: 43, 15, 50; - --accent: #9b6bff; - --accent-contrast: #f0e0ff; - --sw-midnight: #f1eef8; - --sw-crimson: #fff2f4; - --sw-aqua: #eafaf9; - --sw-violet: #f0e0ff; - --sw-amber: #fff6e8; - --sw-ivory: #f7f0ff; -} - -.app.theme-amber.theme-light { - --app-bg: #ffdf9c; - /* stronger Saffron */ - --app-fg: #2a1500; - --app-bg-rgb: 255, 223, 156; - --app-fg-rgb: 42, 21, 0; - --accent: #ff8b36; - --accent-contrast: #ffdf9c; - --sw-midnight: #fff6ee; - --sw-crimson: #fff2f1; - --sw-aqua: #f3fffb; - --sw-violet: #fff6fb; - --sw-amber: #ffdf9c; - --sw-ivory: #fffdf5; + --accent-contrast: #f2fffc; + --sw-ocean: #bccdf8; + --sw-midnight: #9fdce6; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; +} + +.app.theme-rose.theme-light { + --app-bg: #f7e6ea; + --app-fg: #3a1f26; + --app-bg-rgb: 247, 230, 234; + --app-fg-rgb: 58, 31, 38; + --accent: #a8475f; + --accent-contrast: #fff3f5; + --sw-ocean: #bccdf8; + --sw-midnight: #9fdce6; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; +} + +.app.theme-sage.theme-light { + --app-bg: #dcefe1; + --app-fg: #14291d; + --app-bg-rgb: 220, 239, 225; + --app-fg-rgb: 20, 41, 29; + --accent: #387d56; + --accent-contrast: #f4fbf6; + --sw-ocean: #bccdf8; + --sw-midnight: #9fdce6; + --sw-aqua: #d8f5ef; + --sw-ivory: #f9fafb; + --sw-rose: #f7e6ea; + --sw-sage: #dcefe1; } .endScreen { @@ -800,6 +825,7 @@ width: 100%; height: 24px; background: transparent; + accent-color: var(--control-accent); } .range:disabled { @@ -884,20 +910,20 @@ /* Explicit preview swatch colors per mode so clicking a swatch (selecting theme) doesn't change the other swatches' appearance. Scoped under .app to avoid matching unrelated elements. */ -.app.theme-dark .sw-preview-midnight { - background: var(--preview-midnight-dark); +.app.theme-dark .sw-preview-ocean { + background: var(--preview-ocean-dark); } -.app.theme-light .sw-preview-midnight { - background: var(--preview-midnight-light); +.app.theme-light .sw-preview-ocean { + background: var(--preview-ocean-light); } -.app.theme-dark .sw-preview-crimson { - background: var(--preview-crimson-dark); +.app.theme-dark .sw-preview-midnight { + background: var(--preview-midnight-dark); } -.app.theme-light .sw-preview-crimson { - background: var(--preview-crimson-light); +.app.theme-light .sw-preview-midnight { + background: var(--preview-midnight-light); } .app.theme-dark .sw-preview-aqua { @@ -908,30 +934,30 @@ background: var(--preview-aqua-light); } -.app.theme-dark .sw-preview-violet { - background: var(--preview-violet-dark); +.app.theme-dark .sw-preview-ivory { + background: var(--preview-ivory-dark); + border: 2px solid rgba(0, 0, 0, 0.06); } -.app.theme-light .sw-preview-violet { - background: var(--preview-violet-light); +.app.theme-light .sw-preview-ivory { + background: var(--preview-ivory-light); + border: 2px solid rgba(0, 0, 0, 0.06); } -.app.theme-dark .sw-preview-amber { - background: var(--preview-amber-dark); +.app.theme-dark .sw-preview-rose { + background: var(--preview-rose-dark); } -.app.theme-light .sw-preview-amber { - background: var(--preview-amber-light); +.app.theme-light .sw-preview-rose { + background: var(--preview-rose-light); } -.app.theme-dark .sw-preview-ivory { - background: var(--preview-ivory-dark); - border: 2px solid rgba(0, 0, 0, 0.06); +.app.theme-dark .sw-preview-sage { + background: var(--preview-sage-dark); } -.app.theme-light .sw-preview-ivory { - background: var(--preview-ivory-light); - border: 2px solid rgba(0, 0, 0, 0.06); +.app.theme-light .sw-preview-sage { + background: var(--preview-sage-light); } /* Selected state */ @@ -1077,10 +1103,25 @@ .number { --len: 1; font-family: var(--font-mono); - /* Fit long digit strings without overflow (approx monospace glyph width ~0.62em). */ - font-size: min(70vh, calc(92vw / (var(--len) * 0.62))); + /* + * A fixed-width, lining numeral at every digit position: the number never + * shifts horizontally between flashes, and oldstyle descenders never add + * a bobbing baseline. Monospace already tabulates; the explicit properties + * also cover fallback fonts that ship both figure styles. + */ + font-variant-numeric: tabular-nums lining-nums; + /* Explicit 400: thin strokes vanish on dark fields, heavy ones bleed and + prolong afterimages. Medium-regular is the most legible at speed. */ + font-weight: 400; + /* The number uses the active theme's own foreground: the session display + is the theme, not a separate neutral shell. */ + color: var(--app-fg); + /* Fit long digit strings without overflow (approx monospace glyph width ~0.62em). + 60vh caps the bright area: large enough for children, small enough to + avoid an oversized adapting stimulus over a long session. */ + font-size: min(60vh, calc(92vw / (var(--len) * 0.62))); line-height: 1; - letter-spacing: 0.03em; + letter-spacing: 0.04em; user-select: none; white-space: nowrap; display: flex; diff --git a/src/App.tsx b/src/App.tsx index ca0b350..94275ca 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -63,11 +63,23 @@ export default function App() { const [splashVisible, setSplashVisible] = createSignal(false); const [splashExiting, setSplashExiting] = createSignal(false); - const [colorScheme, setColorScheme] = createSignal("midnight"); + const [colorScheme, setColorScheme] = createSignal("ocean"); const [themeMode, setThemeMode] = createSignal("dark"); const themeClass = () => `theme-${colorScheme()}`; const modeClass = () => `theme-${themeMode()}`; + // The attribution block is a sibling of `.app`, so it cannot inherit a + // theme class scoped to the app root. Mirror the mode on so fixed + // chrome outside the app can be themed without relying on :has(). + createEffect(() => { + const light = themeMode() === "light"; + document.body.classList.toggle("theme-light", light); + document.body.classList.toggle("theme-dark", !light); + onCleanup(() => { + document.body.classList.remove("theme-light", "theme-dark"); + }); + }); + onMount(() => { if (!showSplash()) return; @@ -448,19 +460,13 @@ export default function App() { if (activeSessionId == null) return; if (payload.session_id !== activeSessionId) return; + // Clears are global only: numbers replace one another in place, + // so there is no per-number index to guard against any more. const cur = currentShown(); if (cur && payload.emitted_at_ms < cur.emitted_at_ms) return; - if (payload.index == null) { - setDisplayText(""); - setCurrentShown(null); - return; - } - - if (cur && cur.index === payload.index) { - setDisplayText(""); - setCurrentShown(null); - } + setDisplayText(""); + setCurrentShown(null); }), runtime.onAutoRepeatWaiting((payload) => { diff --git a/src/__tests__/__mocks__/fakeWasmPlan.ts b/src/__tests__/__mocks__/fakeWasmPlan.ts index dcf16a3..4787870 100644 --- a/src/__tests__/__mocks__/fakeWasmPlan.ts +++ b/src/__tests__/__mocks__/fakeWasmPlan.ts @@ -7,7 +7,7 @@ import { registerWasmCoreBridge } from "../../wasm/coreBridge"; * * Three test files each carried their own copy of a plan builder, a bridge * stub and a config snapshot. The builders were near-identical — the same - * 3/2/1 countdown, the same 1-based index conversion, the same 100ms gap — and + * 3/2/1 countdown, the same 1-based index conversion, the same exposures — and * the snapshots differed only in `digits_per_number` and `total_numbers`. So a * change to the plan shape had to be made in three places, and the copies had * already drifted: one took an `exposureMs` parameter while the others @@ -20,7 +20,7 @@ import { registerWasmCoreBridge } from "../../wasm/coreBridge"; /** The countdown every plan starts with, as the engine emits it. */ const COUNTDOWN_STEPS: WasmSessionPlan["steps"] = [ - { ClearScreen: { session_id: 1, index: null, delay_ms_before_next: 0 } }, + { ClearScreen: { session_id: 1, delay_ms_before_next: 0 } }, { CountdownTick: { value: "3", delay_ms_before_next: 1000 } }, { CountdownTick: { value: "2", delay_ms_before_next: 1000 } }, // The final tick also carries the pre-flash settle, matching @@ -31,9 +31,6 @@ const COUNTDOWN_STEPS: WasmSessionPlan["steps"] = [ /** The first flash follows the countdown, settle included. */ const FIRST_FLASH_AT_MS = 3100; -/** Blank gap between a clear and the next flash. `INTER_NUMBER_GAP_MS`. */ -const GAP_MS = 100; - /** * A config snapshot for a plan. * @@ -56,8 +53,9 @@ function configSnapshot(overrides?: { * Build a `WasmSessionPlan` whose numbers are exactly `numbers`. * * The steps mirror `build_session_plan` in `core/engine.rs`: an initial clear, - * the three countdown ticks, then a show/clear pair per number, then a trailing - * clear and the completion. Indices are 1-based, as Rust reports them. + * the three countdown ticks, one show per number (continuous replacement, no + * blank step), then a trailing clear and the completion. Indices are 1-based, + * as Rust reports them. * * `exposureMs` is how long each number stays on screen; it defaults to 500ms, * which is what the tests that do not care about timing use. @@ -87,18 +85,10 @@ export function fakeWasmPlan( }, }); at += exposureMs; - steps.push({ - ClearScreen: { - session_id: 1, - index: i + 1, - delay_ms_before_next: GAP_MS, - }, - }); - at += GAP_MS; } steps.push({ - ClearScreen: { session_id: 1, index: null, delay_ms_before_next: 0 }, + ClearScreen: { session_id: 1, delay_ms_before_next: 0 }, }); steps.push({ Complete: { diff --git a/src/__tests__/__mocks__/mockRuntime.ts b/src/__tests__/__mocks__/mockRuntime.ts index 1bd9906..34481c9 100644 --- a/src/__tests__/__mocks__/mockRuntime.ts +++ b/src/__tests__/__mocks__/mockRuntime.ts @@ -57,13 +57,13 @@ export function createMockRuntime() { return "pong (mock)"; }, async getAppSettings() { - return { color_scheme: "midnight", theme_mode: "dark" }; + return { color_scheme: "ocean", theme_mode: "dark" }; }, async setColorScheme(s) { return { color_scheme: s, theme_mode: "dark" }; }, async setThemeMode(m) { - return { color_scheme: "midnight", theme_mode: m }; + return { color_scheme: "ocean", theme_mode: m }; }, async startSession() { return { diff --git a/src/__tests__/browserFallbackPlan.test.ts b/src/__tests__/browserFallbackPlan.test.ts index a868946..7ba9632 100644 --- a/src/__tests__/browserFallbackPlan.test.ts +++ b/src/__tests__/browserFallbackPlan.test.ts @@ -36,7 +36,8 @@ const CONFIG: SessionConfigInput = { allow_negative_numbers: false, }; -// 3 countdown ticks x 1s + 100ms settle + 4 x (500ms show + 100ms gap) = 5.5s. +// 3 countdown ticks x 1s + 100ms settle + 4 x 500ms exposure = 5.1s with +// continuous replacement. 6000ms leaves generous slack for timer delivery. const SESSION_MS = 6000; describe("browser JS planner fallback", () => { diff --git a/src/__tests__/countdownStyles.test.ts b/src/__tests__/countdownStyles.test.ts index 0f9ecc9..d1072f8 100644 --- a/src/__tests__/countdownStyles.test.ts +++ b/src/__tests__/countdownStyles.test.ts @@ -5,7 +5,6 @@ import { COUNTDOWN_FROM, COUNTDOWN_TICK_MS, COUNTDOWN_TICKS, - INTER_NUMBER_GAP_MS, PRE_FLASH_SETTLE_MS, } from "../timing"; @@ -150,7 +149,6 @@ describe("countdown stylesheet covers the countdown surface", () => { expect(COUNTDOWN_FROM).toBe(3); expect(COUNTDOWN_TICK_MS).toBe(1000); expect(PRE_FLASH_SETTLE_MS).toBe(100); - expect(INTER_NUMBER_GAP_MS).toBe(100); // The displayed sequence must be exactly one value per count, descending. expect(COUNTDOWN_TICKS).toHaveLength(COUNTDOWN_FROM); diff --git a/src/__tests__/flashExposure.test.tsx b/src/__tests__/flashExposure.test.tsx index f08b628..12b8b56 100644 --- a/src/__tests__/flashExposure.test.tsx +++ b/src/__tests__/flashExposure.test.tsx @@ -46,9 +46,6 @@ const CONFIG = { const EXPOSURE_MS = 500; -/** Blank gap between a clear and the next flash. `INTER_NUMBER_GAP_MS`. */ -const GAP_MS = 100; - /** * The plan these cases drive, from the shared fixture. * @@ -80,14 +77,19 @@ function recorder() { stop(): void { for (const fn of unsubscribers) fn(); }, - /** On-screen duration of each number, by its 1-based payload index. */ + /** + * On-screen duration of each number. With continuous replacement, a + * number's window ends when the *next* one arrives; the last one ends + * at the closing global clear. + */ exposures(): number[] { - return shows.map((show) => { - const clear = clears.find((c) => c.index === show.index); - if (!clear) { - throw new Error(`Number ${show.index} was never cleared`); + return shows.map((show, i) => { + const next = shows[i + 1]?.emitted_at_ms; + const end = next ?? clears.at(-1)?.emitted_at_ms; + if (end == null) { + throw new Error(`Number ${show.index} was never replaced`); } - return clear.emitted_at_ms - show.emitted_at_ms; + return end - show.emitted_at_ms; }); }, }; @@ -232,7 +234,7 @@ describe("flashed number exposure", () => { // a strobe; only the first turn of the chain is legitimately 0. const positive = scheduledDelays.filter((delay) => delay > 0); expect(positive.length).toBeGreaterThan(0); - expect(Math.min(...positive)).toBeGreaterThanOrEqual(GAP_MS); + expect(Math.min(...positive)).toBeGreaterThanOrEqual(EXPOSURE_MS); }); }); diff --git a/src/__tests__/flashTiming.test.ts b/src/__tests__/flashTiming.test.ts index bd8f239..9c4894b 100644 --- a/src/__tests__/flashTiming.test.ts +++ b/src/__tests__/flashTiming.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { browserRuntime } from "../runtime/browser"; -describe("flash timing: uniform exposure with fixed 100ms gap", () => { +describe("flash timing: uniform exposure with continuous replacement", () => { beforeEach(() => { vi.useFakeTimers(); vi.setSystemTime(0); @@ -13,12 +13,12 @@ describe("flash timing: uniform exposure with fixed 100ms gap", () => { vi.restoreAllMocks(); }); - it("schedules countdown, uniform flashes, and 100ms blanks", async () => { + it("schedules countdown and uniform flashes with no blank between them", async () => { await browserRuntime.setSoundEnabled(false); const countdowns: Array<{ value: string; at: number }> = []; const shows: Array<{ index: number; at: number }> = []; - const indexedClears: Array<{ index: number; at: number }> = []; + const clears: number[] = []; let completedAt: number | null = null; await browserRuntime.onCountdownTick((value) => { @@ -27,10 +27,8 @@ describe("flash timing: uniform exposure with fixed 100ms gap", () => { await browserRuntime.onShowNumber((payload) => { shows.push({ index: payload.index, at: Date.now() }); }); - await browserRuntime.onClearScreen((payload) => { - if (payload.index != null) { - indexedClears.push({ index: payload.index, at: Date.now() }); - } + await browserRuntime.onClearScreen(() => { + clears.push(Date.now()); }); await browserRuntime.onSessionComplete(() => { completedAt = Date.now(); @@ -55,29 +53,21 @@ describe("flash timing: uniform exposure with fixed 100ms gap", () => { await vi.advanceTimersByTimeAsync(1100); expect(shows).toEqual([{ index: 1, at: 3100 }]); - // Uniform 500ms exposure for the first flash (no first-flash bonus). - // This pins the *plan*; `flashExposure.test.tsx` pins the same property at - // the driver level, under injected delivery lateness. + // Continuous replacement: the second number takes the first one's place + // exactly one exposure later. There is no clear event in between — only + // the global clear at session start and the one after the last number. await vi.advanceTimersByTimeAsync(500); - expect(indexedClears).toEqual([{ index: 1, at: 3600 }]); - - // Fixed 100ms blank before the second flash. - await vi.advanceTimersByTimeAsync(100); expect(shows).toEqual([ { index: 1, at: 3100 }, - { index: 2, at: 3700 }, + { index: 2, at: 3600 }, ]); + expect(clears).toEqual([0]); - // Second exposure is identical to the first. + // Uniform 500ms exposure for the second flash too, then the closing + // clear and completion with no trailing gap. await vi.advanceTimersByTimeAsync(500); - expect(indexedClears).toEqual([ - { index: 1, at: 3600 }, - { index: 2, at: 4200 }, - ]); - - // 100ms trailing gap, then completion. - await vi.advanceTimersByTimeAsync(100); - expect(completedAt).toBe(4300); + expect(clears).toEqual([0, 4100]); + expect(completedAt).toBe(4100); }); it("schedules large sessions without upfront generation", async () => { @@ -109,15 +99,15 @@ describe("flash timing: uniform exposure with fixed 100ms gap", () => { expect(shows).toEqual([]); expect(started?.effective_config.total_numbers).toBe(500); - // Early events keep exact golden times. + // Early events keep exact golden times: one exposure per number, no gap. await vi.advanceTimersByTimeAsync(3100); expect(shows[0]).toEqual({ index: 1, at: 3100 }); - await vi.advanceTimersByTimeAsync(200); - expect(shows[1]).toEqual({ index: 2, at: 3300 }); + await vi.advanceTimersByTimeAsync(100); + expect(shows[1]).toEqual({ index: 2, at: 3200 }); // The chained driver runs the full session to identical completion: - // 3100 + 500 * (100 + 100). - await vi.advanceTimersByTimeAsync(100000 - 200); + // 3100 + 500 * 100. + await vi.advanceTimersByTimeAsync(50000 - 100); if (completion.current === null) { throw new Error("large session did not complete"); } diff --git a/src/__tests__/themeStyles.test.ts b/src/__tests__/themeStyles.test.ts new file mode 100644 index 0000000..ffb746d --- /dev/null +++ b/src/__tests__/themeStyles.test.ts @@ -0,0 +1,131 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { describe, expect, it } from "vitest"; +import { COLOR_SCHEMES } from "../runtime/types"; + +/** + * The flashing number is the one stimulus the whole application depends on. + * Its contract lives in CSS, which jsdom does not apply, so a deletion here + * would leave every behavioural test green while the product silently lost it. + * + * These tests read the stylesheet directly and pin the parts that came from + * the visual-strain research: tabular lining digits at an explicit regular + * weight, each theme surface clearing the contrast target on its own, and + * legible controls/chrome in both modes. + */ +const css = readFileSync(resolve(process.cwd(), "src/App.css"), "utf8"); + +function token(selector: string, name: string): string { + const start = css.indexOf(selector); + if (start < 0) throw new Error(`missing selector ${selector}`); + const end = css.indexOf("}", start); + const match = new RegExp(`--${name}:\\s*([^;]+);`).exec( + css.slice(start, end), + ); + if (!match) throw new Error(`missing --${name} in ${selector}`); + return match[1].trim(); +} + +function luminance(hex: string): number { + const channels = [1, 3, 5].map( + (i) => Number.parseInt(hex.slice(i, i + 2), 16) / 255, + ); + const linear = channels.map((c) => + c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4, + ); + return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2]; +} + +function contrast(bg: string, fg: string): number { + const [light, dark] = [luminance(bg), luminance(fg)].sort((a, b) => b - a); + return (light + 0.05) / (dark + 0.05); +} + +describe("flash stimulus styling", () => { + it("lets the session display use the active theme's own colours", () => { + // No separate neutral shell during a session: what the user picked is + // what they see from the home screen through the last flash. + expect(css).not.toContain("--flash-bg"); + expect(css).not.toContain("--flash-fg"); + const field = /\.app:not\(\.home\)\s*\{([^}]*)\}/.exec(css); + expect(field).not.toBeNull(); + expect(field?.[1]).not.toContain("background:"); + }); + + it("pins tabular lining digits at a regular weight", () => { + const number = /\.number\s*\{([^}]*)\}/.exec(css); + expect(number).not.toBeNull(); + const body = number?.[1] ?? ""; + expect(body).toContain("font-variant-numeric: tabular-nums lining-nums"); + expect(body).toMatch(/font-weight:\s*400;/); + expect(body).toContain("color: var(--app-fg)"); + }); + + it("gives native sliders a contrasting accent in every mode", () => { + // Sliders otherwise inherit the browser's default blue, which blends + // into blue themes. A mode-scoped neutral keeps them legible everywhere. + const range = /\.range\s*\{([^}]*)\}/.exec(css); + expect(range).not.toBeNull(); + expect(range?.[1]).toContain("accent-color: var(--control-accent)"); + expect(token(".app.theme-dark {", "control-accent")).toBeTruthy(); + expect(token(".app.theme-light {", "control-accent")).toBeTruthy(); + }); + + it("keeps the bottom-right site link readable in every theme", () => { + // It follows the theme foreground by default; an accent that is bright + // enough on a dark theme can be unreadable on a light one. + const link = /\.bottomInfo a\s*\{([^}]*)\}/.exec(css); + expect(link).not.toBeNull(); + expect(link?.[1]).toContain("color: var(--app-fg)"); + + // On light themes the whole block (label + link) is forced to black, + // which clears WCAG small-text contrast on every light surface. + const light = + /body\.theme-light \.bottomInfo,\s*body\.theme-light \.bottomInfo a\s*\{([^}]*)\}/.exec( + css, + ); + expect(light).not.toBeNull(); + expect(light?.[1]).toContain("color: #000000"); + }); + + it("never uses pure black or pure white for a theme surface", () => { + const declared = [ + ...css.matchAll(/--app-(?:bg|fg):\s*(#[0-9a-f]{6});/g), + ].map((m) => m[1].toLowerCase()); + expect(declared.length).toBeGreaterThan(0); + expect(declared).not.toContain("#000000"); + expect(declared).not.toContain("#ffffff"); + }); + + it("gives every offered scheme a dark and light surface above target", () => { + const schemes = COLOR_SCHEMES; + expect(schemes).toEqual([ + "ocean", + "midnight", + "aqua", + "ivory", + "rose", + "sage", + ]); + + for (const scheme of schemes) { + const dark = token(`.app.theme-${scheme} {`, "app-bg"); + const darkFg = token(`.app.theme-${scheme} {`, "app-fg"); + expect(contrast(dark, darkFg)).toBeGreaterThan(7); + + const light = token(`.app.theme-${scheme}.theme-light {`, "app-bg"); + const lightFg = token(`.app.theme-${scheme}.theme-light {`, "app-fg"); + expect(contrast(light, lightFg)).toBeGreaterThan(7); + } + + // Dawn keeps Memoriad's cool blue under the near-black Midnight theme. + expect(token(".app.theme-midnight.theme-light {", "app-bg")).toBe( + "#9fdce6", + ); + // Ocean is a true ultramarine, between the deep navy and the bright + // cerulean used by Memoriad's Flash Anzan display. + expect(token(".app.theme-ocean {", "app-bg")).toBe("#1c5094"); + // Midnight stays close to black-on-white, tuned off the 21:1 extreme. + expect(token(".app.theme-midnight {", "app-bg")).toBe("#05070a"); + }); +}); diff --git a/src/__tests__/wasmParity.test.ts b/src/__tests__/wasmParity.test.ts index cb7695c..ec0d797 100644 --- a/src/__tests__/wasmParity.test.ts +++ b/src/__tests__/wasmParity.test.ts @@ -233,8 +233,8 @@ describe.skipIf(!HAS_WASM)("WASM bridge ABI", () => { expect(Math.abs(value)).toBeGreaterThanOrEqual(100); expect(Math.abs(value)).toBeLessThanOrEqual(999); } - // 1 initial clear + 3 countdown ticks + 2 per number + final clear + - // complete. - expect(plan.steps).toHaveLength(1 + 3 + 2 * 20 + 1 + 1); + // 1 initial clear + 3 countdown ticks + 1 show per number + // (continuous replacement) + final clear + complete. + expect(plan.steps).toHaveLength(1 + 3 + 20 + 1 + 1); }); }); diff --git a/src/__tests__/wasmPlan.test.ts b/src/__tests__/wasmPlan.test.ts index 941d78f..4019e5b 100644 --- a/src/__tests__/wasmPlan.test.ts +++ b/src/__tests__/wasmPlan.test.ts @@ -28,12 +28,12 @@ function showStep( }; } -function clearStep(index: number | null): WasmSessionPlan["steps"][number] { +/** Clears are global only and never wait; they produce no driver event. */ +function clearStep(): WasmSessionPlan["steps"][number] { return { ClearScreen: { session_id: 1, - index, - delay_ms_before_next: index == null ? 0 : 100, + delay_ms_before_next: 0, }, }; } @@ -52,8 +52,9 @@ function countdownStep(value: string): WasmSessionPlan["steps"][number] { * * Built by the shared `fakeWasmPlan` fixture, which reproduces what * `build_session_plan` in `core/engine.rs` emits for a two-number session: the - * countdown, then a show/clear pair per number, then the completion. Its - * `total_duration_ms` of 4300 is the same value this used to hard-code. + * countdown, then one show per number (continuous replacement), then the + * completion. Its `total_duration_ms` of 4100 is the same value this used to + * hard-code. */ function fixedPlan(): WasmSessionPlan { return fakeWasmPlan([42, 17]); @@ -70,10 +71,8 @@ describe("planStepsToEvents", () => { { at: 1000, kind: "countdown", value: "2" }, { at: 2000, kind: "countdown", value: "1" }, { at: 3100, kind: "show", index: 0, value: 42, runningSum: 42 }, - { at: 3600, kind: "clear", index: 0 }, - { at: 3700, kind: "show", index: 1, value: 17, runningSum: 59 }, - { at: 4200, kind: "clear", index: 1 }, - { at: 4300, kind: "finish" }, + { at: 3600, kind: "show", index: 1, value: 17, runningSum: 59 }, + { at: 4100, kind: "finish" }, ]); }); @@ -94,7 +93,7 @@ describe("planStepsToEvents", () => { delay_ms_before_next: 0, }, }, - { ClearScreen: { session_id: 1, index: 1, delay_ms_before_next: 100 } }, + clearStep(), { Complete: { session_id: 1, numbers: [5], sum: 5 } }, ]; expect(planStepsToEvents(collide())).toBeNull(); @@ -120,7 +119,7 @@ describe("planStepsToEvents", () => { ).toBeNull(); expect( planStepsToEvents([ - clearStep(null), + clearStep(), { CountdownTick: { value: 3 } }, ] as never), ).toBeNull(); @@ -143,7 +142,7 @@ describe("planStepsToEvents", () => { "body is not a record", "ShowNumber with index below 1", "ShowNumber with a non-integer value", - "ClearScreen with index below 1", + "ClearScreen with a negative delay", "a plan with no numbers at all", ])("rejects %s", (label) => { switch (label) { @@ -162,16 +161,15 @@ describe("planStepsToEvents", () => { }, ClearScreen: { session_id: 1, - index: 1, - delay_ms_before_next: 100, + delay_ms_before_next: 0, }, } as never; expect( planStepsToEvents([ - clearStep(null), + clearStep(), ambiguous, showStep(2, 7, 12), - clearStep(2), + clearStep(), ]), ).toBeNull(); break; @@ -182,7 +180,7 @@ describe("planStepsToEvents", () => { case "ShowNumber with index below 1": expect( planStepsToEvents([ - clearStep(null), + clearStep(), { ShowNumber: { index: 0, @@ -197,7 +195,7 @@ describe("planStepsToEvents", () => { case "ShowNumber with a non-integer value": expect( planStepsToEvents([ - clearStep(null), + clearStep(), { ShowNumber: { index: 1, @@ -209,15 +207,14 @@ describe("planStepsToEvents", () => { ] as never), ).toBeNull(); break; - case "ClearScreen with index below 1": + case "ClearScreen with a negative delay": expect( planStepsToEvents([ - clearStep(null), + clearStep(), { ClearScreen: { session_id: 1, - index: 0, - delay_ms_before_next: 100, + delay_ms_before_next: -1, }, }, ] as never), @@ -229,7 +226,7 @@ describe("planStepsToEvents", () => { // flashed, which reads as a session that started and went blank. expect( planStepsToEvents([ - clearStep(null), + clearStep(), countdownStep("3"), countdownStep("2"), countdownStep("1"), @@ -278,12 +275,12 @@ describe("WASM single-source execution", () => { await vi.advanceTimersByTimeAsync(3100); expect(shows).toEqual([{ value: 42, runningSum: 42, at: 3100 }]); - await vi.advanceTimersByTimeAsync(1100); + await vi.advanceTimersByTimeAsync(500); expect(shows).toEqual([ { value: 42, runningSum: 42, at: 3100 }, - { value: 17, runningSum: 59, at: 3700 }, + { value: 17, runningSum: 59, at: 3600 }, ]); - await vi.advanceTimersByTimeAsync(600); + await vi.advanceTimersByTimeAsync(500); expect(completed).toEqual({ numbers: [42, 17], sum: 59 }); }); diff --git a/src/components/AdvancedSettings.tsx b/src/components/AdvancedSettings.tsx index f5a09ae..e241f1f 100644 --- a/src/components/AdvancedSettings.tsx +++ b/src/components/AdvancedSettings.tsx @@ -67,7 +67,7 @@ export interface AdvancedSettingsProps { /** * The display name for each colour scheme on the dark theme. * - * The names differ per theme: the `ivory` swatch is "Obsidian" on dark and + * The names differ per theme: the `ivory` swatch is "Sepia" on dark and * "Ivory" on light, so a single name per scheme would be wrong half the time. * * The scheme list itself lives in `runtime/types.ts` next to the `ColorScheme` @@ -76,21 +76,21 @@ export interface AdvancedSettingsProps { * updating this list left the picker without the new option. */ const DARK_NAMES: Record = { + ocean: "Ocean", midnight: "Midnight", - crimson: "Crimson", aqua: "Aqua", - violet: "Violet", - amber: "Amber", - ivory: "Obsidian", + ivory: "Sepia", + rose: "Rose", + sage: "Forest", }; const LIGHT_NAMES: Record = { + ocean: "Horizon", midnight: "Dawn", - crimson: "Blush", aqua: "Sea Glass", - violet: "Lilac", - amber: "Saffron", ivory: "Ivory", + rose: "Blush", + sage: "Sage", }; export function AdvancedSettings(props: AdvancedSettingsProps): JSX.Element { diff --git a/src/runtime/browser.ts b/src/runtime/browser.ts index 7fd7ba3..cb2b5ba 100644 --- a/src/runtime/browser.ts +++ b/src/runtime/browser.ts @@ -11,7 +11,6 @@ import buzzerUrl from "../assets/buzzer.wav?url"; import { COUNTDOWN_TICK_MS, COUNTDOWN_TICKS, - INTER_NUMBER_GAP_MS, PRE_FLASH_SETTLE_MS, } from "../timing"; import { getWasmCoreBridge, type WasmSessionStep } from "../wasm/coreBridge"; @@ -75,7 +74,7 @@ interface BrowserSession { const SETTINGS_KEY = "flashspan.runtime.settings"; const SOUND_KEY = "flashspan.runtime.sound-enabled"; const DEFAULT_SETTINGS: AppSettings = { - color_scheme: "midnight", + color_scheme: "ocean", theme_mode: "dark", }; @@ -431,10 +430,9 @@ function queueTimer( session.timerId = timerId; } -function emitClearScreen(sessionId: number, index: number | null): void { +function emitClearScreen(sessionId: number): void { emit(listeners.clearScreen, { session_id: sessionId, - index, emitted_at_ms: nowMs(), }); } @@ -628,7 +626,6 @@ type PlannedDriverEvent = value: number; runningSum: number; } - | { at: number; kind: "clear"; index: number } | { at: number; kind: "finish" }; /** Serde enum tags the WASM bridge can produce, in schema order. */ @@ -788,17 +785,11 @@ export function planStepsToEvents( } shows += 1; } else if (tag === "ClearScreen") { - if (body.index == null) { - at += delay ?? 0; - continue; - } - const index = asNonNegativeInt(body.index); - if (index == null || index < 1) { - return null; - } - if (!pushEvent(events, at, { at, kind: "clear", index: index - 1 })) { - return null; - } + // Clears are global only now (session start/stop): numbers replace + // one another continuously, so a plan step never clears a number. + // The runtime emits the global clear itself around the session. + at += delay ?? 0; + continue; } at += delay ?? 0; @@ -936,7 +927,7 @@ function finishSession(session: BrowserSession): void { session.completed = true; clearSessionTimers(session); - emitClearScreen(session.sessionId, null); + emitClearScreen(session.sessionId); // The reveal reflects the session's plan, matching native: the full // sequence and its total, not a subset of what was actually painted. emit(listeners.sessionComplete, { @@ -1033,7 +1024,7 @@ async function startSessionImpl( currentSession = session; silenceAudio(); - emitClearScreen(sessionId, null); + emitClearScreen(sessionId); // Single-source execution when the WASM planner yields valid steps: // times, values, and running sums come straight from the Rust plan. @@ -1068,10 +1059,10 @@ async function startSessionImpl( for (let index = 0; index < plannedNumbers.length; index += 1) { const value = plannedNumbers[index]; running += value; + // Continuous replacement: the next show lands exactly one + // exposure later, with no blank event in between. push({ at, kind: "show", index, value, runningSum: running }); at += numberDurationMs; - push({ at, kind: "clear", index }); - at += INTER_NUMBER_GAP_MS; } push({ at, kind: "finish" }); events = local; @@ -1117,10 +1108,6 @@ async function startSessionImpl( void playAudio("beep"); break; } - case "clear": { - emitClearScreen(sessionId, event.index + 1); - break; - } case "finish": { finishSession(session); break; @@ -1264,7 +1251,7 @@ export const browserRuntime: Runtime = { silenceAudio(); if (currentSession) { clearSessionTimers(currentSession); - emitClearScreen(currentSession.sessionId, null); + emitClearScreen(currentSession.sessionId); } cancelPendingAutoRepeat(); diff --git a/src/runtime/localPlanner.ts b/src/runtime/localPlanner.ts index d5a3827..89f507a 100644 --- a/src/runtime/localPlanner.ts +++ b/src/runtime/localPlanner.ts @@ -77,7 +77,7 @@ export function normalizeSessionConfig( return { digits_per_number: digits, number_duration_s: round1(clamp(input.number_duration_s, 0.1, 60)), - // No inter-number gap field: the gap is fixed (INTER_NUMBER_GAP_MS). + // No inter-number gap field: numbers replace one another continuously. total_numbers: Math.min( clamp(safeInt(input.total_numbers), 1, MAX_TOTAL_NUMBERS), maxTotalForDigits(digits), diff --git a/src/runtime/types.ts b/src/runtime/types.ts index 1efc247..03a7183 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -6,12 +6,12 @@ export type Phase = "idle" | "starting" | "countdown" | "flashing" | "complete"; export type ColorScheme = + | "ocean" | "midnight" - | "ivory" - | "crimson" | "aqua" - | "violet" - | "amber"; + | "ivory" + | "rose" + | "sage"; /** * The colour schemes the picker offers, in display order. @@ -27,12 +27,12 @@ export type ColorScheme = * `_AllSchemesListed` below rejects a union member the list has forgotten. */ export const COLOR_SCHEMES = [ + "ocean", "midnight", - "crimson", "aqua", - "violet", - "amber", "ivory", + "rose", + "sage", ] as const satisfies readonly ColorScheme[]; /** @@ -113,7 +113,6 @@ export interface ShowNumber { export interface ClearScreen { session_id: number; - index: number | null; emitted_at_ms: number; } diff --git a/src/timing.ts b/src/timing.ts index db79756..6b107e5 100644 --- a/src/timing.ts +++ b/src/timing.ts @@ -23,5 +23,7 @@ export const COUNTDOWN_TICK_MS = 1000; */ export const PRE_FLASH_SETTLE_MS = 100; -/** Fixed blank gap between consecutive numbers. Rust: `INTER_NUMBER_GAP_MS`. */ -export const INTER_NUMBER_GAP_MS = 100; +/** + * Numbers replace one another continuously during a session: there is no + * inter-number gap and no blank step. Rust: `core/timing.rs`. + */ diff --git a/src/wasm/coreBridge.ts b/src/wasm/coreBridge.ts index aaac50e..208e8ac 100644 --- a/src/wasm/coreBridge.ts +++ b/src/wasm/coreBridge.ts @@ -38,7 +38,6 @@ export type WasmSessionStep = | { ClearScreen: { session_id: number; - index: number | null; delay_ms_before_next: number; }; }