svelte-file-dropzone
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.FileDropzone = factory()); | ||
}(this, (function () { 'use strict'; | ||
})(this, (function () { 'use strict'; | ||
@@ -60,13 +60,30 @@ function noop() { } | ||
} | ||
let flushing = false; | ||
// flush() calls callbacks in this order: | ||
// 1. All beforeUpdate callbacks, in order: parents before children | ||
// 2. All bind:this callbacks, in reverse order: children before parents. | ||
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT | ||
// for afterUpdates called during the initial onMount, which are called in | ||
// reverse order: children before parents. | ||
// Since callbacks might update component values, which could trigger another | ||
// call to flush(), the following steps guard against this: | ||
// 1. During beforeUpdate, any updated components will be added to the | ||
// dirty_components array and will cause a reentrant call to flush(). Because | ||
// the flush index is kept outside the function, the reentrant call will pick | ||
// up where the earlier call left off and go through all dirty components. The | ||
// current_component value is saved and restored so that the reentrant call will | ||
// not interfere with the "parent" flush() call. | ||
// 2. bind:this callbacks cannot trigger new flush() calls. | ||
// 3. During afterUpdate, any updated components will NOT have their afterUpdate | ||
// callback called a second time; the seen_callbacks set, outside the flush() | ||
// function, guarantees this behavior. | ||
const seen_callbacks = new Set(); | ||
let flushidx = 0; // Do *not* move this inside the flush() function | ||
function flush() { | ||
if (flushing) | ||
return; | ||
flushing = true; | ||
const saved_component = current_component; | ||
do { | ||
// first, call beforeUpdate functions | ||
// and update components | ||
for (let i = 0; i < dirty_components.length; i += 1) { | ||
const component = dirty_components[i]; | ||
while (flushidx < dirty_components.length) { | ||
const component = dirty_components[flushidx]; | ||
flushidx++; | ||
set_current_component(component); | ||
@@ -77,2 +94,3 @@ update(component.$$); | ||
dirty_components.length = 0; | ||
flushidx = 0; | ||
while (binding_callbacks.length) | ||
@@ -97,4 +115,4 @@ binding_callbacks.pop()(); | ||
update_scheduled = false; | ||
flushing = false; | ||
seen_callbacks.clear(); | ||
set_current_component(saved_component); | ||
} | ||
@@ -174,3 +192,3 @@ function update($$) { | ||
after_update: [], | ||
context: new Map(parent_component ? parent_component.$$.context : options.context || []), | ||
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), | ||
// everything else | ||
@@ -245,3 +263,3 @@ callbacks: blank_object(), | ||
/* src/index.svelte generated by Svelte v3.41.0 */ | ||
/* src/index.svelte generated by Svelte v3.49.0 */ | ||
@@ -276,2 +294,2 @@ function create_fragment(ctx) { | ||
}))); | ||
})); |
{ | ||
"name": "svelte-file-dropzone", | ||
"version": "1.0.0-dev.1", | ||
"version": "1.0.0", | ||
"description": "Svelte component for fileupload and file dropzone", | ||
@@ -21,19 +21,19 @@ "svelte": "src/components/Dropzone.svelte", | ||
"dependencies": { | ||
"file-selector": "^0.2.2" | ||
"file-selector": "^0.2.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.14.6", | ||
"@rollup/plugin-commonjs": "18.0.0", | ||
"@rollup/plugin-node-resolve": "11.2.1", | ||
"@storybook/addon-actions": "6.2.9", | ||
"@storybook/addon-links": "6.2.9", | ||
"@babel/core": "7.18.10", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@storybook/addon-actions": "6.5.10", | ||
"@storybook/addon-links": "6.5.10", | ||
"@storybook/addon-notes": "5.3.21", | ||
"@storybook/addon-storysource": "6.2.9", | ||
"@storybook/addons": "6.2.9", | ||
"@storybook/svelte": "6.2.9", | ||
"babel-loader": "8.2.2", | ||
"rollup": "2.46.0", | ||
"@storybook/addon-storysource": "6.5.10", | ||
"@storybook/addons": "6.5.10", | ||
"@storybook/svelte": "6.5.10", | ||
"babel-loader": "8.2.5", | ||
"rollup": "2.77.2", | ||
"rollup-plugin-svelte": "7.1.0", | ||
"svelte": "3.41.0", | ||
"svelte-loader": "3.1.1" | ||
"svelte": "3.49.0", | ||
"svelte-loader": "3.1.3" | ||
}, | ||
@@ -40,0 +40,0 @@ "keywords": [ |
@@ -24,3 +24,3 @@ # svelte-file-dropzone | ||
``` | ||
```svelte | ||
<script> | ||
@@ -76,2 +76,3 @@ import Dropzone from "svelte-file-dropzone"; | ||
| drop | | `{acceptedFiles,fileRejections,event}` | | ||
| filedropped | | `{event}` | | ||
| droprejected | | `{fileRejections,event}` | | ||
@@ -78,0 +79,0 @@ | dropaccepted | | `{acceptedFiles,event}` | |
@@ -114,7 +114,2 @@ import accepts from "./attr-accept"; | ||
// allow the entire document to be a drag target | ||
export function onDocumentDragOver(event) { | ||
event.preventDefault(); | ||
} | ||
function isIe(userAgent) { | ||
@@ -121,0 +116,0 @@ return ( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
40439
6.83%716
4.68%2
-33.33%91
1.11%Updated