Skip to content

Commit

Permalink
add multiple containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikeysanju committed Nov 11, 2024
1 parent d66d857 commit 7ae42a7
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 27 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ A lightweight drag and drop library for Svelte 5 applications. Built with TypeSc
## Installation

```bash
npm install @thisux/sveltednd
npm i @thisux/sveltednd@0.0.13
```

## Quick Start

```typescript
````typescript
<script lang="ts">
import { draggable, droppable, type DragDropState } from '@thisux/sveltednd';
import '@thisux/sveltednd/styles.css'; // optional

// Create a list of items
let items = $state(['Item 1', 'Item 2', 'Item 3']);
Expand All @@ -26,7 +26,7 @@ function handleDrop(state: DragDropState<{ id: string }>) {
items = items.filter((item) => item !== draggedItem);
items = [...items, draggedItem];
}
```
</script>

```svelte
<!-- Make a droppable container -->
Expand All @@ -38,7 +38,7 @@ function handleDrop(state: DragDropState<{ id: string }>) {
</div>
{/each}
</div>
```
````
## Core Concepts
Expand Down
34 changes: 14 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thisux/sveltednd",
"version": "0.0.12",
"version": "0.0.13",
"private": false,
"description": "A lightweight, flexible drag and drop library for Svelte 5 applications.",
"author": "sanju <work@sanju.sh>",
Expand Down Expand Up @@ -73,5 +73,8 @@
"typescript-eslint": "^8.0.0",
"vite": "^5.0.11",
"vitest": "^2.0.4"
},
"dependencies": {
"@thisux/sveltednd": "^0.0.12"
}
}
3 changes: 2 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{ path: '/simple-list', title: 'Simple List' },
{ path: '/horizontal-scroll', title: 'Horizontal Scroll' },
{ path: '/grid-sort', title: 'Grid Sort' },
{ path: '/nested', title: 'Nested Containers' }
{ path: '/nested', title: 'Nested Containers' },
{ path: '/multiple', title: 'Multiple' }
];
const cn = (...classes: string[]) => classes.filter(Boolean).join(' ');
Expand Down
Loading

0 comments on commit 7ae42a7

Please sign in to comment.