Releases: thisbeyond/solid-dnd
Release 0.4.1
Fixed
-
Fix pointer sensor preventing default event behaviour on attachment. Instead,
wait for activation of drag before intercepting relevant events. This avoids
unexpected side effects, such as an<input/>not receiving focus on click.With this change, also listen for and clear any text selection that happens as
a side effect during an active drag operation.Thanks to @yonathan06 for reporting this
behaviour.
Release 0.4.0
Added
- TypeScript Typings! Thanks to
@areknawo, Solid DnD is now fully typed.
Changed
-
Breaking Change As part of adding typings to Solid DnD, change most
function signatures to use positional parameters over an options object. This
simplifies the typing and makes it easier to use and understand the function
parameters.For reference, the rules used when applying this change were:
- Default to multiple positional params. For example, a call to
createDraggable({ id })should now becreateDraggable(id). - Use an object when multiple params are related as a single entity (such as
an 'event'). For example, anonDragEnd(event)handler can remain unchanged
(accepting a single parameter). - Use an options object when there are a large number of parameters (>3).
- Default to multiple positional params. For example, a call to
-
Breaking Change Rename
DragDropContexttoDragDropProviderand
SortableContexttoSortableProviderto match Solid convention and better
reflect usage. Note thatuseDragDropContextanduseSortableContextremain
unchanged.
Fixed
- Fix
eventMap[key] is undefinederror when attempting to drag a draggable
that has been composed manually using thedraggable.dragActivatorsproperty.
This was due to naive key renaming in theasHandlerslogic and so did not
affect draggable usage as a directive.
Release 0.3.3
Fixed
- Remove leftover debug log.
Release 0.3.2
Fixed
- Cleanup dangling references to removed items. When draggables, droppables or
sensors removed, clean up dangling references to them in the state (such as
'active' or 'previous' values). This helps prevent potential infinite recursion
(such as in onDragEnd) where an item (like a draggable) oscillates between
having a valid 'previous' value reference and undefined.
Release 0.3.1
Changed
- As part of the fix for detecting collisions on drag start,
recomputeLayouts
no longer automatically callsdetectCollisionswhen layouts have changed.
Instead, it returns a boolean indicating whether a layout change detected- enabling the caller to call
detectCollisionsif desired.
- enabling the caller to call
Fixed
- Fix case where a drag with no movement results in an incorrect drop. This was
due to collisions not being detected on drag start if layouts had not changed
(the common case). Collisions now always detected bydragStart.
Release 0.3.0
Added
- Add
sensorStartandsensorEndto support sensors explicitly indicating
whether they are active or not. Note that only one sensor can be considered
active at a time.
Changed
-
Activate sensor in
createPointerSensorif the pointer has moved more than 10
pixels. This is irrespective of whether the delay condition has been met. It
addresses the issue where a dragged item appears to jump to its new location
after a delay if the pointer moved quickly at the outset of the drag. -
Make managing sensor active state explicit. Returning a truthy value from a
sensor activator will no longer cause that sensor to be automatically marked
as the active sensor. In addition, other activators will continue to be called
until a sensor explicitly indicates it is active by callingsensorStart.
Similarly, an active sensor must now callsensorEndwhen it is no longer
active (typically when a drag completes). This makes it clearer that a sensor
is responsible for managing its activation state (and how to do so),
especially in cases of delayed activation.
Release 0.2.0
Update to work with Solid 1.0 and streamline the interface with new directives.
Added
- Update
createDraggable,createDroppableandcreateSortableto provide
a custom directive. These can be used with the Soliduse:___syntactic sugar
for common usage setup - no need to pass refs and props around:
const MyComponent = (props) => {
const draggable = createDraggable({ id: props.id });
return <div use:draggable>Drag me!</div>;
};If finer control needed, the underlying primitives are accessible by property
lookup on the directive::
const MyComponent = (props) => {
const draggable = createDraggable({ id: props.id });
return (
<div ref={draggable.ref}>
<div {...draggable.dragActivators}>Drag Handle</div>
Drag me!
</div>
);
};- Automatically detect and register usage of
DragOverlay. Add to
DragDropContextstate ausingDragOverlayproperty that can be checked. - Return a new function
displaceas part of theDragDropContextthat can be
used to set the transform for a droppable or draggable. See usage in
createSortablefor example.
Changed
- Update to work with Solid 1.0! This is a breaking change that requires
updating peer dependency of Solid to 1.0 or greater. - Refactor
isActiveDraggableandisActiveDroppableto appear as resolved
properties rather than functions to call (this is more consistent with the
rest of interface). E.g.draggable.isActiveDraggable()
->draggable.isActivateDraggable. - Refactor sensor interface to use event type rather than handler name. For
example, makecreatePointerSensorusepointerdownrather than
onPointerDownfor activation. As part of this, add aasHandlersoption to
draggableActivatorsto control whether to return object withon___form or
not (default isfalse). - Rename occurrences of
translatetotransform, which feels a more
appropriate name. E.g.translateStyleshould now betransformStyleand the
translateproperty returned fromcreate___calls should be called
transform. - Assume valid
transformvalue is always present. In particular,
transformStyleno longer checks for anulltransform value. - Improve vertical sort algorithm to better handle arbitrary gaps (such as those
created by the CSS gap property on flexbox). As part of this, remove the now
redundantouterHeightandouterWidthproperties from the layout data
returned byelementLayout. - Update
README.mdto reflect simpler directive interface for draggables and
droppables.
Removed
- Remove support for explicitly managing droppable
disabledstate. The current
implementation feels limiting and potentially confusing. For example, it
prevents detecting when a draggable is over a disabled droppable and styling
it appropriately. Note that a similar effect todisabledcan be achieved by
determining drop suitability inonDragEnd.
Release 0.1.2
Simplify releasing.
Added
- Use release-it to simplify
performing a release. - Add keywords to
package.jsonfor easier discoverability of package. - Add default publish configuration to
package.json.