filepond 5.0.0-beta.21 → 5.0.0-beta.23
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.
- package/cdn/assets/index.js +1 -1
- package/cdn/locales/ar-ar.js +1 -1
- package/cdn/locales/bn-bd.js +1 -1
- package/cdn/locales/cs-cz.js +1 -1
- package/cdn/locales/da-dk.js +1 -1
- package/cdn/locales/de-de.js +1 -1
- package/cdn/locales/el-gr.js +1 -1
- package/cdn/locales/en-gb.js +1 -1
- package/cdn/locales/es-es.js +1 -1
- package/cdn/locales/fi-fi.js +1 -1
- package/cdn/locales/fr-fr.js +1 -1
- package/cdn/locales/hi-in.js +1 -1
- package/cdn/locales/hu-hu.js +1 -1
- package/cdn/locales/index.js +1 -1
- package/cdn/locales/is-is.js +1 -1
- package/cdn/locales/it-it.js +1 -1
- package/cdn/locales/ja-jp.js +1 -1
- package/cdn/locales/ko-kr.js +1 -1
- package/cdn/locales/nb-no.js +1 -1
- package/cdn/locales/nl-nl.js +1 -1
- package/cdn/locales/pl-pl.js +1 -1
- package/cdn/locales/pt-pt.js +1 -1
- package/cdn/locales/sv-se.js +1 -1
- package/cdn/locales/tr-tr.js +1 -1
- package/cdn/locales/uk-ua.js +1 -1
- package/cdn/locales/vi-vn.js +1 -1
- package/cdn/locales/zh-cn.js +1 -1
- package/cdn/main.js +2 -2
- package/cdn/workers/httpRequest.js +1 -1
- package/cdn/workers/readFile.js +1 -1
- package/cdn/workers/transformImage.js +1 -1
- package/esm/assets/index.js +1 -1
- package/esm/common/console.js +1 -1
- package/esm/common/entry.js +1 -1
- package/esm/common/perceivedPerformanceProxy.js +1 -1
- package/esm/common/readEntriesFromDataTransfer.js +1 -1
- package/esm/common/ssr.js +1 -1
- package/esm/common/status.js +1 -1
- package/esm/core/entryTree.js +1 -1
- package/esm/core/extensionManager.js +29 -29
- package/esm/core/taskScheduler.js +106 -100
- package/esm/dev/index.js +1 -1
- package/esm/elements/FilePondDefault/index.css.js +1 -1
- package/esm/elements/FilePondDefault/index.js +1 -1
- package/esm/elements/FilePondDropArea/index.css.js +1 -1
- package/esm/elements/FilePondDropArea/index.js +1 -1
- package/esm/elements/FilePondDropArea/index.svelte.js +1 -1
- package/esm/elements/FilePondDropIndicator/index.css.js +1 -1
- package/esm/elements/FilePondDropIndicator/index.js +1 -1
- package/esm/elements/FilePondDropIndicator/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/Entry/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/Entry/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/Entry/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryList/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryList/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryList/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryListItemPlaceholder/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryStatus/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryStatus/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryStatus/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaImage/components/BitmapRenderer.svelte.js +43 -43
- package/esm/elements/FilePondEntryList/components/MediaImage/components/BitmapRendererCache.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaImage/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaImage/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaImage/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaPane/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaPane/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaPane/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.svelte.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaVideo/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaVideo/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/MediaVideo/index.svelte.js +54 -51
- package/esm/elements/FilePondEntryList/contexts/appContext.js +1 -1
- package/esm/elements/FilePondEntryList/contexts/dragContext.js +1 -1
- package/esm/elements/FilePondEntryList/contexts/dropContext.js +1 -1
- package/esm/elements/FilePondEntryList/contexts/entryContext.js +1 -1
- package/esm/elements/FilePondEntryList/contexts/springElementTreeContext.js +1 -1
- package/esm/elements/FilePondEntryList/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/index.js +1 -1
- package/esm/elements/FilePondEntryList/index.svelte.js +1 -1
- package/esm/elements/FilePondInput/index.css.js +1 -1
- package/esm/elements/FilePondInput/index.js +60 -43
- package/esm/elements/FilePondSvelteComponent/index.svelte.js +1 -1
- package/esm/elements/attachments/dragarea.js +1 -1
- package/esm/elements/attachments/droparea.js +1 -1
- package/esm/elements/attachments/measurable.js +1 -1
- package/esm/elements/attachments/resizable.js +1 -1
- package/esm/elements/attachments/transitions.js +1 -1
- package/esm/elements/common/animationGuard.js +1 -1
- package/esm/elements/common/animationPreference.svelte.js +1 -1
- package/esm/elements/common/dragDrop.js +1 -1
- package/esm/elements/common/event.js +1 -1
- package/esm/elements/common/extendStyles.js +1 -1
- package/esm/elements/common/getClosestElement.js +1 -1
- package/esm/elements/common/html.js +1 -1
- package/esm/elements/common/nodeTree.js +1 -1
- package/esm/elements/common/store.svelte.js +1 -1
- package/esm/elements/common/string.js +1 -1
- package/esm/elements/common/transition.js +1 -1
- package/esm/elements/components/BooleanInput/index.css.js +1 -1
- package/esm/elements/components/BooleanInput/index.js +1 -1
- package/esm/elements/components/BooleanInput/index.svelte.js +1 -1
- package/esm/elements/components/Button/index.css.js +1 -1
- package/esm/elements/components/Button/index.js +1 -1
- package/esm/elements/components/Button/index.svelte.js +1 -1
- package/esm/elements/components/ElementPane/index.css.js +1 -1
- package/esm/elements/components/ElementPane/index.js +1 -1
- package/esm/elements/components/ElementPane/index.svelte.js +1 -1
- package/esm/elements/components/ElementSkeleton/index.css.js +1 -1
- package/esm/elements/components/ElementSkeleton/index.js +1 -1
- package/esm/elements/components/ElementSkeleton/index.svelte.js +1 -1
- package/esm/elements/components/FilenameInput/index.css.js +1 -1
- package/esm/elements/components/FilenameInput/index.js +1 -1
- package/esm/elements/components/FilenameInput/index.svelte.js +1 -1
- package/esm/elements/components/NodeList/index.svelte.js +1 -1
- package/esm/elements/components/ProgressIndicator/index.css.js +1 -1
- package/esm/elements/components/ProgressIndicator/index.js +1 -1
- package/esm/elements/components/ProgressIndicator/index.svelte.js +1 -1
- package/esm/elements/components/RangeInput/index.css.js +1 -1
- package/esm/elements/components/RangeInput/index.js +1 -1
- package/esm/elements/components/RangeInput/index.svelte.js +1 -1
- package/esm/elements/components/SpringElement/index.svelte.js +1 -1
- package/esm/elements/components/TextInput/index.css.js +1 -1
- package/esm/elements/components/TextInput/index.js +1 -1
- package/esm/elements/components/TextInput/index.svelte.js +1 -1
- package/esm/extensions/blob-loader.js +1 -1
- package/esm/extensions/canvas-loader.js +1 -1
- package/esm/extensions/chunked-upload-store.js +1 -1
- package/esm/extensions/clipboard-source.js +1 -1
- package/esm/extensions/common/createExtension.js +1 -1
- package/esm/extensions/common/createStoreExtension.js +39 -39
- package/esm/extensions/common/createTransformExtension.js +57 -56
- package/esm/extensions/common/createValidatorExtension.js +64 -82
- package/esm/extensions/console-view.js +1 -1
- package/esm/extensions/data-transfer-loader.js +1 -1
- package/esm/extensions/data-url-store.js +1 -1
- package/esm/extensions/drag-drop-source.js +1 -1
- package/esm/extensions/dropbox-source.js +1 -1
- package/esm/extensions/entry-list-view.js +1 -1
- package/esm/extensions/file-extension-validator.js +1 -1
- package/esm/extensions/file-input-source.js +1 -1
- package/esm/extensions/file-input-store.js +1 -1
- package/esm/extensions/file-mime-type-validator.js +1 -1
- package/esm/extensions/file-name-transform.js +1 -1
- package/esm/extensions/file-name-validator.js +1 -1
- package/esm/extensions/file-size-validator.js +1 -1
- package/esm/extensions/form-post-store.js +1 -1
- package/esm/extensions/image-bitmap-transform.js +32 -32
- package/esm/extensions/index.js +1 -1
- package/esm/extensions/list-count-validator.js +1 -1
- package/esm/extensions/list-size-validator.js +1 -1
- package/esm/extensions/media-resolution-validator.js +1 -1
- package/esm/extensions/object-url-store.js +1 -1
- package/esm/extensions/simulated-loader.js +1 -1
- package/esm/extensions/simulated-store.js +61 -38
- package/esm/extensions/text-input-store.js +1 -1
- package/esm/extensions/url-loader.js +1 -1
- package/esm/extensions/value-callback-store.js +13 -13
- package/esm/index.js +1 -1
- package/esm/locales/ar-ar.js +1 -1
- package/esm/locales/bn-bd.js +1 -1
- package/esm/locales/cs-cz.js +1 -1
- package/esm/locales/da-dk.js +1 -1
- package/esm/locales/de-de.js +1 -1
- package/esm/locales/el-gr.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/es-es.js +1 -1
- package/esm/locales/fi-fi.js +1 -1
- package/esm/locales/fr-fr.js +1 -1
- package/esm/locales/hi-in.js +1 -1
- package/esm/locales/hu-hu.js +1 -1
- package/esm/locales/index.js +1 -1
- package/esm/locales/is-is.js +1 -1
- package/esm/locales/it-it.js +1 -1
- package/esm/locales/ja-jp.js +1 -1
- package/esm/locales/ko-kr.js +1 -1
- package/esm/locales/nb-no.js +1 -1
- package/esm/locales/nl-nl.js +1 -1
- package/esm/locales/pl-pl.js +1 -1
- package/esm/locales/pt-pt.js +1 -1
- package/esm/locales/sv-se.js +1 -1
- package/esm/locales/tr-tr.js +1 -1
- package/esm/locales/uk-ua.js +1 -1
- package/esm/locales/vi-vn.js +1 -1
- package/esm/locales/zh-cn.js +1 -1
- package/esm/templates/entry.js +1 -1
- package/esm/templates/helpers.js +1 -1
- package/esm/templates/index.js +1 -1
- package/esm/templates/media.js +111 -118
- package/esm/utils/array.js +1 -1
- package/esm/utils/bounds.js +1 -1
- package/esm/utils/cache.js +1 -1
- package/esm/utils/canvasToBlob.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debounce.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/file.js +1 -1
- package/esm/utils/functionToBlob.js +1 -1
- package/esm/utils/keyboard.js +1 -1
- package/esm/utils/math.js +1 -1
- package/esm/utils/media.js +1 -1
- package/esm/utils/number.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/objectURL.js +1 -1
- package/esm/utils/placeholder.js +1 -1
- package/esm/utils/poly.js +1 -1
- package/esm/utils/pubsub.js +1 -1
- package/esm/utils/rect.js +1 -1
- package/esm/utils/size.js +13 -9
- package/esm/utils/sleep.js +1 -1
- package/esm/utils/string.js +1 -1
- package/esm/utils/support.js +1 -1
- package/esm/utils/test.js +1 -1
- package/esm/utils/thread.js +1 -1
- package/esm/utils/tree.js +1 -1
- package/esm/utils/url.js +1 -1
- package/esm/utils/vector.js +1 -1
- package/esm/utils/window.js +1 -1
- package/esm/utils/xhr.js +1 -1
- package/esm/workers/httpRequest.js +1 -1
- package/esm/workers/readFile.js +1 -1
- package/esm/workers/transformImage.js +1 -1
- package/package.json +2 -1
- package/types/core/taskScheduler.d.ts +3 -3
- package/types/elements/FilePondEntryList/index.d.ts +1 -1
- package/types/extensions/simulated-store.d.ts +6 -0
- package/types/templates/media.d.ts +6 -18
- package/types/utils/array.d.ts +1 -1
- package/types/utils/size.d.ts +2 -0
package/cdn/workers/readFile.js
CHANGED
package/esm/assets/index.js
CHANGED
package/esm/common/console.js
CHANGED
package/esm/common/entry.js
CHANGED
package/esm/common/ssr.js
CHANGED
package/esm/common/status.js
CHANGED
package/esm/core/entryTree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* FilePond v5.0.0-beta.
|
|
2
|
+
* FilePond v5.0.0-beta.23
|
|
3
3
|
* Copyright (c) 2017-2026 Pqina B.V.
|
|
4
4
|
* Released under the MIT License
|
|
5
5
|
* https://filepond.com
|
|
@@ -8,15 +8,15 @@ import { createTaskScheduler as R } from "./taskScheduler.js";
|
|
|
8
8
|
import { pubsub as z } from "../utils/pubsub.js";
|
|
9
9
|
import { isArray as k } from "../utils/test.js";
|
|
10
10
|
import { arrayItemsEqual as D, arrayRemoveInPlace as G, arraySortByItemProp as H } from "../utils/array.js";
|
|
11
|
-
function V(
|
|
12
|
-
const { on: I, pub: y } = z(),
|
|
11
|
+
function V(c) {
|
|
12
|
+
const { on: I, pub: y } = z(), a = [], { insertEntries: T, replaceEntry: A, updateEntry: v, removeEntries: j } = c, f = R({ log: void 0 }), x = {
|
|
13
13
|
extension: {}
|
|
14
14
|
};
|
|
15
15
|
function l(n, s) {
|
|
16
16
|
x.extension[n] = {
|
|
17
17
|
...g(n),
|
|
18
18
|
...s
|
|
19
|
-
}, y("
|
|
19
|
+
}, y("updateExtensionState", x.extension);
|
|
20
20
|
}
|
|
21
21
|
function g(n) {
|
|
22
22
|
return x.extension[n] ?? {};
|
|
@@ -27,12 +27,12 @@ function V(a) {
|
|
|
27
27
|
function O(n) {
|
|
28
28
|
return x.extension[n].status;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
c.on("removeEntry", ({ entry: n }) => {
|
|
31
31
|
f.abortTasks(n.id);
|
|
32
32
|
});
|
|
33
33
|
function q(n) {
|
|
34
34
|
const s = function(e, i) {
|
|
35
|
-
return
|
|
35
|
+
return c.on(e, i);
|
|
36
36
|
}, o = [], t = { current: void 0 };
|
|
37
37
|
t.current = n({
|
|
38
38
|
// events
|
|
@@ -52,11 +52,11 @@ function V(a) {
|
|
|
52
52
|
const B = E(
|
|
53
53
|
t.current.name
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
c.findEntries(e) && f.pushTask(e, i, {
|
|
56
56
|
// set order to factor of 100 so in theory there's plenty room for adding manual order
|
|
57
57
|
order: B.index * 100,
|
|
58
58
|
// when params is a function it is called on run task
|
|
59
|
-
params: () => [
|
|
59
|
+
params: () => [c.findEntries(e)],
|
|
60
60
|
// add custom options
|
|
61
61
|
...u
|
|
62
62
|
});
|
|
@@ -68,9 +68,9 @@ function V(a) {
|
|
|
68
68
|
f.abortTasks(e);
|
|
69
69
|
},
|
|
70
70
|
setEntries: function(e) {
|
|
71
|
-
|
|
71
|
+
c.entries = e;
|
|
72
72
|
},
|
|
73
|
-
getEntries: () =>
|
|
73
|
+
getEntries: () => c.entries,
|
|
74
74
|
// manipulating entry list
|
|
75
75
|
insertEntries: T,
|
|
76
76
|
removeEntries: j,
|
|
@@ -90,14 +90,14 @@ function V(a) {
|
|
|
90
90
|
e(...i);
|
|
91
91
|
}), t.current;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
f.abortTasks(),
|
|
93
|
+
function S() {
|
|
94
|
+
f.abortTasks(), a.map((n) => n.instance).forEach((n) => n.destroy()), a.length = 0;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const h = {
|
|
97
97
|
// subscribe to events
|
|
98
98
|
on: I,
|
|
99
99
|
get extensions() {
|
|
100
|
-
return
|
|
100
|
+
return a.map(({ factory: n }) => n);
|
|
101
101
|
},
|
|
102
102
|
set extensions(n) {
|
|
103
103
|
if (!k(n))
|
|
@@ -105,23 +105,23 @@ function V(a) {
|
|
|
105
105
|
const s = n.map(
|
|
106
106
|
(t) => Array.isArray(t) ? t[0] : t
|
|
107
107
|
);
|
|
108
|
-
if (D(s,
|
|
108
|
+
if (D(s, h.extensions)) {
|
|
109
109
|
for (const t of n) {
|
|
110
110
|
if (!k(t))
|
|
111
111
|
continue;
|
|
112
|
-
const r =
|
|
112
|
+
const r = a.find((e) => t[0] === e.factory);
|
|
113
113
|
p(r, t[1]);
|
|
114
114
|
}
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
n.length === 0 && (d.clear(),
|
|
118
|
-
for (const t of
|
|
117
|
+
n.length === 0 && (d.clear(), S());
|
|
118
|
+
for (const t of a)
|
|
119
119
|
if (!s.includes(t.factory)) {
|
|
120
|
-
t.instance.destroy(), G(
|
|
120
|
+
t.instance.destroy(), G(a, (r) => r === t);
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
123
|
for (const [t, r] of Object.entries(s)) {
|
|
124
|
-
const e = parseInt(t, 10), i =
|
|
124
|
+
const e = parseInt(t, 10), i = a.find((u) => r === u.factory);
|
|
125
125
|
if (i) {
|
|
126
126
|
if (i.index = e, Array.isArray(n[e])) {
|
|
127
127
|
const u = n[e][1];
|
|
@@ -129,24 +129,24 @@ function V(a) {
|
|
|
129
129
|
}
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
132
|
+
if (a.push({
|
|
133
133
|
index: e,
|
|
134
134
|
factory: r,
|
|
135
135
|
instance: q(r)
|
|
136
136
|
}), Array.isArray(n[e])) {
|
|
137
137
|
const u = n[e][1];
|
|
138
|
-
p(
|
|
138
|
+
p(a.at(-1), u);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
H(
|
|
141
|
+
H(a, "index"), Object.entries(d.get("*") ?? []).forEach(
|
|
142
142
|
([t, r]) => {
|
|
143
143
|
P(t, r);
|
|
144
144
|
}
|
|
145
145
|
);
|
|
146
146
|
for (const [t, r] of d)
|
|
147
147
|
t !== "*" && b(t, r);
|
|
148
|
-
const o =
|
|
149
|
-
y("setExtensions", { extensionNames: o }),
|
|
148
|
+
const o = a.map((t) => t.instance.name);
|
|
149
|
+
y("setExtensions", { extensionNames: o }), c.entries = [...c.entries];
|
|
150
150
|
},
|
|
151
151
|
propagateExtensionProperty: P,
|
|
152
152
|
setExtensionProperties: b,
|
|
@@ -157,7 +157,7 @@ function V(a) {
|
|
|
157
157
|
},
|
|
158
158
|
// destroy FilePond instance
|
|
159
159
|
destroy() {
|
|
160
|
-
|
|
160
|
+
S();
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
function P(n, s) {
|
|
@@ -182,13 +182,13 @@ function V(a) {
|
|
|
182
182
|
s && (n.instance.setProps(s), m(n.instance.name, s));
|
|
183
183
|
}
|
|
184
184
|
function W(n) {
|
|
185
|
-
return
|
|
185
|
+
return a.filter((s) => {
|
|
186
186
|
const o = s.instance.getProps();
|
|
187
187
|
return Object.keys(o).includes(n);
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
function E(n) {
|
|
191
|
-
return
|
|
191
|
+
return a.find((s) => s.instance.name === n);
|
|
192
192
|
}
|
|
193
193
|
const d = /* @__PURE__ */ new Map();
|
|
194
194
|
function m(n, s) {
|
|
@@ -197,7 +197,7 @@ function V(a) {
|
|
|
197
197
|
...s
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
return
|
|
200
|
+
return h;
|
|
201
201
|
}
|
|
202
202
|
export {
|
|
203
203
|
V as createExtensionManager
|
|
@@ -1,173 +1,179 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* FilePond v5.0.0-beta.
|
|
2
|
+
* FilePond v5.0.0-beta.23
|
|
3
3
|
* Copyright (c) 2017-2026 Pqina B.V.
|
|
4
4
|
* Released under the MIT License
|
|
5
5
|
* https://filepond.com
|
|
6
6
|
*/
|
|
7
|
-
import { arrayRemoveInPlace as
|
|
8
|
-
import { pubsub as
|
|
9
|
-
import { isString as
|
|
10
|
-
const
|
|
7
|
+
import { arrayRemoveInPlace as p } from "../utils/array.js";
|
|
8
|
+
import { pubsub as z } from "../utils/pubsub.js";
|
|
9
|
+
import { isString as J, isFunction as h } from "../utils/test.js";
|
|
10
|
+
const o = {
|
|
11
11
|
QUEUED: 1,
|
|
12
12
|
ACTIVE: 2,
|
|
13
13
|
FAILED: 3,
|
|
14
14
|
HALTED: 4
|
|
15
15
|
};
|
|
16
|
-
function Y(
|
|
17
|
-
const { log:
|
|
18
|
-
function
|
|
19
|
-
return t.state ===
|
|
16
|
+
function Y(v) {
|
|
17
|
+
const { log: g = void 0 } = v ?? {}, { on: C, pub: u } = z(), s = [], i = /* @__PURE__ */ new Map();
|
|
18
|
+
function F(t) {
|
|
19
|
+
return t.state === o.QUEUED || t.state === o.ACTIVE;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return t.state ===
|
|
21
|
+
function E(t) {
|
|
22
|
+
return t.state === o.QUEUED;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return t.state ===
|
|
24
|
+
function Q(t) {
|
|
25
|
+
return t.state === o.ACTIVE;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function L(t, n) {
|
|
28
|
+
return J(t) && h(n);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function m(t, n) {
|
|
31
31
|
let r = 0;
|
|
32
|
-
for (let
|
|
33
|
-
t.order >= n[
|
|
32
|
+
for (let e = 0; e < n.length; e++)
|
|
33
|
+
t.order >= n[e].order && (r = e + 1);
|
|
34
34
|
n.splice(r, 0, t);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
36
|
+
function B(t) {
|
|
37
|
+
m(t, s);
|
|
38
38
|
let n = i.get(t.group);
|
|
39
|
-
n || (n = [], i.set(t.group, n)),
|
|
40
|
-
}
|
|
41
|
-
function Q(t, n) {
|
|
42
|
-
const r = i.get(t);
|
|
43
|
-
return r ? !!r.find((o) => o.fn === n) : !1;
|
|
39
|
+
n || (n = [], i.set(t.group, n)), m(t, n);
|
|
44
40
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
41
|
+
function d(t) {
|
|
42
|
+
p(
|
|
47
43
|
s,
|
|
48
44
|
(r) => r.group === t.group && r.fn === t.fn
|
|
49
45
|
);
|
|
50
46
|
const n = i.get(t.group);
|
|
51
|
-
n &&
|
|
47
|
+
n && p(n, (r) => r.fn === t.fn);
|
|
52
48
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
49
|
+
function H(t) {
|
|
50
|
+
p(s, (n) => n.group === t), i.delete(t);
|
|
55
51
|
}
|
|
56
|
-
function
|
|
52
|
+
function f(t) {
|
|
57
53
|
return i.get(t) ?? [];
|
|
58
54
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
55
|
+
function A(t, n) {
|
|
56
|
+
return f(t)[0].state === n;
|
|
61
57
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
58
|
+
function q(t) {
|
|
59
|
+
return f(t).filter(F).length > 0;
|
|
64
60
|
}
|
|
65
|
-
function
|
|
66
|
-
const n =
|
|
61
|
+
function V(t) {
|
|
62
|
+
const n = f(t);
|
|
67
63
|
for (const r of n)
|
|
68
|
-
|
|
64
|
+
U(r);
|
|
69
65
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
66
|
+
function S(t) {
|
|
67
|
+
return f(t).filter(E)[0];
|
|
72
68
|
}
|
|
73
|
-
function
|
|
74
|
-
const r =
|
|
69
|
+
function b(t, n) {
|
|
70
|
+
const r = f(t);
|
|
75
71
|
if (r)
|
|
76
|
-
return r.find((
|
|
72
|
+
return r.find((e) => e.fn === n);
|
|
77
73
|
}
|
|
78
|
-
function
|
|
79
|
-
const {
|
|
80
|
-
for (const
|
|
81
|
-
|
|
74
|
+
function I(t, n, r) {
|
|
75
|
+
const { isSoftFailure: e = !1 } = r || {}, c = i.get(t) ?? [];
|
|
76
|
+
for (const a of c)
|
|
77
|
+
e && a.ignoreSoftFailure || (a.state = n);
|
|
82
78
|
}
|
|
83
|
-
function
|
|
79
|
+
function w() {
|
|
84
80
|
return Array.from(new Set(s.map((t) => t.group)));
|
|
85
81
|
}
|
|
86
|
-
function
|
|
82
|
+
function N() {
|
|
87
83
|
return i.keys();
|
|
88
84
|
}
|
|
89
|
-
function
|
|
90
|
-
return s.filter(
|
|
85
|
+
function R() {
|
|
86
|
+
return s.filter(E).length > 0;
|
|
91
87
|
}
|
|
92
|
-
function
|
|
93
|
-
return s.filter(
|
|
88
|
+
function P() {
|
|
89
|
+
return s.filter(Q);
|
|
94
90
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
91
|
+
function M(t) {
|
|
92
|
+
return P().filter((n) => n.fn === t.fn);
|
|
97
93
|
}
|
|
98
|
-
function
|
|
99
|
-
return t ? t.parallel === 1 / 0 ||
|
|
94
|
+
function y(t) {
|
|
95
|
+
return t ? t.parallel === 1 / 0 || M(t).length < t.parallel : !1;
|
|
100
96
|
}
|
|
101
97
|
function l() {
|
|
102
|
-
queueMicrotask(
|
|
98
|
+
queueMicrotask(D);
|
|
103
99
|
}
|
|
104
|
-
function
|
|
105
|
-
if (!
|
|
106
|
-
|
|
100
|
+
function D() {
|
|
101
|
+
if (!R()) {
|
|
102
|
+
g?.(s), u("idle");
|
|
107
103
|
return;
|
|
108
104
|
}
|
|
109
|
-
|
|
110
|
-
const t =
|
|
105
|
+
g?.(s);
|
|
106
|
+
const t = w();
|
|
111
107
|
for (const n of t) {
|
|
112
|
-
if (!
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
108
|
+
if (!A(n, o.QUEUED)) {
|
|
109
|
+
if (A(n, o.HALTED)) {
|
|
110
|
+
const e = S(n);
|
|
111
|
+
if (!e || e.ignoreSoftFailure === !1 || !y(e))
|
|
116
112
|
continue;
|
|
117
|
-
|
|
113
|
+
G(e);
|
|
118
114
|
}
|
|
119
115
|
continue;
|
|
120
116
|
}
|
|
121
|
-
const r =
|
|
122
|
-
|
|
117
|
+
const r = S(n);
|
|
118
|
+
y(r) && G(r);
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
|
-
async function
|
|
126
|
-
const { group: n, fn: r, params:
|
|
127
|
-
t.state =
|
|
121
|
+
async function G(t) {
|
|
122
|
+
const { group: n, fn: r, params: e, abortController: c } = t;
|
|
123
|
+
t.state = o.ACTIVE;
|
|
128
124
|
try {
|
|
129
|
-
const a =
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
m(t), u === !1 && b(n, e.HALTED, { ignoreOptional: !0 });
|
|
125
|
+
const a = h(e) ? e() : e, T = await r(...a, { abortController: c });
|
|
126
|
+
d(t), T === !1 && I(n, o.HALTED, { isSoftFailure: !0 });
|
|
133
127
|
} catch (a) {
|
|
134
|
-
|
|
128
|
+
u("error", a), I(n, o.HALTED), console.log("set current task state to failed"), t.state = o.FAILED;
|
|
135
129
|
}
|
|
136
|
-
|
|
130
|
+
q(n) || u("complete", n), l();
|
|
137
131
|
}
|
|
138
|
-
function
|
|
132
|
+
function U(t) {
|
|
139
133
|
t.abortController.signal.aborted || t.abortController.abort();
|
|
140
134
|
}
|
|
141
|
-
function
|
|
142
|
-
const {
|
|
143
|
-
|
|
135
|
+
function W(t, n, r) {
|
|
136
|
+
const {
|
|
137
|
+
parallel: e = 1 / 0,
|
|
138
|
+
order: c = 0,
|
|
139
|
+
params: a = [],
|
|
140
|
+
ignoreSoftFailure: T = !1
|
|
141
|
+
} = r ?? {};
|
|
142
|
+
if (!L(t, n))
|
|
143
|
+
return;
|
|
144
|
+
const k = b(t, n);
|
|
145
|
+
if (k) {
|
|
146
|
+
k?.state === o.FAILED && (k.state = o.QUEUED, D());
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
B({
|
|
144
150
|
group: t,
|
|
145
151
|
fn: n,
|
|
146
|
-
params:
|
|
147
|
-
order:
|
|
148
|
-
parallel:
|
|
149
|
-
|
|
150
|
-
state:
|
|
152
|
+
params: a,
|
|
153
|
+
order: c,
|
|
154
|
+
parallel: e,
|
|
155
|
+
ignoreSoftFailure: T,
|
|
156
|
+
state: o.QUEUED,
|
|
151
157
|
abortController: new AbortController()
|
|
152
|
-
}), l()
|
|
158
|
+
}), l();
|
|
153
159
|
}
|
|
154
|
-
function
|
|
155
|
-
const r =
|
|
156
|
-
r && (
|
|
160
|
+
function j(t, n) {
|
|
161
|
+
const r = b(t, n);
|
|
162
|
+
r && (U(r), d(r), l());
|
|
157
163
|
}
|
|
158
|
-
function
|
|
164
|
+
function x(t) {
|
|
159
165
|
if (!t) {
|
|
160
|
-
for (const n of
|
|
161
|
-
|
|
166
|
+
for (const n of N())
|
|
167
|
+
x(n);
|
|
162
168
|
return;
|
|
163
169
|
}
|
|
164
|
-
|
|
170
|
+
V(t), H(t), u("abort", t), u("complete", t), l();
|
|
165
171
|
}
|
|
166
172
|
return {
|
|
167
|
-
on:
|
|
168
|
-
pushTask:
|
|
169
|
-
abortTask:
|
|
170
|
-
abortTasks:
|
|
173
|
+
on: C,
|
|
174
|
+
pushTask: W,
|
|
175
|
+
abortTask: j,
|
|
176
|
+
abortTasks: x
|
|
171
177
|
};
|
|
172
178
|
}
|
|
173
179
|
export {
|
package/esm/dev/index.js
CHANGED