@uploadcare/file-uploader 1.13.0-alpha.3 → 1.13.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/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +4 -11
- package/blocks/CameraSource/CameraSource.d.ts +12 -22
- package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +81 -83
- package/blocks/CameraSource/camera-source.css +1 -0
- package/blocks/CameraSource/constants.d.ts +15 -0
- package/blocks/CameraSource/constants.d.ts.map +1 -0
- package/blocks/CameraSource/constants.js +17 -0
- package/blocks/CloudImageEditor/src/CropFrame.d.ts +0 -7
- package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CropFrame.js +0 -50
- package/blocks/CloudImageEditor/src/css/common.css +0 -4
- package/blocks/CloudImageEditor/src/lib/parseTabs.js +2 -2
- package/blocks/Config/Config.d.ts +3 -3
- package/blocks/Config/Config.d.ts.map +1 -1
- package/blocks/Config/Config.js +13 -3
- package/blocks/Config/assertions.d.ts +5 -0
- package/blocks/Config/assertions.d.ts.map +1 -0
- package/blocks/Config/assertions.js +37 -0
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +4 -5
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +20 -8
- package/blocks/Config/side-effects.d.ts +7 -0
- package/blocks/Config/side-effects.d.ts.map +1 -0
- package/blocks/Config/side-effects.js +32 -0
- package/blocks/UploadList/upload-list.css +1 -0
- package/blocks/utils/comma-separated.d.ts +1 -1
- package/blocks/utils/comma-separated.d.ts.map +1 -1
- package/blocks/utils/comma-separated.js +5 -2
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +1 -15
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +6 -17
- package/package.json +3 -5
- package/types/exported.d.ts +81 -66
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +1 -1
- package/web/uc-cloud-image-editor.min.css +1 -1
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +1 -1
- 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 +3 -3
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
package/types/exported.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LocaleDefinition } from '../abstract/localeRegistry';
|
|
2
2
|
import type { complexConfigKeys } from '../blocks/Config/Config';
|
|
3
3
|
import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
|
|
4
|
+
import type { CameraMode } from '../blocks/CameraSource/CameraSource';
|
|
4
5
|
|
|
5
6
|
export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
|
|
6
7
|
export type { UploaderPublicApi } from '../abstract/UploaderPublicApi';
|
|
@@ -21,7 +22,7 @@ export type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatur
|
|
|
21
22
|
export type IconHrefResolver = (iconName: string) => string;
|
|
22
23
|
export type FileValidators = FuncFileValidator[];
|
|
23
24
|
export type CollectionValidators = FuncCollectionValidator[];
|
|
24
|
-
export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes
|
|
25
|
+
export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes;
|
|
25
26
|
|
|
26
27
|
export type ConfigType = {
|
|
27
28
|
/**
|
|
@@ -240,11 +241,20 @@ export type ConfigType = {
|
|
|
240
241
|
collectionValidators: CollectionValidators;
|
|
241
242
|
|
|
242
243
|
/**
|
|
243
|
-
* The
|
|
244
|
+
* The camera modes to enable in the camera modal,
|
|
245
|
+
* it is possible to select photo or video capture.
|
|
246
|
+
* The first mode is the default mode.
|
|
247
|
+
* @default 'photo,video'
|
|
248
|
+
*/
|
|
249
|
+
cameraModes: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The default tab to open in the camera modal,
|
|
244
253
|
* it is possible to select video or photo capture
|
|
245
|
-
* @default '
|
|
254
|
+
* @default 'null'
|
|
255
|
+
* @deprecated - use `cameraModes` instead
|
|
246
256
|
*/
|
|
247
|
-
defaultCameraMode:
|
|
257
|
+
defaultCameraMode: CameraMode | null;
|
|
248
258
|
/**
|
|
249
259
|
* Enable audio recording.
|
|
250
260
|
* @default true
|
|
@@ -252,23 +262,22 @@ export type ConfigType = {
|
|
|
252
262
|
enableAudioRecording: boolean;
|
|
253
263
|
/**
|
|
254
264
|
* Enable video recording.
|
|
255
|
-
* @
|
|
265
|
+
* @deprecated - use `cameraModes` instead
|
|
266
|
+
* @default null
|
|
256
267
|
*/
|
|
257
|
-
enableVideoRecording: boolean;
|
|
268
|
+
enableVideoRecording: boolean | null;
|
|
258
269
|
|
|
259
270
|
/**
|
|
260
271
|
* The maximum duration of the video recording in seconds
|
|
261
272
|
* @default null
|
|
262
273
|
*/
|
|
263
|
-
maxVideoRecordingDuration: number | null
|
|
274
|
+
maxVideoRecordingDuration: number | null;
|
|
264
275
|
|
|
265
276
|
/**
|
|
266
|
-
* A dictionary object that can contain
|
|
277
|
+
* A dictionary object that can contain
|
|
267
278
|
* the following properties from MediaRecorderOptions
|
|
268
279
|
*/
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
cloudImageEditorMaskHref: string | null;
|
|
280
|
+
mediaRecorderOptions: MediaRecorderOptions | null;
|
|
272
281
|
};
|
|
273
282
|
export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
274
283
|
export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -276,8 +285,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
|
|
|
276
285
|
|
|
277
286
|
export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
|
|
278
287
|
? T extends Uncapitalize<T>
|
|
279
|
-
|
|
280
|
-
|
|
288
|
+
? `${Uncapitalize<C>}${KebabCase<T>}`
|
|
289
|
+
: `${Uncapitalize<C>}-${KebabCase<T>}`
|
|
281
290
|
: S;
|
|
282
291
|
export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
|
|
283
292
|
export type LowerCase<S extends string> = Lowercase<S>;
|
|
@@ -285,9 +294,10 @@ export type LowerCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T
|
|
|
285
294
|
|
|
286
295
|
export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
|
|
287
296
|
|
|
288
|
-
export type OutputCustomErrorType = 'CUSTOM_ERROR'
|
|
297
|
+
export type OutputCustomErrorType = 'CUSTOM_ERROR';
|
|
289
298
|
|
|
290
|
-
export type OutputFileErrorType =
|
|
299
|
+
export type OutputFileErrorType =
|
|
300
|
+
| OutputCustomErrorType
|
|
291
301
|
| 'NOT_AN_IMAGE'
|
|
292
302
|
| 'FORBIDDEN_FILE_TYPE'
|
|
293
303
|
| 'FILE_SIZE_EXCEEDED'
|
|
@@ -295,7 +305,11 @@ export type OutputFileErrorType = OutputCustomErrorType
|
|
|
295
305
|
| 'NETWORK_ERROR'
|
|
296
306
|
| 'UNKNOWN_ERROR';
|
|
297
307
|
|
|
298
|
-
export type OutputCollectionErrorType =
|
|
308
|
+
export type OutputCollectionErrorType =
|
|
309
|
+
| OutputCustomErrorType
|
|
310
|
+
| 'SOME_FILES_HAS_ERRORS'
|
|
311
|
+
| 'TOO_MANY_FILES'
|
|
312
|
+
| 'TOO_FEW_FILES';
|
|
299
313
|
|
|
300
314
|
export type OutputFileErrorPayload = {
|
|
301
315
|
entry: OutputFileEntry;
|
|
@@ -329,22 +343,23 @@ export type OutputErrorTypePayload = {
|
|
|
329
343
|
CUSTOM_ERROR: Record<string, unknown>;
|
|
330
344
|
};
|
|
331
345
|
|
|
332
|
-
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> =
|
|
333
|
-
T extends OutputCustomErrorType
|
|
346
|
+
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType
|
|
334
347
|
? {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
: T extends keyof OutputErrorTypePayload
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
type?: T;
|
|
349
|
+
message: string;
|
|
350
|
+
payload?: OutputErrorTypePayload[T];
|
|
351
|
+
}
|
|
352
|
+
: T extends keyof OutputErrorTypePayload
|
|
353
|
+
? {
|
|
354
|
+
type: T;
|
|
355
|
+
message: string;
|
|
356
|
+
payload?: OutputErrorTypePayload[T];
|
|
357
|
+
}
|
|
358
|
+
: never;
|
|
344
359
|
|
|
345
|
-
export type OutputErrorFile = OutputError<OutputFileErrorType
|
|
360
|
+
export type OutputErrorFile = OutputError<OutputFileErrorType>;
|
|
346
361
|
|
|
347
|
-
export type OutputErrorCollection = OutputError<OutputCollectionErrorType
|
|
362
|
+
export type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
|
|
348
363
|
|
|
349
364
|
export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
|
|
350
365
|
status: TStatus;
|
|
@@ -362,7 +377,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
362
377
|
fullPath: string | null;
|
|
363
378
|
source: SourceTypes | null;
|
|
364
379
|
} & (
|
|
365
|
-
|
|
380
|
+
| {
|
|
366
381
|
status: 'success';
|
|
367
382
|
fileInfo: UploadcareFile;
|
|
368
383
|
uuid: string;
|
|
@@ -374,7 +389,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
374
389
|
isRemoved: false;
|
|
375
390
|
errors: [];
|
|
376
391
|
}
|
|
377
|
-
|
|
392
|
+
| {
|
|
378
393
|
status: 'failed';
|
|
379
394
|
fileInfo: UploadcareFile | null;
|
|
380
395
|
uuid: string | null;
|
|
@@ -386,7 +401,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
386
401
|
isRemoved: false;
|
|
387
402
|
errors: OutputError<OutputFileErrorType>[];
|
|
388
403
|
}
|
|
389
|
-
|
|
404
|
+
| {
|
|
390
405
|
status: 'uploading';
|
|
391
406
|
fileInfo: null;
|
|
392
407
|
uuid: null;
|
|
@@ -398,7 +413,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
398
413
|
isRemoved: false;
|
|
399
414
|
errors: [];
|
|
400
415
|
}
|
|
401
|
-
|
|
416
|
+
| {
|
|
402
417
|
status: 'removed';
|
|
403
418
|
fileInfo: UploadcareFile | null;
|
|
404
419
|
uuid: string | null;
|
|
@@ -410,7 +425,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
410
425
|
isRemoved: true;
|
|
411
426
|
errors: OutputError<OutputFileErrorType>[];
|
|
412
427
|
}
|
|
413
|
-
|
|
428
|
+
| {
|
|
414
429
|
status: 'idle';
|
|
415
430
|
fileInfo: null;
|
|
416
431
|
uuid: null;
|
|
@@ -422,7 +437,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
422
437
|
isRemoved: false;
|
|
423
438
|
errors: [];
|
|
424
439
|
}
|
|
425
|
-
|
|
440
|
+
);
|
|
426
441
|
|
|
427
442
|
export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
|
|
428
443
|
|
|
@@ -446,43 +461,43 @@ export type OutputCollectionState<
|
|
|
446
461
|
} & (TGroupFlag extends 'has-group'
|
|
447
462
|
? { group: UploadcareGroup }
|
|
448
463
|
: TGroupFlag extends 'maybe-has-group'
|
|
449
|
-
|
|
450
|
-
|
|
464
|
+
? { group: UploadcareGroup | null }
|
|
465
|
+
: never) &
|
|
451
466
|
(
|
|
452
467
|
| {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
468
|
+
status: 'idle';
|
|
469
|
+
isFailed: false;
|
|
470
|
+
isUploading: false;
|
|
471
|
+
isSuccess: false;
|
|
472
|
+
errors: [];
|
|
473
|
+
allEntries: OutputFileEntry<'idle' | 'success'>[];
|
|
474
|
+
}
|
|
460
475
|
| {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
476
|
+
status: 'uploading';
|
|
477
|
+
isFailed: false;
|
|
478
|
+
isUploading: true;
|
|
479
|
+
isSuccess: false;
|
|
480
|
+
errors: [];
|
|
481
|
+
allEntries: OutputFileEntry[];
|
|
482
|
+
}
|
|
468
483
|
| {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
484
|
+
status: 'success';
|
|
485
|
+
isFailed: false;
|
|
486
|
+
isUploading: false;
|
|
487
|
+
isSuccess: true;
|
|
488
|
+
errors: [];
|
|
489
|
+
allEntries: OutputFileEntry<'success'>[];
|
|
490
|
+
}
|
|
476
491
|
| {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
status: 'failed';
|
|
493
|
+
isFailed: true;
|
|
494
|
+
isUploading: false;
|
|
495
|
+
isSuccess: false;
|
|
496
|
+
errors: OutputError<OutputCollectionErrorType>[];
|
|
497
|
+
allEntries: OutputFileEntry[];
|
|
498
|
+
}
|
|
484
499
|
);
|
|
485
500
|
|
|
486
501
|
export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
|
|
487
502
|
|
|
488
|
-
export {
|
|
503
|
+
export {};
|