-
Гильмуллин Руслан Ниязович создал
Architecture - mirror-machine on the main thread is the source of truth for tape rendering during stepping; worker `stepped` responses no longer carry tapes (deterministic replay). Worker still sends full tape on `built`, `ran`, and `error` (partial state on mid-run failure). - `Tape.svelte` reads `turing.Tape.viewport` directly via a new `setFromTape(tape, delta?, animate?)` API; no more snapshot shape conversion in the UI. Library guarantees `viewport.length === VIEWPORT_WIDTH` (mirror sets it via setter — workaround for upstream issue #95). - Drop `blank` field from `TapeSnapshot`; UI sources it from the alphabet via `tape.alphabet.blankSymbol`. Component split (MachineView 1037 -> 761 lines) - `TapesStack.svelte` — multi-tape stack + head-thread connector, imperative API (setFromTape/clearAll/setTransitionsEnabled). - `Toolbar.svelte` — Build/Step/Run/Stop + with-pause + examples dropdown; owns its own outside-click handling. - Rename `MachineTab.svelte` -> `MachineView.svelte` (the file is the body shown when an engine tab is active; the tabs strip lives in App.svelte). - Rename `runner.ts` -> `machineRunner.ts`, `worker.ts` -> `machineWorker.ts` (match exported class names). - Extract numeric caps to new `lib/caps.ts`. Worker contract - Rename request/response: `load`/`loaded` -> `build`/`built` (matches the Build button rename). - `runner.load()` -> `runner.build()`; internal handler names (`doLoad`, `loadDisabled`, `reloadWorker`) kept. - Drop dead fields: `BuiltResponse.{stepsApplied, nextCommands}`, `RanResponse.halted`, `ErrorResponse.stack`. - `WorkerError` class carries partial `tapes` from error responses so `failHalted` can mirror the state where execution stuck. User-facing - Build button replaces Load (hammer icon). - "with pause" + interval input hidden in RUNNING_AUTO/RUNNING_CONTINUOUS. - Step/Run stay enabled in HALTED (reload-from-code on entry restarts). - Stop button next to Run during RUNNING_STEP/RUNNING_AUTO. - DEMO mode runs `selectedExample.code` (canonical), not editor `code`. - Code-changed warning fires once per running session (not per keystroke). - Log: `<hr>` separator before each Build / first-Step / Run; per-tape groups with `Tape N:` header + indented `- blank/alphabet/tape` rows; paper-style shorthand `(<sym>/<L|R|S>)` after verbose description; command tense (kept/wrote/moved/stayed). No UI substitution of alphabet symbols - UI renders the literal user-chosen blank glyph; bundled examples switched to `'␣'` as the actual blank. CSS sugar (`.cell.blank`, `.cp-btn.blank`) gives blanks a dim visual hint without overloading any specific character — alphabets are free to include any glyph including `'␣'`. CSS / tooling - Native CSS nesting throughout (no preprocessor). - ES2023 target (for `Array.prototype.with`). - Favicon + header title use first-tape blue (`--accent`). - Drop dead CSS token `--head-dim`; remove redundant `var()` fallbacks. Naming consistency - `cmds`/`cmd` -> `commands`/`command`; `mv` -> `movement`; `arr`, `cb`, `applyTimer` -> `array`, `callbacks`, `applyTimeoutId`; `entries` -> `logEntries`; `onclear`/`onreset`/`onclick` (custom prop) -> camelCase; `flashTimer` -> `flashTimeoutId`; `describeOne` -> `describeAppliedCommand`; `stepEntry`+`appliedEntry` -> single `commandsEntry(commands, application, colors?)`; `setFromSnapshot` -> `setFromTape`; `win` -> `viewport`. - New `Alphabets` type alias (`readonly (readonly string[])[]`). - Drop dead `IconButton.svelte` -> repurposed as corner-overlay icon button (used by Editor reset + Log clear). - Drop dead `SYNTHETIC_ALPHABETS` constant; `alphabets` initialises to `[]` and resets to `[]` on error. Documentation - CLAUDE.md rewritten — architecture tree, MachineView overview, Tape section, multi-tape section, conventions, caps. Adds upstream-bug-workaround convention with running list (currently just turing-machine-js#95). - README architecture tree synced. Bumps version to 1.0.0-alpha.3.ba718888