diff --git a/README.md b/README.md index 673008b..275e185 100644 --- a/README.md +++ b/README.md @@ -452,6 +452,7 @@ interface DragDropAttributes { - **[Nested Containers](https://github.com/thisuxhq/SvelteDnD/blob/main/src/routes/nested/+page.svelte)**: Explore the example in `src/routes/nested/+page.svelte`. - **[Custom Classes](https://github.com/thisuxhq/SvelteDnD/blob/main/src/routes/custom-classes/+page.svelte)**: Explore the example in `src/routes/custom-classes/+page.svelte`. - **[Interactive Elements](https://github.com/thisuxhq/SvelteDnD/blob/main/src/routes/interactive-elements/+page.svelte)**: Explore the example in `src/routes/interactive-elements/+page.svelte`. +- **[Conditional Check](https://github.com/thisuxhq/SvelteDnD/blob/main/src/routes/conditional-check/+page.svelte)**: Explore the example in `src/routes/conditional-check/+page.svelte`. ## Styling diff --git a/package.json b/package.json index 200f6cc..9bfabe2 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,6 @@ "vitest": "^2.0.4" }, "dependencies": { - "@thisux/sveltednd": "^0.0.14" + "@thisux/sveltednd": "^0.0.17" } } \ No newline at end of file diff --git a/src/lib/stores/dnd.svelte.ts b/src/lib/stores/dnd.svelte.ts index fcc6d7b..2e4aed8 100644 --- a/src/lib/stores/dnd.svelte.ts +++ b/src/lib/stores/dnd.svelte.ts @@ -6,5 +6,6 @@ export const dndState = $state({ draggedItem: null, sourceContainer: '', targetContainer: null, - targetElement: null + targetElement: null, + invalidDrop: false }); diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 7c9a610..9cc170f 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -4,6 +4,7 @@ export interface DragDropState { sourceContainer: string; targetContainer: string | null; targetElement: HTMLElement | null; + invalidDrop?: boolean; } export interface DragDropCallbacks { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 57292bc..0055650 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -12,85 +12,71 @@ { path: '/nested', title: 'Nested Containers' }, { path: '/multiple', title: 'Multiple' }, { path: '/custom-classes', title: 'Custom Classes' }, - { path: '/interactive-elements', title: 'Interactives' } + { path: '/interactive-elements', title: 'Interactives' }, + { path: '/conditional-check', title: 'Conditional Check' } ]; const cn = (...classes: string[]) => classes.filter(Boolean).join(' '); -
-
- +
+ + + +
{@render children()} -
+
+ + + + - +