Skip to content

Version 4, better framework integration and API #260

Description

@simonwep

The core of this library was written 8 years ago. Although it's by now battle-tested, the first versions were a copy from what I needed for vue-cloudfront and were basically a single-file library without even TypeScript support. A lot has changed since then and no major refactoring was made to maintain compatibility, at the cost of very high complexity and brittle support for frameworks. For example, the reason to not use prettier is right now that there are expressions that are so complex that they look less readable if they are formatted.

The following is a collection of things that I want to change with the (breaking) release of v4. The list is incomplete and will be extended over the course of the next weeks, feel free to comment your thoughts :)

General

  • Set up prettier for the whole code-base.
  • Internalize class SelectionArea and wrap it in createSelectionArea function.
  • Remove either addEventListener and removeEventListeners or on and off.
  • Add migration guide to documentation.
  • Add tests (Added small unit test #234)

Reworking vue/react/preact integration for more flexibility

  • Replace vue SelectionArea component with useSelectionArea composable.
  • Replace react/preact SelectionArea component with useSelectionArea hook.

Externalize features as plugins

  • Add support for plugins that can use hooks to extend functionality.
  • Move behaviour.triggers to external plugin.
  • Move behaviour.startThreshold to external plugin.
  • Add beforemove event and move behaviour.startThreshold to plugin component.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions