1
- import { browser } from "$app/env " ;
2
- import type { Events } from "$lib /event" ;
3
- import { getFilesFromEvent , extractFilesFromEvent , isEventWithFiles , isNode } from "$lib/event " ;
4
- import type { FileDropOptions } from "$lib/options " ;
1
+ import type { Events } from "../event " ;
2
+ import { getFilesFromEvent , extractFilesFromEvent , isEventWithFiles , isNode } from ".. /event" ;
3
+ import type { FileDropOptions } from "../options " ;
4
+ import { userAgent } from "../useragent " ;
5
5
6
- import useragent from "$lib/useragent" ;
7
6
type Action = {
8
7
destroy ( ) : void ;
9
8
update ( options ?: FileDropOptions ) ;
@@ -66,7 +65,7 @@ export const filedrop = function (node: HTMLElement, options?: FileDropOptions):
66
65
}
67
66
68
67
function openDialog ( ) {
69
- if ( useragent . isIE ( ) || useragent . isLegacyEdge ( ) ) {
68
+ if ( userAgent . isIE ( ) || userAgent . isLegacyEdge ( ) ) {
70
69
setTimeout ( input . click , 1 ) ;
71
70
} else {
72
71
input . click ( ) ;
@@ -277,7 +276,7 @@ export const filedrop = function (node: HTMLElement, options?: FileDropOptions):
277
276
} else {
278
277
node . removeEventListener ( "click" , handleClick ) ;
279
278
}
280
- if ( browser ) {
279
+ if ( ! userAgent . isServer ( ) ) {
281
280
window . addEventListener ( "focus" , handleWindowFocus ) ;
282
281
}
283
282
} else {
@@ -295,7 +294,7 @@ export const filedrop = function (node: HTMLElement, options?: FileDropOptions):
295
294
input . removeEventListener ( "change" , handleChange ) ;
296
295
input . removeEventListener ( "click" , handleInputClick ) ;
297
296
input . files = null ;
298
- if ( browser ) {
297
+ if ( ! userAgent . isServer ( ) ) {
299
298
document . removeEventListener ( "dragover" , handleDocumentDragOver ) ;
300
299
document . removeEventListener ( "dragenter" , handleDocumentDragEnter ) ;
301
300
document . removeEventListener ( "dragleave" , handleDocumentDragLeave ) ;
0 commit comments