@uploadcare/file-uploader 1.19.2 → 1.19.4-alpha.0
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/blocks/Config/side-effects.d.ts.map +1 -1
- package/blocks/Config/side-effects.js +2 -1
- package/blocks/Img/ImgBase.d.ts.map +1 -1
- package/blocks/Img/ImgBase.js +5 -3
- 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 +4 -2
- package/solutions/file-uploader/minimal/index.css +14 -2
- package/types/exported.d.ts +54 -60
- 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.css +1 -1
- 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 +3 -3
|
@@ -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"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
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
|
|
@@ -105,7 +106,7 @@ export const runSideEffects = ({ key, setValue, getValue }) => {
|
|
|
105
106
|
),
|
|
106
107
|
};
|
|
107
108
|
const result = computed.fn(args);
|
|
108
|
-
if (result
|
|
109
|
+
if (isPromiseLike(result)) {
|
|
109
110
|
const prevValue = getValue(computed.key);
|
|
110
111
|
result
|
|
111
112
|
.then((resolvedValue) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImgBase.d.ts","sourceRoot":"","sources":["ImgBase.js"],"names":[],"mappings":"AAgBA;IACE,uBAAmB;IACnB,8BAA0B;IAE1B;;;OAGG;IACH,gBAMC;IAED;;;;;OAKG;IACH,8BAFa,eAAe,CAoB3B;IAED;;;;;OAKG;IACH,uDAWC;IAED;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"ImgBase.d.ts","sourceRoot":"","sources":["ImgBase.js"],"names":[],"mappings":"AAgBA;IACE,uBAAmB;IACnB,8BAA0B;IAE1B;;;OAGG;IACH,gBAMC;IAED;;;;;OAKG;IACH,8BAFa,eAAe,CAoB3B;IAED;;;;;OAKG;IACH,uDAWC;IAED;;;;;OAKG;IACH,oBA+DC;IAED;;;;OAIG;IACH,kBAUC;IAED;;;;OAIG;IACH,eAJW,WAAW,8CAcrB;IAED,oCAAoC;IACpC,sBADY,gBAAgB,QAY3B;IAED,+BAA+B;IAC/B,WADW,gBAAgB,CAO1B;IAED;;;;;;MAUC;IAED,2BAEC;IAED,sBAEC;IAED,mCAOC;IAED,4BAEC;IAED,8BAA8B;IAC9B,aADY,WAAW,QAgBtB;IAED,oBAsBC;IAED,cAEC;IAED,yBAEC;IAED,yBAUC;IAED;;;;aAQC;IAED;;aAGC;IAED;;;;qBAqBC;IAED,6BA8DC;IAED,aAMC;CACF;0BApZyB,gBAAgB"}
|
package/blocks/Img/ImgBase.js
CHANGED
|
@@ -87,9 +87,11 @@ export class ImgBase extends ImgConfig {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Localhost + relative image path (DO NOTHING):
|
|
90
|
-
if (DEV_MODE && this.$$('src') && !this.$$('src').includes('//')) {
|
|
91
|
-
|
|
92
|
-
}
|
|
90
|
+
// if (DEV_MODE && this.$$('src') && !this.$$('src').includes('//')) {
|
|
91
|
+
// return this._proxyUrl(this.$$('src'));
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
console.log({ self: this });
|
|
93
95
|
|
|
94
96
|
let cdnModifiers = this._getCdnModifiers(size, blur);
|
|
95
97
|
|
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.3";
|
|
554
554
|
export const PresenceToggle: {
|
|
555
555
|
new (): {};
|
|
556
556
|
template: string;
|
package/index.ssr.js
CHANGED
|
@@ -1070,7 +1070,7 @@ export const ModalEvents = {
|
|
|
1070
1070
|
DESTROY: "modal:destroy",
|
|
1071
1071
|
};
|
|
1072
1072
|
export const PACKAGE_NAME = `blocks`;
|
|
1073
|
-
export const PACKAGE_VERSION = `1.19.
|
|
1073
|
+
export const PACKAGE_VERSION = `1.19.3`;
|
|
1074
1074
|
export const PresenceToggle = class {
|
|
1075
1075
|
static template = `<slot></slot> `;
|
|
1076
1076
|
static reg = () => {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/file-uploader",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.4-alpha.0",
|
|
4
4
|
"description": "Building blocks for Uploadcare products integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web components",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"MIT"
|
|
36
36
|
],
|
|
37
37
|
"type": "module",
|
|
38
|
-
"sideEffects": [
|
|
38
|
+
"sideEffects": [
|
|
39
|
+
"*.css"
|
|
40
|
+
],
|
|
39
41
|
"module": "./index.js",
|
|
40
42
|
"exports": {
|
|
41
43
|
".": {
|
|
@@ -62,9 +62,14 @@
|
|
|
62
62
|
width: 100%;
|
|
63
63
|
height: unset;
|
|
64
64
|
padding: 4px;
|
|
65
|
+
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
/* border: 1px dashed var(--uc-border); */
|
|
68
|
+
/* border-radius: calc(var(--uc-radius) * 1.75); */
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[uc-file-uploader-minimal] uc-upload-list uc-file-item {
|
|
65
72
|
background-color: var(--uc-background);
|
|
66
|
-
border: 1px dashed var(--uc-border);
|
|
67
|
-
border-radius: calc(var(--uc-radius) * 1.75);
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
[uc-file-uploader-minimal] uc-upload-list .uc-files {
|
|
@@ -145,3 +150,10 @@
|
|
|
145
150
|
[uc-file-uploader-minimal][mode='grid'] uc-upload-list .uc-files .uc-add-more-btn > uc-icon {
|
|
146
151
|
display: flex;
|
|
147
152
|
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
https://86beff04885a8328d3b0.ucr.io/-/resize/100x/-/blur/100/-/@clib/blocks/1.19.3/uc-img/https://cdn.skyledge.com/7c2e222b-1857-4363-b531-408f4a650c99/?token=exp=1753085298~acl=/7c2e222b-1857-4363-b531-408f4a650c99/*~hmac=redacted
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/* https://aadfab151dfea016a1b0.ucr.io/https://files.buildwithfern.com/uploadcare.docs.buildwithfern.com/docs/2025-07-18T10:45:26.503Z/assets/logo-light.svg
|
|
159
|
+
https://8ffef950a74ff210dafb.ucr.io/https://files.buildwithfern.com/uploadcare.docs.buildwithfern.com/docs/2025-07-18T10:45:26.503Z/assets/logo-light.svg */
|
package/types/exported.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export type ConfigType = {
|
|
|
80
80
|
*/
|
|
81
81
|
sourceList: string;
|
|
82
82
|
/**
|
|
83
|
-
* Top-level origin for the uploader.
|
|
83
|
+
* Top-level origin for the uploader.
|
|
84
84
|
* This is used for Google Drive Picker if there is no access to the origin due to the cross-origin policy.
|
|
85
85
|
*/
|
|
86
86
|
topLevelOrigin: string;
|
|
@@ -302,7 +302,7 @@ export type ConfigType = {
|
|
|
302
302
|
|
|
303
303
|
cloudImageEditorMaskHref: string | null;
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
/**
|
|
306
306
|
* Adds data-testid attributes to the each block. Needed for testing purposes.
|
|
307
307
|
* @default false
|
|
308
308
|
*/
|
|
@@ -314,8 +314,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
|
|
|
314
314
|
|
|
315
315
|
export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
|
|
316
316
|
? T extends Uncapitalize<T>
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
? `${Uncapitalize<C>}${KebabCase<T>}`
|
|
318
|
+
: `${Uncapitalize<C>}-${KebabCase<T>}`
|
|
319
319
|
: S;
|
|
320
320
|
export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
|
|
321
321
|
export type LowerCase<S extends string> = Lowercase<S>;
|
|
@@ -323,10 +323,8 @@ export type LowerCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T
|
|
|
323
323
|
|
|
324
324
|
export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
|
|
325
325
|
|
|
326
|
-
export type OutputCustomErrorType = 'CUSTOM_ERROR';
|
|
327
|
-
|
|
328
326
|
export type OutputFileErrorType =
|
|
329
|
-
|
|
|
327
|
+
| 'CUSTOM_ERROR'
|
|
330
328
|
| 'NOT_AN_IMAGE'
|
|
331
329
|
| 'FORBIDDEN_FILE_TYPE'
|
|
332
330
|
| 'FILE_SIZE_EXCEEDED'
|
|
@@ -334,11 +332,7 @@ export type OutputFileErrorType =
|
|
|
334
332
|
| 'NETWORK_ERROR'
|
|
335
333
|
| 'UNKNOWN_ERROR';
|
|
336
334
|
|
|
337
|
-
export type OutputCollectionErrorType =
|
|
338
|
-
| OutputCustomErrorType
|
|
339
|
-
| 'SOME_FILES_HAS_ERRORS'
|
|
340
|
-
| 'TOO_MANY_FILES'
|
|
341
|
-
| 'TOO_FEW_FILES';
|
|
335
|
+
export type OutputCollectionErrorType = 'CUSTOM_ERROR' | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
|
|
342
336
|
|
|
343
337
|
export type OutputFileErrorPayload = {
|
|
344
338
|
entry: OutputFileEntry;
|
|
@@ -372,19 +366,19 @@ export type OutputErrorTypePayload = {
|
|
|
372
366
|
CUSTOM_ERROR: Record<string, unknown>;
|
|
373
367
|
};
|
|
374
368
|
|
|
375
|
-
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends
|
|
369
|
+
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends 'CUSTOM_ERROR'
|
|
376
370
|
? {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
371
|
+
type: T;
|
|
372
|
+
message: string;
|
|
373
|
+
payload?: OutputErrorTypePayload[T];
|
|
374
|
+
}
|
|
381
375
|
: T extends keyof OutputErrorTypePayload
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
376
|
+
? {
|
|
377
|
+
type: T;
|
|
378
|
+
message: string;
|
|
379
|
+
payload?: OutputErrorTypePayload[T];
|
|
380
|
+
}
|
|
381
|
+
: never;
|
|
388
382
|
|
|
389
383
|
export type OutputErrorFile = OutputError<OutputFileErrorType>;
|
|
390
384
|
|
|
@@ -406,7 +400,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
406
400
|
fullPath: string | null;
|
|
407
401
|
source: SourceTypes | null;
|
|
408
402
|
} & (
|
|
409
|
-
|
|
403
|
+
| {
|
|
410
404
|
status: 'success';
|
|
411
405
|
fileInfo: UploadcareFile;
|
|
412
406
|
uuid: string;
|
|
@@ -418,7 +412,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
418
412
|
isRemoved: false;
|
|
419
413
|
errors: [];
|
|
420
414
|
}
|
|
421
|
-
|
|
415
|
+
| {
|
|
422
416
|
status: 'failed';
|
|
423
417
|
fileInfo: UploadcareFile | null;
|
|
424
418
|
uuid: string | null;
|
|
@@ -430,7 +424,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
430
424
|
isRemoved: false;
|
|
431
425
|
errors: OutputError<OutputFileErrorType>[];
|
|
432
426
|
}
|
|
433
|
-
|
|
427
|
+
| {
|
|
434
428
|
status: 'uploading';
|
|
435
429
|
fileInfo: null;
|
|
436
430
|
uuid: null;
|
|
@@ -442,7 +436,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
442
436
|
isRemoved: false;
|
|
443
437
|
errors: [];
|
|
444
438
|
}
|
|
445
|
-
|
|
439
|
+
| {
|
|
446
440
|
status: 'removed';
|
|
447
441
|
fileInfo: UploadcareFile | null;
|
|
448
442
|
uuid: string | null;
|
|
@@ -454,7 +448,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
454
448
|
isRemoved: true;
|
|
455
449
|
errors: OutputError<OutputFileErrorType>[];
|
|
456
450
|
}
|
|
457
|
-
|
|
451
|
+
| {
|
|
458
452
|
status: 'idle';
|
|
459
453
|
fileInfo: null;
|
|
460
454
|
uuid: null;
|
|
@@ -466,7 +460,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
466
460
|
isRemoved: false;
|
|
467
461
|
errors: [];
|
|
468
462
|
}
|
|
469
|
-
|
|
463
|
+
);
|
|
470
464
|
|
|
471
465
|
export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
|
|
472
466
|
|
|
@@ -490,43 +484,43 @@ export type OutputCollectionState<
|
|
|
490
484
|
} & (TGroupFlag extends 'has-group'
|
|
491
485
|
? { group: UploadcareGroup }
|
|
492
486
|
: TGroupFlag extends 'maybe-has-group'
|
|
493
|
-
|
|
494
|
-
|
|
487
|
+
? { group: UploadcareGroup | null }
|
|
488
|
+
: never) &
|
|
495
489
|
(
|
|
496
490
|
| {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
491
|
+
status: 'idle';
|
|
492
|
+
isFailed: false;
|
|
493
|
+
isUploading: false;
|
|
494
|
+
isSuccess: false;
|
|
495
|
+
errors: [];
|
|
496
|
+
allEntries: OutputFileEntry<'idle' | 'success'>[];
|
|
497
|
+
}
|
|
504
498
|
| {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
499
|
+
status: 'uploading';
|
|
500
|
+
isFailed: false;
|
|
501
|
+
isUploading: true;
|
|
502
|
+
isSuccess: false;
|
|
503
|
+
errors: [];
|
|
504
|
+
allEntries: OutputFileEntry[];
|
|
505
|
+
}
|
|
512
506
|
| {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
507
|
+
status: 'success';
|
|
508
|
+
isFailed: false;
|
|
509
|
+
isUploading: false;
|
|
510
|
+
isSuccess: true;
|
|
511
|
+
errors: [];
|
|
512
|
+
allEntries: OutputFileEntry<'success'>[];
|
|
513
|
+
}
|
|
520
514
|
| {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
515
|
+
status: 'failed';
|
|
516
|
+
isFailed: true;
|
|
517
|
+
isUploading: false;
|
|
518
|
+
isSuccess: false;
|
|
519
|
+
errors: OutputError<OutputCollectionErrorType>[];
|
|
520
|
+
allEntries: OutputFileEntry[];
|
|
521
|
+
}
|
|
528
522
|
);
|
|
529
523
|
|
|
530
524
|
export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
|
|
531
525
|
|
|
532
|
-
export {
|
|
526
|
+
export {};
|
|
@@ -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
|
+
});
|