@@ -109,28 +109,57 @@ See this [REPL for minimal usage](https://svelte.dev/repl/645841f327b8484093f94b
109
109
110
110
### Alternatives
111
111
112
- - [ svelte-file-dropzone] ( https://github.com/thecodejack/svelte-file-dropzone )
112
+ - [ svelte-file-dropzone] ( https://github.com/thecodejack/svelte-file-dropzone )
113
113
114
114
### Previous art
115
115
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 )
118
118
119
119
### Dependencies
120
120
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
+ ```
126
155
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 .
128
157
129
158
## Todo
130
159
131
- - tests
132
- - better documentation
133
- - demo website
160
+ - tests
161
+ - better documentation
162
+ - demo website
134
163
135
164
## License
136
165
0 commit comments