Skip to content

feat: add typed EventMap for Paper and Graph with IDE autocomplete#3233

Merged
Geliogabalus merged 2 commits intoclientIO:masterfrom
kumilingus:feat/eventmap-intellisense
Mar 18, 2026
Merged

feat: add typed EventMap for Paper and Graph with IDE autocomplete#3233
Geliogabalus merged 2 commits intoclientIO:masterfrom
kumilingus:feat/eventmap-intellisense

Conversation

@kumilingus
Copy link
Contributor

Summary

  • Add LiteralUnion<T> and ExcludeIndexSignature<T> utility types
  • Add Paper.DefinedEventMap and Graph.DefinedEventMap — stripped of index signatures for IDE autocomplete
  • Add typed on() overloads to both Paper and Graph using DefinedEventMap
  • Add Graph.EventMap with cell collection, change:${string}, layer, and batch events
  • Add paper:mouseenter and paper:mouseleave to Paper.EventMap
  • Backwards compatible: EventMap retains its index signature

Test plan

  • yarn test-ts passes
  • Verify IDE autocomplete works for paper.on('...') and graph.on('...')
  • Verify custom events still accepted: paper.on('my-custom', cb) and paper.on({ 'my-custom': cb })

🤖 Generated with Claude Code

- Add LiteralUnion<T> and ExcludeIndexSignature<T> utility types
- Add Paper.DefinedEventMap (EventMap without index signature) for IDE autocomplete
- Add paper:mouseenter and paper:mouseleave to Paper.EventMap
- Add typed on() overloads to Paper using DefinedEventMap
- Add Graph.EventMap with cell, change:*, layer, and batch events
- Add Graph.DefinedEventMap and typed on() overloads to Graph
- Preserve backwards compatibility: EventMap keeps index signature

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kumilingus kumilingus requested a review from Geliogabalus March 18, 2026 10:56
@kumilingus kumilingus force-pushed the feat/eventmap-intellisense branch from 51555e5 to 2382248 Compare March 18, 2026 12:34
@kumilingus kumilingus requested a review from Geliogabalus March 18, 2026 12:35
- Add LiteralUnion<T> and ExcludeIndexSignature<T> utility types
- Add mvc.EventCallbackMap<T> generic utility for partial event maps
- Add Paper.DefinedEventMap (EventMap without index signature) for IDE autocomplete
- Add paper:mouseenter and paper:mouseleave to Paper.EventMap
- Add typed on() overloads to Paper using DefinedEventMap
- Add Graph.EventMap with cell, change:*, layer, and batch events
- Add Graph.DefinedEventMap and typed on() overloads to Graph
- Preserve backwards compatibility: EventMap keeps index signature

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kumilingus kumilingus force-pushed the feat/eventmap-intellisense branch from 2382248 to ef90cab Compare March 18, 2026 12:38
@Geliogabalus Geliogabalus merged commit bb2f01b into clientIO:master Mar 18, 2026
3 checks passed
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.

2 participants