@uploadcare/file-uploader 1.20.0-rc.0 → 1.20.0-rc.2
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/abstract/CTX.d.ts +2 -2
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +1 -1
- package/abstract/SolutionBlock.d.ts +1 -1
- package/abstract/UploaderBlock.d.ts +1 -1
- package/abstract/UploaderPublicApi.d.ts +2 -2
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +4 -4
- package/blocks/CameraSource/CameraSource.d.ts +1 -1
- package/blocks/Config/side-effects.d.ts.map +1 -1
- package/blocks/Config/side-effects.js +7 -5
- package/blocks/DropArea/DropArea.d.ts +1 -1
- package/blocks/ExternalSource/ExternalSource.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts +1 -1
- package/blocks/FileItem/FileItem.js +3 -3
- package/blocks/FileItem/FileItemConfig.d.ts +1 -1
- package/blocks/FileItem/FileItemConfig.d.ts.map +1 -1
- package/blocks/FileItem/FileItemConfig.js +3 -3
- package/blocks/SimpleBtn/SimpleBtn.d.ts +1 -1
- package/blocks/SourceBtn/SourceBtn.d.ts +1 -1
- package/blocks/Thumb/Thumb.d.ts +1 -1
- package/blocks/UploadList/UploadList.d.ts +1 -1
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +1 -1
- package/index.ssr.js +1 -1
- package/package.json +5 -5
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -1
- package/utils/isPromiseLike.d.ts +2 -0
- package/utils/isPromiseLike.d.ts.map +1 -0
- package/utils/isPromiseLike.js +12 -0
- package/utils/isPromiseLike.test.d.ts +2 -0
- package/utils/isPromiseLike.test.d.ts.map +1 -0
- package/utils/isPromiseLike.test.js +20 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
package/abstract/CTX.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export function uploaderBlockCtx(fnCtx: import("./Block").Block): {
|
|
|
10
10
|
'*commonProgress': number;
|
|
11
11
|
'*uploadList': never[];
|
|
12
12
|
'*uploadQueue': Queue;
|
|
13
|
-
/** @type {
|
|
14
|
-
'*collectionErrors':
|
|
13
|
+
/** @type {import('../types').OutputErrorCollection[]} */
|
|
14
|
+
'*collectionErrors': import("../types").OutputErrorCollection[];
|
|
15
15
|
/** @type {import('../types').OutputCollectionState | null} */
|
|
16
16
|
'*collectionState': import("../types").OutputCollectionState | null;
|
|
17
17
|
/** @type {import('@uploadcare/upload-client').UploadcareGroup | null} */
|
package/abstract/CTX.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CTX.d.ts","sourceRoot":"","sources":["CTX.js"],"names":[],"mappings":"AAGO,+BAA2B;AAG3B,wCADK,OAAO,SAAS,EAAE,KAAK;;;;;;EAejC;AAGK,wCADK,OAAO,SAAS,EAAE,KAAK;;;;IAMjC,
|
|
1
|
+
{"version":3,"file":"CTX.d.ts","sourceRoot":"","sources":["CTX.js"],"names":[],"mappings":"AAGO,+BAA2B;AAG3B,wCADK,OAAO,SAAS,EAAE,KAAK;;;;;;EAejC;AAGK,wCADK,OAAO,SAAS,EAAE,KAAK;;;;IAMjC,yDAAyD;yBAA9C,OAAO,UAAU,EAAE,qBAAqB,EAAE;IAErD,8DAA8D;wBAAnD,OAAO,UAAU,EAAE,qBAAqB,GAAG,IAAI;IAE1D,yEAAyE;kBAA9D,OAAO,2BAA2B,EAAE,eAAe,GAAG,IAAI;IAErE,0BAA0B;sBAAf,GAAG,CAAC,MAAM,CAAC;IAEtB,uFAAuF;6BAA5E,OAAO,oCAAoC,EAAE,oBAAoB,GAAG,IAAI;;;;;;EAEnF;sBArCoB,2BAA2B"}
|
package/abstract/CTX.js
CHANGED
|
@@ -26,7 +26,7 @@ export const uploaderBlockCtx = (fnCtx) => ({
|
|
|
26
26
|
'*commonProgress': 0,
|
|
27
27
|
'*uploadList': [],
|
|
28
28
|
'*uploadQueue': new Queue(1),
|
|
29
|
-
/** @type {
|
|
29
|
+
/** @type {import('../types').OutputErrorCollection[]} */
|
|
30
30
|
'*collectionErrors': [],
|
|
31
31
|
/** @type {import('../types').OutputCollectionState | null} */
|
|
32
32
|
'*collectionState': null,
|
|
@@ -5,7 +5,7 @@ export class SolutionBlock extends Block {
|
|
|
5
5
|
'*commonProgress': number;
|
|
6
6
|
'*uploadList': never[];
|
|
7
7
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
8
|
-
'*collectionErrors':
|
|
8
|
+
'*collectionErrors': import("../index.js").OutputErrorCollection[];
|
|
9
9
|
'*collectionState': import("../index.js").OutputCollectionState | null;
|
|
10
10
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
11
11
|
'*uploadTrigger': Set<string>;
|
|
@@ -7,7 +7,7 @@ export class UploaderBlock extends ActivityBlock {
|
|
|
7
7
|
'*commonProgress': number;
|
|
8
8
|
'*uploadList': never[];
|
|
9
9
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
10
|
-
'*collectionErrors':
|
|
10
|
+
'*collectionErrors': import("../types").OutputErrorCollection[];
|
|
11
11
|
'*collectionState': import("../types").OutputCollectionState | null;
|
|
12
12
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
13
13
|
'*uploadTrigger': Set<string>;
|
|
@@ -69,9 +69,9 @@ export class UploaderPublicApi {
|
|
|
69
69
|
* @param {string} entryId
|
|
70
70
|
* @returns {import('../types/exported.js').OutputFileEntry<TStatus>}
|
|
71
71
|
*/
|
|
72
|
-
getOutputItem
|
|
72
|
+
getOutputItem<TStatus extends import("../types").OutputFileStatus>(entryId: string): import("../types/exported.js").OutputFileEntry<TStatus>;
|
|
73
73
|
/** @template {import('../types').OutputCollectionStatus} TStatus */
|
|
74
|
-
getOutputCollectionState
|
|
74
|
+
getOutputCollectionState<TStatus extends import("../types").OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
75
75
|
/** @param {Boolean} [force] */
|
|
76
76
|
initFlow: (force?: boolean) => void;
|
|
77
77
|
doneFlow: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderPublicApi.d.ts","sourceRoot":"","sources":["UploaderPublicApi.js"],"names":[],"mappings":"AAqBA;IAOE,8DAA8D;IAC9D,iBADY,OAAO,oBAAoB,EAAE,aAAa,EAGrD;IATD;;;OAGG;IACH,aAAK;IAOL,eAAe;IACf,gCAEC;IAED,yCAEC;IAED;;iBAEC;IAED;;;;;;OAMG;IACH,iBAAkB,KAJP,MAIU,EAAE,+BAHZ;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAGT,KAF3C,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAUrD;IAEF;;;;OAIG;IACH,kBAAmB,MAJR,MAIY,EAAE,+BAHd;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAGP,KAF7C,OAAO,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAUrD;IAEF;;;;OAIG;IACH,oBAAqB,QAJV,MAIgB,EAAE,+BAHlB;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;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GACrE,CAAC,OAAO,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GACnD,CAAC,SAAS,OAAO,oBAAoB,EAAE,sBAAsB,GAC3D,CAAC,SAAS,CAAC,CAAC,GACZ,CAAC,GAAG,CAAC,CAAC,KACT,IAAI,CAWV;IAEF,2DAA2D;IAC3D,0BADc,OAAO,oBAAoB,EAAE,YAAY,CAGrD;IAEF,8BAA8B;IAC9B,gBAAiB,QADL,OACW,UAYrB;IAEF;;;OAGG;IACH,0BAOC;CACF;2CA3X0C,iCAAiC"}
|
|
@@ -215,7 +215,7 @@ export class UploaderPublicApi {
|
|
|
215
215
|
* @param {string} entryId
|
|
216
216
|
* @returns {import('../types/exported.js').OutputFileEntry<TStatus>}
|
|
217
217
|
*/
|
|
218
|
-
getOutputItem
|
|
218
|
+
getOutputItem(entryId) {
|
|
219
219
|
const uploadEntryData = /** @type {import('./uploadEntrySchema.js').UploadEntryData} */ (
|
|
220
220
|
Data.getCtx(entryId).store
|
|
221
221
|
);
|
|
@@ -260,14 +260,14 @@ export class UploaderPublicApi {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
return /** @type {import('../types/exported.js').OutputFileEntry<TStatus>} */ (outputItem);
|
|
263
|
-
}
|
|
263
|
+
}
|
|
264
264
|
|
|
265
265
|
/** @template {import('../types').OutputCollectionStatus} TStatus */
|
|
266
|
-
getOutputCollectionState
|
|
266
|
+
getOutputCollectionState() {
|
|
267
267
|
return /** @type {ReturnType<typeof buildOutputCollectionState<TStatus>>} */ (
|
|
268
268
|
buildOutputCollectionState(this._ctx)
|
|
269
269
|
);
|
|
270
|
-
}
|
|
270
|
+
}
|
|
271
271
|
|
|
272
272
|
/** @param {Boolean} [force] */
|
|
273
273
|
initFlow = (force = false) => {
|
|
@@ -64,7 +64,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
64
64
|
'*commonProgress': number;
|
|
65
65
|
'*uploadList': never[];
|
|
66
66
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
67
|
-
'*collectionErrors':
|
|
67
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
68
68
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
69
69
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
70
70
|
'*uploadTrigger': Set<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AA0FO,+BAZ+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,+BAC1C;IACN,GAAG,EAAE,CAAC,CAAC;IACP,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,KAC/C,IAAI,CAAC;IACV,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,KACX,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;CAClD,QAqCH;wCAnHqD,IAAI,SAA7C,MAAO,OAAO,aAAa,EAAE,UAAW,EACkB,KAAK,SAA9D,OAAO,CAAC,MAAM,OAAO,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,EAAG;SAExD,IAAI;UACJ,KAAK;QACL,CACT,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,GAC1D,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAC1D,KACE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// TODO: Here is troubles with tsd: it can't resolve types from `@uploadcare/cname-prefix/async` due to unsupported bundler moduleResolution.
|
|
4
4
|
// @ts-ignore
|
|
5
|
-
import { getPrefixedCdnBaseAsync } from '@uploadcare/cname-prefix/async';
|
|
5
|
+
import { getPrefixedCdnBaseAsync, isPrefixedCdnBase } from '@uploadcare/cname-prefix/async';
|
|
6
6
|
import { deserializeCsv, serializeCsv } from '../utils/comma-separated.js';
|
|
7
7
|
import { DEFAULT_CDN_CNAME } from './initialConfig.js';
|
|
8
|
+
import { isPromiseLike } from '../../utils/isPromiseLike.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @template {keyof import('../../types').ConfigType} TKey
|
|
@@ -65,10 +66,11 @@ const COMPUTED_PROPERTIES = [
|
|
|
65
66
|
key: 'cdnCname',
|
|
66
67
|
deps: ['pubkey', 'cdnCnamePrefixed'],
|
|
67
68
|
fn: ({ pubkey, cdnCname, cdnCnamePrefixed }) => {
|
|
68
|
-
if (cdnCname
|
|
69
|
-
return
|
|
69
|
+
if (pubkey && (cdnCname === DEFAULT_CDN_CNAME || isPrefixedCdnBase(cdnCname, cdnCnamePrefixed))) {
|
|
70
|
+
return getPrefixedCdnBaseAsync(pubkey, cdnCnamePrefixed);
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
+
|
|
73
|
+
return cdnCname;
|
|
72
74
|
},
|
|
73
75
|
}),
|
|
74
76
|
];
|
|
@@ -104,7 +106,7 @@ export const runSideEffects = ({ key, setValue, getValue }) => {
|
|
|
104
106
|
),
|
|
105
107
|
};
|
|
106
108
|
const result = computed.fn(args);
|
|
107
|
-
if (result
|
|
109
|
+
if (isPromiseLike(result)) {
|
|
108
110
|
const prevValue = getValue(computed.key);
|
|
109
111
|
result
|
|
110
112
|
.then((resolvedValue) => {
|
|
@@ -12,7 +12,7 @@ export class DropArea extends UploaderBlock {
|
|
|
12
12
|
'*commonProgress': number;
|
|
13
13
|
'*uploadList': never[];
|
|
14
14
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
15
|
-
'*collectionErrors':
|
|
15
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
16
16
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
17
17
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
18
18
|
'*uploadTrigger': Set<string>;
|
|
@@ -22,7 +22,7 @@ export class ExternalSource extends UploaderBlock {
|
|
|
22
22
|
'*commonProgress': number;
|
|
23
23
|
'*uploadList': never[];
|
|
24
24
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
25
|
-
'*collectionErrors':
|
|
25
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
26
26
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
27
27
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
28
28
|
'*uploadTrigger': Set<string>;
|
|
@@ -24,7 +24,7 @@ export class FileItem extends FileItemConfig {
|
|
|
24
24
|
'*commonProgress': number;
|
|
25
25
|
'*uploadList': never[];
|
|
26
26
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
27
|
-
'*collectionErrors':
|
|
27
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
28
28
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
29
29
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
30
30
|
'*uploadTrigger': Set<string>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { shrinkFile } from '@uploadcare/image-shrink';
|
|
3
3
|
import { CancelError, UploadcareError, uploadFile } from '@uploadcare/upload-client';
|
|
4
4
|
import { ActivityBlock } from '../../abstract/ActivityBlock.js';
|
|
5
|
-
import { debounce } from '../utils/debounce.js';
|
|
6
5
|
import { parseShrink } from '../../utils/parseShrink.js';
|
|
7
|
-
import {
|
|
6
|
+
import { ExternalUploadSource } from '../utils/UploadSource.js';
|
|
7
|
+
import { debounce } from '../utils/debounce.js';
|
|
8
8
|
import { throttle } from '../utils/throttle.js';
|
|
9
9
|
import { FileItemConfig } from './FileItemConfig.js';
|
|
10
10
|
|
|
@@ -134,7 +134,7 @@ export class FileItem extends FileItemConfig {
|
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
if (externalUrl && source &&
|
|
137
|
+
if (externalUrl && source && Object.values(ExternalUploadSource).includes(source)) {
|
|
138
138
|
const hint = this.l10n('waiting-for', { source: this.l10n(`src-type-${source}`) });
|
|
139
139
|
this.$.hint = hint;
|
|
140
140
|
return;
|
|
@@ -20,7 +20,7 @@ export class FileItemConfig extends UploaderBlock {
|
|
|
20
20
|
* @param {(value: import('../../abstract/uploadEntrySchema.js').UploadEntryData[K]) => void} handler_
|
|
21
21
|
* @protected
|
|
22
22
|
*/
|
|
23
|
-
protected _subEntry
|
|
23
|
+
protected _subEntry<K extends import("../../abstract/uploadEntrySchema.js").UploadEntryKeys>(prop_: K, handler_: (value: import("../../abstract/uploadEntrySchema.js").UploadEntryData[K]) => void): void;
|
|
24
24
|
/** @protected */
|
|
25
25
|
protected _reset(): void;
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItemConfig.d.ts","sourceRoot":"","sources":["FileItemConfig.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileItemConfig.d.ts","sourceRoot":"","sources":["FileItemConfig.js"],"names":[],"mappings":"AAGA;IACE,iBAAiB;IACjB,+BAAuB;IAEvB;;;OAGG;IACH,kBAHU,OAAO,qCAAqC,EAAE,oBAAoB,GAAG,IAAI,CAGrE;IAEd;;;;;;OAMG;IACH,qBANqB,CAAC,SAAR,GAAG,EAAG,EAC0F,CAAC,SAAlG,CAAE,KAAK,EAAE,OAAO,qCAAqC,EAAE,oBAAoB,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,GAAI,MAClG,CAAC,GACC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAezC;IAED;;;;;OAKG;IACH,oBAL6E,CAAC,SAAjE,OAAQ,qCAAqC,EAAE,eAAgB,SACjE,CAAC,YACD,CAAC,KAAK,EAAE,OAAO,qCAAqC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,QAoB3F;IAED,iBAAiB;IACjB,yBAOC;CAMF;8BAxE6B,iCAAiC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//@ts-check
|
|
2
|
-
|
|
3
2
|
import { UploaderBlock } from '../../abstract/UploaderBlock.js';
|
|
4
3
|
|
|
5
4
|
export class FileItemConfig extends UploaderBlock {
|
|
@@ -39,8 +38,8 @@ export class FileItemConfig extends UploaderBlock {
|
|
|
39
38
|
* @param {(value: import('../../abstract/uploadEntrySchema.js').UploadEntryData[K]) => void} handler_
|
|
40
39
|
* @protected
|
|
41
40
|
*/
|
|
42
|
-
_subEntry
|
|
43
|
-
this._withEntry(
|
|
41
|
+
_subEntry(prop_, handler_) {
|
|
42
|
+
return this._withEntry(
|
|
44
43
|
/**
|
|
45
44
|
* @template {import('../../abstract/uploadEntrySchema.js').UploadEntryKeys} K
|
|
46
45
|
* @param {import('../../abstract/uploadEntrySchema.js').UploadEntryTypedData} entry
|
|
@@ -56,6 +55,7 @@ export class FileItemConfig extends UploaderBlock {
|
|
|
56
55
|
this._entrySubs.add(sub);
|
|
57
56
|
},
|
|
58
57
|
)(prop_, handler_);
|
|
58
|
+
}
|
|
59
59
|
|
|
60
60
|
/** @protected */
|
|
61
61
|
_reset() {
|
|
@@ -6,7 +6,7 @@ export class SimpleBtn extends UploaderBlock {
|
|
|
6
6
|
'*commonProgress': number;
|
|
7
7
|
'*uploadList': never[];
|
|
8
8
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
9
|
-
'*collectionErrors':
|
|
9
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
10
10
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
11
11
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
12
12
|
'*uploadTrigger': Set<string>;
|
|
@@ -22,7 +22,7 @@ export class SourceBtn extends UploaderBlock {
|
|
|
22
22
|
'*commonProgress': number;
|
|
23
23
|
'*uploadList': never[];
|
|
24
24
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
25
|
-
'*collectionErrors':
|
|
25
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
26
26
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
27
27
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
28
28
|
'*uploadTrigger': Set<string>;
|
package/blocks/Thumb/Thumb.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export class Thumb extends FileItemConfig {
|
|
|
15
15
|
'*commonProgress': number;
|
|
16
16
|
'*uploadList': never[];
|
|
17
17
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
18
|
-
'*collectionErrors':
|
|
18
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
19
19
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
20
20
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
21
21
|
'*uploadTrigger': Set<string>;
|
|
@@ -25,7 +25,7 @@ export class UploadList extends UploaderBlock {
|
|
|
25
25
|
'*commonProgress': number;
|
|
26
26
|
'*uploadList': never[];
|
|
27
27
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
28
|
-
'*collectionErrors':
|
|
28
|
+
'*collectionErrors': import("../../types").OutputErrorCollection[];
|
|
29
29
|
'*collectionState': import("../../types").OutputCollectionState | null;
|
|
30
30
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
31
31
|
'*uploadTrigger': Set<string>;
|
package/env.d.ts
CHANGED
package/env.js
CHANGED
package/index.ssr.d.ts
CHANGED
|
@@ -550,7 +550,7 @@ export namespace ModalEvents {
|
|
|
550
550
|
let DESTROY: string;
|
|
551
551
|
}
|
|
552
552
|
export const PACKAGE_NAME: "blocks";
|
|
553
|
-
export const PACKAGE_VERSION: "1.19.
|
|
553
|
+
export const PACKAGE_VERSION: "1.19.4";
|
|
554
554
|
export const PresenceToggle: {
|
|
555
555
|
new (): {};
|
|
556
556
|
template: string;
|
package/index.ssr.js
CHANGED
|
@@ -1072,7 +1072,7 @@ export const ModalEvents = {
|
|
|
1072
1072
|
DESTROY: "modal:destroy",
|
|
1073
1073
|
};
|
|
1074
1074
|
export const PACKAGE_NAME = `blocks`;
|
|
1075
|
-
export const PACKAGE_VERSION = `1.19.
|
|
1075
|
+
export const PACKAGE_VERSION = `1.19.4`;
|
|
1076
1076
|
export const PresenceToggle = class {
|
|
1077
1077
|
static template = `<slot></slot> `;
|
|
1078
1078
|
static reg = () => {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/file-uploader",
|
|
3
|
-
"version": "1.20.0-rc.
|
|
3
|
+
"version": "1.20.0-rc.2",
|
|
4
4
|
"description": "Building blocks for Uploadcare products integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web components",
|
|
@@ -143,10 +143,10 @@
|
|
|
143
143
|
"license": "MIT",
|
|
144
144
|
"dependencies": {
|
|
145
145
|
"@symbiotejs/symbiote": "^1.11.7",
|
|
146
|
-
"@uploadcare/cname-prefix": "^6.
|
|
147
|
-
"@uploadcare/image-shrink": "^6.
|
|
148
|
-
"@uploadcare/quality-insights": "^6.
|
|
149
|
-
"@uploadcare/upload-client": "^6.
|
|
146
|
+
"@uploadcare/cname-prefix": "^6.17.0",
|
|
147
|
+
"@uploadcare/image-shrink": "^6.17.0",
|
|
148
|
+
"@uploadcare/quality-insights": "^6.17.0",
|
|
149
|
+
"@uploadcare/upload-client": "^6.17.0",
|
|
150
150
|
"keyux": "^0.7.1"
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -6,7 +6,7 @@ export class FileUploaderInline extends SolutionBlock {
|
|
|
6
6
|
'*commonProgress': number;
|
|
7
7
|
'*uploadList': never[];
|
|
8
8
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
9
|
-
'*collectionErrors':
|
|
9
|
+
'*collectionErrors': import("./index.js").OutputErrorCollection[];
|
|
10
10
|
'*collectionState': import("./index.js").OutputCollectionState | null;
|
|
11
11
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
12
12
|
'*uploadTrigger': Set<string>;
|
|
@@ -8,7 +8,7 @@ export class FileUploaderMinimal extends SolutionBlock {
|
|
|
8
8
|
'*commonProgress': number;
|
|
9
9
|
'*uploadList': never[];
|
|
10
10
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
11
|
-
'*collectionErrors':
|
|
11
|
+
'*collectionErrors': import("./index.js").OutputErrorCollection[];
|
|
12
12
|
'*collectionState': import("./index.js").OutputCollectionState | null;
|
|
13
13
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
14
14
|
'*uploadTrigger': Set<string>;
|
|
@@ -5,7 +5,7 @@ export class FileUploaderRegular extends SolutionBlock {
|
|
|
5
5
|
'*commonProgress': number;
|
|
6
6
|
'*uploadList': never[];
|
|
7
7
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
8
|
-
'*collectionErrors':
|
|
8
|
+
'*collectionErrors': import("./index.js").OutputErrorCollection[];
|
|
9
9
|
'*collectionState': import("./index.js").OutputCollectionState | null;
|
|
10
10
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
11
11
|
'*uploadTrigger': Set<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPromiseLike.d.ts","sourceRoot":"","sources":["isPromiseLike.js"],"names":[],"mappings":"AAMO,qCAHI,OAAO,GACL,KAAK,gBAAW,CAO5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @returns {value is Promise}
|
|
6
|
+
*/
|
|
7
|
+
export const isPromiseLike = (value) => {
|
|
8
|
+
return (
|
|
9
|
+
value instanceof Promise ||
|
|
10
|
+
Boolean(value && typeof value === 'object' && 'then' in value && typeof value.then === 'function')
|
|
11
|
+
);
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPromiseLike.test.d.ts","sourceRoot":"","sources":["isPromiseLike.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isPromiseLike } from './isPromiseLike';
|
|
2
|
+
import { expect } from '@esm-bundle/chai';
|
|
3
|
+
|
|
4
|
+
describe('isPromiseLike', () => {
|
|
5
|
+
it('should return true for Promise instances', () => {
|
|
6
|
+
expect(isPromiseLike(Promise.resolve())).to.be.true;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should return true for thenable objects', () => {
|
|
10
|
+
const thenable = { then: () => {} };
|
|
11
|
+
expect(isPromiseLike(thenable)).to.be.true;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return false for non-thenable objects', () => {
|
|
15
|
+
expect(isPromiseLike({})).to.be.false;
|
|
16
|
+
expect(isPromiseLike(null)).to.be.false;
|
|
17
|
+
expect(isPromiseLike(42)).to.be.false;
|
|
18
|
+
expect(isPromiseLike('string')).to.be.false;
|
|
19
|
+
});
|
|
20
|
+
});
|