Fix the sketch tabs and split main.ts into named sub-graphs #6

Merged
yunus merged 3 commits from tidy-and-split-main into main 2026-11-10 21:42:41 +00:00
Owner

Housekeeping, plus a restructure of main.ts toward the project's main goal: orchestration that can be read as dataflow.

Sketch tabs and the UI audit

  • The sketch's Parameters / Scene / Animation tab group had lost its ui-choices class when the shared UI was unified, so it rendered as a vertical list over the formula and theme row. It is a segmented row again.
  • check:ui now requires ui-choices on every role="radiogroup" container. It fails without the fix and passes with it.

main.ts split into src/graph/*.graph.ts

main.ts was one 1,400-line closure whose parts reached each other through 20 scattered defer(() => x$) forward references, so the app's one cycle ran through the whole file. It is now about 70 lines that call 13 modules in dependency order:

chrome (mount and connectChrome$), intents, history, projections, timekeeping, selection, navigation, state-mode, app-state (scopedOf), windows, workspace-actions, document-actions, persistence.

  • Each module is a function from the streams it reads (typed as Picks of other modules' records) to a record of the streams it makes. Return types are inferred.
  • The cycle closes in one place: four defers in main.ts (the windows' signals$/inputs$, and the two action streams folded into history). The only other defer is internal to state mode.
  • Stream bodies moved verbatim, and merge order is kept, so subscription order is unchanged. programList, programOf and inputsFor moved into programs.ts.
  • AGENTS.md describes the graph modules and the one-place cycle rule, and now defines chrome once: unqualified it means workspace chrome; "window chrome" is always written in full.

Verification

  • typecheck, lint (including check:ui), Prettier, and 507 tests pass.
  • Checked in the running app: playback, a window drag and undo, the palette's to-do capture and program launch, state mode with its wires, shift-select → copy → paste → place, painting a section and flying to it with →, and restoring everything after a reload. No console errors.

🤖 Generated with Claude Code

Housekeeping, plus a restructure of `main.ts` toward the project's main goal: orchestration that can be read as dataflow. ## Sketch tabs and the UI audit - The sketch's Parameters / Scene / Animation tab group had lost its `ui-choices` class when the shared UI was unified, so it rendered as a vertical list over the formula and theme row. It is a segmented row again. - `check:ui` now requires `ui-choices` on every `role="radiogroup"` container. It fails without the fix and passes with it. ## `main.ts` split into `src/graph/*.graph.ts` `main.ts` was one 1,400-line closure whose parts reached each other through 20 scattered `defer(() => x$)` forward references, so the app's one cycle ran through the whole file. It is now about 70 lines that call 13 modules in dependency order: `chrome` (mount and `connectChrome$`), `intents`, `history`, `projections`, `timekeeping`, `selection`, `navigation`, `state-mode`, `app-state` (`scopedOf`), `windows`, `workspace-actions`, `document-actions`, `persistence`. - Each module is a function from the streams it reads (typed as `Pick`s of other modules' records) to a record of the streams it makes. Return types are inferred. - **The cycle closes in one place:** four `defer`s in `main.ts` (the windows' `signals$`/`inputs$`, and the two action streams folded into history). The only other `defer` is internal to state mode. - Stream bodies moved verbatim, and merge order is kept, so subscription order is unchanged. `programList`, `programOf` and `inputsFor` moved into `programs.ts`. - AGENTS.md describes the graph modules and the one-place cycle rule, and now defines **chrome** once: unqualified it means workspace chrome; "window chrome" is always written in full. ## Verification - typecheck, lint (including `check:ui`), Prettier, and 507 tests pass. - Checked in the running app: playback, a window drag and undo, the palette's to-do capture and program launch, state mode with its wires, shift-select → copy → paste → place, painting a section and flying to it with →, and restoring everything after a reload. No console errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The tab group lost its ui-choices class in the shared UI move, so it laid
out as a vertical list. check:ui now requires ui-choices on every
role="radiogroup" container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main.ts was one 1,400-line closure whose sub-graphs reached each other
through twenty scattered defer(() => x$) forward references, so the app's
one cycle was spread through the whole file. It is now composed from
src/graph/*.graph.ts modules: each takes the streams it reads (typed as
Picks of other modules' records) and returns the streams it makes.

The only back edges are four defers in main.ts: the windows' signals and
inputs, and the two action streams folded into history. main.ts is about
seventy lines and reads as the dataflow diagram. Stream bodies moved
verbatim; programList, programOf and inputsFor now live beside the
program table.

Verified in the app: playback, drag and undo, palette capture and
launch, state mode, select/copy/paste/place, section flights, and
restoring after a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Define chrome once: workspace chrome by default, window chrome in full
All checks were successful
ci / check (pull_request) Successful in 1m15s
ci / image (pull_request) Has been skipped
58e343ecc1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yunus changed title from tidy-and-split-main to Fix the sketch tabs and split main.ts into named sub-graphs 2026-11-10 21:42:11 +00:00
yunus merged commit acb1a33892 into main 2026-11-10 21:42:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
yunus/hakase!6
No description provided.