@uploadcare/file-uploader 1.24.0-alpha.2 → 1.24.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/dist/env.js +1 -1
- package/dist/index.css +3 -2
- package/dist/index.d.ts +48 -58
- package/dist/index.js +78 -136
- package/dist/index.ssr.js +6 -2
- package/package.json +2 -1
- package/types/css.d.ts +3 -0
- package/web/file-uploader.iife.min.d.ts +48 -58
- package/web/file-uploader.iife.min.js +1 -1
- package/web/file-uploader.min.d.ts +48 -58
- package/web/file-uploader.min.js +1 -1
- 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.d.ts +11 -21
- package/web/uc-cloud-image-editor.min.js +1 -1
- package/web/uc-file-uploader-inline.min.css +1 -1
- package/web/uc-file-uploader-inline.min.d.ts +48 -58
- package/web/uc-file-uploader-inline.min.js +1 -1
- package/web/uc-file-uploader-minimal.min.css +1 -1
- package/web/uc-file-uploader-minimal.min.d.ts +48 -58
- package/web/uc-file-uploader-minimal.min.js +1 -1
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.d.ts +48 -58
- package/web/uc-file-uploader-regular.min.js +1 -1
- package/web/uc-img.min.js +1 -1
package/dist/env.js
CHANGED
package/dist/index.css
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
@layer uc.base, uc.components, uc.rules, uc.solutions, uc.post-reset, uc.base, uc.rules, uc.post-reset;
|
|
26
|
+
@layer uc, uc.base, uc.components, uc.rules, uc.solutions, uc.post-reset, uc.base, uc.rules, uc.post-reset;
|
|
27
27
|
|
|
28
28
|
/* src/blocks/ActivityHeader/activity-header.css */
|
|
29
29
|
@layer uc.components {
|
|
@@ -1740,6 +1740,7 @@
|
|
|
1740
1740
|
uc-icon svg {
|
|
1741
1741
|
width: calc(var(--uc-button-size) / 2);
|
|
1742
1742
|
height: calc(var(--uc-button-size) / 2);
|
|
1743
|
+
overflow: visible;
|
|
1743
1744
|
}
|
|
1744
1745
|
}
|
|
1745
1746
|
|
|
@@ -2314,7 +2315,7 @@
|
|
|
2314
2315
|
}
|
|
2315
2316
|
|
|
2316
2317
|
/* src/blocks/themes/uc-basic/layers.css */
|
|
2317
|
-
@layer uc.base, uc.components, uc.rules, uc.solutions, uc.post-reset;
|
|
2318
|
+
@layer uc, uc.base, uc.components, uc.rules, uc.solutions, uc.post-reset;
|
|
2318
2319
|
|
|
2319
2320
|
/* src/blocks/themes/uc-basic/config.css */
|
|
2320
2321
|
@layer uc.base {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,41 +7,6 @@ export { loadFileUploaderFrom } from './abstract/loadFileUploaderFrom.js';
|
|
|
7
7
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
8
8
|
export { PACKAGE_NAME, PACKAGE_VERSION } from './env.js';
|
|
9
9
|
|
|
10
|
-
declare const ExternalUploadSource: Readonly<{
|
|
11
|
-
readonly FACEBOOK: "facebook";
|
|
12
|
-
readonly DROPBOX: "dropbox";
|
|
13
|
-
readonly GDRIVE: "gdrive";
|
|
14
|
-
readonly GPHOTOS: "gphotos";
|
|
15
|
-
readonly FLICKR: "flickr";
|
|
16
|
-
readonly VK: "vk";
|
|
17
|
-
readonly EVERNOTE: "evernote";
|
|
18
|
-
readonly BOX: "box";
|
|
19
|
-
readonly ONEDRIVE: "onedrive";
|
|
20
|
-
readonly HUDDLE: "huddle";
|
|
21
|
-
}>;
|
|
22
|
-
declare const UploadSource: Readonly<{
|
|
23
|
-
readonly FACEBOOK: "facebook";
|
|
24
|
-
readonly DROPBOX: "dropbox";
|
|
25
|
-
readonly GDRIVE: "gdrive";
|
|
26
|
-
readonly GPHOTOS: "gphotos";
|
|
27
|
-
readonly FLICKR: "flickr";
|
|
28
|
-
readonly VK: "vk";
|
|
29
|
-
readonly EVERNOTE: "evernote";
|
|
30
|
-
readonly BOX: "box";
|
|
31
|
-
readonly ONEDRIVE: "onedrive";
|
|
32
|
-
readonly HUDDLE: "huddle";
|
|
33
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
34
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
35
|
-
readonly LOCAL: "local";
|
|
36
|
-
readonly DROP_AREA: "drop-area";
|
|
37
|
-
readonly CAMERA: "camera";
|
|
38
|
-
readonly EXTERNAL: "external";
|
|
39
|
-
readonly API: "js-api";
|
|
40
|
-
readonly URL: "url";
|
|
41
|
-
readonly DRAW: "draw";
|
|
42
|
-
}>;
|
|
43
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
44
|
-
|
|
45
10
|
declare class A11y {
|
|
46
11
|
private _destroyKeyUX;
|
|
47
12
|
private readonly _scopedWindow;
|
|
@@ -182,7 +147,7 @@ declare class Block extends BaseComponent<any> {
|
|
|
182
147
|
static StateConsumerScope: string | null;
|
|
183
148
|
static styleAttrs: string[];
|
|
184
149
|
protected requireCtxName: boolean;
|
|
185
|
-
activityType:
|
|
150
|
+
activityType: ActivityType;
|
|
186
151
|
init$: {};
|
|
187
152
|
l10n(str: string, variables?: Record<string, string | number>): string;
|
|
188
153
|
private pluralize;
|
|
@@ -479,8 +444,8 @@ declare class ValidationManager {
|
|
|
479
444
|
private _getValidatorDescriptorsForEntry;
|
|
480
445
|
}
|
|
481
446
|
|
|
482
|
-
type CameraMode =
|
|
483
|
-
type CameraStatus =
|
|
447
|
+
type CameraMode = 'photo' | 'video';
|
|
448
|
+
type CameraStatus = 'shot' | 'retake' | 'accept' | 'play' | 'stop' | 'pause' | 'resume';
|
|
484
449
|
declare class CameraSource extends UploaderBlock {
|
|
485
450
|
couldBeCtxOwner: boolean;
|
|
486
451
|
activityType: "camera";
|
|
@@ -580,12 +545,52 @@ declare class UploadList extends UploaderBlock {
|
|
|
580
545
|
destroyCallback(): void;
|
|
581
546
|
}
|
|
582
547
|
|
|
548
|
+
declare const ExternalUploadSource: Readonly<{
|
|
549
|
+
readonly FACEBOOK: "facebook";
|
|
550
|
+
readonly DROPBOX: "dropbox";
|
|
551
|
+
readonly GDRIVE: "gdrive";
|
|
552
|
+
readonly GPHOTOS: "gphotos";
|
|
553
|
+
readonly FLICKR: "flickr";
|
|
554
|
+
readonly VK: "vk";
|
|
555
|
+
readonly EVERNOTE: "evernote";
|
|
556
|
+
readonly BOX: "box";
|
|
557
|
+
readonly ONEDRIVE: "onedrive";
|
|
558
|
+
readonly HUDDLE: "huddle";
|
|
559
|
+
}>;
|
|
560
|
+
declare const UploadSource: Readonly<{
|
|
561
|
+
readonly FACEBOOK: "facebook";
|
|
562
|
+
readonly DROPBOX: "dropbox";
|
|
563
|
+
readonly GDRIVE: "gdrive";
|
|
564
|
+
readonly GPHOTOS: "gphotos";
|
|
565
|
+
readonly FLICKR: "flickr";
|
|
566
|
+
readonly VK: "vk";
|
|
567
|
+
readonly EVERNOTE: "evernote";
|
|
568
|
+
readonly BOX: "box";
|
|
569
|
+
readonly ONEDRIVE: "onedrive";
|
|
570
|
+
readonly HUDDLE: "huddle";
|
|
571
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
572
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
573
|
+
readonly LOCAL: "local";
|
|
574
|
+
readonly DROP_AREA: "drop-area";
|
|
575
|
+
readonly CAMERA: "camera";
|
|
576
|
+
readonly EXTERNAL: "external";
|
|
577
|
+
readonly API: "js-api";
|
|
578
|
+
readonly URL: "url";
|
|
579
|
+
readonly DRAW: "draw";
|
|
580
|
+
}>;
|
|
581
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
582
|
+
|
|
583
583
|
declare const CameraSourceTypes: Readonly<{
|
|
584
584
|
PHOTO: "photo";
|
|
585
585
|
VIDEO: "video";
|
|
586
586
|
}>;
|
|
587
587
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
588
588
|
|
|
589
|
+
type ApiAddFileCommonOptions = {
|
|
590
|
+
silent?: boolean;
|
|
591
|
+
fileName?: string;
|
|
592
|
+
source?: string;
|
|
593
|
+
};
|
|
589
594
|
declare class UploaderPublicApi {
|
|
590
595
|
private _ctx;
|
|
591
596
|
constructor(ctx: UploaderBlock);
|
|
@@ -595,25 +600,10 @@ declare class UploaderPublicApi {
|
|
|
595
600
|
/**
|
|
596
601
|
* TODO: Probably we should not allow user to override `source` property
|
|
597
602
|
*/
|
|
598
|
-
addFileFromUrl: (url: string, { silent, fileName, source
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}) => OutputFileEntry<"idle">;
|
|
603
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source, }?: {
|
|
604
|
-
silent?: boolean;
|
|
605
|
-
fileName?: string;
|
|
606
|
-
source?: string;
|
|
607
|
-
}) => OutputFileEntry<"idle">;
|
|
608
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source, }?: {
|
|
609
|
-
silent?: boolean;
|
|
610
|
-
fileName?: string;
|
|
611
|
-
source?: string;
|
|
612
|
-
}) => OutputFileEntry<"idle">;
|
|
613
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: {
|
|
614
|
-
silent?: boolean;
|
|
615
|
-
fileName?: string;
|
|
616
|
-
source?: string;
|
|
603
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
604
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
605
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
606
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
617
607
|
fullPath?: string;
|
|
618
608
|
}) => OutputFileEntry<"idle">;
|
|
619
609
|
removeFileByInternalId: (internalId: string) => void;
|
|
@@ -2040,4 +2030,4 @@ declare class FileUploaderRegular extends SolutionBlock {
|
|
|
2040
2030
|
type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
|
|
2041
2031
|
declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
2042
2032
|
|
|
2043
|
-
export { ActivityBlock, ActivityHeader, Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UploadCtxProvider, UploadList, UploadSource, UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
|
|
2033
|
+
export { ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UploadCtxProvider, UploadList, UploadSource, UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
|
package/dist/index.js
CHANGED
|
@@ -1216,7 +1216,7 @@ import { TelemetryAPIService } from "@uploadcare/quality-insights";
|
|
|
1216
1216
|
import { Queue as Queue2 } from "@uploadcare/upload-client";
|
|
1217
1217
|
|
|
1218
1218
|
// package.json
|
|
1219
|
-
var version = "1.24.0
|
|
1219
|
+
var version = "1.24.0";
|
|
1220
1220
|
|
|
1221
1221
|
// src/env.ts
|
|
1222
1222
|
var PACKAGE_NAME = "blocks";
|
|
@@ -1547,7 +1547,7 @@ var Block = class extends BaseComponent {
|
|
|
1547
1547
|
return testId;
|
|
1548
1548
|
}
|
|
1549
1549
|
get modalManager() {
|
|
1550
|
-
return this.has("*modalManager")
|
|
1550
|
+
return this.has("*modalManager") ? this.$["*modalManager"] : void 0;
|
|
1551
1551
|
}
|
|
1552
1552
|
get telemetryManager() {
|
|
1553
1553
|
if (!this.cfg.qualityInsights) {
|
|
@@ -1590,7 +1590,7 @@ var Block = class extends BaseComponent {
|
|
|
1590
1590
|
destroyCtxCallback() {
|
|
1591
1591
|
Data.deleteCtx(this.ctxName);
|
|
1592
1592
|
this.localeManager?.destroy();
|
|
1593
|
-
this.modalManager
|
|
1593
|
+
this.modalManager?.destroy();
|
|
1594
1594
|
}
|
|
1595
1595
|
async proxyUrl(url) {
|
|
1596
1596
|
if (this.cfg.secureDeliveryProxy && this.cfg.secureDeliveryProxyUrlResolver) {
|
|
@@ -1741,7 +1741,7 @@ var ActivityBlock = class _ActivityBlock extends Block {
|
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
1743
|
_isActivityRegistered() {
|
|
1744
|
-
return this.activityType && _ActivityBlock._activityCallbacks.has(this);
|
|
1744
|
+
return !!this.activityType && _ActivityBlock._activityCallbacks.has(this);
|
|
1745
1745
|
}
|
|
1746
1746
|
static _activityCallbacks = /* @__PURE__ */ new Map();
|
|
1747
1747
|
// declare static activities to satisfy type references below
|
|
@@ -3511,11 +3511,7 @@ var UploaderPublicApi = class {
|
|
|
3511
3511
|
/**
|
|
3512
3512
|
* TODO: Probably we should not allow user to override `source` property
|
|
3513
3513
|
*/
|
|
3514
|
-
addFileFromUrl = (url, {
|
|
3515
|
-
silent,
|
|
3516
|
-
fileName,
|
|
3517
|
-
source
|
|
3518
|
-
} = {}) => {
|
|
3514
|
+
addFileFromUrl = (url, { silent, fileName, source } = {}) => {
|
|
3519
3515
|
const internalId = this._uploadCollection.add({
|
|
3520
3516
|
externalUrl: url,
|
|
3521
3517
|
fileName: fileName ?? null,
|
|
@@ -3524,11 +3520,7 @@ var UploaderPublicApi = class {
|
|
|
3524
3520
|
});
|
|
3525
3521
|
return this.getOutputItem(internalId);
|
|
3526
3522
|
};
|
|
3527
|
-
addFileFromUuid = (uuid, {
|
|
3528
|
-
silent,
|
|
3529
|
-
fileName,
|
|
3530
|
-
source
|
|
3531
|
-
} = {}) => {
|
|
3523
|
+
addFileFromUuid = (uuid, { silent, fileName, source } = {}) => {
|
|
3532
3524
|
const internalId = this._uploadCollection.add({
|
|
3533
3525
|
uuid,
|
|
3534
3526
|
fileName: fileName ?? null,
|
|
@@ -3537,11 +3529,7 @@ var UploaderPublicApi = class {
|
|
|
3537
3529
|
});
|
|
3538
3530
|
return this.getOutputItem(internalId);
|
|
3539
3531
|
};
|
|
3540
|
-
addFileFromCdnUrl = (cdnUrl, {
|
|
3541
|
-
silent,
|
|
3542
|
-
fileName,
|
|
3543
|
-
source
|
|
3544
|
-
} = {}) => {
|
|
3532
|
+
addFileFromCdnUrl = (cdnUrl, { silent, fileName, source } = {}) => {
|
|
3545
3533
|
const parsedCdnUrl = parseCdnUrl({
|
|
3546
3534
|
url: cdnUrl,
|
|
3547
3535
|
cdnBase: this.cfg.cdnCname
|
|
@@ -3603,10 +3591,7 @@ var UploaderPublicApi = class {
|
|
|
3603
3591
|
};
|
|
3604
3592
|
openSystemDialog = (options = {}) => {
|
|
3605
3593
|
const accept = serializeCsv(
|
|
3606
|
-
mergeFileTypes([
|
|
3607
|
-
this.cfg.accept ?? "",
|
|
3608
|
-
...this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : []
|
|
3609
|
-
])
|
|
3594
|
+
mergeFileTypes([this.cfg.accept ?? "", ...this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : []])
|
|
3610
3595
|
);
|
|
3611
3596
|
const INPUT_ATTR_NAME = "uploadcare-file-input";
|
|
3612
3597
|
const fileInput = document.createElement("input");
|
|
@@ -3624,18 +3609,13 @@ var UploaderPublicApi = class {
|
|
|
3624
3609
|
fileInput.multiple = this.cfg.multiple;
|
|
3625
3610
|
if (options.captureCamera) {
|
|
3626
3611
|
fileInput.capture = this.cfg.cameraCapture;
|
|
3627
|
-
const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(
|
|
3628
|
-
this.cfg
|
|
3629
|
-
);
|
|
3612
|
+
const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(this.cfg);
|
|
3630
3613
|
if (options.modeCamera === CameraSourceTypes.PHOTO && isPhotoEnabled) {
|
|
3631
3614
|
fileInput.accept = BASIC_IMAGE_WILDCARD;
|
|
3632
3615
|
} else if (options.modeCamera === CameraSourceTypes.VIDEO && isVideoRecordingEnabled) {
|
|
3633
3616
|
fileInput.accept = BASIC_VIDEO_WILDCARD;
|
|
3634
3617
|
} else {
|
|
3635
|
-
fileInput.accept = [
|
|
3636
|
-
BASIC_IMAGE_WILDCARD,
|
|
3637
|
-
isVideoRecordingEnabled && BASIC_VIDEO_WILDCARD
|
|
3638
|
-
].filter(Boolean).join(",");
|
|
3618
|
+
fileInput.accept = [BASIC_IMAGE_WILDCARD, isVideoRecordingEnabled && BASIC_VIDEO_WILDCARD].filter(Boolean).join(",");
|
|
3639
3619
|
}
|
|
3640
3620
|
} else {
|
|
3641
3621
|
fileInput.accept = accept;
|
|
@@ -3713,9 +3693,7 @@ var UploaderPublicApi = class {
|
|
|
3713
3693
|
return;
|
|
3714
3694
|
}
|
|
3715
3695
|
if (srcKey === "camera" && browserFeatures.htmlMediaCapture) {
|
|
3716
|
-
const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(
|
|
3717
|
-
this.cfg
|
|
3718
|
-
);
|
|
3696
|
+
const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(this.cfg);
|
|
3719
3697
|
if (isPhotoEnabled && isVideoRecordingEnabled) {
|
|
3720
3698
|
this._ctx.set$({
|
|
3721
3699
|
"*currentActivity": ActivityBlock.activities.START_FROM
|
|
@@ -3773,9 +3751,7 @@ var UploaderPublicApi = class {
|
|
|
3773
3751
|
};
|
|
3774
3752
|
setModalState = (opened) => {
|
|
3775
3753
|
if (opened && !this._ctx.$["*currentActivity"]) {
|
|
3776
|
-
console.warn(
|
|
3777
|
-
`Can't open modal without current activity. Please use "setCurrentActivity" method first.`
|
|
3778
|
-
);
|
|
3754
|
+
console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);
|
|
3779
3755
|
return;
|
|
3780
3756
|
}
|
|
3781
3757
|
if (opened) {
|
|
@@ -4425,9 +4401,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4425
4401
|
}
|
|
4426
4402
|
};
|
|
4427
4403
|
_updateTimer = () => {
|
|
4428
|
-
const currentTime = Math.floor(
|
|
4429
|
-
(performance.now() - this.$._startTime + this.$._elapsedTime) / 1e3
|
|
4430
|
-
);
|
|
4404
|
+
const currentTime = Math.floor((performance.now() - this.$._startTime + this.$._elapsedTime) / 1e3);
|
|
4431
4405
|
if (typeof this.cfg.maxVideoRecordingDuration === "number" && this.cfg.maxVideoRecordingDuration > 0) {
|
|
4432
4406
|
const remainingTime = this.cfg.maxVideoRecordingDuration - currentTime;
|
|
4433
4407
|
if (remainingTime <= 0) {
|
|
@@ -4496,22 +4470,16 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4496
4470
|
if (this._stream) {
|
|
4497
4471
|
this._mediaRecorder = new MediaRecorder(this._stream, this._options);
|
|
4498
4472
|
this._mediaRecorder.start();
|
|
4499
|
-
this._mediaRecorder.addEventListener(
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
this._chunks.push(event.data);
|
|
4503
|
-
}
|
|
4504
|
-
);
|
|
4473
|
+
this._mediaRecorder.addEventListener("dataavailable", (event) => {
|
|
4474
|
+
this._chunks.push(event.data);
|
|
4475
|
+
});
|
|
4505
4476
|
this._startTimer();
|
|
4506
4477
|
this.classList.add("uc-recording");
|
|
4507
4478
|
this._setCameraState(CameraSourceEvents.PLAY);
|
|
4508
4479
|
}
|
|
4509
4480
|
} catch (error) {
|
|
4510
4481
|
console.error("Failed to start recording", error);
|
|
4511
|
-
this.telemetryManager.sendEventError(
|
|
4512
|
-
error,
|
|
4513
|
-
"camera recording. Failed to start recording"
|
|
4514
|
-
);
|
|
4482
|
+
this.telemetryManager.sendEventError(error, "camera recording. Failed to start recording");
|
|
4515
4483
|
}
|
|
4516
4484
|
};
|
|
4517
4485
|
_stopRecording = () => {
|
|
@@ -4570,10 +4538,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4570
4538
|
});
|
|
4571
4539
|
} catch (error) {
|
|
4572
4540
|
console.error("Failed to preview video", error);
|
|
4573
|
-
this.telemetryManager.sendEventError(
|
|
4574
|
-
error,
|
|
4575
|
-
"camera previewing. Failed to preview video"
|
|
4576
|
-
);
|
|
4541
|
+
this.telemetryManager.sendEventError(error, "camera previewing. Failed to preview video");
|
|
4577
4542
|
}
|
|
4578
4543
|
};
|
|
4579
4544
|
_retake = () => {
|
|
@@ -4594,12 +4559,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4594
4559
|
if (!blob2) {
|
|
4595
4560
|
return;
|
|
4596
4561
|
}
|
|
4597
|
-
const file2 = this._createFile(
|
|
4598
|
-
"camera",
|
|
4599
|
-
"jpeg",
|
|
4600
|
-
DEFAULT_PICTURE_FORMAT,
|
|
4601
|
-
blob2
|
|
4602
|
-
);
|
|
4562
|
+
const file2 = this._createFile("camera", "jpeg", DEFAULT_PICTURE_FORMAT, blob2);
|
|
4603
4563
|
this._toSend(file2);
|
|
4604
4564
|
}, DEFAULT_PICTURE_FORMAT);
|
|
4605
4565
|
return;
|
|
@@ -4760,47 +4720,44 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4760
4720
|
(mode) => mode === CameraSourceTypes.PHOTO || mode === CameraSourceTypes.VIDEO
|
|
4761
4721
|
);
|
|
4762
4722
|
}
|
|
4763
|
-
_setPermissionsState = debounce(
|
|
4764
|
-
(state
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
},
|
|
4802
|
-
300
|
|
4803
|
-
);
|
|
4723
|
+
_setPermissionsState = debounce((state) => {
|
|
4724
|
+
this.classList.toggle("uc-initialized", state === "granted");
|
|
4725
|
+
const visibleAudio = this._activeTab === CameraSourceTypes.VIDEO && this.cfg.enableAudioRecording;
|
|
4726
|
+
const currentIcon = this._activeTab === CameraSourceTypes.PHOTO ? "camera-full" : "video-camera-full";
|
|
4727
|
+
if (state === "granted") {
|
|
4728
|
+
this.set$({
|
|
4729
|
+
videoHidden: false,
|
|
4730
|
+
cameraHidden: false,
|
|
4731
|
+
tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
|
|
4732
|
+
tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
|
|
4733
|
+
messageHidden: true,
|
|
4734
|
+
timerHidden: true,
|
|
4735
|
+
currentIcon,
|
|
4736
|
+
audioToggleMicrophoneHidden: !visibleAudio,
|
|
4737
|
+
audioSelectHidden: !visibleAudio
|
|
4738
|
+
});
|
|
4739
|
+
} else if (state === "prompt") {
|
|
4740
|
+
this.$.l10nMessage = "camera-permissions-prompt";
|
|
4741
|
+
this.set$({
|
|
4742
|
+
videoHidden: true,
|
|
4743
|
+
cameraHidden: true,
|
|
4744
|
+
tabCameraHidden: true,
|
|
4745
|
+
messageHidden: false
|
|
4746
|
+
});
|
|
4747
|
+
this._stopCapture();
|
|
4748
|
+
} else {
|
|
4749
|
+
this.$.l10nMessage = "camera-permissions-denied";
|
|
4750
|
+
this.set$({
|
|
4751
|
+
videoHidden: true,
|
|
4752
|
+
messageHidden: false,
|
|
4753
|
+
tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
|
|
4754
|
+
tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
|
|
4755
|
+
cameraActionsHidden: true,
|
|
4756
|
+
mutableClassButton: "uc-shot-btn uc-camera-action"
|
|
4757
|
+
});
|
|
4758
|
+
this._stopCapture();
|
|
4759
|
+
}
|
|
4760
|
+
}, 300);
|
|
4804
4761
|
_makeStreamInactive = () => {
|
|
4805
4762
|
if (!this._stream) return false;
|
|
4806
4763
|
const audioTracks = this._stream?.getAudioTracks();
|
|
@@ -4858,10 +4815,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4858
4815
|
} catch (error) {
|
|
4859
4816
|
this._setPermissionsState("denied");
|
|
4860
4817
|
console.log("Failed to capture camera", error);
|
|
4861
|
-
this.telemetryManager.sendEventError(
|
|
4862
|
-
error,
|
|
4863
|
-
"camera capturing. Failed to capture camera"
|
|
4864
|
-
);
|
|
4818
|
+
this.telemetryManager.sendEventError(error, "camera capturing. Failed to capture camera");
|
|
4865
4819
|
}
|
|
4866
4820
|
};
|
|
4867
4821
|
_handlePermissionsChange = () => {
|
|
@@ -4877,14 +4831,8 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4877
4831
|
response.addEventListener("change", this._handlePermissionsChange);
|
|
4878
4832
|
}
|
|
4879
4833
|
} catch (error) {
|
|
4880
|
-
console.log(
|
|
4881
|
-
|
|
4882
|
-
error
|
|
4883
|
-
);
|
|
4884
|
-
this.telemetryManager.sendEventError(
|
|
4885
|
-
error,
|
|
4886
|
-
"camera permissions. Failed to use permissions API"
|
|
4887
|
-
);
|
|
4834
|
+
console.log("Failed to use permissions API. Fallback to manual request mode.", error);
|
|
4835
|
+
this.telemetryManager.sendEventError(error, "camera permissions. Failed to use permissions API");
|
|
4888
4836
|
this._capture();
|
|
4889
4837
|
}
|
|
4890
4838
|
};
|
|
@@ -4899,10 +4847,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4899
4847
|
await this._getDevices();
|
|
4900
4848
|
navigator.mediaDevices.addEventListener("devicechange", this._getDevices);
|
|
4901
4849
|
} catch (error) {
|
|
4902
|
-
this.telemetryManager.sendEventError(
|
|
4903
|
-
error,
|
|
4904
|
-
"camera devices. Failed to get user media"
|
|
4905
|
-
);
|
|
4850
|
+
this.telemetryManager.sendEventError(error, "camera devices. Failed to get user media");
|
|
4906
4851
|
console.log("Failed to get user media", error);
|
|
4907
4852
|
}
|
|
4908
4853
|
};
|
|
@@ -4932,10 +4877,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4932
4877
|
}
|
|
4933
4878
|
this._selectedAudioId = this._audioDevices[0]?.value ?? null;
|
|
4934
4879
|
} catch (error) {
|
|
4935
|
-
this.telemetryManager.sendEventError(
|
|
4936
|
-
error,
|
|
4937
|
-
"camera devices. Failed to get devices"
|
|
4938
|
-
);
|
|
4880
|
+
this.telemetryManager.sendEventError(error, "camera devices. Failed to get devices");
|
|
4939
4881
|
console.log("Failed to get devices", error);
|
|
4940
4882
|
}
|
|
4941
4883
|
};
|
|
@@ -4949,9 +4891,7 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4949
4891
|
if (this._unsubPermissions) {
|
|
4950
4892
|
this._unsubPermissions();
|
|
4951
4893
|
}
|
|
4952
|
-
const isChromium = Boolean(
|
|
4953
|
-
window.chrome
|
|
4954
|
-
);
|
|
4894
|
+
const isChromium = Boolean(window.chrome);
|
|
4955
4895
|
if (!isChromium) {
|
|
4956
4896
|
this._setPermissionsState("denied");
|
|
4957
4897
|
}
|
|
@@ -4990,15 +4930,9 @@ var CameraSource = class extends UploaderBlock {
|
|
|
4990
4930
|
}
|
|
4991
4931
|
_destroy() {
|
|
4992
4932
|
for (const permission of DEFAULT_PERMISSIONS) {
|
|
4993
|
-
this._permissionResponses[permission]?.removeEventListener(
|
|
4994
|
-
"change",
|
|
4995
|
-
this._handlePermissionsChange
|
|
4996
|
-
);
|
|
4933
|
+
this._permissionResponses[permission]?.removeEventListener("change", this._handlePermissionsChange);
|
|
4997
4934
|
}
|
|
4998
|
-
navigator.mediaDevices?.removeEventListener(
|
|
4999
|
-
"devicechange",
|
|
5000
|
-
this._getDevices
|
|
5001
|
-
);
|
|
4935
|
+
navigator.mediaDevices?.removeEventListener("devicechange", this._getDevices);
|
|
5002
4936
|
}
|
|
5003
4937
|
async destroyCallback() {
|
|
5004
4938
|
super.destroyCallback();
|
|
@@ -6127,9 +6061,7 @@ function batchPreloadImages(list) {
|
|
|
6127
6061
|
preloaders.push(preload);
|
|
6128
6062
|
}
|
|
6129
6063
|
const images = preloaders.map((preload) => preload.image);
|
|
6130
|
-
const promise = Promise.allSettled(
|
|
6131
|
-
preloaders.map((preload) => preload.promise)
|
|
6132
|
-
);
|
|
6064
|
+
const promise = Promise.allSettled(preloaders.map((preload) => preload.promise));
|
|
6133
6065
|
const cancel = () => {
|
|
6134
6066
|
preloaders.forEach((preload) => {
|
|
6135
6067
|
preload.cancel();
|
|
@@ -9247,6 +9179,7 @@ var ExternalSource = class extends UploaderBlock {
|
|
|
9247
9179
|
couldSelectAll: false,
|
|
9248
9180
|
couldDeselectAll: false,
|
|
9249
9181
|
showSelectionStatus: false,
|
|
9182
|
+
showDoneBtn: false,
|
|
9250
9183
|
counterText: "",
|
|
9251
9184
|
doneBtnTextClass: "uc-hidden",
|
|
9252
9185
|
toolbarVisible: true,
|
|
@@ -9358,6 +9291,9 @@ var ExternalSource = class extends UploaderBlock {
|
|
|
9358
9291
|
couldDeselectAll: message.selectedCount === message.total,
|
|
9359
9292
|
selectedList: message.selectedFiles
|
|
9360
9293
|
});
|
|
9294
|
+
if (!this.$.showDoneBtn && message.isReady) {
|
|
9295
|
+
this.$.showDoneBtn = true;
|
|
9296
|
+
}
|
|
9361
9297
|
}
|
|
9362
9298
|
handleIframeLoad() {
|
|
9363
9299
|
this.applyEmbedCss(this.cfg.externalSourcesEmbedCss);
|
|
@@ -9437,7 +9373,8 @@ var ExternalSource = class extends UploaderBlock {
|
|
|
9437
9373
|
isDoneBtnEnabled: false,
|
|
9438
9374
|
couldSelectAll: false,
|
|
9439
9375
|
couldDeselectAll: false,
|
|
9440
|
-
showSelectionStatus: false
|
|
9376
|
+
showSelectionStatus: false,
|
|
9377
|
+
showDoneBtn: false
|
|
9441
9378
|
});
|
|
9442
9379
|
}
|
|
9443
9380
|
};
|
|
@@ -9462,7 +9399,11 @@ ExternalSource.template = /* HTML */
|
|
|
9462
9399
|
<button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button>
|
|
9463
9400
|
<button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button>
|
|
9464
9401
|
</div>
|
|
9465
|
-
<button
|
|
9402
|
+
<button
|
|
9403
|
+
type="button"
|
|
9404
|
+
class="uc-done-btn uc-primary-btn"
|
|
9405
|
+
set="onclick: onDone; @disabled: !isDoneBtnEnabled; @hidden: !showDoneBtn"
|
|
9406
|
+
>
|
|
9466
9407
|
<uc-spinner set="@hidden: isSelectionReady"></uc-spinner>
|
|
9467
9408
|
<span l10n="done" set="@class: doneBtnTextClass"></span>
|
|
9468
9409
|
</button>
|
|
@@ -11121,6 +11062,7 @@ var Thumb = class extends FileItemConfig {
|
|
|
11121
11062
|
}
|
|
11122
11063
|
return Math.min(size, CDN_MAX_OUTPUT_DIMENSION);
|
|
11123
11064
|
}
|
|
11065
|
+
// biome-ignore lint/style/noInferrableTypes: Here the type is needed because `_withEntry` could not infer it correctly
|
|
11124
11066
|
_generateThumbnail = this._withEntry(async (entry, force = false) => {
|
|
11125
11067
|
const fileInfo = entry.getValue("fileInfo");
|
|
11126
11068
|
const isImage = entry.getValue("isImage");
|
package/dist/index.ssr.js
CHANGED
|
@@ -840,7 +840,11 @@ export const ExternalSource = class {
|
|
|
840
840
|
<button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button>
|
|
841
841
|
<button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button>
|
|
842
842
|
</div>
|
|
843
|
-
<button
|
|
843
|
+
<button
|
|
844
|
+
type="button"
|
|
845
|
+
class="uc-done-btn uc-primary-btn"
|
|
846
|
+
set="onclick: onDone; @disabled: !isDoneBtnEnabled; @hidden: !showDoneBtn"
|
|
847
|
+
>
|
|
844
848
|
<uc-spinner set="@hidden: isSelectionReady"></uc-spinner>
|
|
845
849
|
<span l10n="done" set="@class: doneBtnTextClass"></span>
|
|
846
850
|
</button>
|
|
@@ -1128,7 +1132,7 @@ export const ModalEvents = {
|
|
|
1128
1132
|
DESTROY: "modal:destroy",
|
|
1129
1133
|
};
|
|
1130
1134
|
export const PACKAGE_NAME = `blocks`;
|
|
1131
|
-
export const PACKAGE_VERSION = `1.24.0
|
|
1135
|
+
export const PACKAGE_VERSION = `1.24.0`;
|
|
1132
1136
|
export const PresenceToggle = class {
|
|
1133
1137
|
static template = `<slot></slot> `;
|
|
1134
1138
|
static reg = () => {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/file-uploader",
|
|
3
|
-
"version": "1.24.0
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Building blocks for Uploadcare products integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web components",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"default": "./dist/index.js"
|
|
48
48
|
},
|
|
49
49
|
"./index.css": {
|
|
50
|
+
"types": "./types/css.d.ts",
|
|
50
51
|
"default": "./dist/index.css"
|
|
51
52
|
},
|
|
52
53
|
"./abstract/loadFileUploaderFrom.js": "./dist/abstract/loadFileUploaderFrom.js",
|
package/types/css.d.ts
ADDED