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
DragDropContext
toDragDropProvider
and
SortableContext
toSortableProvider
to match Solid convention and better
reflect usage. Note thatuseDragDropContext
anduseSortableContext
remain
unchanged.
Fixed
- Fix
eventMap[key] is undefined
error when attempting to drag a draggable
that has been composed manually using thedraggable.dragActivators
property.
This was due to naive key renaming in theasHandlers
logic 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 callsdetectCollisions
when layouts have changed.
Instead, it returns a boolean indicating whether a layout change detected- enabling the caller to call
detectCollisions
if 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
sensorStart
andsensorEnd
to 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
createPointerSensor
if 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 callsensorEnd
when 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
,createDroppable
andcreateSortable
to 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
DragDropContext
state ausingDragOverlay
property that can be checked. - Return a new function
displace
as part of theDragDropContext
that can be
used to set the transform for a droppable or draggable. See usage in
createSortable
for 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
isActiveDraggable
andisActiveDroppable
to 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, makecreatePointerSensor
usepointerdown
rather than
onPointerDown
for activation. As part of this, add aasHandlers
option to
draggableActivators
to control whether to return object withon___
form or
not (default isfalse
). - Rename occurrences of
translate
totransform
, which feels a more
appropriate name. E.g.translateStyle
should now betransformStyle
and the
translate
property returned fromcreate___
calls should be called
transform
. - Assume valid
transform
value is always present. In particular,
transformStyle
no longer checks for anull
transform 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
redundantouterHeight
andouterWidth
properties from the layout data
returned byelementLayout
. - Update
README.md
to reflect simpler directive interface for draggables and
droppables.
Removed
- Remove support for explicitly managing droppable
disabled
state. 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 todisabled
can 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.json
for easier discoverability of package. - Add default publish configuration to
package.json
.