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
|
@@ -1,42 +1,41 @@
|
|
|
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 { createExtension as
|
|
8
|
-
import { isFileEntry as V, isBlobOrFile as
|
|
7
|
+
import { createExtension as w } from "./createExtension.js";
|
|
8
|
+
import { isFileEntry as V, isBlobOrFile as F, isFile as b } from "../../utils/test.js";
|
|
9
9
|
import { Status as n } from "../../common/status.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
pushTask: r,
|
|
10
|
+
import { upperCaseFirstLetter as M } from "../../utils/string.js";
|
|
11
|
+
function j(I, y, A) {
|
|
12
|
+
return w(I, y, (u, d) => {
|
|
13
|
+
const { didSetProps: h, props: c } = u, {
|
|
14
|
+
setExtensionStatus: U,
|
|
15
|
+
getEntries: L,
|
|
16
|
+
on: f,
|
|
17
|
+
pushTask: o,
|
|
19
18
|
abortTask: D,
|
|
20
|
-
setEntryExtensionStatus:
|
|
21
|
-
getEntryExtensionStatus:
|
|
19
|
+
setEntryExtensionStatus: i,
|
|
20
|
+
getEntryExtensionStatus: g,
|
|
22
21
|
setEntryExtensionState: l,
|
|
23
|
-
getEntryExtensionState:
|
|
24
|
-
} =
|
|
22
|
+
getEntryExtensionState: r
|
|
23
|
+
} = d, {
|
|
25
24
|
// by default can only validate a blob/file
|
|
26
|
-
canValidateEntry:
|
|
25
|
+
canValidateEntry: O = (t) => V(t) && F(t.file),
|
|
27
26
|
// by default all validate entry returns "all is well" state
|
|
28
27
|
validateEntry: S = () => null
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
} = A(u, d);
|
|
29
|
+
h(() => {
|
|
30
|
+
T();
|
|
32
31
|
});
|
|
33
|
-
function
|
|
34
|
-
for (const t of
|
|
35
|
-
|
|
32
|
+
function T() {
|
|
33
|
+
for (const t of L())
|
|
34
|
+
E(t);
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
const { canValidate:
|
|
39
|
-
|
|
36
|
+
function E(t) {
|
|
37
|
+
const { canValidate: a } = r(t);
|
|
38
|
+
a !== null && l(t, {
|
|
40
39
|
// null means it's undetermined if we can validate, need to retest
|
|
41
40
|
canValidate: null,
|
|
42
41
|
// null means it's undetermined if we should validate, need to retest
|
|
@@ -50,47 +49,47 @@ function H(y, A, L) {
|
|
|
50
49
|
}
|
|
51
50
|
});
|
|
52
51
|
}
|
|
53
|
-
async function
|
|
54
|
-
|
|
52
|
+
async function m(t) {
|
|
53
|
+
i(t, {
|
|
55
54
|
type: n.System,
|
|
56
55
|
code: "VALIDATION_BUSY",
|
|
57
56
|
progress: 1 / 0
|
|
58
57
|
});
|
|
59
|
-
let
|
|
58
|
+
let a;
|
|
60
59
|
try {
|
|
61
|
-
|
|
60
|
+
a = await S(t);
|
|
62
61
|
} catch (s) {
|
|
63
|
-
throw
|
|
62
|
+
throw i(t, {
|
|
64
63
|
type: n.Error,
|
|
65
64
|
code: "VALIDATION_ERROR",
|
|
66
65
|
values: { error: s }
|
|
67
66
|
}), s;
|
|
68
67
|
}
|
|
69
|
-
let
|
|
70
|
-
if (V(t) &&
|
|
68
|
+
let e = "unknown";
|
|
69
|
+
if (V(t) && b(t.file) && (e = `fileMainType${M(t.file.type.split("/").shift() ?? "")}`), i(
|
|
71
70
|
t,
|
|
72
|
-
|
|
71
|
+
a ? {
|
|
73
72
|
type: n.Error,
|
|
74
73
|
code: "VALIDATION_INVALID",
|
|
75
|
-
subcode:
|
|
74
|
+
subcode: a.code,
|
|
76
75
|
values: {
|
|
77
|
-
...
|
|
78
|
-
fileMainType:
|
|
76
|
+
...a.values,
|
|
77
|
+
fileMainType: e
|
|
79
78
|
}
|
|
80
79
|
} : {
|
|
81
80
|
type: n.System,
|
|
82
81
|
code: "VALIDATION_COMPLETE"
|
|
83
82
|
}
|
|
84
|
-
),
|
|
83
|
+
), a)
|
|
85
84
|
return !1;
|
|
86
85
|
}
|
|
87
|
-
async function
|
|
88
|
-
const { shouldValidate:
|
|
89
|
-
if (!
|
|
86
|
+
async function N(t) {
|
|
87
|
+
const { shouldValidate: a } = c;
|
|
88
|
+
if (!a)
|
|
90
89
|
return;
|
|
91
|
-
const
|
|
90
|
+
const e = await a(t);
|
|
92
91
|
l(t, {
|
|
93
|
-
shouldValidate:
|
|
92
|
+
shouldValidate: e,
|
|
94
93
|
// have determined if we should validate, switch to idle
|
|
95
94
|
status: {
|
|
96
95
|
type: n.System,
|
|
@@ -98,19 +97,19 @@ function H(y, A, L) {
|
|
|
98
97
|
}
|
|
99
98
|
});
|
|
100
99
|
}
|
|
101
|
-
async function
|
|
102
|
-
let
|
|
100
|
+
async function p(t) {
|
|
101
|
+
let a;
|
|
103
102
|
try {
|
|
104
|
-
|
|
105
|
-
} catch (
|
|
106
|
-
throw
|
|
103
|
+
a = await O(t);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
throw i(t, {
|
|
107
106
|
type: n.Error,
|
|
108
107
|
code: "VALIDATION_ERROR",
|
|
109
|
-
values: { error:
|
|
110
|
-
}),
|
|
108
|
+
values: { error: e }
|
|
109
|
+
}), e;
|
|
111
110
|
}
|
|
112
111
|
l(t, {
|
|
113
|
-
canValidate:
|
|
112
|
+
canValidate: a,
|
|
114
113
|
// have determined if we can validate, switch to idle
|
|
115
114
|
status: {
|
|
116
115
|
type: n.System,
|
|
@@ -118,49 +117,32 @@ function H(y, A, L) {
|
|
|
118
117
|
}
|
|
119
118
|
});
|
|
120
119
|
}
|
|
121
|
-
function
|
|
122
|
-
const { canValidate:
|
|
123
|
-
|
|
120
|
+
function _(t) {
|
|
121
|
+
const { canValidate: a } = r(t);
|
|
122
|
+
a !== null && (D(t.id, p), E(t));
|
|
124
123
|
}
|
|
125
|
-
function
|
|
126
|
-
const { canValidate:
|
|
127
|
-
if (!(s?.type === "error" ||
|
|
128
|
-
if (
|
|
129
|
-
|
|
124
|
+
function x(t) {
|
|
125
|
+
const { canValidate: a, shouldValidate: e, status: s } = r(t), k = s?.code === "VALIDATION_COMPLETE";
|
|
126
|
+
if (!(s?.type === "error" || k || a === !1 || e === !1)) {
|
|
127
|
+
if (a === null) {
|
|
128
|
+
o(t.id, p);
|
|
130
129
|
return;
|
|
131
130
|
}
|
|
132
|
-
if (
|
|
133
|
-
|
|
131
|
+
if (c.shouldValidate && e === null) {
|
|
132
|
+
o(t.id, N);
|
|
134
133
|
return;
|
|
135
134
|
}
|
|
136
|
-
|
|
135
|
+
a === !0 && o(t.id, m);
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
|
-
|
|
140
|
-
for (const e of t) {
|
|
141
|
-
const a = O(e);
|
|
142
|
-
if (a.type === n.Error) {
|
|
143
|
-
f({
|
|
144
|
-
type: n.Error,
|
|
145
|
-
code: "VALIDATION_INVALID_ENTRIES",
|
|
146
|
-
meta: a.meta
|
|
147
|
-
});
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
f({
|
|
152
|
-
type: n.System,
|
|
153
|
-
code: "VALIDATION_COMPLETE"
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const U = i("updateEntryData", R), k = i("updateEntry", b), w = i("updateEntries", P(v));
|
|
138
|
+
const v = f("updateEntryData", _), R = f("updateEntry", x);
|
|
157
139
|
return {
|
|
158
140
|
destroy() {
|
|
159
|
-
|
|
141
|
+
R(), v();
|
|
160
142
|
}
|
|
161
143
|
};
|
|
162
144
|
});
|
|
163
145
|
}
|
|
164
146
|
export {
|
|
165
|
-
|
|
147
|
+
j as createValidatorExtension
|
|
166
148
|
};
|
|
@@ -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
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import { blobToFile as S } from "../utils/file.js";
|
|
8
8
|
import { getImageSize as k } from "../utils/media.js";
|
|
9
9
|
import { rectApply as q, rectFromSize as A } from "../utils/rect.js";
|
|
10
|
-
import {
|
|
11
|
-
import { isFileEntry as
|
|
12
|
-
import { thread as
|
|
13
|
-
import { createTransformExtension as
|
|
14
|
-
import { transformImage as
|
|
15
|
-
const
|
|
10
|
+
import { sizeIsEmpty as H, sizeFromRect as W } from "../utils/size.js";
|
|
11
|
+
import { isFileEntry as C, isImageFile as L } from "../utils/test.js";
|
|
12
|
+
import { thread as O, createThreadWorker as U } from "../utils/thread.js";
|
|
13
|
+
import { createTransformExtension as Q } from "./common/createTransformExtension.js";
|
|
14
|
+
import { transformImage as j } from "../workers/transformImage.js";
|
|
15
|
+
const Z = Q(
|
|
16
16
|
"ImageBitmapTransform",
|
|
17
17
|
{
|
|
18
18
|
actionTransform: "transformImage",
|
|
@@ -28,29 +28,29 @@ const Y = U(
|
|
|
28
28
|
shouldTransform: () => !0
|
|
29
29
|
},
|
|
30
30
|
({ props: v, extensionName: b }) => {
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function z(o) {
|
|
32
|
+
return C(o) && L(o.file) && !/svg/.test(o.file.type);
|
|
33
33
|
}
|
|
34
|
-
async function
|
|
34
|
+
async function F(o, { abortController: T }) {
|
|
35
35
|
const {
|
|
36
|
-
aspectRatio:
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
39
|
-
upscale:
|
|
40
|
-
fit:
|
|
41
|
-
quality:
|
|
42
|
-
compression:
|
|
36
|
+
aspectRatio: c,
|
|
37
|
+
width: f,
|
|
38
|
+
height: l,
|
|
39
|
+
upscale: I,
|
|
40
|
+
fit: d,
|
|
41
|
+
quality: R,
|
|
42
|
+
compression: x,
|
|
43
43
|
type: E,
|
|
44
44
|
workersURL: B
|
|
45
|
-
} = v, { file: n } = o, M = [...o.extension[b].history ?? []],
|
|
46
|
-
if (
|
|
45
|
+
} = v, { file: n } = o, M = [...o.extension[b].history ?? []], h = await k(n);
|
|
46
|
+
if (h === null || H(h))
|
|
47
47
|
throw "Failed to read image size";
|
|
48
|
-
const e = q(A(
|
|
49
|
-
let t =
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
let i =
|
|
53
|
-
if (r ? i || (i = r * a) : r = i / a, t.width = i, t.height = r,
|
|
48
|
+
const e = q(A(h, c), Math.round);
|
|
49
|
+
let t = W(e);
|
|
50
|
+
if (f || l) {
|
|
51
|
+
const m = e.width / e.height, a = c || m;
|
|
52
|
+
let i = f, r = l;
|
|
53
|
+
if (r ? i || (i = r * a) : r = i / a, t.width = i, t.height = r, d === "contain" ? i > r ? t.width = r * a : t.height = i / a : d === "cover" && (i > r ? t.height = i / a : t.width = r * a), !I && (t.width > e.width || t.height > e.height)) {
|
|
54
54
|
const y = Math.min(
|
|
55
55
|
e.width / t.width,
|
|
56
56
|
e.height / t.height
|
|
@@ -60,15 +60,15 @@ const Y = U(
|
|
|
60
60
|
}
|
|
61
61
|
let s;
|
|
62
62
|
try {
|
|
63
|
-
s = await
|
|
64
|
-
|
|
63
|
+
s = await O(
|
|
64
|
+
U(B, j),
|
|
65
65
|
[
|
|
66
66
|
n,
|
|
67
67
|
e,
|
|
68
68
|
{
|
|
69
69
|
resizeWidth: Math.round(t.width),
|
|
70
70
|
resizeHeight: Math.round(t.height),
|
|
71
|
-
resizeQuality:
|
|
71
|
+
resizeQuality: R,
|
|
72
72
|
imageOrientation: "from-image"
|
|
73
73
|
}
|
|
74
74
|
],
|
|
@@ -87,7 +87,7 @@ const Y = U(
|
|
|
87
87
|
try {
|
|
88
88
|
u = await p.convertToBlob({
|
|
89
89
|
type: E || n.type,
|
|
90
|
-
quality:
|
|
90
|
+
quality: x
|
|
91
91
|
});
|
|
92
92
|
} catch {
|
|
93
93
|
throw "Failed to convert canvas to blob";
|
|
@@ -99,11 +99,11 @@ const Y = U(
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
return {
|
|
102
|
-
canTransformEntry:
|
|
103
|
-
transformEntry:
|
|
102
|
+
canTransformEntry: z,
|
|
103
|
+
transformEntry: F
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
export {
|
|
108
|
-
|
|
108
|
+
Z as ImageBitmapTransform
|
|
109
109
|
};
|
package/esm/extensions/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
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 { createStoreExtension as
|
|
8
|
-
import { isFileEntry as
|
|
9
|
-
import { getUniqueId as
|
|
10
|
-
import { createProgressEvent as
|
|
11
|
-
import { log as
|
|
12
|
-
import { sleep as
|
|
13
|
-
|
|
7
|
+
import { createStoreExtension as k } from "./common/createStoreExtension.js";
|
|
8
|
+
import { isFileEntry as P, isFile as U } from "../utils/test.js";
|
|
9
|
+
import { getUniqueId as z } from "../utils/string.js";
|
|
10
|
+
import { createProgressEvent as I } from "../utils/xhr.js";
|
|
11
|
+
import { log as h } from "../common/console.js";
|
|
12
|
+
import { sleep as g } from "../utils/sleep.js";
|
|
13
|
+
import { noop as y } from "../utils/placeholder.js";
|
|
14
|
+
const H = k(
|
|
14
15
|
"SimulatedStore",
|
|
15
16
|
{
|
|
16
17
|
bitrate: 1024e3,
|
|
@@ -19,57 +20,79 @@ const T = b(
|
|
|
19
20
|
fetchStoredFile: void 0,
|
|
20
21
|
log: !0
|
|
21
22
|
},
|
|
22
|
-
({ extensionName:
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
({ extensionName: S, props: d, didSetProps: w }) => {
|
|
24
|
+
let p;
|
|
25
|
+
w(({ bitrate: e = 1024e3, tickrate: t = 250 }) => {
|
|
26
|
+
p = e / 8 * (t / 1e3);
|
|
26
27
|
});
|
|
27
|
-
const
|
|
28
|
-
async function
|
|
29
|
-
if (!
|
|
28
|
+
const a = /* @__PURE__ */ new Map();
|
|
29
|
+
async function v(e, { abortController: t, onprogress: n, onabort: o }) {
|
|
30
|
+
if (!P(e) || !U(e.file))
|
|
30
31
|
return;
|
|
31
32
|
let r;
|
|
32
33
|
t.signal.onabort = () => {
|
|
33
34
|
clearInterval(r), o();
|
|
34
35
|
};
|
|
35
|
-
const { log: s, connectionDelay:
|
|
36
|
-
if (await
|
|
36
|
+
const { log: s, connectionDelay: f, tickrate: m, onstore: b = y } = d;
|
|
37
|
+
if (await g(f), t.signal.aborted)
|
|
37
38
|
return;
|
|
38
|
-
const
|
|
39
|
-
return await new Promise((
|
|
40
|
-
let
|
|
39
|
+
const u = e.size;
|
|
40
|
+
return await new Promise((x, D) => {
|
|
41
|
+
let l = 0;
|
|
41
42
|
r = setInterval(() => {
|
|
42
|
-
if (!t.signal.aborted
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if (!t.signal.aborted) {
|
|
44
|
+
l = Math.min(u, l + p);
|
|
45
|
+
try {
|
|
46
|
+
b(l / u);
|
|
47
|
+
} catch (c) {
|
|
48
|
+
s && i(["error during store operation"]), clearInterval(r), D(c);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (n(I(!0, l, u)), l === u) {
|
|
52
|
+
const c = z();
|
|
53
|
+
a.set(c, e), s && i(["did store", c]), clearInterval(r), x(c);
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
|
-
},
|
|
56
|
+
}, m);
|
|
47
57
|
});
|
|
48
58
|
}
|
|
49
|
-
async function
|
|
59
|
+
async function E(e, t, n) {
|
|
50
60
|
const {
|
|
51
61
|
log: o,
|
|
52
62
|
connectionDelay: r,
|
|
53
|
-
fetchStoredFile: s = () => new File(["Simulated"], "Untitled.txt", { type: "plain/text" })
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
fetchStoredFile: s = () => new File(["Simulated"], "Untitled.txt", { type: "plain/text" }),
|
|
64
|
+
onrestore: f = y
|
|
65
|
+
} = d;
|
|
66
|
+
await g(r);
|
|
67
|
+
try {
|
|
68
|
+
f();
|
|
69
|
+
} catch (m) {
|
|
70
|
+
throw o && i(["error during restore operation"]), m;
|
|
71
|
+
}
|
|
72
|
+
return a.has(e) ? (o && i(["did restore", e]), a.get(e)) : await s(e, t, n);
|
|
56
73
|
}
|
|
57
|
-
async function
|
|
58
|
-
const { log: t, connectionDelay:
|
|
59
|
-
|
|
74
|
+
async function F(e) {
|
|
75
|
+
const { log: t, connectionDelay: n, onrelease: o = y } = d;
|
|
76
|
+
await g(n);
|
|
77
|
+
try {
|
|
78
|
+
o();
|
|
79
|
+
} catch (r) {
|
|
80
|
+
throw t && i(["error during release operation"]), r;
|
|
81
|
+
}
|
|
82
|
+
return a.delete(e), t && i(["did release", e]), !0;
|
|
60
83
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
84
|
+
function i(e) {
|
|
85
|
+
h("⛃", S, "(", ...e, ")"), Array.from(a).forEach(([t, n], o, r) => {
|
|
86
|
+
h(" ", o < r.length - 1 ? "├─" : "└─", t, n);
|
|
64
87
|
});
|
|
65
88
|
}
|
|
66
89
|
return {
|
|
67
|
-
storeEntry:
|
|
68
|
-
restoreEntry:
|
|
69
|
-
releaseEntry:
|
|
90
|
+
storeEntry: v,
|
|
91
|
+
restoreEntry: E,
|
|
92
|
+
releaseEntry: F
|
|
70
93
|
};
|
|
71
94
|
}
|
|
72
95
|
);
|
|
73
96
|
export {
|
|
74
|
-
|
|
97
|
+
H as SimulatedStore
|
|
75
98
|
};
|