Change8

interaction@0.2.0

Breaking Changes
📦 remixView on GitHub →
3 breaking1 features🔧 11 symbols

Summary

This release introduces a major refactor to the Interaction and Descriptor APIs, moving towards a context-based 'this' approach for interactions and simplifying event listener configurations.

⚠️ Breaking Changes

  • Interaction API refactor: Interactions now receive context via 'this' instead of function arguments. Update functions to use this.on(), this.target, this.signal, and this.raise.
  • Descriptor API simplification: Removed capture() and listenWith() helpers. Use inline descriptor objects extending AddEventListenerOptions (e.g., { capture: true, listener() {} }).
  • Removed 'on' signal overload: The on(target, signal, listeners) signature is removed. Use createContainer(target, { signal }) for signal-based cleanup.

Migration Steps

  1. Refactor interaction functions to use 'this: Interaction' context and access target/signal via 'this'.
  2. Replace calls to capture(...) and listenWith(...) with plain objects containing listener and option flags.
  3. Replace on(target, signal, listeners) calls with createContainer(target, { signal }).set(listeners) or similar container logic.
  4. Rename any usage of 'onError' to 'this.raise' within the new Interaction context.

✨ New Features

  • Added 'onError' handler to containers for centralized listener error handling, facilitating integration with error boundaries like Remix <Catch>.

🔧 Affected Symbols

Interactionthis.onthis.targetthis.signalthis.raisecapturelistenWithoncreateContaineronErrorAddEventListenerOptions