filepond 5.0.0-beta.2 → 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/README.md +27 -4
- package/cdn/assets/index.js +1 -1
- package/cdn/dev/index.js +1 -0
- package/cdn/extensions/blob-loader.js +1 -1
- package/cdn/extensions/canvas-loader.js +1 -1
- package/cdn/extensions/chunked-upload-store.js +1 -1
- package/cdn/extensions/clipboard-source.js +1 -1
- package/cdn/extensions/console-view.js +1 -1
- package/cdn/extensions/data-transfer-loader.js +1 -1
- package/cdn/extensions/data-url-store.js +1 -1
- package/cdn/extensions/drag-drop-source.js +1 -1
- package/cdn/extensions/dropbox-source.js +1 -1
- package/cdn/extensions/entry-list-view.js +1 -1
- package/cdn/extensions/file-extension-validator.js +1 -1
- package/cdn/extensions/file-input-source.js +1 -1
- package/cdn/extensions/file-input-store.js +1 -1
- package/cdn/extensions/file-mime-type-validator.js +1 -1
- package/cdn/extensions/file-name-transform.js +1 -1
- package/cdn/extensions/file-name-validator.js +1 -1
- package/cdn/extensions/file-size-validator.js +1 -1
- package/cdn/extensions/form-post-store.js +1 -1
- package/cdn/extensions/image-bitmap-transform.js +1 -0
- package/cdn/extensions/index.js +1 -1
- package/cdn/extensions/list-count-validator.js +1 -1
- package/cdn/extensions/list-size-validator.js +1 -1
- package/cdn/extensions/media-resolution-validator.js +1 -1
- package/cdn/extensions/object-url-store.js +1 -1
- package/cdn/extensions/simulated-loader.js +1 -1
- package/cdn/extensions/simulated-store.js +1 -1
- package/cdn/extensions/text-input-store.js +1 -1
- package/cdn/extensions/url-loader.js +1 -1
- package/cdn/extensions/value-callback-store.js +1 -1
- package/cdn/index.js +1 -7
- package/cdn/locales/ar-ar.js +72 -48
- package/cdn/locales/bn-bd.js +72 -48
- package/cdn/locales/cs-cz.js +83 -59
- package/cdn/locales/da-dk.js +74 -50
- package/cdn/locales/de-de.js +72 -42
- package/cdn/locales/el-gr.js +72 -48
- package/cdn/locales/en-gb.js +85 -62
- package/cdn/locales/es-es.js +69 -39
- package/cdn/locales/fi-fi.js +69 -45
- package/cdn/locales/fr-fr.js +78 -48
- package/cdn/locales/hi-in.js +72 -42
- package/cdn/locales/hu-hu.js +66 -42
- package/cdn/locales/index.js +1 -1
- package/cdn/locales/is-is.js +71 -47
- package/cdn/locales/it-it.js +73 -43
- package/cdn/locales/ja-jp.js +72 -42
- package/cdn/locales/ko-kr.js +72 -42
- package/cdn/locales/nb-no.js +74 -44
- package/cdn/locales/nl-nl.js +71 -48
- package/cdn/locales/pl-pl.js +76 -52
- package/cdn/locales/pt-pt.js +71 -41
- package/cdn/locales/sv-se.js +73 -43
- package/cdn/locales/tr-tr.js +83 -59
- package/cdn/locales/uk-ua.js +72 -48
- package/cdn/locales/vi-vn.js +82 -58
- package/cdn/locales/zh-cn.js +72 -42
- package/cdn/main.js +7 -0
- package/cdn/templates/entry.js +1 -1
- package/cdn/templates/helpers.js +1 -1
- package/cdn/templates/index.js +1 -1
- package/cdn/templates/media.js +1 -1
- 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 +142 -133
- package/esm/core/extensionManager.js +89 -86
- package/esm/core/taskScheduler.js +78 -97
- package/esm/dev/index.js +122 -0
- package/esm/elements/FilePondDefault/index.css.js +2 -2
- package/esm/elements/FilePondDefault/index.js +164 -125
- package/esm/elements/FilePondDropArea/index.css.js +1 -1
- package/esm/elements/FilePondDropArea/index.js +1 -1
- package/esm/elements/FilePondDropArea/index.svelte.js +38 -40
- package/esm/elements/FilePondDropIndicator/index.css.js +1 -1
- package/esm/elements/FilePondDropIndicator/index.js +1 -1
- package/esm/elements/FilePondDropIndicator/index.svelte.js +65 -67
- package/esm/elements/FilePondEntryList/components/Entry/index.css.js +2 -2
- package/esm/elements/FilePondEntryList/components/Entry/index.js +1 -1
- package/esm/elements/FilePondEntryList/components/Entry/index.svelte.js +37 -37
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.css.js +2 -2
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.js +1 -2
- package/esm/elements/FilePondEntryList/components/EntryActivityIndicator/index.svelte.js +115 -86
- 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 +159 -154
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.css.js +1 -1
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.js +1 -2
- package/esm/elements/FilePondEntryList/components/EntryListItem/index.svelte.js +70 -46
- 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 -2
- package/esm/elements/FilePondEntryList/components/EntryStatus/index.svelte.js +62 -62
- 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 +91 -83
- 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 +33 -35
- 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 +88 -88
- 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 +2 -2
- package/esm/elements/FilePondEntryList/index.js +11 -14
- package/esm/elements/FilePondEntryList/index.svelte.js +351 -271
- package/esm/elements/FilePondInput/index.css.js +3 -3
- package/esm/elements/FilePondInput/index.js +252 -191
- package/esm/elements/FilePondSvelteComponent/index.svelte.js +11 -11
- package/esm/elements/attachments/dragarea.js +62 -63
- 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 +35 -41
- 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 +4 -4
- package/esm/elements/common/nodeTree.js +9 -9
- package/esm/elements/common/store.svelte.js +1 -1
- package/esm/elements/common/string.js +75 -55
- 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 +31 -33
- package/esm/elements/components/Button/index.css.js +2 -2
- package/esm/elements/components/Button/index.js +1 -1
- package/esm/elements/components/Button/index.svelte.js +49 -49
- 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 +2 -2
- 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 +174 -200
- 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 +98 -124
- package/esm/elements/components/RangeInput/index.css.js +2 -2
- package/esm/elements/components/RangeInput/index.js +1 -1
- package/esm/elements/components/RangeInput/index.svelte.js +86 -85
- package/esm/elements/components/SpringElement/index.svelte.js +91 -90
- 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 +25 -27
- 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 +38 -37
- 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 +36 -33
- 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 +35 -29
- 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 +21 -17
- 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 +33 -22
- package/esm/extensions/form-post-store.js +1 -1
- package/esm/extensions/image-bitmap-transform.js +109 -0
- package/esm/extensions/index.js +23 -21
- package/esm/extensions/list-count-validator.js +21 -21
- package/esm/extensions/list-size-validator.js +42 -31
- package/esm/extensions/media-resolution-validator.js +57 -47
- 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 +72 -48
- package/esm/locales/bn-bd.js +72 -48
- package/esm/locales/cs-cz.js +83 -59
- package/esm/locales/da-dk.js +74 -50
- package/esm/locales/de-de.js +72 -42
- package/esm/locales/el-gr.js +72 -48
- package/esm/locales/en-gb.js +85 -62
- package/esm/locales/es-es.js +69 -39
- package/esm/locales/fi-fi.js +69 -45
- package/esm/locales/fr-fr.js +78 -48
- package/esm/locales/hi-in.js +72 -42
- package/esm/locales/hu-hu.js +66 -42
- package/esm/locales/index.js +1 -1
- package/esm/locales/is-is.js +71 -47
- package/esm/locales/it-it.js +73 -43
- package/esm/locales/ja-jp.js +72 -42
- package/esm/locales/ko-kr.js +72 -42
- package/esm/locales/nb-no.js +74 -44
- package/esm/locales/nl-nl.js +71 -48
- package/esm/locales/pl-pl.js +76 -52
- package/esm/locales/pt-pt.js +71 -41
- package/esm/locales/sv-se.js +73 -43
- package/esm/locales/tr-tr.js +83 -59
- package/esm/locales/uk-ua.js +72 -48
- package/esm/locales/vi-vn.js +82 -58
- package/esm/locales/zh-cn.js +72 -42
- package/esm/svelte/svelte/src/constants.js +13 -12
- package/esm/svelte/svelte/src/internal/client/constants.js +29 -24
- package/esm/svelte/svelte/src/internal/client/context.js +33 -28
- package/esm/svelte/svelte/src/internal/client/dom/blocks/boundary.js +185 -126
- package/esm/svelte/svelte/src/internal/client/dom/blocks/branches.js +42 -43
- package/esm/svelte/svelte/src/internal/client/dom/blocks/each.js +175 -150
- package/esm/svelte/svelte/src/internal/client/dom/blocks/html.js +55 -32
- package/esm/svelte/svelte/src/internal/client/dom/blocks/if.js +12 -12
- package/esm/svelte/svelte/src/internal/client/dom/blocks/svelte-element.js +17 -17
- package/esm/svelte/svelte/src/internal/client/dom/elements/attributes.js +111 -113
- package/esm/svelte/svelte/src/internal/client/dom/elements/bindings/this.js +29 -16
- package/esm/svelte/svelte/src/internal/client/dom/elements/events.js +65 -60
- package/esm/svelte/svelte/src/internal/client/dom/elements/transitions.js +54 -54
- package/esm/svelte/svelte/src/internal/client/dom/operations.js +30 -22
- package/esm/svelte/svelte/src/internal/client/dom/reconciler.js +19 -4
- package/esm/svelte/svelte/src/internal/client/error-handling.js +17 -17
- package/esm/svelte/svelte/src/internal/client/errors.js +24 -20
- package/esm/svelte/svelte/src/internal/client/proxy.js +1 -1
- package/esm/svelte/svelte/src/internal/client/reactivity/async.js +60 -40
- package/esm/svelte/svelte/src/internal/client/reactivity/batch.js +273 -236
- package/esm/svelte/svelte/src/internal/client/reactivity/deriveds.js +110 -84
- package/esm/svelte/svelte/src/internal/client/reactivity/effects.js +160 -157
- package/esm/svelte/svelte/src/internal/client/reactivity/props.js +2 -1
- package/esm/svelte/svelte/src/internal/client/reactivity/sources.js +69 -70
- package/esm/svelte/svelte/src/internal/client/reactivity/status.js +12 -0
- package/esm/svelte/svelte/src/internal/client/reactivity/utils.js +16 -0
- package/esm/svelte/svelte/src/internal/client/render.js +68 -64
- package/esm/svelte/svelte/src/internal/client/runtime.js +174 -170
- package/esm/svelte/svelte/src/internal/shared/attributes.js +32 -32
- package/esm/svelte/svelte/src/internal/shared/utils.js +16 -15
- package/esm/svelte/svelte/src/motion/spring.js +7 -7
- package/esm/svelte/svelte/src/reactivity/map.js +17 -21
- package/esm/templates/entry.js +194 -159
- package/esm/templates/helpers.js +85 -75
- package/esm/templates/index.js +1 -1
- package/esm/templates/media.js +163 -131
- 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 +84 -74
- package/esm/utils/file.js +82 -69
- package/esm/utils/functionToBlob.js +1 -1
- package/esm/utils/keyboard.js +34 -0
- package/esm/utils/math.js +14 -7
- package/esm/utils/media.js +1 -1
- package/esm/utils/number.js +11 -16
- 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 +39 -30
- package/esm/utils/size.js +1 -1
- package/esm/utils/sleep.js +1 -1
- package/esm/utils/string.js +25 -21
- package/esm/utils/support.js +5 -6
- package/esm/utils/test.js +1 -1
- package/esm/utils/thread.js +50 -43
- package/esm/utils/tree.js +1 -1
- package/esm/utils/url.js +2 -2
- 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 +17 -12
- package/types/core/entryTree.d.ts +6 -2
- package/types/core/extensionManager.d.ts +16 -2
- package/types/core/taskScheduler.d.ts +2 -2
- package/types/dev/index.d.ts +11 -3
- package/types/elements/FilePondDefault/index.d.ts +15 -5
- package/types/elements/FilePondEntryList/components/MediaImage/index.d.ts +1 -1
- package/types/elements/FilePondEntryList/components/MediaVideo/index.d.ts +1 -1
- package/types/elements/FilePondEntryList/contexts/appContext.d.ts +1 -0
- package/types/elements/FilePondEntryList/contexts/entryContext.d.ts +1 -0
- package/types/elements/FilePondEntryList/index.d.ts +10 -11
- package/types/elements/FilePondInput/index.d.ts +22 -11
- package/types/elements/common/animationPreference.svelte.d.ts +6 -3
- package/types/elements/common/nodeTree.d.ts +1 -1
- package/types/elements/common/string.d.ts +1 -1
- package/types/extensions/common/createTransformExtension.d.ts +1 -1
- package/types/extensions/data-url-store.d.ts +2 -0
- package/types/extensions/file-name-transform.d.ts +1 -1
- package/types/extensions/file-size-validator.d.ts +2 -0
- package/types/extensions/image-bitmap-transform.d.ts +32 -0
- package/types/extensions/index.d.ts +1 -0
- package/types/extensions/list-size-validator.d.ts +2 -0
- package/types/extensions/simulated-loader.d.ts +2 -0
- package/types/extensions/simulated-store.d.ts +1 -1
- package/types/extensions/url-loader.d.ts +2 -0
- package/types/locales/ar-ar.d.ts +101 -76
- package/types/locales/bn-bd.d.ts +101 -76
- package/types/locales/cs-cz.d.ts +101 -76
- package/types/locales/da-dk.d.ts +101 -76
- package/types/locales/de-de.d.ts +101 -76
- package/types/locales/el-gr.d.ts +101 -76
- package/types/locales/en-gb.d.ts +102 -82
- package/types/locales/es-es.d.ts +101 -76
- package/types/locales/fi-fi.d.ts +101 -76
- package/types/locales/fr-fr.d.ts +101 -76
- package/types/locales/hi-in.d.ts +101 -76
- package/types/locales/hu-hu.d.ts +101 -76
- package/types/locales/is-is.d.ts +101 -76
- package/types/locales/it-it.d.ts +101 -76
- package/types/locales/ja-jp.d.ts +101 -76
- package/types/locales/ko-kr.d.ts +101 -76
- package/types/locales/nb-no.d.ts +101 -76
- package/types/locales/nl-nl.d.ts +101 -76
- package/types/locales/pl-pl.d.ts +101 -76
- package/types/locales/pt-pt.d.ts +101 -76
- package/types/locales/sv-se.d.ts +101 -76
- package/types/locales/tr-tr.d.ts +101 -76
- package/types/locales/uk-ua.d.ts +101 -76
- package/types/locales/vi-vn.d.ts +101 -76
- package/types/locales/zh-cn.d.ts +101 -76
- package/types/templates/entry.d.ts +15 -16
- package/types/templates/helpers.d.ts +5 -1
- package/types/templates/media.d.ts +43 -6
- package/types/types/index.d.ts +9 -15
- package/types/utils/file.d.ts +7 -15
- package/types/utils/keyboard.d.ts +5 -0
- package/types/utils/rect.d.ts +5 -0
- package/types/utils/string.d.ts +1 -0
- 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
- package/types/elements/FilePondEntryList/components/EntryContext/index.d.ts +0 -1
|
@@ -1,201 +1,204 @@
|
|
|
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 { createTaskScheduler as
|
|
8
|
-
import { pubsub as
|
|
7
|
+
import { createTaskScheduler as R } from "./taskScheduler.js";
|
|
8
|
+
import { pubsub as z } from "../utils/pubsub.js";
|
|
9
9
|
import { isArray as k } from "../utils/test.js";
|
|
10
|
-
import { arrayItemsEqual as
|
|
11
|
-
function
|
|
12
|
-
const { on: I, pub: y } =
|
|
10
|
+
import { arrayItemsEqual as D, arrayRemoveInPlace as G, arraySortByItemProp as H } from "../utils/array.js";
|
|
11
|
+
function V(a) {
|
|
12
|
+
const { on: I, pub: y } = z(), c = [], { insertEntries: T, replaceEntry: A, updateEntry: v, removeEntries: j } = a, f = R({ log: void 0 }), x = {
|
|
13
13
|
extension: {}
|
|
14
14
|
};
|
|
15
|
-
function l(n,
|
|
16
|
-
|
|
15
|
+
function l(n, s) {
|
|
16
|
+
x.extension[n] = {
|
|
17
17
|
...g(n),
|
|
18
|
-
...
|
|
19
|
-
}, y("update",
|
|
18
|
+
...s
|
|
19
|
+
}, y("update", x.extension);
|
|
20
20
|
}
|
|
21
21
|
function g(n) {
|
|
22
|
-
return
|
|
22
|
+
return x.extension[n] ?? {};
|
|
23
23
|
}
|
|
24
|
-
function C(n,
|
|
25
|
-
l(n, { status:
|
|
24
|
+
function C(n, s) {
|
|
25
|
+
l(n, { status: s });
|
|
26
26
|
}
|
|
27
27
|
function O(n) {
|
|
28
|
-
return
|
|
28
|
+
return x.extension[n].status;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
a.on("removeEntry", ({ entry: n }) => {
|
|
31
|
+
f.abortTasks(n.id);
|
|
32
32
|
});
|
|
33
33
|
function q(n) {
|
|
34
|
-
const
|
|
35
|
-
return
|
|
34
|
+
const s = function(e, i) {
|
|
35
|
+
return a.on(e, i);
|
|
36
36
|
}, o = [], t = { current: void 0 };
|
|
37
37
|
t.current = n({
|
|
38
38
|
// events
|
|
39
|
-
on:
|
|
39
|
+
on: s,
|
|
40
40
|
// get root extension state
|
|
41
|
-
setExtensionState: r((
|
|
42
|
-
l(t.current.name,
|
|
41
|
+
setExtensionState: r((e) => {
|
|
42
|
+
l(t.current.name, e);
|
|
43
43
|
}),
|
|
44
44
|
getExtensionState: r(() => g(t.current.name)),
|
|
45
45
|
// get root extension status
|
|
46
46
|
setExtensionStatus: r(
|
|
47
|
-
(
|
|
47
|
+
(e) => C(t.current.name, e)
|
|
48
48
|
),
|
|
49
49
|
// @ts-ignore
|
|
50
50
|
getExtensionStatus: r(() => O(t.current.name)),
|
|
51
|
-
pushTask: function(
|
|
51
|
+
pushTask: function(e, i, u) {
|
|
52
52
|
const B = E(
|
|
53
53
|
t.current.name
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
a.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: () => [a.findEntries(e)],
|
|
60
60
|
// add custom options
|
|
61
|
-
...
|
|
61
|
+
...u
|
|
62
62
|
});
|
|
63
63
|
},
|
|
64
|
-
abortTask: function(
|
|
65
|
-
|
|
64
|
+
abortTask: function(e, i) {
|
|
65
|
+
f.abortTask(e, i);
|
|
66
66
|
},
|
|
67
|
-
abortTasks: (
|
|
68
|
-
|
|
67
|
+
abortTasks: (e) => {
|
|
68
|
+
f.abortTasks(e);
|
|
69
69
|
},
|
|
70
|
-
setEntries: function(
|
|
71
|
-
|
|
70
|
+
setEntries: function(e) {
|
|
71
|
+
a.entries = e;
|
|
72
72
|
},
|
|
73
|
-
getEntries: () =>
|
|
73
|
+
getEntries: () => a.entries,
|
|
74
74
|
// manipulating entry list
|
|
75
75
|
insertEntries: T,
|
|
76
76
|
removeEntries: j,
|
|
77
77
|
replaceEntry: A,
|
|
78
78
|
updateEntry: v
|
|
79
79
|
});
|
|
80
|
-
function r(
|
|
81
|
-
return (...
|
|
80
|
+
function r(e) {
|
|
81
|
+
return (...i) => {
|
|
82
82
|
if (t.current) {
|
|
83
|
-
|
|
83
|
+
e(...i);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
o.push([
|
|
86
|
+
o.push([e, i]);
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
return o.forEach(([
|
|
90
|
-
|
|
89
|
+
return o.forEach(([e, i]) => {
|
|
90
|
+
e(...i);
|
|
91
91
|
}), t.current;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function h() {
|
|
94
|
+
f.abortTasks(), c.map((n) => n.instance).forEach((n) => n.destroy()), c.length = 0;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const S = {
|
|
97
97
|
// subscribe to events
|
|
98
98
|
on: I,
|
|
99
99
|
get extensions() {
|
|
100
|
-
return
|
|
100
|
+
return c.map(({ factory: n }) => n);
|
|
101
101
|
},
|
|
102
102
|
set extensions(n) {
|
|
103
103
|
if (!k(n))
|
|
104
104
|
return;
|
|
105
|
-
const
|
|
105
|
+
const s = n.map(
|
|
106
106
|
(t) => Array.isArray(t) ? t[0] : t
|
|
107
107
|
);
|
|
108
|
-
if (
|
|
108
|
+
if (D(s, S.extensions)) {
|
|
109
109
|
for (const t of n) {
|
|
110
110
|
if (!k(t))
|
|
111
111
|
continue;
|
|
112
|
-
const r =
|
|
113
|
-
|
|
112
|
+
const r = c.find((e) => t[0] === e.factory);
|
|
113
|
+
p(r, t[1]);
|
|
114
114
|
}
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
n.length === 0 && (
|
|
118
|
-
for (const t of
|
|
119
|
-
if (!
|
|
120
|
-
t.instance.destroy(),
|
|
117
|
+
n.length === 0 && (d.clear(), h());
|
|
118
|
+
for (const t of c)
|
|
119
|
+
if (!s.includes(t.factory)) {
|
|
120
|
+
t.instance.destroy(), G(c, (r) => r === t);
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
|
-
for (const [t, r] of Object.entries(
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
|
|
123
|
+
for (const [t, r] of Object.entries(s)) {
|
|
124
|
+
const e = parseInt(t, 10), i = c.find((u) => r === u.factory);
|
|
125
|
+
if (i) {
|
|
126
|
+
if (i.index = e, Array.isArray(n[e])) {
|
|
127
|
+
const u = n[e][1];
|
|
128
|
+
p(i, u);
|
|
129
|
+
}
|
|
127
130
|
continue;
|
|
128
131
|
}
|
|
129
|
-
if (
|
|
130
|
-
index:
|
|
132
|
+
if (c.push({
|
|
133
|
+
index: e,
|
|
131
134
|
factory: r,
|
|
132
135
|
instance: q(r)
|
|
133
|
-
}), Array.isArray(n[
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
+
}), Array.isArray(n[e])) {
|
|
137
|
+
const u = n[e][1];
|
|
138
|
+
p(c.at(-1), u);
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
|
-
|
|
141
|
+
H(c, "index"), Object.entries(d.get("*") ?? []).forEach(
|
|
139
142
|
([t, r]) => {
|
|
140
143
|
P(t, r);
|
|
141
144
|
}
|
|
142
145
|
);
|
|
143
|
-
for (const [t, r] of
|
|
146
|
+
for (const [t, r] of d)
|
|
144
147
|
t !== "*" && b(t, r);
|
|
145
|
-
const o =
|
|
146
|
-
y("setExtensions", { extensionNames: o }),
|
|
148
|
+
const o = c.map((t) => t.instance.name);
|
|
149
|
+
y("setExtensions", { extensionNames: o }), a.entries = [...a.entries];
|
|
147
150
|
},
|
|
148
151
|
propagateExtensionProperty: P,
|
|
149
152
|
setExtensionProperties: b,
|
|
150
153
|
getExtensionProperties: M,
|
|
151
154
|
// access manager state
|
|
152
155
|
getState() {
|
|
153
|
-
return
|
|
156
|
+
return x.extension;
|
|
154
157
|
},
|
|
155
158
|
// destroy FilePond instance
|
|
156
159
|
destroy() {
|
|
157
|
-
|
|
160
|
+
h();
|
|
158
161
|
}
|
|
159
162
|
};
|
|
160
|
-
function P(n,
|
|
161
|
-
const o = { [n]:
|
|
163
|
+
function P(n, s) {
|
|
164
|
+
const o = { [n]: s }, t = W(n);
|
|
162
165
|
for (const r of t)
|
|
163
|
-
|
|
166
|
+
p(r, o);
|
|
164
167
|
m("*", o);
|
|
165
168
|
}
|
|
166
|
-
function b(n,
|
|
169
|
+
function b(n, s) {
|
|
167
170
|
const o = E(n);
|
|
168
|
-
o ?
|
|
171
|
+
o ? p(o, s) : m(n, s);
|
|
169
172
|
}
|
|
170
173
|
function M(n) {
|
|
171
|
-
const
|
|
172
|
-
if (!
|
|
174
|
+
const s = E(n);
|
|
175
|
+
if (!s)
|
|
173
176
|
return;
|
|
174
|
-
const { instance: o } =
|
|
177
|
+
const { instance: o } = s;
|
|
175
178
|
if (o)
|
|
176
179
|
return o.getProps();
|
|
177
180
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
181
|
+
function p(n, s) {
|
|
182
|
+
s && (n.instance.setProps(s), m(n.instance.name, s));
|
|
180
183
|
}
|
|
181
184
|
function W(n) {
|
|
182
|
-
return
|
|
183
|
-
const o =
|
|
185
|
+
return c.filter((s) => {
|
|
186
|
+
const o = s.instance.getProps();
|
|
184
187
|
return Object.keys(o).includes(n);
|
|
185
188
|
});
|
|
186
189
|
}
|
|
187
190
|
function E(n) {
|
|
188
|
-
return
|
|
191
|
+
return c.find((s) => s.instance.name === n);
|
|
189
192
|
}
|
|
190
|
-
const
|
|
191
|
-
function m(n,
|
|
192
|
-
|
|
193
|
-
...
|
|
194
|
-
...
|
|
193
|
+
const d = /* @__PURE__ */ new Map();
|
|
194
|
+
function m(n, s) {
|
|
195
|
+
d.set(n, {
|
|
196
|
+
...d.get(n),
|
|
197
|
+
...s
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
|
-
return
|
|
200
|
+
return S;
|
|
198
201
|
}
|
|
199
202
|
export {
|
|
200
|
-
|
|
203
|
+
V as createExtensionManager
|
|
201
204
|
};
|
|
@@ -1,194 +1,175 @@
|
|
|
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
7
|
import { arrayRemoveInPlace as T } from "../utils/array.js";
|
|
8
|
-
import { pubsub as
|
|
9
|
-
import { isString as
|
|
10
|
-
import { log as p } from "../common/console.js";
|
|
8
|
+
import { pubsub as j } from "../utils/pubsub.js";
|
|
9
|
+
import { isString as z, isFunction as D } from "../utils/test.js";
|
|
11
10
|
const e = {
|
|
12
11
|
QUEUED: 1,
|
|
13
12
|
ACTIVE: 2,
|
|
14
13
|
FAILED: 3,
|
|
15
14
|
HALTED: 4
|
|
16
15
|
};
|
|
17
|
-
function
|
|
18
|
-
const {
|
|
19
|
-
function
|
|
20
|
-
p(`Tasks: ${a.length}`);
|
|
21
|
-
for (const t of a) {
|
|
22
|
-
const { group: n, fn: r, order: o, parallel: s, state: u, ...D } = t;
|
|
23
|
-
let j = {
|
|
24
|
-
// queued
|
|
25
|
-
1: "📥",
|
|
26
|
-
// active
|
|
27
|
-
2: "👉",
|
|
28
|
-
// failed
|
|
29
|
-
3: "💥",
|
|
30
|
-
// halted
|
|
31
|
-
4: "🖐️"
|
|
32
|
-
}[u];
|
|
33
|
-
p(j, n, r.name, { parallel: s, order: o });
|
|
34
|
-
}
|
|
35
|
-
p("");
|
|
36
|
-
}
|
|
37
|
-
function v(t) {
|
|
16
|
+
function Y(S) {
|
|
17
|
+
const { log: p = void 0 } = S ?? {}, { on: U, pub: f } = j(), s = [], i = /* @__PURE__ */ new Map();
|
|
18
|
+
function h(t) {
|
|
38
19
|
return t.state === e.QUEUED || t.state === e.ACTIVE;
|
|
39
20
|
}
|
|
40
|
-
function
|
|
21
|
+
function k(t) {
|
|
41
22
|
return t.state === e.QUEUED;
|
|
42
23
|
}
|
|
43
|
-
function
|
|
24
|
+
function x(t) {
|
|
44
25
|
return t.state === e.ACTIVE;
|
|
45
26
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
27
|
+
function C(t, n) {
|
|
28
|
+
return z(t) && D(n);
|
|
48
29
|
}
|
|
49
|
-
function
|
|
30
|
+
function g(t, n) {
|
|
50
31
|
let r = 0;
|
|
51
32
|
for (let o = 0; o < n.length; o++)
|
|
52
33
|
t.order >= n[o].order && (r = o + 1);
|
|
53
34
|
n.splice(r, 0, t);
|
|
54
35
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
36
|
+
function v(t) {
|
|
37
|
+
g(t, s);
|
|
57
38
|
let n = i.get(t.group);
|
|
58
|
-
n || (n = [], i.set(t.group, n)),
|
|
39
|
+
n || (n = [], i.set(t.group, n)), g(t, n);
|
|
59
40
|
}
|
|
60
|
-
function
|
|
41
|
+
function Q(t, n) {
|
|
61
42
|
const r = i.get(t);
|
|
62
43
|
return r ? !!r.find((o) => o.fn === n) : !1;
|
|
63
44
|
}
|
|
64
|
-
function
|
|
45
|
+
function m(t) {
|
|
65
46
|
T(
|
|
66
|
-
|
|
47
|
+
s,
|
|
67
48
|
(r) => r.group === t.group && r.fn === t.fn
|
|
68
49
|
);
|
|
69
50
|
const n = i.get(t.group);
|
|
70
51
|
n && T(n, (r) => r.fn === t.fn);
|
|
71
52
|
}
|
|
72
|
-
function
|
|
73
|
-
T(
|
|
53
|
+
function B(t) {
|
|
54
|
+
T(s, (n) => n.group === t), i.delete(t);
|
|
74
55
|
}
|
|
75
56
|
function c(t) {
|
|
76
57
|
return i.get(t) ?? [];
|
|
77
58
|
}
|
|
78
|
-
function
|
|
59
|
+
function E(t, n) {
|
|
79
60
|
return c(t)[0].state === n;
|
|
80
61
|
}
|
|
81
|
-
function
|
|
82
|
-
return c(t).filter(
|
|
62
|
+
function H(t) {
|
|
63
|
+
return c(t).filter(h).length > 0;
|
|
83
64
|
}
|
|
84
|
-
function
|
|
65
|
+
function L(t) {
|
|
85
66
|
const n = c(t);
|
|
86
67
|
for (const r of n)
|
|
87
|
-
|
|
68
|
+
y(r);
|
|
88
69
|
}
|
|
89
|
-
function
|
|
90
|
-
return c(t).filter(
|
|
70
|
+
function d(t) {
|
|
71
|
+
return c(t).filter(k)[0];
|
|
91
72
|
}
|
|
92
|
-
function
|
|
73
|
+
function O(t, n) {
|
|
93
74
|
const r = c(t);
|
|
94
75
|
if (r)
|
|
95
76
|
return r.find((o) => o.fn === n);
|
|
96
77
|
}
|
|
97
|
-
function
|
|
98
|
-
const { ignoreOptional: o = !1 } = r || {},
|
|
99
|
-
for (const u of
|
|
78
|
+
function b(t, n, r) {
|
|
79
|
+
const { ignoreOptional: o = !1 } = r || {}, a = i.get(t) ?? [];
|
|
80
|
+
for (const u of a)
|
|
100
81
|
o && u.isOptional || (u.state = n);
|
|
101
82
|
}
|
|
102
|
-
function
|
|
103
|
-
return Array.from(new Set(
|
|
83
|
+
function V() {
|
|
84
|
+
return Array.from(new Set(s.map((t) => t.group)));
|
|
104
85
|
}
|
|
105
|
-
function
|
|
86
|
+
function q() {
|
|
106
87
|
return i.keys();
|
|
107
88
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
89
|
+
function w() {
|
|
90
|
+
return s.filter(k).length > 0;
|
|
110
91
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
92
|
+
function N() {
|
|
93
|
+
return s.filter(x);
|
|
113
94
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
95
|
+
function R(t) {
|
|
96
|
+
return N().filter((n) => n.fn === t.fn);
|
|
116
97
|
}
|
|
117
|
-
function
|
|
118
|
-
return t ? t.parallel === 1 / 0 ||
|
|
98
|
+
function A(t) {
|
|
99
|
+
return t ? t.parallel === 1 / 0 || R(t).length < t.parallel : !1;
|
|
119
100
|
}
|
|
120
101
|
function l() {
|
|
121
|
-
queueMicrotask(
|
|
102
|
+
queueMicrotask(F);
|
|
122
103
|
}
|
|
123
|
-
function
|
|
124
|
-
if (!
|
|
125
|
-
|
|
104
|
+
function F() {
|
|
105
|
+
if (!w()) {
|
|
106
|
+
p?.(s), f("idle");
|
|
126
107
|
return;
|
|
127
108
|
}
|
|
128
|
-
|
|
129
|
-
const t =
|
|
109
|
+
p?.(s);
|
|
110
|
+
const t = V();
|
|
130
111
|
for (const n of t) {
|
|
131
|
-
if (!
|
|
132
|
-
if (
|
|
133
|
-
const o =
|
|
134
|
-
if (!o || !
|
|
112
|
+
if (!E(n, e.QUEUED)) {
|
|
113
|
+
if (E(n, e.HALTED)) {
|
|
114
|
+
const o = d(n);
|
|
115
|
+
if (!o || !A(o))
|
|
135
116
|
continue;
|
|
136
|
-
|
|
117
|
+
I(o);
|
|
137
118
|
}
|
|
138
119
|
continue;
|
|
139
120
|
}
|
|
140
|
-
const r =
|
|
141
|
-
|
|
121
|
+
const r = d(n);
|
|
122
|
+
A(r) && I(r);
|
|
142
123
|
}
|
|
143
124
|
}
|
|
144
|
-
async function
|
|
125
|
+
async function I(t) {
|
|
145
126
|
const { group: n, fn: r, params: o } = t;
|
|
146
127
|
t.state = e.ACTIVE;
|
|
147
128
|
try {
|
|
148
|
-
const
|
|
129
|
+
const a = D(o) ? o() : o, u = await r(...a, {
|
|
149
130
|
abortController: t.abortController
|
|
150
131
|
});
|
|
151
|
-
|
|
152
|
-
} catch (
|
|
153
|
-
t.state = e.FAILED, f("error",
|
|
132
|
+
m(t), u === !1 && b(n, e.HALTED, { ignoreOptional: !0 });
|
|
133
|
+
} catch (a) {
|
|
134
|
+
t.state = e.FAILED, f("error", a), b(n, e.HALTED);
|
|
154
135
|
}
|
|
155
|
-
|
|
136
|
+
H(n) || f("complete", n), l();
|
|
156
137
|
}
|
|
157
|
-
function
|
|
138
|
+
function y(t) {
|
|
158
139
|
t.abortController.signal.aborted || t.abortController.abort();
|
|
159
140
|
}
|
|
160
|
-
function
|
|
161
|
-
const { parallel: o = 1 / 0, order:
|
|
162
|
-
!
|
|
141
|
+
function P(t, n, r) {
|
|
142
|
+
const { parallel: o = 1 / 0, order: a = 0, params: u = [], isOptional: W = !1 } = r ?? {};
|
|
143
|
+
!C(t, n) || Q(t, n) || (v({
|
|
163
144
|
group: t,
|
|
164
145
|
fn: n,
|
|
165
146
|
params: u,
|
|
166
|
-
order:
|
|
147
|
+
order: a,
|
|
167
148
|
parallel: o,
|
|
168
|
-
isOptional:
|
|
149
|
+
isOptional: W,
|
|
169
150
|
state: e.QUEUED,
|
|
170
151
|
abortController: new AbortController()
|
|
171
152
|
}), l());
|
|
172
153
|
}
|
|
173
|
-
function
|
|
174
|
-
const r =
|
|
175
|
-
r && (
|
|
154
|
+
function M(t, n) {
|
|
155
|
+
const r = O(t, n);
|
|
156
|
+
r && (y(r), m(r), l());
|
|
176
157
|
}
|
|
177
|
-
function
|
|
158
|
+
function G(t) {
|
|
178
159
|
if (!t) {
|
|
179
|
-
for (const n of
|
|
180
|
-
|
|
160
|
+
for (const n of q())
|
|
161
|
+
G(n);
|
|
181
162
|
return;
|
|
182
163
|
}
|
|
183
|
-
|
|
164
|
+
L(t), B(t), f("abort", t), f("complete", t), l();
|
|
184
165
|
}
|
|
185
166
|
return {
|
|
186
|
-
on:
|
|
187
|
-
pushTask:
|
|
188
|
-
abortTask:
|
|
189
|
-
abortTasks:
|
|
167
|
+
on: U,
|
|
168
|
+
pushTask: P,
|
|
169
|
+
abortTask: M,
|
|
170
|
+
abortTasks: G
|
|
190
171
|
};
|
|
191
172
|
}
|
|
192
173
|
export {
|
|
193
|
-
|
|
174
|
+
Y as createTaskScheduler
|
|
194
175
|
};
|
package/esm/dev/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* FilePond v5.0.0-beta.21
|
|
3
|
+
* Copyright (c) 2017-2026 Pqina B.V.
|
|
4
|
+
* Released under the MIT License
|
|
5
|
+
* https://filepond.com
|
|
6
|
+
*/
|
|
7
|
+
import { h as y } from "../utils/dom.js";
|
|
8
|
+
import { blobToFile as $ } from "../utils/file.js";
|
|
9
|
+
import { createRandomish as S, randomNumberBetween as b } from "../utils/math.js";
|
|
10
|
+
import { sleep as D } from "../utils/sleep.js";
|
|
11
|
+
const x = 1, u = S(x);
|
|
12
|
+
function M(t, e) {
|
|
13
|
+
return e ? /text/.test(e) : /\.(txt|md|markdown)$/.test(t);
|
|
14
|
+
}
|
|
15
|
+
function F(t, e) {
|
|
16
|
+
return e ? /image/.test(e) : /\.(png|jpg|jpeg|webp)$/.test(t);
|
|
17
|
+
}
|
|
18
|
+
async function H(t) {
|
|
19
|
+
const { name: e = "Untitled", type: i } = t ?? {};
|
|
20
|
+
return M(e, i) ? await T({
|
|
21
|
+
...t,
|
|
22
|
+
name: e
|
|
23
|
+
}) ?? null : F(e, i) ? await R({
|
|
24
|
+
...t,
|
|
25
|
+
name: e
|
|
26
|
+
}) : null;
|
|
27
|
+
}
|
|
28
|
+
function v(t, e, i) {
|
|
29
|
+
const { width: n, height: a } = t.canvas, d = t.createLinearGradient(
|
|
30
|
+
n * u(),
|
|
31
|
+
0,
|
|
32
|
+
n * u(),
|
|
33
|
+
a
|
|
34
|
+
), p = 3, o = 30;
|
|
35
|
+
let s = Math.round(b(0, 360 - o, u));
|
|
36
|
+
for (let c = 0; c < p; c++)
|
|
37
|
+
s += Math.round(b(o, 90, u)), d.addColorStop(c / (p - 1), `hsl(${s} 90% 50%)`);
|
|
38
|
+
t.fillStyle = e || d, t.fillRect(0, 0, n, a), t.fillStyle = "rgba(0,0,0,.35)", t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${n / 16}px sans-serif`, t.fillText(`${i} ${n} × ${a}`, n * 0.5, a * 0.5);
|
|
39
|
+
}
|
|
40
|
+
async function R(t) {
|
|
41
|
+
const {
|
|
42
|
+
name: e = "Untitled",
|
|
43
|
+
width: i = 1280,
|
|
44
|
+
height: n = 720,
|
|
45
|
+
quality: a = 0.98,
|
|
46
|
+
fillStyle: d = void 0,
|
|
47
|
+
lastModified: p = Date.now()
|
|
48
|
+
} = t ?? {};
|
|
49
|
+
let o = "image/png";
|
|
50
|
+
if (e && !t?.type) {
|
|
51
|
+
const l = e.split(".").pop();
|
|
52
|
+
l && /jpeg|png|webp/.test(l) && (o = `image/${e.split(".").pop()}`);
|
|
53
|
+
}
|
|
54
|
+
const s = y("canvas", {
|
|
55
|
+
width: i,
|
|
56
|
+
height: n
|
|
57
|
+
}), c = s.getContext("2d");
|
|
58
|
+
v(c, d, o);
|
|
59
|
+
const g = await new Promise((l, r) => {
|
|
60
|
+
try {
|
|
61
|
+
s.toBlob(
|
|
62
|
+
(f) => {
|
|
63
|
+
f ? l(f) : r(new Error("Failed to create blob from canvas"));
|
|
64
|
+
},
|
|
65
|
+
o,
|
|
66
|
+
a
|
|
67
|
+
);
|
|
68
|
+
} catch (f) {
|
|
69
|
+
r(f);
|
|
70
|
+
}
|
|
71
|
+
}), m = /\./.test(e) ? e : `${e}.${o.split("/").pop()}`;
|
|
72
|
+
return $(g, m, { type: o, lastModified: p });
|
|
73
|
+
}
|
|
74
|
+
async function I(t) {
|
|
75
|
+
const {
|
|
76
|
+
name: e = "Untitled",
|
|
77
|
+
width: i = 1280,
|
|
78
|
+
height: n = 720,
|
|
79
|
+
fps: a = 10,
|
|
80
|
+
fillStyle: d = "silver",
|
|
81
|
+
lastModified: p = Date.now()
|
|
82
|
+
} = t ?? {}, o = 10, s = "video/webp", c = y("canvas", { width: i, height: n }), g = c.getContext("2d"), m = [], l = new MediaRecorder(c.captureStream(a), {
|
|
83
|
+
mimeType: "video/webm"
|
|
84
|
+
});
|
|
85
|
+
l.ondataavailable = (r) => {
|
|
86
|
+
r.data.size && m.push(r.data);
|
|
87
|
+
}, l.start();
|
|
88
|
+
for (let r = 0; r < o; r++)
|
|
89
|
+
v(g, d, s), await D(1e3 / a);
|
|
90
|
+
return await new Promise((r) => {
|
|
91
|
+
l.onstop = r, setTimeout(() => {
|
|
92
|
+
l.stop();
|
|
93
|
+
}, 1e3 / a);
|
|
94
|
+
}), new File(m, `${e}.${s.split("/").pop()}`, { type: s, lastModified: p });
|
|
95
|
+
}
|
|
96
|
+
async function T(t) {
|
|
97
|
+
const {
|
|
98
|
+
name: e = "Untitled",
|
|
99
|
+
type: i = "text/plain",
|
|
100
|
+
content: n = "Hello World",
|
|
101
|
+
lastModified: a = Date.now()
|
|
102
|
+
} = t ?? {};
|
|
103
|
+
if (i === "text/plain")
|
|
104
|
+
return new File([n], e.endsWith(".txt") ? e : `${e}.txt`, {
|
|
105
|
+
type: i,
|
|
106
|
+
lastModified: a
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
let h, w;
|
|
110
|
+
function N() {
|
|
111
|
+
const t = performance.now();
|
|
112
|
+
h || (h = t), w || (w = t);
|
|
113
|
+
const e = t - w;
|
|
114
|
+
return w = t, { ms: t - h, step: e };
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
T as generateDocument,
|
|
118
|
+
H as generateFile,
|
|
119
|
+
R as generateImage,
|
|
120
|
+
I as generateVideo,
|
|
121
|
+
N as now
|
|
122
|
+
};
|