Skip to content

Cut createMarkingMenu over to the event-driven engine - #233

Merged
QuentinRoy merged 2 commits into
mainfrom
claude/implement-issue-184-025b87
Sep 4, 2026
Merged

Cut createMarkingMenu over to the event-driven engine#233
QuentinRoy merged 2 commits into
mainfrom
claude/implement-issue-184-025b87

Conversation

@QuentinRoy

Copy link
Copy Markdown
Owner

Closes #184.

createMarkingMenu still built and returned a 'hot' RxJS Observable, even though the parent proposal in #153 replaced that pipeline with a state machine, a native pointer source, and a typed event controller, already built and tested behind src/engine/. This change wires the public entry point to that engine and removes the Observable path from it.

createMarkingMenu now constructs the engine's controller and returns it already active. A caller listens with controller.on(type, listener) and stops the menu with controller.dispose() (or [Symbol.dispose](), for using). notifySteps, MarkingMenuNotification, exportNotification, and the conditional result type they required are gone: every controller dispatches the full start/open/move/change/select/cancel event set, and a consumer who only wants selections listens for select.

The engine's config and renderer had no equivalent yet for the stroke and gesture-feedback styling options the old config exposed (strokeColor, strokeWidth, lowerStroke*, gestureFeedback*), or for the small dot the legacy layout drew at the root of the upper stroke once novice mode opened. Wiring the entry point straight through without them would have silently dropped a documented, tested part of the public config and changed how a gesture looks on screen, so both are added as part of this change.

The end-to-end fixture's Observable-to-event shim, which let the specs target the final event shape while the RxJS engine still ran underneath, is deleted. The fixture and multiple-controllers.spec.ts now drive the real controller directly, and all ten existing gesture scenarios pass against it unchanged. Two new Playwright specs cover the coverage-bar items that could only be verified against a real browser: disposal.spec.ts checks that pointer input and pending work after dispose() produce no events or visual mutations, rendered resources are released, and a second dispose() is a no-op; dispatch-ordering.spec.ts checks, from a listener's own vantage point, that the DOM a open/change/select listener sees is already the complete result of the input that triggered it.

The legacy RxJS engine and its dependency are untouched. Removing them, along with the remaining internal call sites that still import rxjs, is a separate change.

To verify locally: yarn build && yarn e2e:build && yarn e2e:test runs the full Playwright suite, including the two new specs, against the built package. yarn test:coverage covers the unit level. The README's API section and the demo now describe the event-based controller instead of the Observable.

Test plan

  • yarn typecheck
  • yarn lint
  • yarn format:check
  • yarn test:coverage (318 tests, coverage above the repo's threshold)
  • yarn build && yarn e2e:build && yarn e2e:test (34 Playwright tests, including the two new coverage-bar specs)
  • yarn package:lint, yarn package:types, yarn package:smoke-test

🤖 Generated with Claude Code

createMarkingMenu now builds and returns the totorobot-backed controller
from src/engine/controller.ts instead of the RxJS Observable pipeline in
navigation.ts/connect.ts. It stops taking notifySteps and stops returning
an Observable: MarkingMenuNotification, exportNotification, and the
conditional result type go with it. A caller now gets an already-active
controller and listens with on(type, listener), matching off to remove a
listener, and calls dispose() (or uses `using`) to tear it down.

EngineConfig and the renderer gain the stroke and gesture-feedback
styling options the old config carried (strokeColor, strokeWidth,
lowerStroke*, gestureFeedback*), since the engine had no equivalents
yet and dropping them silently would have been a visual regression.
The renderer also gains the novice-mode start-point marker the legacy
layout connection drew at the root of the upper stroke, which the
engine renderer never reproduced.

The E2E fixture's Observable-to-event shim is deleted; the fixture and
multiple-controllers.spec.ts now drive the controller directly. Two
Playwright specs cover the remaining coverage-bar items: disposal at
the browser boundary, and commit-render-dispatch ordering observed
from a real listener.

The legacy RxJS engine, its dependency, and the rest of its call sites
are untouched: removing them is a separate, later change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfcf5dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
marking-menu Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Replace each with a comma, a colon, or a plain full stop, per the
project's prose style.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@QuentinRoy
QuentinRoy merged commit ab83b8b into main Sep 4, 2026
3 checks passed
@QuentinRoy
QuentinRoy deleted the claude/implement-issue-184-025b87 branch September 4, 2026 10:17
@github-actions github-actions Bot mentioned this pull request Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cut createMarkingMenu over to the new engine and delete the shim

1 participant