Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"@solid-primitives/async": "0.0.100",
"@solid-primitives/url": "0.1.0",
"@solid-primitives/favicon": "0.0.100",
"@solid-primitives/sortable": "0.0.100"
"@solid-primitives/sortable": "0.0.100",
"@solid-primitives/drag-drop": "0.0.100"
},
"changesets": [
"a11y-dataset-hydration-safety",
Expand All @@ -127,6 +128,7 @@
"deep-solid2-migration",
"destructure-solid2-migration",
"devices-solid2-migration",
"drag-new-package",
"eleven-baths-build",
"eleven-buttons-jump",
"event-bus-solid2-migration",
Expand Down
30 changes: 30 additions & 0 deletions packages/drag-drop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# @solid-primitives/drag-drop

## 0.1.0-next.0

### Minor Changes

- 75d2a1f: New package: `@solid-primitives/drag-drop` — composable drag-and-drop primitives for Solid 2.0.

### Exports

**Pointer-event DnD** (UI element dragging):
- `makeDraggable` — non-reactive base, no Solid owner required
- `makeDroppable` — non-reactive drop target base
- `createDraggable` — reactive draggable with `isDragging`, `transform`, auto style/class; keyboard-accessible (`Space`/`Enter` to pick up/drop, arrow keys to nudge, `Escape` to cancel)
- `createDroppable` — reactive drop target with `isOver`, `active`, auto style/class
- `createSortable` — combines draggable + droppable on the same element
- `createDragContext` — coordinates a tree of draggables and droppables, with optional `autoScroll` near viewport edges
- `arrayMove` — pure reorder helper for `onDragEnd` + `createSortable`

**Native HTML5 DnD** (file drops, `draggable="true"` elements):
- `makeNativeDroppable` — non-reactive base with depth-counter fix for child elements
- `createNativeDroppable` — reactive native drop zone for OS file drops

**Collision detection strategies** (pure functions, pass to `createDragContext`):
- `closestCenter`, `closestCorners`, `rectIntersection`, `pointerWithin` (default)

### Notes
- The reported `transform` is corrected for page scroll during a drag, so the dragged element doesn't visually drift from the pointer if the page scrolls mid-drag (needed for `autoScroll` to look right, and for any scrollable page in general).
- `createDroppable`/`createSortable` log a dev-mode warning when used without a `createDragContext` ancestor, since `isOver`/`active` silently stay `false`/`null` in that case.
- `isDragging`/`isOver` are backed by `createProjection` instead of a per-instance `active()?.id === id` memo, so a drag start/end or hover change in a large list only notifies the specific items involved.
2 changes: 1 addition & 1 deletion packages/drag-drop/deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/drag-drop",
"version": "0.0.100",
"version": "0.1.0-next.0",
"description": "Composable drag-and-drop primitives.",
"license": "MIT",
"exports": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/drag-drop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/drag-drop",
"version": "0.0.100",
"version": "0.1.0-next.0",
"description": "Composable drag-and-drop primitives.",
"author": "David Di Biase <dave@solidjs.com>",
"contributors": [],
Expand Down
7 changes: 7 additions & 0 deletions packages/upload/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @solid-primitives/upload

## 1.0.0-next.4

### Patch Changes

- Updated dependencies [75d2a1f]
- @solid-primitives/drag-drop@0.1.0-next.0

## 1.0.0-next.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/upload/deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/upload",
"version": "1.0.0-next.3",
"version": "1.0.0-next.4",
"description": "Primitives for uploading files.",
"license": "MIT",
"exports": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/upload/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/upload",
"version": "1.0.0-next.3",
"version": "1.0.0-next.4",
"description": "Primitives for uploading files.",
"author": "Rustam Ashurmatov <rr.ashurmatov.21@gmail.com>",
"license": "MIT",
Expand Down