Skip to content

Commit abab1f2

Browse files
committed
removes filesize & attr-accept as dependencies; removes formatted filesizes from errors;
1 parent 6dcdecb commit abab1f2

File tree

10 files changed

+7900
-8088
lines changed

10 files changed

+7900
-8088
lines changed

README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,28 +109,57 @@ See this [REPL for minimal usage](https://svelte.dev/repl/645841f327b8484093f94b
109109

110110
### Alternatives
111111

112-
- [svelte-file-dropzone](https://github.com/thecodejack/svelte-file-dropzone)
112+
- [svelte-file-dropzone](https://github.com/thecodejack/svelte-file-dropzone)
113113

114114
### Previous art
115115

116-
- [react-dropzone](https://github.com/react-dropzone/react-dropzone)
117-
- [svelte-file-dropzone](https://github.com/thecodejack/svelte-file-dropzone)
116+
- [react-dropzone](https://github.com/react-dropzone/react-dropzone)
117+
- [svelte-file-dropzone](https://github.com/thecodejack/svelte-file-dropzone)
118118

119119
### Dependencies
120120

121-
- [attr-accept](https://github.com/react-dropzone/attr-accept)
122-
- [file-selector](https://github.com/react-dropzone/file-selector)
123-
- [filesize](https://github.com/avoidwork/filesize.js)
124-
125-
## Issues
121+
- [file-selector](https://github.com/react-dropzone/file-selector)
122+
123+
## Typescript
124+
125+
In order for typings to work properly, you'll need to add the following to
126+
`global.d.ts` [until this issue is
127+
resolved](https://github.com/sveltejs/language-tools/issues/431):
128+
129+
```typescript
130+
declare type FileDropEvent = import("./lib/event").FileDropEvent;
131+
declare type FileDropSelectEvent = import("./lib/event").FileDropSelectEvent;
132+
declare type FileDropDragEvent = import("./lib/event").FileDropDragEvent;
133+
declare namespace svelte.JSX {
134+
interface HTMLAttributes<T> {
135+
onfiledrop?: (event: CustomEvent<FileDropSelectEvent> & { target: EventTarget & T }) => void;
136+
ononfiledrop?: (event: CustomEvent<FileDropSelectEvent> & { target: EventTarget & T }) => void;
137+
ononfiledragenter?: (event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T }) => void;
138+
ononfiledragleave?: (event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T }) => void;
139+
ononfiledragover?: (event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T }) => void;
140+
ononfiledialogcancel?: (event: CustomEvent<FileDropEvent> & { target: EventTarget & T }) => void;
141+
ononfiledialogclose?: (event: CustomEvent<FileDropEvent> & { target: EventTarget & T }) => void;
142+
ononfiledialogopen?: (event: CustomEvent<FileDropEvent> & { target: EventTarget & T }) => void;
143+
ononwindowfiledragenter?: (
144+
event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T },
145+
) => void;
146+
ononwindowfiledragleave?: (
147+
event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T },
148+
) => void;
149+
ononwindowfiledragover?: (
150+
event: CustomEvent<FileDropDragEvent> & { target: EventTarget & T },
151+
) => void;
152+
}
153+
}
154+
```
126155

127-
- Typing / intelisense for events on the FileDrop component are not registering properly. The [override](https://github.com/chanced/filedrop-svelte/blob/main/src/types.d.ts) work for the action though.
156+
You may need to edit `tsconfig.json` to include `global.d.ts` if it isn't already.
128157

129158
## Todo
130159

131-
- tests
132-
- better documentation
133-
- demo website
160+
- tests
161+
- better documentation
162+
- demo website
134163

135164
## License
136165

0 commit comments

Comments
 (0)