Skip to content

feat!: adopt object-based menu and helper APIs#126

Merged
QuentinRoy merged 23 commits into
masterfrom
feat/new-item-api
Jul 23, 2026
Merged

feat!: adopt object-based menu and helper APIs#126
QuentinRoy merged 23 commits into
masterfrom
feat/new-item-api

Conversation

@QuentinRoy

@QuentinRoy QuentinRoy commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Breaking API redesign for #108 and #109, plus a consistency pass that converts the remaining multi-argument helper APIs to named options objects. This is a clean break for the pre-1.0 package; there is no deprecation shim. The TypeScript migration (#123) will build on top of this PR.

Public API changes

#108 — single recursive MenuItem shape

  • Menu items are now { label, children? } objects recursively.
  • name is renamed to label throughout the model, layout, demo, documentation, and selection values.
  • String item shorthand is removed; every item is an object.
  • MMItem#getChildrenByName is renamed to getChildrenByLabel.
  • Custom item id support is preserved.

#109 — options-object call signature

MarkingMenu(items, parentDOM, options) becomes:

MarkingMenu({ items, parent, ...options });

Example migration:

// Before
MarkingMenu(['Item', { name: 'Sub', children: ['A'] }], parent);

// After
MarkingMenu({
  items: [
    { label: 'Item' },
    { label: 'Sub', children: [{ label: 'A' }] },
  ],
  parent,
});

Selections now expose label instead of name.

Helper API consistency

The internal and exported helper APIs now use named configuration objects where positional arguments were ambiguous or numerous, including:

  • connectLayout, createStrokeCanvas, and gesture feedback factories;
  • MMItem construction and recursive model creation;
  • navigation and dwelling configuration;
  • drag watcher options;
  • recognizer helpers (walkMMModel, findMMItem, articulation-point detection, and point lookup).

Related call sites, tests, and JSDoc were updated together. A small number of local helpers remain positional where their call sites are unambiguous.

Review notes

  • The additional refactor is behavior-preserving: it changes argument shape and naming, not the menu/navigation algorithms.
  • The audit tracking document was removed after the migration was completed; the durable documentation is in the source JSDoc and tests.
  • No unrelated source changes were found in the branch.

Validation

  • yarn test — 101/101 tests pass
  • yarn lint — 0 errors; 4 warnings remain
  • yarn format:check — clean
  • yarn build and yarn build-demo — pass

Closes #108, closes #109.

Menu items are now a single recursive shape `{ label, children? }`:
- the `name` property is renamed to `label` (#108),
- the string shorthand is removed; every item is an object,
- `MMItem#getChildrenByName` is renamed to `getChildrenByLabel`.

`MarkingMenu(items, parentDOM, options)` becomes
`MarkingMenu({ items, parent, ...options })` (#109).

BREAKING CHANGE: item `name` is now `label`, string items are no longer
accepted, and MarkingMenu takes a single options object.

Closes #108, closes #109.
@QuentinRoy QuentinRoy changed the title feat!: new MenuItem shape and options-object call signature (#108, #109) feat!: adopt object-based menu and helper APIs (#108, #109) Jul 23, 2026
@QuentinRoy QuentinRoy changed the title feat!: adopt object-based menu and helper APIs (#108, #109) feat!: adopt object-based menu and helper APIs Jul 23, 2026
@QuentinRoy
QuentinRoy merged commit 5a46547 into master Jul 23, 2026
2 checks passed
@QuentinRoy
QuentinRoy deleted the feat/new-item-api branch July 23, 2026 17:44
QuentinRoy added a commit that referenced this pull request Jul 26, 2026
Replaces the conventional-commits-driven standard-version flow with
Changesets for changelog/version management:

- CI-driven release via changesets/action: opens/updates a Version
  Packages PR on push to master and publishes on merge, using npm
  trusted publishing (OIDC) instead of a long-lived NPM_TOKEN, with
  GitHub Releases enabled.
- Keep GitHub-linked changelog entries via @changesets/changelog-github.
- Drop the PR-title conventional-commit lint and Renovate's
  :semanticCommits preset, since nothing consumes that format anymore.
- Renovate dependency PRs get no automatic changeset, matching prior
  behavior where deps bumps didn't trigger a release on their own.
- Backfill a changeset for the unreleased breaking change in #126
  (object-based menu API), filed as minor rather than major to stay
  in the 0.x range per this project's convention.

Two manual follow-ups outside this PR: install the changesets bot
GitHub App, and configure npm trusted publishing for this package
(workflow filename: release.yml).

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Accept an options object instead of positional arguments Remove automatic item normalization from the public API

1 participant