@uploadcare/file-uploader 1.13.0-alpha.1 → 1.13.0-alpha.3
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 +11 -4
- package/blocks/CameraSource/CameraSource.d.ts +22 -12
- package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +83 -81
- package/blocks/CameraSource/camera-source.css +0 -1
- package/blocks/CloudImageEditor/src/CropFrame.d.ts +7 -0
- package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CropFrame.js +50 -0
- package/blocks/CloudImageEditor/src/css/common.css +4 -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 +3 -13
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +5 -4
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +8 -20
- 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 +2 -5
- package/index.ssr.d.ts +14 -0
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +16 -5
- package/package.json +6 -4
- package/types/exported.d.ts +66 -81
- 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.js +3 -3
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/blocks/CameraSource/constants.d.ts +0 -15
- package/blocks/CameraSource/constants.d.ts.map +0 -1
- package/blocks/CameraSource/constants.js +0 -17
- package/blocks/Config/assertions.d.ts +0 -5
- package/blocks/Config/assertions.d.ts.map +0 -1
- package/blocks/Config/assertions.js +0 -37
- package/blocks/Config/side-effects.d.ts +0 -7
- package/blocks/Config/side-effects.d.ts.map +0 -1
- package/blocks/Config/side-effects.js +0 -32
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { deserealizeCsv } from '../../../utils/comma-separated.js';
|
|
4
4
|
import { ALL_TABS } from '../toolbar-constants.js';
|
|
5
5
|
|
|
6
6
|
/** @param {string} tabs */
|
|
7
7
|
export const parseTabs = (tabs) => {
|
|
8
8
|
if (!tabs) return ALL_TABS;
|
|
9
|
-
const tabList =
|
|
9
|
+
const tabList = deserealizeCsv(tabs).filter((tab) => ALL_TABS.includes(tab));
|
|
10
10
|
if (tabList.length === 0) {
|
|
11
11
|
return ALL_TABS;
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 'iconHrefResolver',
|
|
10
10
|
* 'fileValidators',
|
|
11
11
|
* 'collectionValidators',
|
|
12
|
-
* '
|
|
12
|
+
* 'mediaRecorerOptions',
|
|
13
13
|
* ]}
|
|
14
14
|
*/
|
|
15
15
|
export const complexConfigKeys: [
|
|
@@ -20,7 +20,7 @@ export const complexConfigKeys: [
|
|
|
20
20
|
'iconHrefResolver',
|
|
21
21
|
'fileValidators',
|
|
22
22
|
'collectionValidators',
|
|
23
|
-
'
|
|
23
|
+
'mediaRecorerOptions'
|
|
24
24
|
];
|
|
25
25
|
export type Config = import('../../utils/mixinClass.js').MixinClass<typeof ConfigClass, import('../../types').ConfigType>;
|
|
26
26
|
/** @typedef {import('../../utils/mixinClass.js').MixinClass<typeof ConfigClass, import('../../types').ConfigType>} Config */
|
|
@@ -64,6 +64,6 @@ declare class ConfigClass extends Block {
|
|
|
64
64
|
}
|
|
65
65
|
import { Block } from '../../abstract/Block.js';
|
|
66
66
|
/** Mapping of attribute names to state */
|
|
67
|
-
declare const attrStateMapping: Record<"
|
|
67
|
+
declare const attrStateMapping: Record<"pubkey" | "multiple" | "accept" | "store" | "debug" | "crop-preset" | "secure-expire" | "max-local-file-size-bytes" | "multiple-min" | "multiple-max" | "confirm-upload" | "img-only" | "external-sources-preferred-types" | "external-sources-embed-css" | "camera-mirror" | "camera-capture" | "source-list" | "thumb-size" | "show-empty-list" | "use-local-image-editor" | "use-cloud-image-editor" | "cloud-image-editor-tabs" | "remove-copyright" | "image-shrink" | "modal-scroll-lock" | "modal-backdrop-strokes" | "source-list-wrap" | "remote-tab-session-key" | "cdn-cname" | "base-url" | "social-base-url" | "secure-signature" | "secure-delivery-proxy" | "retry-throttled-request-max-times" | "multipart-min-file-size" | "multipart-chunk-size" | "max-concurrent-requests" | "multipart-max-concurrent-requests" | "multipart-max-attempts" | "check-for-url-duplicates" | "save-url-for-recurrent-uploads" | "group-output" | "user-agent-integration" | "locale-name" | "secure-uploads-expire-threshold" | "default-camera-mode" | "enable-audio-recording" | "enable-video-recording" | "max-video-recording-duration" | "cloud-image-editor-mask-href" | "secureexpire" | "croppreset" | "maxlocalfilesizebytes" | "multiplemin" | "multiplemax" | "confirmupload" | "imgonly" | "externalsourcespreferredtypes" | "externalsourcesembedcss" | "cameramirror" | "cameracapture" | "sourcelist" | "thumbsize" | "showemptylist" | "uselocalimageeditor" | "usecloudimageeditor" | "cloudimageeditortabs" | "removecopyright" | "imageshrink" | "modalscrolllock" | "modalbackdropstrokes" | "sourcelistwrap" | "remotetabsessionkey" | "cdncname" | "baseurl" | "socialbaseurl" | "securesignature" | "securedeliveryproxy" | "retrythrottledrequestmaxtimes" | "multipartminfilesize" | "multipartchunksize" | "maxconcurrentrequests" | "multipartmaxconcurrentrequests" | "multipartmaxattempts" | "checkforurlduplicates" | "saveurlforrecurrentuploads" | "groupoutput" | "useragentintegration" | "localename" | "secureuploadsexpirethreshold" | "defaultcameramode" | "enableaudiorecording" | "enablevideorecording" | "maxvideorecordingduration" | "cloudimageeditormaskhref", string>;
|
|
68
68
|
export {};
|
|
69
69
|
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["Config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["Config.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,gCAXU;IACT,UAAc;IACd,0BAA8B;IAC9B,gCAAoC;IACpC,gCAAoC;IACpC,kBAAsB;IACtB,gBAAoB;IACpB,sBAA0B;IAC1B,qBAAyB;CACtB,CAWF;qBAiNY,OAAO,2BAA2B,EAAE,UAAU,CAAC,kBAAkB,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC;AAAlH,6HAA6H;AAG7H,4BAAmF;AAvLnF;IAkBE;;;;OAIG;IACH,+BAYC;IAED;;;;OAIG;IACH,2BAQC;IAED;;;;OAIG;IACH,kBAiBC;IAED;;;OAGG;IACH,kBAIC;IAED;;;;OAIG;IACH,wCAJW,MAAM,iBACN,OAAO,aACP,OAAO,QAoBjB;IA0CD;;;;OAIG;IACH,+BAJW,MAAM,uBAAuB,UAC7B,MAAM,UACN,MAAM,QAahB;CACF;sBAvOqB,yBAAyB;AAsD/C,0CAA0C;AAC1C,moEAGG"}
|
package/blocks/Config/Config.js
CHANGED
|
@@ -4,8 +4,6 @@ import { initialConfig } from './initialConfig.js';
|
|
|
4
4
|
import { sharedConfigKey } from '../../abstract/sharedConfigKey.js';
|
|
5
5
|
import { toKebabCase } from '../../utils/toKebabCase.js';
|
|
6
6
|
import { normalizeConfigValue } from './normalizeConfigValue.js';
|
|
7
|
-
import { runAssertions } from './assertions.js';
|
|
8
|
-
import { runSideEffects } from './side-effects.js';
|
|
9
7
|
|
|
10
8
|
const allConfigKeys = /** @type {(keyof import('../../types').ConfigType)[]} */ ([
|
|
11
9
|
// "debug" option should go first to be able to print debug messages from the very beginning
|
|
@@ -23,7 +21,7 @@ const allConfigKeys = /** @type {(keyof import('../../types').ConfigType)[]} */
|
|
|
23
21
|
* 'iconHrefResolver',
|
|
24
22
|
* 'fileValidators',
|
|
25
23
|
* 'collectionValidators',
|
|
26
|
-
* '
|
|
24
|
+
* 'mediaRecorerOptions',
|
|
27
25
|
* ]}
|
|
28
26
|
*/
|
|
29
27
|
export const complexConfigKeys = [
|
|
@@ -34,7 +32,7 @@ export const complexConfigKeys = [
|
|
|
34
32
|
'iconHrefResolver',
|
|
35
33
|
'fileValidators',
|
|
36
34
|
'collectionValidators',
|
|
37
|
-
'
|
|
35
|
+
'mediaRecorerOptions',
|
|
38
36
|
];
|
|
39
37
|
|
|
40
38
|
/** @type {(key: keyof import('../../types').ConfigType) => key is keyof import('../../types').ConfigComplexType} */
|
|
@@ -138,14 +136,6 @@ class ConfigClass extends Block {
|
|
|
138
136
|
this._flushValueToState(key, normalizedValue);
|
|
139
137
|
|
|
140
138
|
this.debugPrint(`[uc-config] "${key}"`, normalizedValue);
|
|
141
|
-
|
|
142
|
-
runAssertions(this.cfg);
|
|
143
|
-
runSideEffects({
|
|
144
|
-
key,
|
|
145
|
-
value: normalizedValue ?? null,
|
|
146
|
-
setValue: this._setValue.bind(this),
|
|
147
|
-
getValue: this._getValue.bind(this),
|
|
148
|
-
});
|
|
149
139
|
}
|
|
150
140
|
|
|
151
141
|
/**
|
|
@@ -155,7 +145,7 @@ class ConfigClass extends Block {
|
|
|
155
145
|
_getValue(key) {
|
|
156
146
|
const anyThis = /** @type {typeof this & any} */ (this);
|
|
157
147
|
const localPropName = getLocalPropName(key);
|
|
158
|
-
return anyThis[localPropName]
|
|
148
|
+
return anyThis[localPropName];
|
|
159
149
|
}
|
|
160
150
|
|
|
161
151
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,uDAAwD;AACxD,+DAAgE;AAChE,sEAAuE;AAEvE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,uDAAwD;AACxD,+DAAgE;AAChE,sEAAuE;AAEvE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CAoElD"}
|
|
@@ -68,10 +68,11 @@ export const initialConfig = {
|
|
|
68
68
|
fileValidators: [],
|
|
69
69
|
collectionValidators: [],
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
defaultCameraMode: null,
|
|
71
|
+
defaultCameraMode: 'photo',
|
|
73
72
|
enableAudioRecording: true,
|
|
74
|
-
enableVideoRecording:
|
|
73
|
+
enableVideoRecording: true,
|
|
75
74
|
maxVideoRecordingDuration: null,
|
|
76
|
-
|
|
75
|
+
mediaRecorerOptions: null,
|
|
76
|
+
|
|
77
|
+
cloudImageEditorMaskHref: null,
|
|
77
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAeO,iCADK,OAAO,WAWlB;AA8JM,sGAHI,OAAO,mDAcjB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import { CameraSourceTypes } from '../CameraSource/constants.js';
|
|
4
|
-
import { deserializeCsv } from '../utils/comma-separated.js';
|
|
5
3
|
import { initialConfig } from './initialConfig.js';
|
|
6
4
|
|
|
7
5
|
/** @param {unknown} value */
|
|
@@ -33,28 +31,18 @@ const asStore = (value) => (value === 'auto' ? value : asBoolean(value));
|
|
|
33
31
|
const asCameraCapture = (value) => {
|
|
34
32
|
const strValue = asString(value);
|
|
35
33
|
if (strValue !== 'user' && strValue !== 'environment' && strValue !== '') {
|
|
36
|
-
throw new Error(`Invalid value: "${strValue}"`);
|
|
34
|
+
throw new Error(`Invalid "cameraCapture" value: "${strValue}"`);
|
|
37
35
|
}
|
|
38
36
|
return strValue;
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
/** @param {unknown} value */
|
|
42
|
-
const
|
|
40
|
+
const asCameraTab = (value) => {
|
|
43
41
|
const strValue = asString(value);
|
|
44
|
-
if (
|
|
45
|
-
throw new Error(`Invalid value: "${strValue}"`);
|
|
42
|
+
if (strValue !== 'photo' && strValue !== 'video') {
|
|
43
|
+
throw new Error(`Invalid "CameraTab" value: "${strValue}"`);
|
|
46
44
|
}
|
|
47
|
-
return
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/** @param {unknown} value */
|
|
51
|
-
const asCameraModes = (value) => {
|
|
52
|
-
const str = asString(value);
|
|
53
|
-
const array = deserializeCsv(str);
|
|
54
|
-
if (array.some((item) => !Object.values(CameraSourceTypes).includes(item))) {
|
|
55
|
-
throw new Error(`Invalid value: "${array}"`);
|
|
56
|
-
}
|
|
57
|
-
return str;
|
|
45
|
+
return strValue;
|
|
58
46
|
};
|
|
59
47
|
|
|
60
48
|
/** @param {unknown} value */
|
|
@@ -178,13 +166,13 @@ const mapping = {
|
|
|
178
166
|
fileValidators: /** @type {typeof asArray<import('../../types').FileValidators>} */ (asArray),
|
|
179
167
|
collectionValidators: /** @type {typeof asArray<import('../../types').CollectionValidators>} */ (asArray),
|
|
180
168
|
|
|
181
|
-
|
|
182
|
-
defaultCameraMode: asCameraMode,
|
|
169
|
+
defaultCameraMode: asCameraTab,
|
|
183
170
|
enableAudioRecording: asBoolean,
|
|
184
171
|
enableVideoRecording: asBoolean,
|
|
185
|
-
|
|
172
|
+
mediaRecorerOptions: asObject,
|
|
186
173
|
|
|
187
174
|
maxVideoRecordingDuration: asNumber,
|
|
175
|
+
cloudImageEditorMaskHref: asString,
|
|
188
176
|
};
|
|
189
177
|
|
|
190
178
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comma-separated.d.ts","sourceRoot":"","sources":["comma-separated.js"],"names":[],"mappings":"AAGO,sCADK,MAAM,
|
|
1
|
+
{"version":3,"file":"comma-separated.d.ts","sourceRoot":"","sources":["comma-separated.js"],"names":[],"mappings":"AAGO,sCADK,MAAM,YAOjB;AAGM,oCADK,OAAO,EAAE,UAOpB"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
/** @param {string} value */
|
|
4
|
-
export const
|
|
4
|
+
export const deserealizeCsv = (value) => {
|
|
5
5
|
if (!value) {
|
|
6
6
|
return [];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
return value
|
|
10
|
-
.split(',')
|
|
11
|
-
.map((item) => item.trim())
|
|
12
|
-
.filter(Boolean);
|
|
9
|
+
return value.split(',').map((item) => item.trim());
|
|
13
10
|
};
|
|
14
11
|
|
|
15
12
|
/** @param {unknown[]} value */
|
package/index.ssr.d.ts
CHANGED
|
@@ -54,6 +54,20 @@ export const BtnUi: {
|
|
|
54
54
|
};
|
|
55
55
|
export const CameraSource: {
|
|
56
56
|
new (): {};
|
|
57
|
+
types: {
|
|
58
|
+
PHOTO: string;
|
|
59
|
+
VIDEO: string;
|
|
60
|
+
};
|
|
61
|
+
events: {
|
|
62
|
+
IDLE: string;
|
|
63
|
+
SHOT: string;
|
|
64
|
+
PLAY: string;
|
|
65
|
+
PAUSE: string;
|
|
66
|
+
RESUME: string;
|
|
67
|
+
STOP: string;
|
|
68
|
+
RETAKE: string;
|
|
69
|
+
ACCEPT: string;
|
|
70
|
+
};
|
|
57
71
|
template: string;
|
|
58
72
|
extSrcList: {
|
|
59
73
|
FACEBOOK: string;
|
package/index.ssr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAYE;AACF
|
|
1
|
+
{"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAYE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqJE;AACF;;;;;;;;EAuCE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CE;AACF;;;;;;;;EAuCE;AACF;;;;;;;EAsGE;AACF;;;;;;;EAaE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgEE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EASE;AACF;;;;;;EAKE;AACF;;;;;;;EAWE;AACF;;;;;;;EAME;AACF;;;;;;;EAWE;AACF;;;;;;;EA2IE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEE;;;;;;;;;;;;;AAaF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFE;AACF;;;;;;EAKE;AACF;;;;;;EAKE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CE;AACF;;;;;;;;EAWE;AACF;;;;;;EAwBE;AACF;;;;;;;EAUE;AACF;;;;;;;;EAWE;AACF,oCAAqC;AACrC,uCAAwC;AACxC;;;;;;;EAME;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDE;AACF;;;;;;;EAeE;AACF;;;;;;EAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDE;AACF;;;;;;EAKE;AACF;;;;;;EAKE;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;EAWE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4FE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEE;AACK,yCAAiC;AACjC,qCAA6B;AAC7B,6CAAqC;AACrC,oCAA4B"}
|
package/index.ssr.js
CHANGED
|
@@ -53,6 +53,17 @@ export const BtnUi = class {
|
|
|
53
53
|
static bindAttributes = () => {};
|
|
54
54
|
};
|
|
55
55
|
export const CameraSource = class {
|
|
56
|
+
static types = { PHOTO: "photo", VIDEO: "video" };
|
|
57
|
+
static events = {
|
|
58
|
+
IDLE: "idle",
|
|
59
|
+
SHOT: "shot",
|
|
60
|
+
PLAY: "play",
|
|
61
|
+
PAUSE: "pause",
|
|
62
|
+
RESUME: "resume",
|
|
63
|
+
STOP: "stop",
|
|
64
|
+
RETAKE: "retake",
|
|
65
|
+
ACCEPT: "accept",
|
|
66
|
+
};
|
|
56
67
|
static template = `
|
|
57
68
|
<uc-activity-header>
|
|
58
69
|
<button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back">
|
|
@@ -107,7 +118,7 @@ export const CameraSource = class {
|
|
|
107
118
|
<button
|
|
108
119
|
data-id="video"
|
|
109
120
|
type="button"
|
|
110
|
-
class="uc-switch
|
|
121
|
+
class="uc-switch uc-mini-btn"
|
|
111
122
|
set="onclick: onClickTab; @hidden: tabVideoHidden"
|
|
112
123
|
>
|
|
113
124
|
<uc-icon name="video-camera"></uc-icon>
|
|
@@ -134,8 +145,8 @@ export const CameraSource = class {
|
|
|
134
145
|
</button>
|
|
135
146
|
|
|
136
147
|
<div class="uc-select">
|
|
137
|
-
<button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden:
|
|
138
|
-
<uc-icon set="@name:
|
|
148
|
+
<button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicorphoneHidden;">
|
|
149
|
+
<uc-icon set="@name:toggleMicorphoneIcon"></uc-icon>
|
|
139
150
|
</button>
|
|
140
151
|
|
|
141
152
|
<uc-select
|
|
@@ -364,11 +375,11 @@ export const Config = class {
|
|
|
364
375
|
"user-agent-integration",
|
|
365
376
|
"locale-name",
|
|
366
377
|
"secure-uploads-expire-threshold",
|
|
367
|
-
"camera-modes",
|
|
368
378
|
"default-camera-mode",
|
|
369
379
|
"enable-audio-recording",
|
|
370
380
|
"enable-video-recording",
|
|
371
381
|
"max-video-recording-duration",
|
|
382
|
+
"cloud-image-editor-mask-href",
|
|
372
383
|
"multiplemin",
|
|
373
384
|
"multiplemax",
|
|
374
385
|
"confirmupload",
|
|
@@ -409,11 +420,11 @@ export const Config = class {
|
|
|
409
420
|
"useragentintegration",
|
|
410
421
|
"localename",
|
|
411
422
|
"secureuploadsexpirethreshold",
|
|
412
|
-
"cameramodes",
|
|
413
423
|
"defaultcameramode",
|
|
414
424
|
"enableaudiorecording",
|
|
415
425
|
"enablevideorecording",
|
|
416
426
|
"maxvideorecordingduration",
|
|
427
|
+
"cloudimageeditormaskhref",
|
|
417
428
|
];
|
|
418
429
|
static reg = () => {};
|
|
419
430
|
static styleAttrs = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/file-uploader",
|
|
3
|
-
"version": "1.13.0-alpha.
|
|
3
|
+
"version": "1.13.0-alpha.3",
|
|
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
|
".": {
|
|
@@ -116,7 +118,7 @@
|
|
|
116
118
|
"marked": "^4.3.0",
|
|
117
119
|
"node-watch": "^0.7.3",
|
|
118
120
|
"npm-run-all": "^4.1.5",
|
|
119
|
-
"playwright": "^1.
|
|
121
|
+
"playwright": "^1.49.1",
|
|
120
122
|
"postcss": "^8.4.21",
|
|
121
123
|
"prettier": "^3.2.4",
|
|
122
124
|
"prettier-plugin-jsdoc": "1.3.0",
|
|
@@ -140,4 +142,4 @@
|
|
|
140
142
|
"@uploadcare/upload-client": "^6.14.1",
|
|
141
143
|
"keyux": "^0.7.1"
|
|
142
144
|
}
|
|
143
|
-
}
|
|
145
|
+
}
|
package/types/exported.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
export type { CameraMode } from '../blocks/CameraSource/CameraSource';
|
|
5
4
|
|
|
6
5
|
export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
|
|
7
6
|
export type { UploaderPublicApi } from '../abstract/UploaderPublicApi';
|
|
@@ -22,7 +21,7 @@ export type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatur
|
|
|
22
21
|
export type IconHrefResolver = (iconName: string) => string;
|
|
23
22
|
export type FileValidators = FuncFileValidator[];
|
|
24
23
|
export type CollectionValidators = FuncCollectionValidator[];
|
|
25
|
-
export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes
|
|
24
|
+
export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes
|
|
26
25
|
|
|
27
26
|
export type ConfigType = {
|
|
28
27
|
/**
|
|
@@ -241,20 +240,11 @@ export type ConfigType = {
|
|
|
241
240
|
collectionValidators: CollectionValidators;
|
|
242
241
|
|
|
243
242
|
/**
|
|
244
|
-
* The
|
|
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,
|
|
243
|
+
* The default tab to open in the camera modal,
|
|
253
244
|
* it is possible to select video or photo capture
|
|
254
|
-
* @default '
|
|
255
|
-
* @deprecated - use `cameraModes` instead
|
|
245
|
+
* @default 'photo'
|
|
256
246
|
*/
|
|
257
|
-
defaultCameraMode:
|
|
247
|
+
defaultCameraMode: 'photo' | 'video';
|
|
258
248
|
/**
|
|
259
249
|
* Enable audio recording.
|
|
260
250
|
* @default true
|
|
@@ -262,22 +252,23 @@ export type ConfigType = {
|
|
|
262
252
|
enableAudioRecording: boolean;
|
|
263
253
|
/**
|
|
264
254
|
* Enable video recording.
|
|
265
|
-
* @
|
|
266
|
-
* @default null
|
|
255
|
+
* @default true
|
|
267
256
|
*/
|
|
268
|
-
enableVideoRecording: boolean
|
|
257
|
+
enableVideoRecording: boolean;
|
|
269
258
|
|
|
270
259
|
/**
|
|
271
260
|
* The maximum duration of the video recording in seconds
|
|
272
261
|
* @default null
|
|
273
262
|
*/
|
|
274
|
-
maxVideoRecordingDuration: number | null
|
|
263
|
+
maxVideoRecordingDuration: number | null
|
|
275
264
|
|
|
276
265
|
/**
|
|
277
|
-
* A dictionary object that can contain
|
|
266
|
+
* A dictionary object that can contain
|
|
278
267
|
* the following properties from MediaRecorderOptions
|
|
279
268
|
*/
|
|
280
|
-
|
|
269
|
+
mediaRecorerOptions: MediaRecorderOptions | null
|
|
270
|
+
|
|
271
|
+
cloudImageEditorMaskHref: string | null;
|
|
281
272
|
};
|
|
282
273
|
export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
283
274
|
export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -285,8 +276,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
|
|
|
285
276
|
|
|
286
277
|
export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
|
|
287
278
|
? T extends Uncapitalize<T>
|
|
288
|
-
|
|
289
|
-
|
|
279
|
+
? `${Uncapitalize<C>}${KebabCase<T>}`
|
|
280
|
+
: `${Uncapitalize<C>}-${KebabCase<T>}`
|
|
290
281
|
: S;
|
|
291
282
|
export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
|
|
292
283
|
export type LowerCase<S extends string> = Lowercase<S>;
|
|
@@ -294,10 +285,9 @@ export type LowerCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T
|
|
|
294
285
|
|
|
295
286
|
export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
|
|
296
287
|
|
|
297
|
-
export type OutputCustomErrorType = 'CUSTOM_ERROR'
|
|
288
|
+
export type OutputCustomErrorType = 'CUSTOM_ERROR'
|
|
298
289
|
|
|
299
|
-
export type OutputFileErrorType =
|
|
300
|
-
| OutputCustomErrorType
|
|
290
|
+
export type OutputFileErrorType = OutputCustomErrorType
|
|
301
291
|
| 'NOT_AN_IMAGE'
|
|
302
292
|
| 'FORBIDDEN_FILE_TYPE'
|
|
303
293
|
| 'FILE_SIZE_EXCEEDED'
|
|
@@ -305,11 +295,7 @@ export type OutputFileErrorType =
|
|
|
305
295
|
| 'NETWORK_ERROR'
|
|
306
296
|
| 'UNKNOWN_ERROR';
|
|
307
297
|
|
|
308
|
-
export type OutputCollectionErrorType =
|
|
309
|
-
| OutputCustomErrorType
|
|
310
|
-
| 'SOME_FILES_HAS_ERRORS'
|
|
311
|
-
| 'TOO_MANY_FILES'
|
|
312
|
-
| 'TOO_FEW_FILES';
|
|
298
|
+
export type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
|
|
313
299
|
|
|
314
300
|
export type OutputFileErrorPayload = {
|
|
315
301
|
entry: OutputFileEntry;
|
|
@@ -343,23 +329,22 @@ export type OutputErrorTypePayload = {
|
|
|
343
329
|
CUSTOM_ERROR: Record<string, unknown>;
|
|
344
330
|
};
|
|
345
331
|
|
|
346
|
-
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> =
|
|
332
|
+
export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> =
|
|
333
|
+
T extends OutputCustomErrorType
|
|
347
334
|
? {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
: T extends keyof OutputErrorTypePayload
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
: never;
|
|
335
|
+
type?: T;
|
|
336
|
+
message: string;
|
|
337
|
+
payload?: OutputErrorTypePayload[T];
|
|
338
|
+
}
|
|
339
|
+
: T extends keyof OutputErrorTypePayload ? {
|
|
340
|
+
type: T;
|
|
341
|
+
message: string;
|
|
342
|
+
payload?: OutputErrorTypePayload[T];
|
|
343
|
+
} : never
|
|
359
344
|
|
|
360
|
-
export type OutputErrorFile = OutputError<OutputFileErrorType
|
|
345
|
+
export type OutputErrorFile = OutputError<OutputFileErrorType>
|
|
361
346
|
|
|
362
|
-
export type OutputErrorCollection = OutputError<OutputCollectionErrorType
|
|
347
|
+
export type OutputErrorCollection = OutputError<OutputCollectionErrorType>
|
|
363
348
|
|
|
364
349
|
export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
|
|
365
350
|
status: TStatus;
|
|
@@ -377,7 +362,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
377
362
|
fullPath: string | null;
|
|
378
363
|
source: SourceTypes | null;
|
|
379
364
|
} & (
|
|
380
|
-
|
|
365
|
+
| {
|
|
381
366
|
status: 'success';
|
|
382
367
|
fileInfo: UploadcareFile;
|
|
383
368
|
uuid: string;
|
|
@@ -389,7 +374,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
389
374
|
isRemoved: false;
|
|
390
375
|
errors: [];
|
|
391
376
|
}
|
|
392
|
-
|
|
377
|
+
| {
|
|
393
378
|
status: 'failed';
|
|
394
379
|
fileInfo: UploadcareFile | null;
|
|
395
380
|
uuid: string | null;
|
|
@@ -401,7 +386,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
401
386
|
isRemoved: false;
|
|
402
387
|
errors: OutputError<OutputFileErrorType>[];
|
|
403
388
|
}
|
|
404
|
-
|
|
389
|
+
| {
|
|
405
390
|
status: 'uploading';
|
|
406
391
|
fileInfo: null;
|
|
407
392
|
uuid: null;
|
|
@@ -413,7 +398,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
413
398
|
isRemoved: false;
|
|
414
399
|
errors: [];
|
|
415
400
|
}
|
|
416
|
-
|
|
401
|
+
| {
|
|
417
402
|
status: 'removed';
|
|
418
403
|
fileInfo: UploadcareFile | null;
|
|
419
404
|
uuid: string | null;
|
|
@@ -425,7 +410,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
425
410
|
isRemoved: true;
|
|
426
411
|
errors: OutputError<OutputFileErrorType>[];
|
|
427
412
|
}
|
|
428
|
-
|
|
413
|
+
| {
|
|
429
414
|
status: 'idle';
|
|
430
415
|
fileInfo: null;
|
|
431
416
|
uuid: null;
|
|
@@ -437,7 +422,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
|
|
|
437
422
|
isRemoved: false;
|
|
438
423
|
errors: [];
|
|
439
424
|
}
|
|
440
|
-
);
|
|
425
|
+
);
|
|
441
426
|
|
|
442
427
|
export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
|
|
443
428
|
|
|
@@ -461,43 +446,43 @@ export type OutputCollectionState<
|
|
|
461
446
|
} & (TGroupFlag extends 'has-group'
|
|
462
447
|
? { group: UploadcareGroup }
|
|
463
448
|
: TGroupFlag extends 'maybe-has-group'
|
|
464
|
-
|
|
465
|
-
|
|
449
|
+
? { group: UploadcareGroup | null }
|
|
450
|
+
: never) &
|
|
466
451
|
(
|
|
467
452
|
| {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
453
|
+
status: 'idle';
|
|
454
|
+
isFailed: false;
|
|
455
|
+
isUploading: false;
|
|
456
|
+
isSuccess: false;
|
|
457
|
+
errors: [];
|
|
458
|
+
allEntries: OutputFileEntry<'idle' | 'success'>[];
|
|
459
|
+
}
|
|
475
460
|
| {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
461
|
+
status: 'uploading';
|
|
462
|
+
isFailed: false;
|
|
463
|
+
isUploading: true;
|
|
464
|
+
isSuccess: false;
|
|
465
|
+
errors: [];
|
|
466
|
+
allEntries: OutputFileEntry[];
|
|
467
|
+
}
|
|
483
468
|
| {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
469
|
+
status: 'success';
|
|
470
|
+
isFailed: false;
|
|
471
|
+
isUploading: false;
|
|
472
|
+
isSuccess: true;
|
|
473
|
+
errors: [];
|
|
474
|
+
allEntries: OutputFileEntry<'success'>[];
|
|
475
|
+
}
|
|
491
476
|
| {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
477
|
+
status: 'failed';
|
|
478
|
+
isFailed: true;
|
|
479
|
+
isUploading: false;
|
|
480
|
+
isSuccess: false;
|
|
481
|
+
errors: OutputError<OutputCollectionErrorType>[];
|
|
482
|
+
allEntries: OutputFileEntry[];
|
|
483
|
+
}
|
|
499
484
|
);
|
|
500
485
|
|
|
501
486
|
export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
|
|
502
487
|
|
|
503
|
-
export {};
|
|
488
|
+
export { };
|