Drop the browser build; space works the transport; fix bulk track rename

The browser page is gone, with its shim, its shell CSS and its suite. build.py
has no --tauri flag and one output: the app's page. The patch lists lose the
SHARED_ prefix, which only ever meant "shared between the two builds", and
test-pdf.js was quietly loading the browser page — it reads the app's now.

Space plays and pauses, in the main window off the player at the bottom and in
the mixer off the same transport. It is swallowed rather than passed on: that
stops the window scrolling, and stops a focused button taking the same press as
a second activation, which toggles twice and looks like a dead key. Typing, and
any dialog other than the mixer, keep it. Deciding what is in front needs both
markers — closing does not always remove .open, and .modal without it is
display:none regardless of the hidden attribute.

The mixer footer put the next file's name adrift in the middle of the row. The
margin-left: auto meant to park it beside Close could do nothing, because the
framework's flex: 1 1 auto had both nav groups growing to fill the row and left
no free space to absorb. Pinned to flex: 0 0 auto. The file-detail modal shares
the markup and follows.

Bulk track rename wrote nothing, on every file, and had never worked. A rename
is keyed on the name it replaces rather than a path, so the frame-rate pass
threw reading edit.path off it — before any byte was written, so nothing was
corrupted, only untouched. The failure handler discarded the reason and the run
still ended on a tidy Done, which is why 0 saved read as progress; it now names
the file and the cause in the log.

429 checks. The gap that hid the rename bug was end-to-end: the writer was unit
tested and the panel rendered, and nothing drove one into the other.
This commit is contained in:
2026-08-18 00:14:36 +08:00
parent 2d0b7fe8b5
commit 16c3e6e103
13 changed files with 409 additions and 860 deletions
+9 -20
View File
@@ -1,10 +1,8 @@
# BWF Analyser — standalone
Two builds of the same tool, from the same source.
**`mac-app/`** — a real macOS app. Double-click **Build BWF Analyser.command** once and it produces `BWF Analyser.app` next to itself. No server, no internet, no dependencies to install beyond Rust; everything the WordPress plugin did is in it, jsPDF included.
**`index.html`** — the browser version. Double-click it and it runs: no server, no build step, no internet. Everything the WordPress plugin did is in that one file, jsPDF included.
**`mac-app/`** — a real macOS app. Double-click **Build BWF Analyser.command** once and it produces `BWF Analyser.app` next to itself.
There was a second, browser-only build of the same source — a self-contained `index.html` you opened directly. It has been removed, along with its shim, its shell CSS and its test suite. Passages below that compare the app against "the browser build" are describing that history, not something you can still build.
## The Mac app
@@ -20,7 +18,7 @@ Rebuilding replaces the `.app` in place — nothing to delete first. If it's run
Nothing is downloaded except Rust and the crates it needs. The app itself never touches the network.
### How it differs from the browser build
### How it differs from the plugin it came from
It's editor-only. There's one way in — **Open Folder**, or drop a folder anywhere in the window — and it opens every recording read-write. The browser build's read-only Select Folder / Select Files / Clear row is gone, along with the page framing and the in-app title: the app fills the window at any width (the plugin's 960px centred column is lifted), the window's own title bar is left blank next to the traffic lights, and the table header stays put while you scroll a long day.
@@ -48,9 +46,9 @@ The first time you pick a folder inside Documents, Desktop or Downloads, macOS m
Since you built it yourself, there's no Gatekeeper warning. It also isn't notarised, so copying the `.app` to another machine will trip Gatekeeper there.
### Layout fixes, both builds
### Layout fixes
Both live in `build/overrides.css`, which applies to the browser build too, without touching the plugin's own stylesheet.
These live in `build/overrides.css`, on top of the plugin's own stylesheet rather than inside it.
The detail modal laid its metadata out with `repeat(auto-fill, minmax(180px, 1fr))`, and `dt`/`dd` are separate grid items flowing in sequence — so any odd number of columns splits the pairs, and every other row reads inside out. It's pinned to exactly two label/value pairs per row now, dropping to one when the window is narrow, and the modal is wider to suit.
@@ -329,22 +327,14 @@ Text selection is macOS blue rather than the framework's near-black.
The PHP is gone. The shortcode markup is now static HTML and the `wp_localize_script` strings live in a plain `window.bwfaL10n` object near the bottom of the file — edit any value there to relabel the UI. jsPDF is bundled inline instead of fetched from cdnjs.
In the browser build, one thing was added: a warning if the browser blocks the folder-write permission. Opening a page from a `file://` address gives it no real origin, and Chrome refuses the File System Access API on that basis, so metadata editing needs the folder served over http:
```
cd /path/to/this/folder
python3 -m http.server
```
Then open <http://localhost:8000/>. Or just use the Mac app, where this doesn't come up.
The browser build used to need a warning here, because a page opened from a `file://` address has no real origin and Chrome refuses the File System Access API on that basis, so editing metadata meant serving the folder over http first. The app routes every read and write through Rust, so none of that arises.
## Rebuilding
`build/` holds the sources and the assembler. `build/pdf-writer.js` is the rewritten PDF writer itself, read by `build.py` and substituted for the plugin's own — 200 lines of drawing code is unreadable as a patch string.
```
python3 build/build.py # -> index.html (browser)
python3 build/build.py --tauri # -> mac-app/dist/index.html
python3 build/build.py # -> mac-app/dist/index.html
python3 build/make-icons.py # regenerates the app icon and .icns
```
@@ -355,14 +345,13 @@ To pick up a new version of the plugin, drop its CSS/JS into `build/src/` and re
`npm i jsdom` first, then:
```
node build/test.js # browser build — 35 checks
node build/test-tauri.js # Mac app frontend + bridge — 94 checks
node build/test-tauri.js # app frontend + bridge — 114 checks
node build/test-framerate.js # frame-rate writing across all five fields — 11 checks
node build/test-pdf.js # PDF geometry, clipping, wrapping, the report header — 12 checks
node build/test-restore.js # remembering, reopening and ejecting the folder — 8 checks
node build/test-play.js # waveform bucketing, resampling, the channel sum, the clock, the FFT — 25 checks
node build/test-export.js # conversion, normalising, track picking, combining, naming, the report — 140 checks
BWF_TINY_CHUNKS=1 node build/test-tauri.js # every transfer forced to chunk — 95 checks
BWF_TINY_CHUNKS=1 node build/test-tauri.js # every transfer forced to chunk — 115 checks
```
The Tauri suite re-implements the Rust commands in Node, mirroring them exactly, and runs the real bridge and the real analyser against real files on disk. Web Audio is faked, so an interrupted session, one that refuses to resume, and one whose clock stops while it still claims to be running can all be staged on purpose. It covers opening a folder read-write, timecode reconstruction, a metadata edit landing on the actual file with the audio bytes untouched and the result re-parsing cleanly, both exports being written where the save panel pointed, and a dropped folder taking the same route as a picked one.