filepond 5.0.0-beta.20 → 5.0.0-beta.21
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 +45 -0
- package/cdn/workers/httpRequestWorker.js +37 -0
- package/cdn/workers/readFile.js +14 -0
- package/cdn/workers/readFileWorker.js +6 -0
- package/cdn/workers/transformImage.js +16 -0
- package/cdn/workers/transformImageWorker.js +8 -0
- 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 +28 -28
- package/esm/core/taskScheduler.js +78 -97
- package/esm/dev/index.js +1 -1
- package/esm/elements/FilePondDefault/index.css.js +1 -1
- package/esm/elements/FilePondDefault/index.js +46 -45
- 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 +80 -80
- 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 +65 -60
- 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 +2 -1
- package/esm/elements/FilePondEntryList/components/MediaImage/index.svelte.js +70 -70
- package/esm/elements/FilePondEntryList/components/MediaPane/index.css.js +2 -2
- 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 +1 -1
- 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 +2 -1
- package/esm/elements/FilePondEntryList/index.svelte.js +166 -166
- package/esm/elements/FilePondInput/index.css.js +1 -1
- package/esm/elements/FilePondInput/index.js +15 -11
- 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 +9 -9
- 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 +2 -2
- package/esm/elements/components/ProgressIndicator/index.js +1 -1
- package/esm/elements/components/ProgressIndicator/index.svelte.js +70 -70
- 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 +1 -1
- package/esm/extensions/common/createTransformExtension.js +1 -1
- package/esm/extensions/common/createValidatorExtension.js +1 -1
- package/esm/extensions/console-view.js +1 -1
- package/esm/extensions/data-transfer-loader.js +1 -1
- package/esm/extensions/data-url-store.js +24 -19
- 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 +56 -54
- 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 +74 -65
- package/esm/extensions/simulated-store.js +1 -1
- package/esm/extensions/text-input-store.js +1 -1
- package/esm/extensions/url-loader.js +74 -71
- package/esm/extensions/value-callback-store.js +1 -1
- 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 +2 -2
- package/esm/templates/helpers.js +1 -1
- package/esm/templates/index.js +1 -1
- package/esm/templates/media.js +119 -111
- 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 +1 -1
- 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 +47 -42
- 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 +88 -113
- package/esm/workers/httpRequest.js +45 -0
- package/esm/workers/httpRequestWorker.js +37 -0
- package/esm/workers/readFile.js +14 -0
- package/esm/workers/readFileWorker.js +6 -0
- package/esm/workers/transformImage.js +16 -0
- package/esm/workers/transformImageWorker.js +8 -0
- package/package.json +5 -1
- package/types/core/taskScheduler.d.ts +2 -2
- package/types/elements/FilePondDefault/index.d.ts +2 -0
- package/types/elements/FilePondInput/index.d.ts +2 -0
- package/types/elements/common/nodeTree.d.ts +1 -1
- package/types/extensions/data-url-store.d.ts +2 -0
- package/types/extensions/image-bitmap-transform.d.ts +2 -0
- package/types/extensions/simulated-loader.d.ts +2 -0
- package/types/extensions/url-loader.d.ts +2 -0
- package/types/templates/media.d.ts +14 -0
- package/types/types/index.d.ts +5 -11
- package/types/utils/thread.d.ts +6 -0
- package/types/utils/xhr.d.ts +1 -0
- package/types/workers/httpRequest.d.ts +23 -0
- package/types/workers/readFile.d.ts +9 -0
- package/types/workers/transformImage.d.ts +6 -0
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* FilePond v5.0.0-beta.
|
|
2
|
+
* FilePond v5.0.0-beta.21
|
|
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 { blobToFile as
|
|
8
|
-
import { getImageSize as
|
|
7
|
+
import { blobToFile as S } from "../utils/file.js";
|
|
8
|
+
import { getImageSize as k } from "../utils/media.js";
|
|
9
9
|
import { rectApply as q, rectFromSize as A } from "../utils/rect.js";
|
|
10
10
|
import { sizeFromRect as H } from "../utils/size.js";
|
|
11
11
|
import { isFileEntry as W, isImageFile as C } from "../utils/test.js";
|
|
12
|
-
import { thread as O } from "../utils/thread.js";
|
|
13
|
-
import { createTransformExtension as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
resizeWidth: u,
|
|
17
|
-
resizeHeight: n,
|
|
18
|
-
resizeQuality: s,
|
|
19
|
-
imageOrientation: "from-image"
|
|
20
|
-
}).then((m) => {
|
|
21
|
-
h(null, m, [m]);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const U = k(
|
|
12
|
+
import { thread as L, createThreadWorker as O } from "../utils/thread.js";
|
|
13
|
+
import { createTransformExtension as U } from "./common/createTransformExtension.js";
|
|
14
|
+
import { transformImage as Q } from "../workers/transformImage.js";
|
|
15
|
+
const Y = U(
|
|
25
16
|
"ImageBitmapTransform",
|
|
26
17
|
{
|
|
27
18
|
actionTransform: "transformImage",
|
|
@@ -33,75 +24,86 @@ const U = k(
|
|
|
33
24
|
type: void 0,
|
|
34
25
|
quality: "medium",
|
|
35
26
|
compression: 0.98,
|
|
27
|
+
workersURL: void 0,
|
|
36
28
|
shouldTransform: () => !0
|
|
37
29
|
},
|
|
38
|
-
({ props:
|
|
39
|
-
function
|
|
40
|
-
return W(
|
|
30
|
+
({ props: v, extensionName: b }) => {
|
|
31
|
+
function F(o) {
|
|
32
|
+
return W(o) && C(o.file) && !/svg/.test(o.file.type);
|
|
41
33
|
}
|
|
42
|
-
async function
|
|
43
|
-
const {
|
|
44
|
-
|
|
34
|
+
async function z(o, { abortController: T }) {
|
|
35
|
+
const {
|
|
36
|
+
aspectRatio: m,
|
|
37
|
+
width: c,
|
|
38
|
+
height: f,
|
|
39
|
+
upscale: R,
|
|
40
|
+
fit: l,
|
|
41
|
+
quality: x,
|
|
42
|
+
compression: I,
|
|
43
|
+
type: E,
|
|
44
|
+
workersURL: B
|
|
45
|
+
} = v, { file: n } = o, M = [...o.extension[b].history ?? []], d = await k(n);
|
|
46
|
+
if (d === null)
|
|
45
47
|
throw "Failed to read image size";
|
|
46
|
-
const e = q(A(
|
|
48
|
+
const e = q(A(d, m), Math.round);
|
|
47
49
|
let t = H(e);
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
50
|
+
if (c || f) {
|
|
51
|
+
const h = e.width / e.height, a = m || h;
|
|
52
|
+
let i = c, r = f;
|
|
53
|
+
if (r ? i || (i = r * a) : r = i / a, t.width = i, t.height = r, l === "contain" ? i > r ? t.width = r * a : t.height = i / a : l === "cover" && (i > r ? t.height = i / a : t.width = r * a), !R && (t.width > e.width || t.height > e.height)) {
|
|
54
|
+
const y = Math.min(
|
|
53
55
|
e.width / t.width,
|
|
54
56
|
e.height / t.height
|
|
55
57
|
);
|
|
56
|
-
t.width *=
|
|
58
|
+
t.width *= y, t.height *= y;
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
let
|
|
61
|
+
let s;
|
|
60
62
|
try {
|
|
61
|
-
|
|
62
|
-
Q,
|
|
63
|
+
s = await L(
|
|
64
|
+
O(B, Q),
|
|
63
65
|
[
|
|
64
|
-
|
|
65
|
-
e
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
n,
|
|
67
|
+
e,
|
|
68
|
+
{
|
|
69
|
+
resizeWidth: Math.round(t.width),
|
|
70
|
+
resizeHeight: Math.round(t.height),
|
|
71
|
+
resizeQuality: x,
|
|
72
|
+
imageOrientation: "from-image"
|
|
73
|
+
}
|
|
72
74
|
],
|
|
73
75
|
{
|
|
74
|
-
abortController:
|
|
76
|
+
abortController: T
|
|
75
77
|
}
|
|
76
78
|
);
|
|
77
79
|
} catch {
|
|
78
80
|
throw "Failed to create image bitmap";
|
|
79
81
|
}
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
+
const p = new OffscreenCanvas(s.width, s.height), g = p.getContext("bitmaprenderer");
|
|
83
|
+
if (g === null)
|
|
82
84
|
throw "Failed to create bitmap renderer";
|
|
83
|
-
|
|
84
|
-
let
|
|
85
|
+
g.transferFromImageBitmap(s);
|
|
86
|
+
let u;
|
|
85
87
|
try {
|
|
86
|
-
|
|
87
|
-
type:
|
|
88
|
-
quality:
|
|
88
|
+
u = await p.convertToBlob({
|
|
89
|
+
type: E || n.type,
|
|
90
|
+
quality: I
|
|
89
91
|
});
|
|
90
92
|
} catch {
|
|
91
93
|
throw "Failed to convert canvas to blob";
|
|
92
94
|
}
|
|
93
|
-
const
|
|
95
|
+
const w = S(u, n.name);
|
|
94
96
|
return {
|
|
95
|
-
file:
|
|
96
|
-
history: [...
|
|
97
|
+
file: w,
|
|
98
|
+
history: [...M, w]
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
return {
|
|
100
|
-
canTransformEntry:
|
|
101
|
-
transformEntry:
|
|
102
|
+
canTransformEntry: F,
|
|
103
|
+
transformEntry: z
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
export {
|
|
106
|
-
|
|
108
|
+
Y as ImageBitmapTransform
|
|
107
109
|
};
|
package/esm/extensions/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* FilePond v5.0.0-beta.
|
|
2
|
+
* FilePond v5.0.0-beta.21
|
|
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 { createProgressEvent as
|
|
8
|
-
import { isBlobOrFile as
|
|
9
|
-
import { createExtension as
|
|
7
|
+
import { createProgressEvent as y } from "../utils/xhr.js";
|
|
8
|
+
import { isBlobOrFile as Q, isString as F, isNumber as Y } from "../utils/test.js";
|
|
9
|
+
import { createExtension as j } from "./common/createExtension.js";
|
|
10
10
|
import { Status as s } from "../common/status.js";
|
|
11
|
-
import { sleep as
|
|
12
|
-
import { log as
|
|
13
|
-
const
|
|
11
|
+
import { sleep as p } from "../utils/sleep.js";
|
|
12
|
+
import { log as q } from "../common/console.js";
|
|
13
|
+
const W = j(
|
|
14
14
|
"SimulatedLoader",
|
|
15
15
|
{
|
|
16
16
|
actionLoad: "load",
|
|
@@ -20,96 +20,105 @@ const V = Y(
|
|
|
20
20
|
connectionDelay: 250,
|
|
21
21
|
errorDelay: void 0,
|
|
22
22
|
parallel: 4,
|
|
23
|
+
log: !0,
|
|
23
24
|
fetchFile: void 0
|
|
24
25
|
},
|
|
25
|
-
({ extensionName:
|
|
26
|
+
({ extensionName: L, props: E, didSetProps: A }, I) => {
|
|
26
27
|
const {
|
|
27
28
|
setEntryExtensionStatus: n,
|
|
28
|
-
getEntryExtensionStatus:
|
|
29
|
-
createProgressHandler:
|
|
29
|
+
getEntryExtensionStatus: U,
|
|
30
|
+
createProgressHandler: T,
|
|
30
31
|
removeEntries: O,
|
|
31
|
-
updateEntry:
|
|
32
|
+
updateEntry: g,
|
|
32
33
|
pushTask: h,
|
|
33
|
-
abortTasks:
|
|
34
|
-
on:
|
|
35
|
-
} =
|
|
34
|
+
abortTasks: x,
|
|
35
|
+
on: R
|
|
36
|
+
} = I;
|
|
36
37
|
let k;
|
|
37
|
-
|
|
38
|
+
A(({ bitrate: t = 1024e3, tickrate: e = 250 }) => {
|
|
38
39
|
k = t / 8 * (e / 1e3);
|
|
39
40
|
});
|
|
40
|
-
async function
|
|
41
|
+
async function _(t) {
|
|
41
42
|
n(t, {
|
|
42
43
|
type: s.System,
|
|
43
44
|
code: "LOAD_QUEUED"
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
async function
|
|
47
|
-
const { src: e, size:
|
|
47
|
+
async function P(t) {
|
|
48
|
+
const { src: e, size: c = 1024 * 1024 } = t, { log: o, connectionDelay: a, errorDelay: i } = E;
|
|
48
49
|
if (n(t, {
|
|
49
50
|
type: s.System,
|
|
50
51
|
code: "LOAD_BUSY",
|
|
51
52
|
progress: 1 / 0
|
|
52
|
-
}), await
|
|
53
|
-
await
|
|
54
|
-
const
|
|
53
|
+
}), await p(a), i) {
|
|
54
|
+
await p(i);
|
|
55
|
+
const r = "Simulated error";
|
|
55
56
|
throw n(t, {
|
|
56
57
|
type: s.Error,
|
|
57
58
|
code: "LOAD_ERROR",
|
|
58
|
-
values: { error:
|
|
59
|
-
}),
|
|
59
|
+
values: { error: r }
|
|
60
|
+
}), o && l(["did throw load info error", t.id]), r;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
o && l(["did load info", t.id]), g(t, {
|
|
62
63
|
name: e.split("/").pop(),
|
|
63
64
|
type: "plain/text",
|
|
64
|
-
size:
|
|
65
|
+
size: c
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
async function
|
|
68
|
-
const { src:
|
|
68
|
+
async function z(t, { abortController: e }) {
|
|
69
|
+
const { src: c, size: o = 1024 * 1024 } = t, {
|
|
70
|
+
log: a,
|
|
71
|
+
actionLoad: i,
|
|
72
|
+
actionAbort: r,
|
|
73
|
+
tickrate: b,
|
|
74
|
+
connectionDelay: w,
|
|
75
|
+
fetchFile: m,
|
|
76
|
+
errorDelay: S
|
|
77
|
+
} = E;
|
|
69
78
|
n(t, {
|
|
70
79
|
type: s.System,
|
|
71
80
|
code: "LOAD_BUSY",
|
|
72
81
|
progress: 1 / 0
|
|
73
82
|
});
|
|
74
|
-
const d =
|
|
75
|
-
if (await
|
|
76
|
-
await
|
|
77
|
-
const
|
|
83
|
+
const d = T(t);
|
|
84
|
+
if (await p(w), S) {
|
|
85
|
+
await p(S);
|
|
86
|
+
const u = "Simulated error";
|
|
78
87
|
throw n(t, {
|
|
79
88
|
type: s.Error,
|
|
80
89
|
code: "LOAD_ERROR",
|
|
81
|
-
values: { error:
|
|
82
|
-
}),
|
|
90
|
+
values: { error: u }
|
|
91
|
+
}), a && l(["did throw load data error", t.id]), u;
|
|
83
92
|
}
|
|
84
|
-
return await new Promise((
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
if (e.signal.aborted || (
|
|
93
|
+
return await new Promise((u) => {
|
|
94
|
+
let f = 0;
|
|
95
|
+
const v = setInterval(async () => {
|
|
96
|
+
if (e.signal.aborted || (f = Math.min(o, f + k), d(y(!0, f, o)), f < o))
|
|
88
97
|
return;
|
|
89
|
-
d(
|
|
90
|
-
let
|
|
91
|
-
|
|
98
|
+
d(y(!0, o, o)), clearInterval(v);
|
|
99
|
+
let D;
|
|
100
|
+
m ? D = await m(t, { abortController: e, onprogress: d, onabort }) : (await p(0), D = new File(["#".repeat(o)], c.split("/").pop(), {
|
|
92
101
|
type: "plain/text"
|
|
93
|
-
})),
|
|
94
|
-
file:
|
|
102
|
+
})), g(t, {
|
|
103
|
+
file: D,
|
|
95
104
|
state: {
|
|
96
105
|
load: !1
|
|
97
106
|
},
|
|
98
107
|
extension: {
|
|
99
|
-
[
|
|
108
|
+
[L]: {
|
|
100
109
|
status: {
|
|
101
110
|
type: s.Success,
|
|
102
111
|
code: "LOAD_COMPLETE"
|
|
103
112
|
}
|
|
104
113
|
}
|
|
105
114
|
}
|
|
106
|
-
}),
|
|
115
|
+
}), a && l(["did load data", t.id]), u();
|
|
107
116
|
}, b);
|
|
108
117
|
e.signal.onabort = () => {
|
|
109
|
-
clearInterval(
|
|
118
|
+
clearInterval(v), a && l(["did abort load data", t.id]), g(t, {
|
|
110
119
|
state: {
|
|
111
|
-
[
|
|
112
|
-
[
|
|
120
|
+
[i]: !1,
|
|
121
|
+
[r]: !1
|
|
113
122
|
}
|
|
114
123
|
}), queueMicrotask(() => {
|
|
115
124
|
O(t);
|
|
@@ -117,40 +126,40 @@ const V = Y(
|
|
|
117
126
|
};
|
|
118
127
|
});
|
|
119
128
|
}
|
|
120
|
-
function
|
|
121
|
-
const e =
|
|
122
|
-
if (e?.type === "error" ||
|
|
129
|
+
function B(t) {
|
|
130
|
+
const e = U(t), c = Object.keys(e).length > 0;
|
|
131
|
+
if (e?.type === "error" || Q(t.file))
|
|
123
132
|
return;
|
|
124
|
-
const { src: a, name: i, size:
|
|
125
|
-
if (!
|
|
133
|
+
const { src: a, name: i, size: r } = t, { actionLoad: b, actionAbort: w, parallel: m } = E, S = t.state[b], d = t.state[w];
|
|
134
|
+
if (!F(a))
|
|
126
135
|
return;
|
|
127
|
-
if (
|
|
128
|
-
|
|
136
|
+
if (d) {
|
|
137
|
+
x(t.id), O(t);
|
|
129
138
|
return;
|
|
130
139
|
}
|
|
131
|
-
if (
|
|
140
|
+
if (S === !1)
|
|
132
141
|
return;
|
|
133
|
-
if (!(
|
|
134
|
-
h(t.id,
|
|
142
|
+
if (!(F(i) && Y(r))) {
|
|
143
|
+
h(t.id, P);
|
|
135
144
|
return;
|
|
136
145
|
}
|
|
137
|
-
if (!
|
|
138
|
-
h(t.id,
|
|
146
|
+
if (!c) {
|
|
147
|
+
h(t.id, _);
|
|
139
148
|
return;
|
|
140
149
|
}
|
|
141
|
-
h(t.id,
|
|
150
|
+
h(t.id, z, { parallel: m });
|
|
142
151
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
152
|
+
function l(t) {
|
|
153
|
+
q("⧗", L, "(", ...t, ")");
|
|
145
154
|
}
|
|
146
|
-
const
|
|
155
|
+
const M = R("updateEntry", B);
|
|
147
156
|
return {
|
|
148
157
|
destroy: () => {
|
|
149
|
-
|
|
158
|
+
M();
|
|
150
159
|
}
|
|
151
160
|
};
|
|
152
161
|
}
|
|
153
162
|
);
|
|
154
163
|
export {
|
|
155
|
-
|
|
164
|
+
W as SimulatedLoader
|
|
156
165
|
};
|