svelte-dnd-action 0.9.23 → 0.9.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +12 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -233,7 +233,7 @@ setDebugMode(true);
233
233
  ### Typescript
234
234
 
235
235
  If you are using Typescript, you will need to add the following block to your `global.d.ts` (at least until [this svelte issue](https://github.com/sveltejs/language-tools/issues/431) is resolved):
236
-
236
+ #### Svelte 3 or below
237
237
  ```typescript
238
238
  declare type Item = import('svelte-dnd-action').Item;
239
239
  declare type DndEvent<ItemType = Item> = import('svelte-dnd-action').DndEvent<ItemType>;
@@ -245,6 +245,17 @@ declare namespace svelte.JSX {
245
245
  }
246
246
 
247
247
  ```
248
+ #### Svelte 4:
249
+ ```typescript
250
+ declare type Item = import('svelte-dnd-action').Item;
251
+ declare type DndEvent<ItemType = Item> = import('svelte-dnd-action').DndEvent<ItemType>;
252
+ declare namespace svelteHTML {
253
+ interface HTMLAttributes<T> {
254
+ 'on:consider'?: (event: CustomEvent<DndEvent<ItemType>> & { target: EventTarget & T }) => void;
255
+ 'on:finalize'?: (event: CustomEvent<DndEvent<ItemType>> & { target: EventTarget & T }) => void;
256
+ }
257
+ }
258
+ ```
248
259
 
249
260
  You may need to edit `tsconfig.json` to include `global.d.ts` if it doesn't already: "include": ["src/**/*", "global.d.ts"].
250
261
  Then you will be able to use the library with type safety as follows (Typescript gurus out there, improvements are welcome :smile:):
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "dist"
44
44
  ],
45
45
  "description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
46
- "version": "0.9.23",
46
+ "version": "0.9.24",
47
47
  "repository": {
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"