@uploadcare/file-uploader 1.13.0-alpha.2 → 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/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 -3
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +20 -7
- 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/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 -15
- package/package.json +3 -5
- package/types/exported.d.ts +81 -64
- 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.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.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,21 +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
|
-
|
|
280
|
+
mediaRecorderOptions: MediaRecorderOptions | null;
|
|
270
281
|
};
|
|
271
282
|
export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
272
283
|
export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -274,8 +285,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
|
|
|
274
285
|
|
|
275
286
|
export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
|
|
276
287
|
? T extends Uncapitalize<T>
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
? `${Uncapitalize<C>}${KebabCase<T>}`
|
|
289
|
+
: `${Uncapitalize<C>}-${KebabCase<T>}`
|
|
279
290
|
: S;
|
|
280
291
|
export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
|
|
281
292
|
export type LowerCase<S extends string> = Lowercase<S>;
|
|
@@ -283,9 +294,10 @@ export type LowerCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T
|
|
|
283
294
|
|
|
284
295
|
export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
|
|
285
296
|
|
|
286
|
-
export type OutputCustomErrorType = 'CUSTOM_ERROR'
|
|
297
|
+
export type OutputCustomErrorType = 'CUSTOM_ERROR';
|
|
287
298
|
|
|
288
|
-
export type OutputFileErrorType =
|
|
299
|
+
export type OutputFileErrorType =
|
|
300
|
+
| OutputCustomErrorType
|
|
289
301
|
| 'NOT_AN_IMAGE'
|
|
290
302
|
| 'FORBIDDEN_FILE_TYPE'
|
|
291
303
|
| 'FILE_SIZE_EXCEEDED'
|
|
@@ -293,7 +305,11 @@ export type OutputFileErrorType = OutputCustomErrorType
|
|
|
293
305
|
| 'NETWORK_ERROR'
|
|
294
306
|
| 'UNKNOWN_ERROR';
|
|
295
307
|
|
|
296
|
-
export type OutputCollectionErrorType =
|
|
308
|
+
export type OutputCollectionErrorType =
|
|
309
|
+
| OutputCustomErrorType
|
|
310
|
+
| 'SOME_FILES_HAS_ERRORS'
|
|
311
|
+
| 'TOO_MANY_FILES'
|
|
312
|
+
| 'TOO_FEW_FILES';
|
|
297
313
|
|
|
298
314
|
export type OutputFileErrorPayload = {
|
|
299
315
|
entry: OutputFileEntry;
|
|
@@ -327,22 +343,23 @@ export type OutputErrorTypePayload = {
|
|
|
327
343
|
CUSTOM_ERROR: Record<string, unknown>;
|
|
328
344
|
};
|
|
329
345
|
|
|
330
|
-
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> =
|
|
331
|
-
T extends OutputCustomErrorType
|
|
346
|
+
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType
|
|
332
347
|
? {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
: T extends keyof OutputErrorTypePayload
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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;
|
|
342
359
|
|
|
343
|
-
export type OutputErrorFile = OutputError<OutputFileErrorType
|
|
360
|
+
export type OutputErrorFile = OutputError<OutputFileErrorType>;
|
|
344
361
|
|
|
345
|
-
export type OutputErrorCollection = OutputError<OutputCollectionErrorType
|
|
362
|
+
export type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
|
|
346
363
|
|
|
347
364
|
export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
|
|
348
365
|
status: TStatus;
|
|
@@ -360,7 +377,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
360
377
|
fullPath: string | null;
|
|
361
378
|
source: SourceTypes | null;
|
|
362
379
|
} & (
|
|
363
|
-
|
|
380
|
+
| {
|
|
364
381
|
status: 'success';
|
|
365
382
|
fileInfo: UploadcareFile;
|
|
366
383
|
uuid: string;
|
|
@@ -372,7 +389,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
372
389
|
isRemoved: false;
|
|
373
390
|
errors: [];
|
|
374
391
|
}
|
|
375
|
-
|
|
392
|
+
| {
|
|
376
393
|
status: 'failed';
|
|
377
394
|
fileInfo: UploadcareFile | null;
|
|
378
395
|
uuid: string | null;
|
|
@@ -384,7 +401,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
384
401
|
isRemoved: false;
|
|
385
402
|
errors: OutputError<OutputFileErrorType>[];
|
|
386
403
|
}
|
|
387
|
-
|
|
404
|
+
| {
|
|
388
405
|
status: 'uploading';
|
|
389
406
|
fileInfo: null;
|
|
390
407
|
uuid: null;
|
|
@@ -396,7 +413,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
396
413
|
isRemoved: false;
|
|
397
414
|
errors: [];
|
|
398
415
|
}
|
|
399
|
-
|
|
416
|
+
| {
|
|
400
417
|
status: 'removed';
|
|
401
418
|
fileInfo: UploadcareFile | null;
|
|
402
419
|
uuid: string | null;
|
|
@@ -408,7 +425,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
408
425
|
isRemoved: true;
|
|
409
426
|
errors: OutputError<OutputFileErrorType>[];
|
|
410
427
|
}
|
|
411
|
-
|
|
428
|
+
| {
|
|
412
429
|
status: 'idle';
|
|
413
430
|
fileInfo: null;
|
|
414
431
|
uuid: null;
|
|
@@ -420,7 +437,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
420
437
|
isRemoved: false;
|
|
421
438
|
errors: [];
|
|
422
439
|
}
|
|
423
|
-
|
|
440
|
+
);
|
|
424
441
|
|
|
425
442
|
export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
|
|
426
443
|
|
|
@@ -444,43 +461,43 @@ export type OutputCollectionState<
|
|
|
444
461
|
} & (TGroupFlag extends 'has-group'
|
|
445
462
|
? { group: UploadcareGroup }
|
|
446
463
|
: TGroupFlag extends 'maybe-has-group'
|
|
447
|
-
|
|
448
|
-
|
|
464
|
+
? { group: UploadcareGroup | null }
|
|
465
|
+
: never) &
|
|
449
466
|
(
|
|
450
467
|
| {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
468
|
+
status: 'idle';
|
|
469
|
+
isFailed: false;
|
|
470
|
+
isUploading: false;
|
|
471
|
+
isSuccess: false;
|
|
472
|
+
errors: [];
|
|
473
|
+
allEntries: OutputFileEntry<'idle' | 'success'>[];
|
|
474
|
+
}
|
|
458
475
|
| {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
476
|
+
status: 'uploading';
|
|
477
|
+
isFailed: false;
|
|
478
|
+
isUploading: true;
|
|
479
|
+
isSuccess: false;
|
|
480
|
+
errors: [];
|
|
481
|
+
allEntries: OutputFileEntry[];
|
|
482
|
+
}
|
|
466
483
|
| {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
484
|
+
status: 'success';
|
|
485
|
+
isFailed: false;
|
|
486
|
+
isUploading: false;
|
|
487
|
+
isSuccess: true;
|
|
488
|
+
errors: [];
|
|
489
|
+
allEntries: OutputFileEntry<'success'>[];
|
|
490
|
+
}
|
|
474
491
|
| {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
492
|
+
status: 'failed';
|
|
493
|
+
isFailed: true;
|
|
494
|
+
isUploading: false;
|
|
495
|
+
isSuccess: false;
|
|
496
|
+
errors: OutputError<OutputCollectionErrorType>[];
|
|
497
|
+
allEntries: OutputFileEntry[];
|
|
498
|
+
}
|
|
482
499
|
);
|
|
483
500
|
|
|
484
501
|
export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
|
|
485
502
|
|
|
486
|
-
export {
|
|
503
|
+
export {};
|