Mischback / colorizer

A simple web-based colorscheme builder which focuses on contrast values.
https://mischback.github.io/colorizer/
MIT License
1 stars 0 forks source link

Replace ``SortableJS`` #43

Open Mischback opened 1 year ago

Mischback commented 1 year ago

During implementation of #40, the actual drag'n'drop operation is handled with SortableJS. However, this adds around 40 - 50kB to the bundle size, which is kind of not acceptable.

After finishing the initial implementation of the contrast grid, which should also allow drag'n'drop operations, SortableJS should be replaced, because I feel like the app is using just a minimal subset of its functions.

v1 / the original implementation had its own drag'n'drop logic already implemented. Should be easily adaptable.

Mischback commented 1 year ago

v1 / the original implementation had its own drag'n'drop logic already implemented. Should be easily adaptable.

Nope

Problem A

Most existing Drag'n'Drop libraries are pure JS implementations, that do not use HTML5's native drag'n'drop API.

This means they are required to implement lots of stuff and add quite some size to a bundle.

Problem B

HTML5's native API requires the draggable elements to have an attribute draggable="true", which is basically fine. But as most of the elements that are meant to be draggable in Colorizer are dynamically created, this may cause some issues.

Possible solution: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

Mischback commented 1 year ago

ToDo