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.
Files changed (252) hide show
  1. package/cdn/assets/index.js +1 -1
  2. package/cdn/locales/ar-ar.js +1 -1
  3. package/cdn/locales/bn-bd.js +1 -1
  4. package/cdn/locales/cs-cz.js +1 -1
  5. package/cdn/locales/da-dk.js +1 -1
  6. package/cdn/locales/de-de.js +1 -1
  7. package/cdn/locales/el-gr.js +1 -1
  8. package/cdn/locales/en-gb.js +1 -1
  9. package/cdn/locales/es-es.js +1 -1
  10. package/cdn/locales/fi-fi.js +1 -1
  11. package/cdn/locales/fr-fr.js +1 -1
  12. package/cdn/locales/hi-in.js +1 -1
  13. package/cdn/locales/hu-hu.js +1 -1
  14. package/cdn/locales/index.js +1 -1
  15. package/cdn/locales/is-is.js +1 -1
  16. package/cdn/locales/it-it.js +1 -1
  17. package/cdn/locales/ja-jp.js +1 -1
  18. package/cdn/locales/ko-kr.js +1 -1
  19. package/cdn/locales/nb-no.js +1 -1
  20. package/cdn/locales/nl-nl.js +1 -1
  21. package/cdn/locales/pl-pl.js +1 -1
  22. package/cdn/locales/pt-pt.js +1 -1
  23. package/cdn/locales/sv-se.js +1 -1
  24. package/cdn/locales/tr-tr.js +1 -1
  25. package/cdn/locales/uk-ua.js +1 -1
  26. package/cdn/locales/vi-vn.js +1 -1
  27. package/cdn/locales/zh-cn.js +1 -1
  28. package/cdn/main.js +2 -2
  29. package/cdn/workers/httpRequest.js +45 -0
  30. package/cdn/workers/httpRequestWorker.js +37 -0
  31. package/cdn/workers/readFile.js +14 -0
  32. package/cdn/workers/readFileWorker.js +6 -0
  33. package/cdn/workers/transformImage.js +16 -0
  34. package/cdn/workers/transformImageWorker.js +8 -0
  35. package/esm/assets/index.js +1 -1
  36. package/esm/common/console.js +1 -1
  37. package/esm/common/entry.js +1 -1
  38. package/esm/common/perceivedPerformanceProxy.js +1 -1
  39. package/esm/common/readEntriesFromDataTransfer.js +1 -1
  40. package/esm/common/ssr.js +1 -1
  41. package/esm/common/status.js +1 -1
  42. package/esm/core/entryTree.js +1 -1
  43. package/esm/core/extensionManager.js +28 -28
  44. package/esm/core/taskScheduler.js +78 -97
  45. package/esm/dev/index.js +1 -1
  46. package/esm/elements/FilePondDefault/index.css.js +1 -1
  47. package/esm/elements/FilePondDefault/index.js +46 -45
  48. package/esm/elements/FilePondDropArea/index.css.js +1 -1
  49. package/esm/elements/FilePondDropArea/index.js +1 -1
  50. package/esm/elements/FilePondDropArea/index.svelte.js +1 -1
  51. package/esm/elements/FilePondDropIndicator/index.css.js +1 -1
  52. package/esm/elements/FilePondDropIndicator/index.js +1 -1
  53. package/esm/elements/FilePondDropIndicator/index.svelte.js +1 -1
  54. package/esm/elements/FilePondEntryList/components/Entry/index.css.js +1 -1
  55. package/esm/elements/FilePondEntryList/components/Entry/index.js +1 -1
  56. package/esm/elements/FilePondEntryList/components/Entry/index.svelte.js +1 -1
  57. package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.css.js +1 -1
  58. package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.js +1 -1
  59. package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.svelte.js +80 -80
  60. package/esm/elements/FilePondEntryList/components/EntryList/index.css.js +1 -1
  61. package/esm/elements/FilePondEntryList/components/EntryList/index.js +1 -1
  62. package/esm/elements/FilePondEntryList/components/EntryList/index.svelte.js +1 -1
  63. package/esm/elements/FilePondEntryList/components/EntryListItem/index.css.js +1 -1
  64. package/esm/elements/FilePondEntryList/components/EntryListItem/index.js +1 -1
  65. package/esm/elements/FilePondEntryList/components/EntryListItem/index.svelte.js +1 -1
  66. package/esm/elements/FilePondEntryList/components/EntryListItemPlaceholder/index.svelte.js +1 -1
  67. package/esm/elements/FilePondEntryList/components/EntryStatus/index.css.js +1 -1
  68. package/esm/elements/FilePondEntryList/components/EntryStatus/index.js +1 -1
  69. package/esm/elements/FilePondEntryList/components/EntryStatus/index.svelte.js +1 -1
  70. package/esm/elements/FilePondEntryList/components/MediaImage/components/BitmapRenderer.svelte.js +65 -60
  71. package/esm/elements/FilePondEntryList/components/MediaImage/components/BitmapRendererCache.js +1 -1
  72. package/esm/elements/FilePondEntryList/components/MediaImage/index.css.js +1 -1
  73. package/esm/elements/FilePondEntryList/components/MediaImage/index.js +2 -1
  74. package/esm/elements/FilePondEntryList/components/MediaImage/index.svelte.js +70 -70
  75. package/esm/elements/FilePondEntryList/components/MediaPane/index.css.js +2 -2
  76. package/esm/elements/FilePondEntryList/components/MediaPane/index.js +1 -1
  77. package/esm/elements/FilePondEntryList/components/MediaPane/index.svelte.js +1 -1
  78. package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.css.js +1 -1
  79. package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.js +1 -1
  80. package/esm/elements/FilePondEntryList/components/MediaTimeIndicator/index.svelte.js +1 -1
  81. package/esm/elements/FilePondEntryList/components/MediaVideo/index.css.js +1 -1
  82. package/esm/elements/FilePondEntryList/components/MediaVideo/index.js +1 -1
  83. package/esm/elements/FilePondEntryList/components/MediaVideo/index.svelte.js +1 -1
  84. package/esm/elements/FilePondEntryList/contexts/appContext.js +1 -1
  85. package/esm/elements/FilePondEntryList/contexts/dragContext.js +1 -1
  86. package/esm/elements/FilePondEntryList/contexts/dropContext.js +1 -1
  87. package/esm/elements/FilePondEntryList/contexts/entryContext.js +1 -1
  88. package/esm/elements/FilePondEntryList/contexts/springElementTreeContext.js +1 -1
  89. package/esm/elements/FilePondEntryList/index.css.js +1 -1
  90. package/esm/elements/FilePondEntryList/index.js +2 -1
  91. package/esm/elements/FilePondEntryList/index.svelte.js +166 -166
  92. package/esm/elements/FilePondInput/index.css.js +1 -1
  93. package/esm/elements/FilePondInput/index.js +15 -11
  94. package/esm/elements/FilePondSvelteComponent/index.svelte.js +1 -1
  95. package/esm/elements/attachments/dragarea.js +1 -1
  96. package/esm/elements/attachments/droparea.js +1 -1
  97. package/esm/elements/attachments/measurable.js +1 -1
  98. package/esm/elements/attachments/resizable.js +1 -1
  99. package/esm/elements/attachments/transitions.js +1 -1
  100. package/esm/elements/common/animationGuard.js +1 -1
  101. package/esm/elements/common/animationPreference.svelte.js +1 -1
  102. package/esm/elements/common/dragDrop.js +1 -1
  103. package/esm/elements/common/event.js +1 -1
  104. package/esm/elements/common/extendStyles.js +1 -1
  105. package/esm/elements/common/getClosestElement.js +1 -1
  106. package/esm/elements/common/html.js +1 -1
  107. package/esm/elements/common/nodeTree.js +9 -9
  108. package/esm/elements/common/store.svelte.js +1 -1
  109. package/esm/elements/common/string.js +1 -1
  110. package/esm/elements/common/transition.js +1 -1
  111. package/esm/elements/components/BooleanInput/index.css.js +1 -1
  112. package/esm/elements/components/BooleanInput/index.js +1 -1
  113. package/esm/elements/components/BooleanInput/index.svelte.js +1 -1
  114. package/esm/elements/components/Button/index.css.js +1 -1
  115. package/esm/elements/components/Button/index.js +1 -1
  116. package/esm/elements/components/Button/index.svelte.js +1 -1
  117. package/esm/elements/components/ElementPane/index.css.js +1 -1
  118. package/esm/elements/components/ElementPane/index.js +1 -1
  119. package/esm/elements/components/ElementPane/index.svelte.js +1 -1
  120. package/esm/elements/components/ElementSkeleton/index.css.js +1 -1
  121. package/esm/elements/components/ElementSkeleton/index.js +1 -1
  122. package/esm/elements/components/ElementSkeleton/index.svelte.js +1 -1
  123. package/esm/elements/components/FilenameInput/index.css.js +1 -1
  124. package/esm/elements/components/FilenameInput/index.js +1 -1
  125. package/esm/elements/components/FilenameInput/index.svelte.js +1 -1
  126. package/esm/elements/components/NodeList/index.svelte.js +1 -1
  127. package/esm/elements/components/ProgressIndicator/index.css.js +2 -2
  128. package/esm/elements/components/ProgressIndicator/index.js +1 -1
  129. package/esm/elements/components/ProgressIndicator/index.svelte.js +70 -70
  130. package/esm/elements/components/RangeInput/index.css.js +1 -1
  131. package/esm/elements/components/RangeInput/index.js +1 -1
  132. package/esm/elements/components/RangeInput/index.svelte.js +1 -1
  133. package/esm/elements/components/SpringElement/index.svelte.js +1 -1
  134. package/esm/elements/components/TextInput/index.css.js +1 -1
  135. package/esm/elements/components/TextInput/index.js +1 -1
  136. package/esm/elements/components/TextInput/index.svelte.js +1 -1
  137. package/esm/extensions/blob-loader.js +1 -1
  138. package/esm/extensions/canvas-loader.js +1 -1
  139. package/esm/extensions/chunked-upload-store.js +1 -1
  140. package/esm/extensions/clipboard-source.js +1 -1
  141. package/esm/extensions/common/createExtension.js +1 -1
  142. package/esm/extensions/common/createStoreExtension.js +1 -1
  143. package/esm/extensions/common/createTransformExtension.js +1 -1
  144. package/esm/extensions/common/createValidatorExtension.js +1 -1
  145. package/esm/extensions/console-view.js +1 -1
  146. package/esm/extensions/data-transfer-loader.js +1 -1
  147. package/esm/extensions/data-url-store.js +24 -19
  148. package/esm/extensions/drag-drop-source.js +1 -1
  149. package/esm/extensions/dropbox-source.js +1 -1
  150. package/esm/extensions/entry-list-view.js +1 -1
  151. package/esm/extensions/file-extension-validator.js +1 -1
  152. package/esm/extensions/file-input-source.js +1 -1
  153. package/esm/extensions/file-input-store.js +1 -1
  154. package/esm/extensions/file-mime-type-validator.js +1 -1
  155. package/esm/extensions/file-name-transform.js +1 -1
  156. package/esm/extensions/file-name-validator.js +1 -1
  157. package/esm/extensions/file-size-validator.js +1 -1
  158. package/esm/extensions/form-post-store.js +1 -1
  159. package/esm/extensions/image-bitmap-transform.js +56 -54
  160. package/esm/extensions/index.js +1 -1
  161. package/esm/extensions/list-count-validator.js +1 -1
  162. package/esm/extensions/list-size-validator.js +1 -1
  163. package/esm/extensions/media-resolution-validator.js +1 -1
  164. package/esm/extensions/object-url-store.js +1 -1
  165. package/esm/extensions/simulated-loader.js +74 -65
  166. package/esm/extensions/simulated-store.js +1 -1
  167. package/esm/extensions/text-input-store.js +1 -1
  168. package/esm/extensions/url-loader.js +74 -71
  169. package/esm/extensions/value-callback-store.js +1 -1
  170. package/esm/index.js +1 -1
  171. package/esm/locales/ar-ar.js +1 -1
  172. package/esm/locales/bn-bd.js +1 -1
  173. package/esm/locales/cs-cz.js +1 -1
  174. package/esm/locales/da-dk.js +1 -1
  175. package/esm/locales/de-de.js +1 -1
  176. package/esm/locales/el-gr.js +1 -1
  177. package/esm/locales/en-gb.js +1 -1
  178. package/esm/locales/es-es.js +1 -1
  179. package/esm/locales/fi-fi.js +1 -1
  180. package/esm/locales/fr-fr.js +1 -1
  181. package/esm/locales/hi-in.js +1 -1
  182. package/esm/locales/hu-hu.js +1 -1
  183. package/esm/locales/index.js +1 -1
  184. package/esm/locales/is-is.js +1 -1
  185. package/esm/locales/it-it.js +1 -1
  186. package/esm/locales/ja-jp.js +1 -1
  187. package/esm/locales/ko-kr.js +1 -1
  188. package/esm/locales/nb-no.js +1 -1
  189. package/esm/locales/nl-nl.js +1 -1
  190. package/esm/locales/pl-pl.js +1 -1
  191. package/esm/locales/pt-pt.js +1 -1
  192. package/esm/locales/sv-se.js +1 -1
  193. package/esm/locales/tr-tr.js +1 -1
  194. package/esm/locales/uk-ua.js +1 -1
  195. package/esm/locales/vi-vn.js +1 -1
  196. package/esm/locales/zh-cn.js +1 -1
  197. package/esm/templates/entry.js +2 -2
  198. package/esm/templates/helpers.js +1 -1
  199. package/esm/templates/index.js +1 -1
  200. package/esm/templates/media.js +119 -111
  201. package/esm/utils/array.js +1 -1
  202. package/esm/utils/bounds.js +1 -1
  203. package/esm/utils/cache.js +1 -1
  204. package/esm/utils/canvasToBlob.js +1 -1
  205. package/esm/utils/date.js +1 -1
  206. package/esm/utils/debounce.js +1 -1
  207. package/esm/utils/dom.js +1 -1
  208. package/esm/utils/file.js +1 -1
  209. package/esm/utils/functionToBlob.js +1 -1
  210. package/esm/utils/keyboard.js +1 -1
  211. package/esm/utils/math.js +1 -1
  212. package/esm/utils/media.js +1 -1
  213. package/esm/utils/number.js +1 -1
  214. package/esm/utils/object.js +1 -1
  215. package/esm/utils/objectURL.js +1 -1
  216. package/esm/utils/placeholder.js +1 -1
  217. package/esm/utils/poly.js +1 -1
  218. package/esm/utils/pubsub.js +1 -1
  219. package/esm/utils/rect.js +1 -1
  220. package/esm/utils/size.js +1 -1
  221. package/esm/utils/sleep.js +1 -1
  222. package/esm/utils/string.js +1 -1
  223. package/esm/utils/support.js +1 -1
  224. package/esm/utils/test.js +1 -1
  225. package/esm/utils/thread.js +47 -42
  226. package/esm/utils/tree.js +1 -1
  227. package/esm/utils/url.js +1 -1
  228. package/esm/utils/vector.js +1 -1
  229. package/esm/utils/window.js +1 -1
  230. package/esm/utils/xhr.js +88 -113
  231. package/esm/workers/httpRequest.js +45 -0
  232. package/esm/workers/httpRequestWorker.js +37 -0
  233. package/esm/workers/readFile.js +14 -0
  234. package/esm/workers/readFileWorker.js +6 -0
  235. package/esm/workers/transformImage.js +16 -0
  236. package/esm/workers/transformImageWorker.js +8 -0
  237. package/package.json +5 -1
  238. package/types/core/taskScheduler.d.ts +2 -2
  239. package/types/elements/FilePondDefault/index.d.ts +2 -0
  240. package/types/elements/FilePondInput/index.d.ts +2 -0
  241. package/types/elements/common/nodeTree.d.ts +1 -1
  242. package/types/extensions/data-url-store.d.ts +2 -0
  243. package/types/extensions/image-bitmap-transform.d.ts +2 -0
  244. package/types/extensions/simulated-loader.d.ts +2 -0
  245. package/types/extensions/url-loader.d.ts +2 -0
  246. package/types/templates/media.d.ts +14 -0
  247. package/types/types/index.d.ts +5 -11
  248. package/types/utils/thread.d.ts +6 -0
  249. package/types/utils/xhr.d.ts +1 -0
  250. package/types/workers/httpRequest.d.ts +23 -0
  251. package/types/workers/readFile.d.ts +9 -0
  252. package/types/workers/transformImage.d.ts +6 -0
@@ -1,27 +1,18 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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 M } from "../utils/file.js";
8
- import { getImageSize as S } from "../utils/media.js";
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 k } from "./common/createTransformExtension.js";
14
- function Q(f, d, g, p, i, u, n, s, h) {
15
- createImageBitmap(f, d, g, p, i, {
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: f, extensionName: d }) => {
39
- function g(i) {
40
- return W(i) && C(i.file) && !/svg/.test(i.file.type);
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 p(i, { abortController: u }) {
43
- const { aspectRatio: n, width: s, height: h, upscale: m, fit: y, quality: T, compression: E, type: R } = f, { file: c } = i, B = [...i.extension[d].history ?? []], v = await S(c);
44
- if (v === null)
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(v, n), Math.round);
48
+ const e = q(A(d, m), Math.round);
47
49
  let t = H(e);
48
- if (s || h) {
49
- const w = e.width / e.height, a = n || w;
50
- let r = s, o = h;
51
- if (o ? r || (r = o * a) : o = r / a, t.width = r, t.height = o, y === "contain" ? r > o ? t.width = o * a : t.height = r / a : y === "cover" && (r > o ? t.height = r / a : t.width = o * a), !m && (t.width > e.width || t.height > e.height)) {
52
- const I = Math.min(
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 *= I, t.height *= I;
58
+ t.width *= y, t.height *= y;
57
59
  }
58
60
  }
59
- let l;
61
+ let s;
60
62
  try {
61
- l = await O(
62
- Q,
63
+ s = await L(
64
+ O(B, Q),
63
65
  [
64
- c,
65
- e.x,
66
- e.y,
67
- e.width,
68
- e.height,
69
- Math.round(t.width),
70
- Math.round(t.height),
71
- T
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: u
76
+ abortController: T
75
77
  }
76
78
  );
77
79
  } catch {
78
80
  throw "Failed to create image bitmap";
79
81
  }
80
- const F = new OffscreenCanvas(l.width, l.height), b = F.getContext("bitmaprenderer");
81
- if (b === null)
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
- b.transferFromImageBitmap(l);
84
- let z;
85
+ g.transferFromImageBitmap(s);
86
+ let u;
85
87
  try {
86
- z = await F.convertToBlob({
87
- type: R || c.type,
88
- quality: E
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 x = M(z, c.name);
95
+ const w = S(u, n.name);
94
96
  return {
95
- file: x,
96
- history: [...B, x]
97
+ file: w,
98
+ history: [...M, w]
97
99
  };
98
100
  }
99
101
  return {
100
- canTransformEntry: g,
101
- transformEntry: p
102
+ canTransformEntry: F,
103
+ transformEntry: z
102
104
  };
103
105
  }
104
106
  );
105
107
  export {
106
- U as ImageBitmapTransform
108
+ Y as ImageBitmapTransform
107
109
  };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,16 +1,16 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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 v } from "../utils/xhr.js";
8
- import { isBlobOrFile as M, isString as y, isNumber as Q } from "../utils/test.js";
9
- import { createExtension as Y } from "./common/createExtension.js";
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 f } from "../utils/sleep.js";
12
- import { log as j } from "../common/console.js";
13
- const V = Y(
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: g, props: S, didSetProps: F }, A) => {
26
+ ({ extensionName: L, props: E, didSetProps: A }, I) => {
26
27
  const {
27
28
  setEntryExtensionStatus: n,
28
- getEntryExtensionStatus: I,
29
- createProgressHandler: U,
29
+ getEntryExtensionStatus: U,
30
+ createProgressHandler: T,
30
31
  removeEntries: O,
31
- updateEntry: E,
32
+ updateEntry: g,
32
33
  pushTask: h,
33
- abortTasks: T,
34
- on: x
35
- } = A;
34
+ abortTasks: x,
35
+ on: R
36
+ } = I;
36
37
  let k;
37
- F(({ bitrate: t = 1024e3, tickrate: e = 250 }) => {
38
+ A(({ bitrate: t = 1024e3, tickrate: e = 250 }) => {
38
39
  k = t / 8 * (e / 1e3);
39
40
  });
40
- async function R(t) {
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 _(t) {
47
- const { src: e, size: l = 1024 * 1024 } = t, { connectionDelay: o, errorDelay: a } = S;
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 f(o), a) {
53
- await f(a);
54
- const i = "Simulated error";
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: i }
59
- }), c(["did throw load info error", t.id]), i;
59
+ values: { error: r }
60
+ }), o && l(["did throw load info error", t.id]), r;
60
61
  }
61
- c(["did load info", t.id]), E(t, {
62
+ o && l(["did load info", t.id]), g(t, {
62
63
  name: e.split("/").pop(),
63
64
  type: "plain/text",
64
- size: l
65
+ size: c
65
66
  });
66
67
  }
67
- async function P(t, { abortController: e }) {
68
- const { src: l, size: o = 1024 * 1024 } = t, { actionLoad: a, actionAbort: i, tickrate: b, connectionDelay: w, fetchFile: p, errorDelay: m } = S;
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 = U(t);
75
- if (await f(w), m) {
76
- await f(m);
77
- const r = "Simulated error";
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: r }
82
- }), c(["did throw load data error", t.id]), r;
90
+ values: { error: u }
91
+ }), a && l(["did throw load data error", t.id]), u;
83
92
  }
84
- return await new Promise((r) => {
85
- let u = 0;
86
- const D = setInterval(async () => {
87
- if (e.signal.aborted || (u = Math.min(o, u + k), d(v(!0, u, o)), u < o))
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(v(!0, o, o)), clearInterval(D);
90
- let L;
91
- p ? L = await p(t, { abortController: e, onprogress: d, onabort }) : (await f(0), L = new File(["#".repeat(o)], l.split("/").pop(), {
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
- })), E(t, {
94
- file: L,
102
+ })), g(t, {
103
+ file: D,
95
104
  state: {
96
105
  load: !1
97
106
  },
98
107
  extension: {
99
- [g]: {
108
+ [L]: {
100
109
  status: {
101
110
  type: s.Success,
102
111
  code: "LOAD_COMPLETE"
103
112
  }
104
113
  }
105
114
  }
106
- }), c(["did load data", t.id]), r();
115
+ }), a && l(["did load data", t.id]), u();
107
116
  }, b);
108
117
  e.signal.onabort = () => {
109
- clearInterval(D), c(["did abort load data", t.id]), E(t, {
118
+ clearInterval(v), a && l(["did abort load data", t.id]), g(t, {
110
119
  state: {
111
- [a]: !1,
112
- [i]: !1
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 z(t) {
121
- const e = I(t), l = Object.keys(e).length > 0;
122
- if (e?.type === "error" || M(t.file))
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: b } = t, { actionLoad: w, actionAbort: p, parallel: m } = S, d = t.state[w], r = t.state[p];
125
- if (!y(a))
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 (r) {
128
- T(t.id), O(t);
136
+ if (d) {
137
+ x(t.id), O(t);
129
138
  return;
130
139
  }
131
- if (d === !1)
140
+ if (S === !1)
132
141
  return;
133
- if (!(y(i) && Q(b))) {
134
- h(t.id, _);
142
+ if (!(F(i) && Y(r))) {
143
+ h(t.id, P);
135
144
  return;
136
145
  }
137
- if (!l) {
138
- h(t.id, R);
146
+ if (!c) {
147
+ h(t.id, _);
139
148
  return;
140
149
  }
141
- h(t.id, P, { parallel: m });
150
+ h(t.id, z, { parallel: m });
142
151
  }
143
- function c(t) {
144
- j("⧗", g, "(", ...t, ")");
152
+ function l(t) {
153
+ q("⧗", L, "(", ...t, ")");
145
154
  }
146
- const B = x("updateEntry", z);
155
+ const M = R("updateEntry", B);
147
156
  return {
148
157
  destroy: () => {
149
- B();
158
+ M();
150
159
  }
151
160
  };
152
161
  }
153
162
  );
154
163
  export {
155
- V as SimulatedLoader
164
+ W as SimulatedLoader
156
165
  };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FilePond v5.0.0-beta.20
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