@uploadcare/file-uploader 1.29.0-alpha.2 → 1.30.0-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/README.md +0 -2
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +335 -691
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +82 -115
- package/dist/locales/file-uploader/ar.d.ts +2 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +2 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +2 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +2 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +2 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +2 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +2 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +2 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +2 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +2 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +2 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +2 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +2 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +2 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +2 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +2 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +2 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +2 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +2 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +2 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +2 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +2 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +2 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +2 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +2 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +2 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +2 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +2 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +2 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +2 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +2 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +2 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +2 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +2 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +337 -691
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
- package/web/file-uploader.min.d.ts +337 -691
- package/web/file-uploader.min.js +4 -4
- package/web/file-uploader.min.js.LEGAL.txt +1 -1
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +3 -3
- package/web/uc-cloud-image-editor.layered.min.css +3 -3
- package/web/uc-cloud-image-editor.min.css +3 -3
- package/web/uc-cloud-image-editor.min.d.ts +321 -675
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +3 -3
- package/web/uc-file-uploader-inline.min.d.ts +337 -691
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.d.ts +337 -691
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +3 -3
- package/web/uc-file-uploader-regular.min.d.ts +337 -691
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
- package/web/uc-img.min.js +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import _default from './locales/file-uploader/en.js';
|
|
|
4
4
|
import * as lit_html from 'lit-html';
|
|
5
5
|
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
6
6
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
7
|
-
import {
|
|
7
|
+
import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
|
|
8
8
|
export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
|
|
9
9
|
import { Ref } from 'lit/directives/ref.js';
|
|
10
10
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
@@ -90,72 +90,8 @@ declare class A11y implements ISharedInstance {
|
|
|
90
90
|
declare class LocaleManager extends SharedInstance {
|
|
91
91
|
private _localeName;
|
|
92
92
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
93
|
-
private _applyOverrides;
|
|
94
|
-
private _applyPluginLocales;
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
/**
|
|
98
|
-
* Custom configuration options registration system for plugins
|
|
99
|
-
*/
|
|
100
|
-
type CustomConfigDefinition<T = unknown> = {
|
|
101
|
-
/**
|
|
102
|
-
* Config option name (will be used as property and optionally as attribute)
|
|
103
|
-
*/
|
|
104
|
-
name: string;
|
|
105
|
-
/**
|
|
106
|
-
* Default value for the config option
|
|
107
|
-
*/
|
|
108
|
-
defaultValue: T;
|
|
109
|
-
/**
|
|
110
|
-
* Whether this config can be set via HTML attribute
|
|
111
|
-
* @default true
|
|
112
|
-
*/
|
|
113
|
-
attribute?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Convert attribute string to config value
|
|
116
|
-
* Only used if attribute is true
|
|
117
|
-
*/
|
|
118
|
-
fromAttribute?: (value: string | null) => T;
|
|
119
|
-
/**
|
|
120
|
-
* Convert config value to attribute string
|
|
121
|
-
* Only used if attribute is true
|
|
122
|
-
*/
|
|
123
|
-
toAttribute?: (value: T) => string | null;
|
|
124
|
-
/**
|
|
125
|
-
* Normalize/validate the config value
|
|
126
|
-
*/
|
|
127
|
-
normalize?: (value: unknown) => T;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Registry for custom config options defined by plugins
|
|
131
|
-
* This is managed by the PluginManager as a shared instance property
|
|
132
|
-
*/
|
|
133
|
-
declare class CustomConfigRegistry {
|
|
134
|
-
private _definitions;
|
|
135
|
-
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
136
|
-
unregister(name: string): void;
|
|
137
|
-
unregisterByPlugin(pluginId: string): void;
|
|
138
|
-
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
139
|
-
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Interface for TypeScript module augmentation
|
|
143
|
-
* Plugins should extend this interface to add their custom config types
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* declare module '@uploadcare/file-uploader' {
|
|
148
|
-
* interface CustomConfig {
|
|
149
|
-
* 'my-custom-option': string;
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
interface CustomConfig {
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
158
|
-
|
|
159
95
|
declare class TypedData<T extends Record<string, unknown>> {
|
|
160
96
|
private _ctxId;
|
|
161
97
|
private _data;
|
|
@@ -168,41 +104,6 @@ declare class TypedData<T extends Record<string, unknown>> {
|
|
|
168
104
|
destroy(): void;
|
|
169
105
|
}
|
|
170
106
|
|
|
171
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
172
|
-
signal?: AbortSignal;
|
|
173
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
174
|
-
type FileValidatorDescriptor = {
|
|
175
|
-
runOn: 'add' | 'upload' | 'change';
|
|
176
|
-
validator: FuncFileValidator;
|
|
177
|
-
};
|
|
178
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
179
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
180
|
-
declare class ValidationManager extends SharedInstance {
|
|
181
|
-
private get _uploadCollection();
|
|
182
|
-
private _commonFileValidators;
|
|
183
|
-
private _commonCollectionValidators;
|
|
184
|
-
private _queue;
|
|
185
|
-
private _runQueueDebounced;
|
|
186
|
-
private _isDestroyed;
|
|
187
|
-
private _entryValidationState;
|
|
188
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
189
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
190
|
-
runCollectionValidators(): void;
|
|
191
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
192
|
-
private _runFileValidatorsForEntry;
|
|
193
|
-
private _addCustomTypeToValidationError;
|
|
194
|
-
private _getEntryValidationState;
|
|
195
|
-
private _getValidatorDescriptors;
|
|
196
|
-
private _getValidatorDescriptorsForEntry;
|
|
197
|
-
destroy(): void;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
declare class SecureUploadsManager extends SharedInstance {
|
|
201
|
-
private _secureToken;
|
|
202
|
-
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
203
|
-
destroy(): void;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
107
|
type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
|
|
207
108
|
type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
|
|
208
109
|
type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
@@ -254,6 +155,155 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
254
155
|
}>;
|
|
255
156
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
256
157
|
|
|
158
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
159
|
+
|
|
160
|
+
interface UploadEntryData extends Record<string, unknown> {
|
|
161
|
+
file: File | null;
|
|
162
|
+
externalUrl: string | null;
|
|
163
|
+
fileName: string | null;
|
|
164
|
+
fileSize: number | null;
|
|
165
|
+
lastModified: number;
|
|
166
|
+
uploadProgress: number;
|
|
167
|
+
uuid: string | null;
|
|
168
|
+
isImage: boolean;
|
|
169
|
+
mimeType: string | null;
|
|
170
|
+
ctxName: string | null;
|
|
171
|
+
cdnUrl: string | null;
|
|
172
|
+
cdnUrlModifiers: string | null;
|
|
173
|
+
fileInfo: UploadcareFile | null;
|
|
174
|
+
isUploading: boolean;
|
|
175
|
+
abortController: AbortController | null;
|
|
176
|
+
thumbUrl: string | null;
|
|
177
|
+
silent: boolean;
|
|
178
|
+
source: string | null;
|
|
179
|
+
fullPath: string | null;
|
|
180
|
+
metadata: Metadata | null;
|
|
181
|
+
errors: OutputErrorFile[];
|
|
182
|
+
uploadError: Error | null;
|
|
183
|
+
isRemoved: boolean;
|
|
184
|
+
isQueuedForUploading: boolean;
|
|
185
|
+
isValidationPending: boolean;
|
|
186
|
+
isQueuedForValidation: boolean;
|
|
187
|
+
}
|
|
188
|
+
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
189
|
+
type UploadEntryKeys = keyof UploadEntryData;
|
|
190
|
+
|
|
191
|
+
type ApiAddFileCommonOptions = {
|
|
192
|
+
silent?: boolean;
|
|
193
|
+
fileName?: string;
|
|
194
|
+
source?: string;
|
|
195
|
+
};
|
|
196
|
+
declare class UploaderPublicApi extends SharedInstance {
|
|
197
|
+
private _l10n;
|
|
198
|
+
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
199
|
+
get cfg(): Readonly<ConfigType>;
|
|
200
|
+
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
201
|
+
/**
|
|
202
|
+
* TODO: Probably we should not allow user to override `source` property
|
|
203
|
+
*/
|
|
204
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
205
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
206
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
207
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
208
|
+
fullPath?: string;
|
|
209
|
+
}) => OutputFileEntry<"idle">;
|
|
210
|
+
removeFileByInternalId: (internalId: string) => void;
|
|
211
|
+
removeAllFiles(): void;
|
|
212
|
+
uploadAll: () => void;
|
|
213
|
+
openSystemDialog: (options?: {
|
|
214
|
+
captureCamera?: boolean;
|
|
215
|
+
modeCamera?: ModeCameraType;
|
|
216
|
+
}) => void;
|
|
217
|
+
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
218
|
+
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
219
|
+
initFlow: (force?: boolean) => void;
|
|
220
|
+
doneFlow: () => void;
|
|
221
|
+
setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
|
|
222
|
+
getCurrentActivity: () => ActivityType;
|
|
223
|
+
setModalState: (opened: boolean) => void;
|
|
224
|
+
private get _sourceList();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare const ExternalUploadSource: Readonly<{
|
|
228
|
+
readonly FACEBOOK: "facebook";
|
|
229
|
+
readonly DROPBOX: "dropbox";
|
|
230
|
+
readonly GDRIVE: "gdrive";
|
|
231
|
+
readonly GPHOTOS: "gphotos";
|
|
232
|
+
readonly FLICKR: "flickr";
|
|
233
|
+
readonly VK: "vk";
|
|
234
|
+
readonly EVERNOTE: "evernote";
|
|
235
|
+
readonly BOX: "box";
|
|
236
|
+
readonly ONEDRIVE: "onedrive";
|
|
237
|
+
readonly HUDDLE: "huddle";
|
|
238
|
+
}>;
|
|
239
|
+
declare const UploadSource: Readonly<{
|
|
240
|
+
readonly FACEBOOK: "facebook";
|
|
241
|
+
readonly DROPBOX: "dropbox";
|
|
242
|
+
readonly GDRIVE: "gdrive";
|
|
243
|
+
readonly GPHOTOS: "gphotos";
|
|
244
|
+
readonly FLICKR: "flickr";
|
|
245
|
+
readonly VK: "vk";
|
|
246
|
+
readonly EVERNOTE: "evernote";
|
|
247
|
+
readonly BOX: "box";
|
|
248
|
+
readonly ONEDRIVE: "onedrive";
|
|
249
|
+
readonly HUDDLE: "huddle";
|
|
250
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
251
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
252
|
+
readonly LOCAL: "local";
|
|
253
|
+
readonly DROP_AREA: "drop-area";
|
|
254
|
+
readonly CAMERA: "camera";
|
|
255
|
+
readonly EXTERNAL: "external";
|
|
256
|
+
readonly API: "js-api";
|
|
257
|
+
readonly URL: "url";
|
|
258
|
+
readonly DRAW: "draw";
|
|
259
|
+
}>;
|
|
260
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
261
|
+
|
|
262
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
263
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
264
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
265
|
+
protected couldBeCtxOwner: boolean;
|
|
266
|
+
private _isCtxOwner;
|
|
267
|
+
private _unobserveCollection?;
|
|
268
|
+
private _unobserveCollectionProperties?;
|
|
269
|
+
init$: {
|
|
270
|
+
'*commonProgress': number;
|
|
271
|
+
'*uploadList': never[];
|
|
272
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
273
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
274
|
+
'*collectionState': OutputCollectionState | null;
|
|
275
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
276
|
+
'*uploadTrigger': Set<string>;
|
|
277
|
+
'*currentActivity': null;
|
|
278
|
+
'*currentActivityParams': {};
|
|
279
|
+
'*history': never[];
|
|
280
|
+
'*historyBack': null;
|
|
281
|
+
'*closeModal': () => void;
|
|
282
|
+
};
|
|
283
|
+
private get _hasCtxOwner();
|
|
284
|
+
initCallback(): void;
|
|
285
|
+
getAPI(): UploaderPublicApi;
|
|
286
|
+
get validationManager(): ValidationManager;
|
|
287
|
+
get api(): UploaderPublicApi;
|
|
288
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
289
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
290
|
+
disconnectedCallback(): void;
|
|
291
|
+
connectedCallback(): void;
|
|
292
|
+
private _initCtxOwner;
|
|
293
|
+
private _observeUploadCollection;
|
|
294
|
+
private _unobserveUploadCollection;
|
|
295
|
+
private _createGroup;
|
|
296
|
+
private _flushOutputItems;
|
|
297
|
+
private _handleCollectionUpdate;
|
|
298
|
+
private _handleCollectionPropertiesUpdate;
|
|
299
|
+
private _flushCommonUploadProgress;
|
|
300
|
+
private _openCloudImageEditor;
|
|
301
|
+
private _setInitialCrop;
|
|
302
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
303
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
304
|
+
getOutputData(): OutputFileEntry[];
|
|
305
|
+
}
|
|
306
|
+
|
|
257
307
|
/**
|
|
258
308
|
* Mapping of loading resources per operation
|
|
259
309
|
*/
|
|
@@ -368,14 +418,11 @@ declare global {
|
|
|
368
418
|
declare class Icon extends LitBlock {
|
|
369
419
|
name: string;
|
|
370
420
|
private _resolvedHref;
|
|
371
|
-
private _pluginSvg;
|
|
372
421
|
private _iconHrefResolver;
|
|
373
|
-
private _unsubscribePlugins?;
|
|
374
422
|
initCallback(): void;
|
|
375
423
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
376
424
|
private _updateResolvedHref;
|
|
377
425
|
render(): lit_html.TemplateResult<1>;
|
|
378
|
-
disconnectedCallback(): void;
|
|
379
426
|
}
|
|
380
427
|
declare global {
|
|
381
428
|
interface HTMLElementTagNameMap {
|
|
@@ -906,7 +953,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
906
953
|
private _hasNetworkProblems;
|
|
907
954
|
private _isInitialized;
|
|
908
955
|
private _pendingInitUpdate;
|
|
909
|
-
private _pendingSizeWait;
|
|
910
956
|
private readonly _debouncedShowLoader;
|
|
911
957
|
private readonly _imgRef;
|
|
912
958
|
private readonly _cropperRef;
|
|
@@ -956,11 +1002,12 @@ type ActivityParams$1 = {
|
|
|
956
1002
|
internalId: string;
|
|
957
1003
|
};
|
|
958
1004
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1005
|
+
couldBeCtxOwner: boolean;
|
|
1006
|
+
activityType: "cloud-image-edit";
|
|
959
1007
|
private _entry?;
|
|
960
1008
|
private _editorConfig;
|
|
961
1009
|
get activityParams(): ActivityParams$1;
|
|
962
1010
|
initCallback(): void;
|
|
963
|
-
disconnectedCallback(): void;
|
|
964
1011
|
private _handleApply;
|
|
965
1012
|
private _handleCancel;
|
|
966
1013
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -997,6 +1044,7 @@ type ActivityParams = {
|
|
|
997
1044
|
};
|
|
998
1045
|
declare class ExternalSource extends LitUploaderBlock {
|
|
999
1046
|
couldBeCtxOwner: boolean;
|
|
1047
|
+
activityType: "external";
|
|
1000
1048
|
private _messageBridge?;
|
|
1001
1049
|
private _iframeRef;
|
|
1002
1050
|
private _latestSelectionSummary;
|
|
@@ -1040,26 +1088,22 @@ declare global {
|
|
|
1040
1088
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1041
1089
|
START_FROM: "start-from";
|
|
1042
1090
|
CAMERA: "camera";
|
|
1091
|
+
DRAW: "draw";
|
|
1043
1092
|
UPLOAD_LIST: "upload-list";
|
|
1044
1093
|
URL: "url";
|
|
1045
1094
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1046
1095
|
EXTERNAL: "external";
|
|
1047
1096
|
}>;
|
|
1048
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1049
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1097
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1098
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1050
1099
|
|
|
1051
1100
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1052
|
-
interface CustomActivities {
|
|
1053
|
-
}
|
|
1054
1101
|
type ActivityParamsMap = {
|
|
1055
1102
|
'cloud-image-edit': ActivityParams$1;
|
|
1056
1103
|
external: ActivityParams;
|
|
1057
|
-
} & {
|
|
1058
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1059
1104
|
};
|
|
1060
1105
|
declare class LitActivityBlock extends LitBlock {
|
|
1061
1106
|
protected historyTracked: boolean;
|
|
1062
|
-
activityType: ActivityType;
|
|
1063
1107
|
private [ACTIVE_PROP]?;
|
|
1064
1108
|
init$: {
|
|
1065
1109
|
'*currentActivity': null;
|
|
@@ -1073,11 +1117,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1073
1117
|
private _activate;
|
|
1074
1118
|
initCallback(): void;
|
|
1075
1119
|
private _historyFlush;
|
|
1076
|
-
|
|
1120
|
+
private _isActivityRegistered;
|
|
1077
1121
|
private static _activityCallbacks;
|
|
1078
1122
|
static activities: Readonly<{
|
|
1079
1123
|
START_FROM: 'start-from';
|
|
1080
1124
|
CAMERA: 'camera';
|
|
1125
|
+
DRAW: 'draw';
|
|
1081
1126
|
UPLOAD_LIST: 'upload-list';
|
|
1082
1127
|
URL: 'url';
|
|
1083
1128
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1093,8 +1138,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1093
1138
|
private _unregisterActivity;
|
|
1094
1139
|
disconnectedCallback(): void;
|
|
1095
1140
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1096
|
-
get initActivity():
|
|
1097
|
-
get doneActivity():
|
|
1141
|
+
get initActivity(): string | null;
|
|
1142
|
+
get doneActivity(): string | null;
|
|
1098
1143
|
historyBack(): void;
|
|
1099
1144
|
}
|
|
1100
1145
|
|
|
@@ -1156,9 +1201,7 @@ type EventPayload = {
|
|
|
1156
1201
|
declare class EventEmitter extends SharedInstance {
|
|
1157
1202
|
private _timeoutStore;
|
|
1158
1203
|
private _targets;
|
|
1159
|
-
private _listeners;
|
|
1160
1204
|
bindTarget(target: LitBlock): () => void;
|
|
1161
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1162
1205
|
private _dispatch;
|
|
1163
1206
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1164
1207
|
debounce?: TDebounce;
|
|
@@ -1166,123 +1209,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1166
1209
|
destroy(): void;
|
|
1167
1210
|
}
|
|
1168
1211
|
|
|
1169
|
-
type
|
|
1170
|
-
|
|
1171
|
-
fileName?: string;
|
|
1172
|
-
source?: string;
|
|
1212
|
+
type EventMap = {
|
|
1213
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1173
1214
|
};
|
|
1174
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
1175
|
-
private _l10n;
|
|
1176
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1177
|
-
get cfg(): Readonly<ConfigType>;
|
|
1178
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
1179
|
-
/**
|
|
1180
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
1181
|
-
*/
|
|
1182
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1183
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1184
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1185
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
1186
|
-
fullPath?: string;
|
|
1187
|
-
}) => OutputFileEntry<"idle">;
|
|
1188
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
1189
|
-
removeAllFiles(): void;
|
|
1190
|
-
uploadAll: () => void;
|
|
1191
|
-
openSystemDialog: (options?: {
|
|
1192
|
-
captureCamera?: boolean;
|
|
1193
|
-
modeCamera?: ModeCameraType;
|
|
1194
|
-
}) => void;
|
|
1195
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
1196
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
1197
|
-
initFlow: (force?: boolean) => void;
|
|
1198
|
-
doneFlow: () => void;
|
|
1199
|
-
private _pluginsReady;
|
|
1200
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1201
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1202
|
-
getCurrentActivity: () => ActivityType;
|
|
1203
|
-
historyBack: () => void;
|
|
1204
|
-
setModalState: (opened: boolean) => void;
|
|
1205
|
-
private get _sourceList();
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
declare const ExternalUploadSource: Readonly<{
|
|
1209
|
-
readonly FACEBOOK: "facebook";
|
|
1210
|
-
readonly DROPBOX: "dropbox";
|
|
1211
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
1212
|
-
readonly GDRIVE: "gdrive";
|
|
1213
|
-
readonly GPHOTOS: "gphotos";
|
|
1214
|
-
readonly FLICKR: "flickr";
|
|
1215
|
-
readonly VK: "vk";
|
|
1216
|
-
readonly EVERNOTE: "evernote";
|
|
1217
|
-
readonly BOX: "box";
|
|
1218
|
-
readonly ONEDRIVE: "onedrive";
|
|
1219
|
-
readonly HUDDLE: "huddle";
|
|
1220
|
-
}>;
|
|
1221
|
-
declare const UploadSource: Readonly<{
|
|
1222
|
-
readonly FACEBOOK: "facebook";
|
|
1223
|
-
readonly DROPBOX: "dropbox";
|
|
1224
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
1225
|
-
readonly GDRIVE: "gdrive";
|
|
1226
|
-
readonly GPHOTOS: "gphotos";
|
|
1227
|
-
readonly FLICKR: "flickr";
|
|
1228
|
-
readonly VK: "vk";
|
|
1229
|
-
readonly EVERNOTE: "evernote";
|
|
1230
|
-
readonly BOX: "box";
|
|
1231
|
-
readonly ONEDRIVE: "onedrive";
|
|
1232
|
-
readonly HUDDLE: "huddle";
|
|
1233
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1234
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1235
|
-
readonly LOCAL: "local";
|
|
1236
|
-
readonly DROP_AREA: "drop-area";
|
|
1237
|
-
readonly CAMERA: "camera";
|
|
1238
|
-
readonly EXTERNAL: "external";
|
|
1239
|
-
readonly API: "js-api";
|
|
1240
|
-
readonly URL: "url";
|
|
1241
|
-
}>;
|
|
1242
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1243
1215
|
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
private
|
|
1250
|
-
private
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1255
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1256
|
-
'*collectionState': OutputCollectionState | null;
|
|
1257
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1258
|
-
'*uploadTrigger': Set<string>;
|
|
1259
|
-
'*currentActivity': null;
|
|
1260
|
-
'*currentActivityParams': {};
|
|
1261
|
-
'*history': never[];
|
|
1262
|
-
'*historyBack': null;
|
|
1263
|
-
'*closeModal': () => void;
|
|
1264
|
-
};
|
|
1265
|
-
private get _hasCtxOwner();
|
|
1266
|
-
initCallback(): void;
|
|
1267
|
-
getAPI(): UploaderPublicApi;
|
|
1268
|
-
get validationManager(): ValidationManager;
|
|
1269
|
-
get api(): UploaderPublicApi;
|
|
1270
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1271
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1272
|
-
disconnectedCallback(): void;
|
|
1273
|
-
connectedCallback(): void;
|
|
1274
|
-
private _initCtxOwner;
|
|
1275
|
-
private _observeUploadCollection;
|
|
1276
|
-
private _unobserveUploadCollection;
|
|
1277
|
-
private _createGroup;
|
|
1278
|
-
private _flushOutputItems;
|
|
1279
|
-
private _handleCollectionUpdate;
|
|
1280
|
-
private _handleCollectionPropertiesUpdate;
|
|
1281
|
-
private _flushCommonUploadProgress;
|
|
1282
|
-
private _setInitialCrop;
|
|
1283
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1284
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1285
|
-
getOutputData(): OutputFileEntry[];
|
|
1216
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1217
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1218
|
+
private scopes;
|
|
1219
|
+
private listener;
|
|
1220
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1221
|
+
private openUploadList;
|
|
1222
|
+
private _listener;
|
|
1223
|
+
private handlePaste;
|
|
1224
|
+
registerBlock(scope: Node): () => void;
|
|
1225
|
+
destroy(): void;
|
|
1286
1226
|
}
|
|
1287
1227
|
|
|
1288
1228
|
type SelectOption = {
|
|
@@ -1305,6 +1245,7 @@ declare global {
|
|
|
1305
1245
|
type CameraMode = 'photo' | 'video';
|
|
1306
1246
|
declare class CameraSource extends LitUploaderBlock {
|
|
1307
1247
|
couldBeCtxOwner: boolean;
|
|
1248
|
+
activityType: "camera";
|
|
1308
1249
|
private _unsubPermissions;
|
|
1309
1250
|
private _capturing;
|
|
1310
1251
|
private _chunks;
|
|
@@ -1326,6 +1267,7 @@ declare class CameraSource extends LitUploaderBlock {
|
|
|
1326
1267
|
private _timerRef;
|
|
1327
1268
|
private _lineRef;
|
|
1328
1269
|
private _videoRef;
|
|
1270
|
+
private _switcherRef;
|
|
1329
1271
|
private _startTime;
|
|
1330
1272
|
private _elapsedTime;
|
|
1331
1273
|
private _videoTransformCss;
|
|
@@ -1423,54 +1365,25 @@ declare global {
|
|
|
1423
1365
|
/**
|
|
1424
1366
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1425
1367
|
*/
|
|
1426
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1368
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartButtonSettings"];
|
|
1369
|
+
/** Mapping of attribute names to state */
|
|
1370
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1427
1371
|
declare class Config extends LitBlock {
|
|
1428
1372
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
1429
1373
|
'ctx-name': string;
|
|
1430
1374
|
};
|
|
1431
1375
|
init$: LitBlock["init$"] & ConfigType;
|
|
1432
1376
|
private _computationControllers;
|
|
1433
|
-
private _pluginChangeUnsubscribe?;
|
|
1434
|
-
private _mutationObserver?;
|
|
1435
|
-
/**
|
|
1436
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1437
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1438
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1439
|
-
*/
|
|
1440
|
-
private _customAttrKeyMapping;
|
|
1441
|
-
/** Set of all custom config names registered by plugins */
|
|
1442
|
-
private _customConfigKeys;
|
|
1443
|
-
/**
|
|
1444
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1445
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1446
|
-
*/
|
|
1447
|
-
private _customConfigSubscriptions;
|
|
1448
|
-
/**
|
|
1449
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1450
|
-
*/
|
|
1451
|
-
private _isCustomConfig;
|
|
1452
|
-
/**
|
|
1453
|
-
* Get the custom config definition for a key
|
|
1454
|
-
*/
|
|
1455
|
-
private _getCustomConfigDefinition;
|
|
1456
|
-
/**
|
|
1457
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1458
|
-
*/
|
|
1459
|
-
private _getAttributeNames;
|
|
1460
1377
|
private _flushValueToAttribute;
|
|
1461
1378
|
private _flushValueToState;
|
|
1462
1379
|
private _setValue;
|
|
1463
1380
|
private _getValue;
|
|
1464
1381
|
private _assertSameValueDifferentReference;
|
|
1465
|
-
private _processCustomConfigs;
|
|
1466
|
-
private _setupCustomConfigs;
|
|
1467
|
-
private _setupMutationObserver;
|
|
1468
1382
|
initCallback(): void;
|
|
1469
|
-
attributeChangedCallback(name:
|
|
1470
|
-
disconnectedCallback(): void;
|
|
1383
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1471
1384
|
static get observedAttributes(): string[];
|
|
1472
1385
|
}
|
|
1473
|
-
interface Config extends ConfigType
|
|
1386
|
+
interface Config extends ConfigType {
|
|
1474
1387
|
}
|
|
1475
1388
|
declare global {
|
|
1476
1389
|
interface HTMLElementTagNameMap {
|
|
@@ -1554,12 +1467,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1554
1467
|
private _isFailed;
|
|
1555
1468
|
private _isUploading;
|
|
1556
1469
|
private _isFocused;
|
|
1470
|
+
private _isEditable;
|
|
1557
1471
|
private _showFileNames;
|
|
1558
1472
|
private _ariaLabelStatusFile;
|
|
1559
|
-
private _pluginFileActions;
|
|
1560
1473
|
private _renderedOnce;
|
|
1561
1474
|
private _observer?;
|
|
1562
|
-
private
|
|
1475
|
+
private _handleEdit;
|
|
1563
1476
|
private _handleRemove;
|
|
1564
1477
|
private _handleUploadClick;
|
|
1565
1478
|
private _calculateState;
|
|
@@ -1571,8 +1484,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1571
1484
|
private _handleEntryId;
|
|
1572
1485
|
private _updateShowFileNames;
|
|
1573
1486
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1574
|
-
private _updatePluginFileActions;
|
|
1575
|
-
private _handlePluginFileAction;
|
|
1576
1487
|
initCallback(): void;
|
|
1577
1488
|
connectedCallback(): void;
|
|
1578
1489
|
disconnectedCallback(): void;
|
|
@@ -1669,6 +1580,67 @@ declare global {
|
|
|
1669
1580
|
}
|
|
1670
1581
|
}
|
|
1671
1582
|
|
|
1583
|
+
declare class SourceBtn extends LitUploaderBlock {
|
|
1584
|
+
couldBeCtxOwner: boolean;
|
|
1585
|
+
private _registeredTypes;
|
|
1586
|
+
type?: string;
|
|
1587
|
+
onlyIcon: boolean;
|
|
1588
|
+
private _iconName;
|
|
1589
|
+
private _srcTypeKey;
|
|
1590
|
+
private _initTypes;
|
|
1591
|
+
initCallback(): void;
|
|
1592
|
+
private _registerType;
|
|
1593
|
+
activate(): void;
|
|
1594
|
+
private _applyType;
|
|
1595
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1596
|
+
render(): lit_html.TemplateResult<1>;
|
|
1597
|
+
}
|
|
1598
|
+
declare global {
|
|
1599
|
+
interface HTMLElementTagNameMap {
|
|
1600
|
+
'uc-source-btn': SourceBtn;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
declare class Dropdown extends LitBlock {
|
|
1605
|
+
private _id;
|
|
1606
|
+
protected render(): unknown;
|
|
1607
|
+
}
|
|
1608
|
+
declare global {
|
|
1609
|
+
interface HTMLElementTagNameMap {
|
|
1610
|
+
'uc-dropdown': Dropdown;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
|
|
1615
|
+
type AdvancedSmartBtnConfig = {
|
|
1616
|
+
sourceList: string;
|
|
1617
|
+
mode: SmartButtonMode;
|
|
1618
|
+
};
|
|
1619
|
+
declare class SmartBtn extends LitUploaderBlock {
|
|
1620
|
+
static styleAttrs: string[];
|
|
1621
|
+
couldBeCtxOwner: boolean;
|
|
1622
|
+
dropzone: boolean;
|
|
1623
|
+
private _sourceList;
|
|
1624
|
+
private _status;
|
|
1625
|
+
private _buttonTextKey;
|
|
1626
|
+
private _entry;
|
|
1627
|
+
private _lastDigest;
|
|
1628
|
+
private _visible;
|
|
1629
|
+
private get isIdle();
|
|
1630
|
+
private get buttonText();
|
|
1631
|
+
private _throttledHandleCollectionUpdate;
|
|
1632
|
+
private _updateButtonBasedOnCollectionState;
|
|
1633
|
+
initCallback(): void;
|
|
1634
|
+
private readonly _handleClickAbort;
|
|
1635
|
+
private readonly _handleClick;
|
|
1636
|
+
render(): lit_html.TemplateResult<1>;
|
|
1637
|
+
}
|
|
1638
|
+
declare global {
|
|
1639
|
+
interface HTMLElementTagNameMap {
|
|
1640
|
+
'uc-smart-btn': SmartBtn;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1672
1644
|
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
|
|
1673
1645
|
type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
|
|
1674
1646
|
type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
|
|
@@ -1881,10 +1853,6 @@ type ConfigType = {
|
|
|
1881
1853
|
* Expiry threshold for secure uploads.
|
|
1882
1854
|
*/
|
|
1883
1855
|
secureUploadsExpireThreshold: number;
|
|
1884
|
-
/**
|
|
1885
|
-
* Array of plugins to register with the uploader instance.
|
|
1886
|
-
*/
|
|
1887
|
-
plugins: UploaderPlugin[];
|
|
1888
1856
|
/**
|
|
1889
1857
|
* Metadata for the file.
|
|
1890
1858
|
*/
|
|
@@ -1970,6 +1938,7 @@ type ConfigType = {
|
|
|
1970
1938
|
* Define the clipboard paste scope.
|
|
1971
1939
|
*/
|
|
1972
1940
|
pasteScope: PasteScope;
|
|
1941
|
+
smartButtonSettings: AdvancedSmartBtnConfig | null;
|
|
1973
1942
|
};
|
|
1974
1943
|
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
1975
1944
|
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -2145,237 +2114,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2145
2114
|
allEntries: OutputFileEntry[];
|
|
2146
2115
|
});
|
|
2147
2116
|
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
};
|
|
2152
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2153
|
-
type PluginSourceRegistration = {
|
|
2154
|
-
id: string;
|
|
2155
|
-
label: string;
|
|
2156
|
-
icon?: string;
|
|
2157
|
-
/**
|
|
2158
|
-
* @internal
|
|
2159
|
-
*
|
|
2160
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2161
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2162
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2163
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2164
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2165
|
-
*/
|
|
2166
|
-
expand?: () => string[];
|
|
2167
|
-
onSelect: () => Promise<void> | void;
|
|
2168
|
-
};
|
|
2169
|
-
type PluginRenderDispose = () => void;
|
|
2170
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2171
|
-
type PluginActivityRegistration = {
|
|
2172
|
-
id: string;
|
|
2173
|
-
render: PluginRender;
|
|
2174
|
-
};
|
|
2175
|
-
type PluginFileActionRegistration = {
|
|
2176
|
-
/** Unique action identifier. */
|
|
2177
|
-
id: string;
|
|
2178
|
-
/** Icon name to display in the action button. */
|
|
2179
|
-
icon: string;
|
|
2180
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2181
|
-
label: string;
|
|
2182
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2183
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2184
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2185
|
-
};
|
|
2186
|
-
type PluginFileHookResult = {
|
|
2187
|
-
/** The (optionally transformed) file */
|
|
2188
|
-
file: File | Blob;
|
|
2189
|
-
};
|
|
2190
|
-
type PluginFileHookContext = PluginFileHookResult & {
|
|
2191
|
-
/**
|
|
2192
|
-
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
2193
|
-
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
2194
|
-
*/
|
|
2195
|
-
signal: AbortSignal;
|
|
2196
|
-
};
|
|
2197
|
-
type PluginFileHookRegistration = {
|
|
2198
|
-
/**
|
|
2199
|
-
* When the hook is called:
|
|
2200
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2201
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2202
|
-
*
|
|
2203
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2204
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2205
|
-
*/
|
|
2206
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2207
|
-
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
2208
|
-
/**
|
|
2209
|
-
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
2210
|
-
* @default 30000
|
|
2211
|
-
*/
|
|
2212
|
-
timeout?: number;
|
|
2213
|
-
};
|
|
2214
|
-
type PluginRegistryApi = {
|
|
2215
|
-
registerSource: (source: PluginSourceRegistration) => void;
|
|
2216
|
-
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
2217
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
2218
|
-
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
2219
|
-
registerIcon: (icon: PluginIconRegistration) => void;
|
|
2220
|
-
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
2221
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2222
|
-
};
|
|
2223
|
-
/**
|
|
2224
|
-
* API for managing plugin config subscriptions
|
|
2225
|
-
*/
|
|
2226
|
-
type PluginConfigApi = {
|
|
2227
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2228
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2229
|
-
};
|
|
2230
|
-
/**
|
|
2231
|
-
* API for managing plugin activity interactions
|
|
2232
|
-
*/
|
|
2233
|
-
type PluginActivityApi = {
|
|
2234
|
-
/**
|
|
2235
|
-
* Get the current activity parameters.
|
|
2236
|
-
*
|
|
2237
|
-
* @returns The current activity parameters object
|
|
2238
|
-
*
|
|
2239
|
-
* @example
|
|
2240
|
-
* ```typescript
|
|
2241
|
-
* const params = pluginApi.activity.getParams();
|
|
2242
|
-
* console.log('Current params:', params);
|
|
2243
|
-
* ```
|
|
2244
|
-
*/
|
|
2245
|
-
getParams: () => Record<string, unknown>;
|
|
2246
|
-
/**
|
|
2247
|
-
* Subscribe to changes in activity parameters.
|
|
2248
|
-
* The callback will be called immediately with the current params,
|
|
2249
|
-
* and then whenever the params change.
|
|
2250
|
-
*
|
|
2251
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2252
|
-
*
|
|
2253
|
-
* @param callback - Function to call with the new params
|
|
2254
|
-
* @returns Unsubscribe function
|
|
2255
|
-
*
|
|
2256
|
-
* @example
|
|
2257
|
-
* ```typescript
|
|
2258
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2259
|
-
* console.log('Activity params changed:', params);
|
|
2260
|
-
* });
|
|
2261
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2262
|
-
* ```
|
|
2263
|
-
*/
|
|
2264
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2265
|
-
};
|
|
2266
|
-
type PluginFileEntryUpdate = {
|
|
2267
|
-
file?: File | Blob;
|
|
2268
|
-
cdnUrl?: string | null;
|
|
2269
|
-
cdnUrlModifiers?: string | null;
|
|
2270
|
-
mimeType?: string | null;
|
|
2271
|
-
};
|
|
2272
|
-
type PluginFilesApi = {
|
|
2273
|
-
/**
|
|
2274
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2275
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2276
|
-
*/
|
|
2277
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2278
|
-
};
|
|
2279
|
-
type PluginApi = {
|
|
2280
|
-
registry: PluginRegistryApi;
|
|
2281
|
-
config: PluginConfigApi;
|
|
2282
|
-
activity: PluginActivityApi;
|
|
2283
|
-
files: PluginFilesApi;
|
|
2284
|
-
};
|
|
2285
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2286
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2287
|
-
type PluginSetupParams = {
|
|
2288
|
-
pluginApi: PluginApi;
|
|
2289
|
-
uploaderApi: PluginUploaderApi;
|
|
2290
|
-
};
|
|
2291
|
-
type UploaderPlugin = {
|
|
2292
|
-
id: string;
|
|
2293
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2294
|
-
};
|
|
2295
|
-
type Owned<T> = T & {
|
|
2296
|
-
pluginId: string;
|
|
2297
|
-
};
|
|
2298
|
-
type PluginRegistrySnapshot = {
|
|
2299
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2300
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2301
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2302
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2303
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2304
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2305
|
-
};
|
|
2306
|
-
|
|
2307
|
-
type EventMap = {
|
|
2308
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2309
|
-
};
|
|
2310
|
-
|
|
2311
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2312
|
-
file: File | null;
|
|
2313
|
-
externalUrl: string | null;
|
|
2314
|
-
fileName: string | null;
|
|
2315
|
-
fileSize: number | null;
|
|
2316
|
-
lastModified: number;
|
|
2317
|
-
uploadProgress: number;
|
|
2318
|
-
uuid: string | null;
|
|
2319
|
-
isImage: boolean;
|
|
2320
|
-
mimeType: string | null;
|
|
2321
|
-
ctxName: string | null;
|
|
2322
|
-
cdnUrl: string | null;
|
|
2323
|
-
cdnUrlModifiers: string | null;
|
|
2324
|
-
fileInfo: UploadcareFile | null;
|
|
2325
|
-
isUploading: boolean;
|
|
2326
|
-
abortController: AbortController | null;
|
|
2327
|
-
thumbUrl: string | null;
|
|
2328
|
-
silent: boolean;
|
|
2329
|
-
source: string | null;
|
|
2330
|
-
fullPath: string | null;
|
|
2331
|
-
metadata: Metadata | null;
|
|
2332
|
-
errors: OutputErrorFile[];
|
|
2333
|
-
uploadError: Error | null;
|
|
2334
|
-
isRemoved: boolean;
|
|
2335
|
-
isQueuedForUploading: boolean;
|
|
2336
|
-
isValidationPending: boolean;
|
|
2337
|
-
isQueuedForValidation: boolean;
|
|
2338
|
-
}
|
|
2339
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2340
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2341
|
-
|
|
2342
|
-
declare class PluginRegistry {
|
|
2343
|
-
private _sources;
|
|
2344
|
-
private _activities;
|
|
2345
|
-
private _fileActions;
|
|
2346
|
-
private _fileHooks;
|
|
2347
|
-
private _icons;
|
|
2348
|
-
private _i18n;
|
|
2349
|
-
readonly config: CustomConfigRegistry;
|
|
2350
|
-
private _own;
|
|
2351
|
-
addSource(pluginId: string, item: PluginSourceRegistration): void;
|
|
2352
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): void;
|
|
2353
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
|
|
2354
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
|
|
2355
|
-
addIcon(pluginId: string, item: PluginIconRegistration): void;
|
|
2356
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): void;
|
|
2357
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2358
|
-
purge(pluginId: string): void;
|
|
2359
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
declare class PluginManager extends SharedInstance {
|
|
2363
|
-
private _plugins;
|
|
2364
|
-
private _subscribers;
|
|
2365
|
-
private _pluginsUpdate;
|
|
2366
|
-
private _lazyPluginLoader;
|
|
2367
|
-
readonly registry: PluginRegistry;
|
|
2368
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2369
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2370
|
-
pluginsReady(): Promise<void>;
|
|
2371
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2372
|
-
private _syncPlugins;
|
|
2373
|
-
private _registerPlugin;
|
|
2374
|
-
private _unregisterPlugin;
|
|
2375
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2376
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2117
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2118
|
+
private _secureToken;
|
|
2119
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2377
2120
|
destroy(): void;
|
|
2378
|
-
private _notifySubscribers;
|
|
2379
2121
|
}
|
|
2380
2122
|
|
|
2381
2123
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2416,87 +2158,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2416
2158
|
private get _location();
|
|
2417
2159
|
}
|
|
2418
2160
|
|
|
2419
|
-
interface ISharedInstance {
|
|
2420
|
-
destroy?(): void;
|
|
2421
|
-
}
|
|
2422
|
-
declare class SharedInstance {
|
|
2423
|
-
protected _ctx: PubSub<SharedState>;
|
|
2424
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2425
|
-
private _subscriptions;
|
|
2426
|
-
private _cfgProxy;
|
|
2427
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2428
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2429
|
-
protected addSub(unsub: () => void): void;
|
|
2430
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2431
|
-
destroy(): void;
|
|
2432
|
-
}
|
|
2433
|
-
declare const instanceKeyMap: {
|
|
2434
|
-
modalManager: "*modalManager";
|
|
2435
|
-
pluginManager: "*pluginManager";
|
|
2436
|
-
telemetryManager: "*telemetryManager";
|
|
2437
|
-
localeManager: "*localeManager";
|
|
2438
|
-
a11y: "*a11y";
|
|
2439
|
-
clipboard: "*clipboard";
|
|
2440
|
-
blocksRegistry: "*blocksRegistry";
|
|
2441
|
-
eventEmitter: "*eventEmitter";
|
|
2442
|
-
uploadCollection: "*uploadCollection";
|
|
2443
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2444
|
-
api: "*publicApi";
|
|
2445
|
-
validationManager: "*validationManager";
|
|
2446
|
-
};
|
|
2447
|
-
type InstanceTypeMap = {
|
|
2448
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2449
|
-
};
|
|
2450
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2451
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2452
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2453
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2454
|
-
readonly ctx: PubSub<SharedState>;
|
|
2455
|
-
readonly modalManager: ModalManager | null;
|
|
2456
|
-
readonly pluginManager: PluginManager;
|
|
2457
|
-
readonly telemetryManager: TelemetryManager;
|
|
2458
|
-
readonly localeManager: LocaleManager;
|
|
2459
|
-
readonly a11y: A11y;
|
|
2460
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2461
|
-
readonly eventEmitter: EventEmitter;
|
|
2462
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2463
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2464
|
-
readonly api: UploaderPublicApi;
|
|
2465
|
-
readonly validationManager: ValidationManager;
|
|
2466
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2467
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2471
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2472
|
-
private scopes;
|
|
2473
|
-
private listener;
|
|
2474
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2475
|
-
private openUploadList;
|
|
2476
|
-
private _listener;
|
|
2477
|
-
private handlePaste;
|
|
2478
|
-
registerBlock(scope: Node): () => void;
|
|
2479
|
-
destroy(): void;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2483
|
-
type LazyPluginEntry = {
|
|
2484
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2485
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2486
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2487
|
-
};
|
|
2488
|
-
|
|
2489
2161
|
type SharedConfigState = {
|
|
2490
2162
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2491
2163
|
};
|
|
2492
|
-
type SharedCustomConfigState = {
|
|
2493
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2494
|
-
};
|
|
2495
2164
|
type BlocksRegistry = Set<LitBlock>;
|
|
2496
2165
|
type ActivityBlockCtxState = {
|
|
2497
|
-
'*currentActivity':
|
|
2166
|
+
'*currentActivity': string | null;
|
|
2498
2167
|
'*currentActivityParams': Record<string, unknown>;
|
|
2499
|
-
'*history': (
|
|
2168
|
+
'*history': (string | null)[];
|
|
2500
2169
|
'*historyBack': (() => void) | null;
|
|
2501
2170
|
'*closeModal': () => void;
|
|
2502
2171
|
};
|
|
@@ -2513,7 +2182,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2513
2182
|
};
|
|
2514
2183
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2515
2184
|
'*solution': string | null;
|
|
2516
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2517
2185
|
};
|
|
2518
2186
|
type CloudImageEditorState = {
|
|
2519
2187
|
'*originalUrl': string | null;
|
|
@@ -2564,9 +2232,7 @@ type EditorToolbarState = {
|
|
|
2564
2232
|
'*currentOperation': string | null;
|
|
2565
2233
|
'*operationTooltip': string | null;
|
|
2566
2234
|
};
|
|
2567
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2568
2235
|
type DynamicBlockState = {
|
|
2569
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2570
2236
|
'*blocksRegistry': BlocksRegistry;
|
|
2571
2237
|
'*eventEmitter': EventEmitter;
|
|
2572
2238
|
'*localeManager': LocaleManager;
|
|
@@ -2574,7 +2240,6 @@ type DynamicBlockState = {
|
|
|
2574
2240
|
'*a11y': A11y;
|
|
2575
2241
|
'*modalManager': ModalManager | null;
|
|
2576
2242
|
'*clipboard': ClipboardLayer;
|
|
2577
|
-
'*pluginManager': PluginManager;
|
|
2578
2243
|
};
|
|
2579
2244
|
type DynamicUploaderBlockState = {
|
|
2580
2245
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2585,7 +2250,66 @@ type DynamicUploaderBlockState = {
|
|
|
2585
2250
|
type LocaleState = {
|
|
2586
2251
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2587
2252
|
};
|
|
2588
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2253
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2254
|
+
|
|
2255
|
+
interface ISharedInstance {
|
|
2256
|
+
destroy?(): void;
|
|
2257
|
+
}
|
|
2258
|
+
declare class SharedInstance {
|
|
2259
|
+
protected _ctx: PubSub<SharedState>;
|
|
2260
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2261
|
+
private _subscriptions;
|
|
2262
|
+
private _cfgProxy;
|
|
2263
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2264
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2265
|
+
protected addSub(unsub: () => void): void;
|
|
2266
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2267
|
+
destroy(): void;
|
|
2268
|
+
}
|
|
2269
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2270
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2271
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2272
|
+
readonly ctx: PubSub<SharedState>;
|
|
2273
|
+
readonly modalManager: ModalManager | null;
|
|
2274
|
+
readonly telemetryManager: TelemetryManager;
|
|
2275
|
+
readonly localeManager: LocaleManager;
|
|
2276
|
+
readonly a11y: A11y;
|
|
2277
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2278
|
+
readonly eventEmitter: EventEmitter;
|
|
2279
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2280
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2281
|
+
readonly api: UploaderPublicApi;
|
|
2282
|
+
readonly validationManager: ValidationManager;
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2286
|
+
signal?: AbortSignal;
|
|
2287
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2288
|
+
type FileValidatorDescriptor = {
|
|
2289
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2290
|
+
validator: FuncFileValidator;
|
|
2291
|
+
};
|
|
2292
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2293
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2294
|
+
declare class ValidationManager extends SharedInstance {
|
|
2295
|
+
private get _uploadCollection();
|
|
2296
|
+
private _commonFileValidators;
|
|
2297
|
+
private _commonCollectionValidators;
|
|
2298
|
+
private _queue;
|
|
2299
|
+
private _runQueueDebounced;
|
|
2300
|
+
private _isDestroyed;
|
|
2301
|
+
private _entryValidationState;
|
|
2302
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2303
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2304
|
+
runCollectionValidators(): void;
|
|
2305
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2306
|
+
private _runFileValidatorsForEntry;
|
|
2307
|
+
private _addCustomTypeToValidationError;
|
|
2308
|
+
private _getEntryValidationState;
|
|
2309
|
+
private _getValidatorDescriptors;
|
|
2310
|
+
private _getValidatorDescriptorsForEntry;
|
|
2311
|
+
destroy(): void;
|
|
2312
|
+
}
|
|
2589
2313
|
|
|
2590
2314
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2591
2315
|
willYield: boolean;
|
|
@@ -2597,7 +2321,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2597
2321
|
};
|
|
2598
2322
|
declare class LitBlock extends LitBlockBase {
|
|
2599
2323
|
private _cfgProxy;
|
|
2324
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2600
2325
|
static styleAttrs: string[];
|
|
2326
|
+
activityType: ActivityType;
|
|
2601
2327
|
init$: {};
|
|
2602
2328
|
constructor();
|
|
2603
2329
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2605,7 +2331,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2605
2331
|
protected _sharedInstancesBag: {
|
|
2606
2332
|
readonly ctx: PubSub<SharedState>;
|
|
2607
2333
|
readonly modalManager: ModalManager | null;
|
|
2608
|
-
readonly pluginManager: PluginManager;
|
|
2609
2334
|
readonly telemetryManager: TelemetryManager;
|
|
2610
2335
|
readonly localeManager: LocaleManager;
|
|
2611
2336
|
readonly a11y: A11y;
|
|
@@ -2615,34 +2340,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2615
2340
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2616
2341
|
readonly api: UploaderPublicApi;
|
|
2617
2342
|
readonly validationManager: ValidationManager;
|
|
2618
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2619
|
-
modalManager: ModalManager | null;
|
|
2620
|
-
pluginManager: PluginManager;
|
|
2621
|
-
telemetryManager: TelemetryManager;
|
|
2622
|
-
localeManager: LocaleManager;
|
|
2623
|
-
a11y: A11y;
|
|
2624
|
-
clipboard: ClipboardLayer;
|
|
2625
|
-
blocksRegistry: BlocksRegistry;
|
|
2626
|
-
eventEmitter: EventEmitter;
|
|
2627
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2628
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2629
|
-
api: UploaderPublicApi;
|
|
2630
|
-
validationManager: ValidationManager;
|
|
2631
|
-
}[TName]>) => void): () => void;
|
|
2632
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2633
|
-
modalManager: ModalManager | null;
|
|
2634
|
-
pluginManager: PluginManager;
|
|
2635
|
-
telemetryManager: TelemetryManager;
|
|
2636
|
-
localeManager: LocaleManager;
|
|
2637
|
-
a11y: A11y;
|
|
2638
|
-
clipboard: ClipboardLayer;
|
|
2639
|
-
blocksRegistry: BlocksRegistry;
|
|
2640
|
-
eventEmitter: EventEmitter;
|
|
2641
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2642
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2643
|
-
api: UploaderPublicApi;
|
|
2644
|
-
validationManager: ValidationManager;
|
|
2645
|
-
}[TName]>>;
|
|
2646
2343
|
};
|
|
2647
2344
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2648
2345
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2661,7 +2358,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2661
2358
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2662
2359
|
*/
|
|
2663
2360
|
private destroyCtxCallback;
|
|
2664
|
-
|
|
2361
|
+
/**
|
|
2362
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2363
|
+
* @param key The shared state key.
|
|
2364
|
+
* @param resolver The resolver function that creates the instance.
|
|
2365
|
+
*/
|
|
2665
2366
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2666
2367
|
private _destroySharedContextInstances;
|
|
2667
2368
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2688,7 +2389,7 @@ declare class Modal extends LitBlock {
|
|
|
2688
2389
|
private _handleDialogClose;
|
|
2689
2390
|
private _handleDialogMouseDown;
|
|
2690
2391
|
private _handleDialogMouseUp;
|
|
2691
|
-
show():
|
|
2392
|
+
show(): void;
|
|
2692
2393
|
hide(): void;
|
|
2693
2394
|
private _handleModalOpen;
|
|
2694
2395
|
private _handleModalClose;
|
|
@@ -2760,10 +2461,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2760
2461
|
|
|
2761
2462
|
declare class LitSolutionBlock extends LitBlock {
|
|
2762
2463
|
static styleAttrs: string[];
|
|
2763
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2764
2464
|
init$: {
|
|
2765
2465
|
'*solution': string | null;
|
|
2766
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2767
2466
|
'*commonProgress': number;
|
|
2768
2467
|
'*uploadList': never[];
|
|
2769
2468
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -2895,32 +2594,9 @@ declare global {
|
|
|
2895
2594
|
}
|
|
2896
2595
|
}
|
|
2897
2596
|
|
|
2898
|
-
|
|
2899
|
-
id: string;
|
|
2900
|
-
label: string;
|
|
2901
|
-
icon?: string;
|
|
2902
|
-
onClick: () => void | Promise<void>;
|
|
2903
|
-
};
|
|
2904
|
-
declare class SourceBtn extends LitUploaderBlock {
|
|
2905
|
-
couldBeCtxOwner: boolean;
|
|
2906
|
-
source?: SourceButtonConfig;
|
|
2907
|
-
private _iconName;
|
|
2908
|
-
private _srcTypeKey;
|
|
2909
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2910
|
-
private _applySource;
|
|
2911
|
-
activate(): void;
|
|
2912
|
-
render(): lit_html.TemplateResult<1>;
|
|
2913
|
-
}
|
|
2914
|
-
declare global {
|
|
2915
|
-
interface HTMLElementTagNameMap {
|
|
2916
|
-
'uc-source-btn': SourceBtn;
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
declare class SourceList extends LitUploaderBlock {
|
|
2597
|
+
declare class SourceList extends LitBlock {
|
|
2921
2598
|
private _rawSourceList;
|
|
2922
|
-
private
|
|
2923
|
-
private _sources;
|
|
2599
|
+
private _cameraModes;
|
|
2924
2600
|
/**
|
|
2925
2601
|
* CSS-only attribute
|
|
2926
2602
|
*/
|
|
@@ -2928,10 +2604,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
2928
2604
|
initCallback(): void;
|
|
2929
2605
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
2930
2606
|
private _updateSources;
|
|
2931
|
-
private
|
|
2932
|
-
private _makePluginSourceConfig;
|
|
2607
|
+
private _sources;
|
|
2933
2608
|
render(): lit_html.TemplateResult<1>;
|
|
2934
|
-
disconnectedCallback(): void;
|
|
2935
2609
|
}
|
|
2936
2610
|
declare global {
|
|
2937
2611
|
interface HTMLElementTagNameMap {
|
|
@@ -2986,8 +2660,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
2986
2660
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
2987
2661
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
2988
2662
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2989
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2990
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
2991
2663
|
}
|
|
2992
2664
|
declare global {
|
|
2993
2665
|
interface HTMLElementTagNameMap {
|
|
@@ -2995,71 +2667,45 @@ declare global {
|
|
|
2995
2667
|
}
|
|
2996
2668
|
}
|
|
2997
2669
|
|
|
2998
|
-
declare class
|
|
2999
|
-
static styleAttrs: string[];
|
|
2670
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
3000
2671
|
couldBeCtxOwner: boolean;
|
|
3001
|
-
|
|
3002
|
-
private
|
|
3003
|
-
private readonly _handleClick;
|
|
2672
|
+
activityType: ActivityType;
|
|
2673
|
+
private _formState;
|
|
3004
2674
|
initCallback(): void;
|
|
2675
|
+
private _inputRef;
|
|
2676
|
+
private _handleInput;
|
|
2677
|
+
private _handleUpload;
|
|
3005
2678
|
render(): lit_html.TemplateResult<1>;
|
|
3006
2679
|
}
|
|
3007
2680
|
declare global {
|
|
3008
2681
|
interface HTMLElementTagNameMap {
|
|
3009
|
-
'uc-
|
|
2682
|
+
'uc-url-source': UrlSource;
|
|
3010
2683
|
}
|
|
3011
2684
|
}
|
|
3012
2685
|
|
|
3013
|
-
declare class
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
private _ensureRegistered;
|
|
3020
|
-
private _renderActivity;
|
|
3021
|
-
private _disposeActivity;
|
|
3022
|
-
disconnectedCallback(): void;
|
|
3023
|
-
render(): lit_html.TemplateResult<1>;
|
|
3024
|
-
}
|
|
3025
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3026
|
-
mode: 'modal' | 'inline';
|
|
3027
|
-
private _activities;
|
|
3028
|
-
private _unsubscribePlugins?;
|
|
2686
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2687
|
+
static styleAttrs: string[];
|
|
2688
|
+
couldBeCtxOwner: boolean;
|
|
2689
|
+
dropzone: boolean;
|
|
2690
|
+
private _buttonTextKey;
|
|
2691
|
+
private readonly _handleClick;
|
|
3029
2692
|
initCallback(): void;
|
|
3030
|
-
private _syncActivities;
|
|
3031
|
-
disconnectedCallback(): void;
|
|
3032
|
-
render(): lit_html.TemplateResult<1>;
|
|
3033
|
-
}
|
|
3034
|
-
declare global {
|
|
3035
|
-
interface HTMLElementTagNameMap {
|
|
3036
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3037
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3038
|
-
}
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3042
|
-
private _formState;
|
|
3043
|
-
private _inputRef;
|
|
3044
|
-
private _handleInput;
|
|
3045
|
-
private _handleUpload;
|
|
3046
|
-
firstUpdated(): void;
|
|
3047
2693
|
render(): lit_html.TemplateResult<1>;
|
|
3048
2694
|
}
|
|
3049
2695
|
declare global {
|
|
3050
2696
|
interface HTMLElementTagNameMap {
|
|
3051
|
-
'uc-
|
|
2697
|
+
'uc-simple-btn': SimpleBtn;
|
|
3052
2698
|
}
|
|
3053
2699
|
}
|
|
3054
2700
|
|
|
3055
2701
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3056
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3057
2702
|
attributesMeta: {
|
|
3058
2703
|
headless?: boolean;
|
|
3059
2704
|
'ctx-name': string;
|
|
3060
2705
|
};
|
|
3061
2706
|
static styleAttrs: string[];
|
|
3062
2707
|
headless: boolean;
|
|
2708
|
+
smart: boolean;
|
|
3063
2709
|
constructor();
|
|
3064
2710
|
initCallback(): void;
|
|
3065
2711
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -3071,7 +2717,6 @@ declare global {
|
|
|
3071
2717
|
}
|
|
3072
2718
|
|
|
3073
2719
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3074
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3075
2720
|
attributesMeta: {
|
|
3076
2721
|
'ctx-name': string;
|
|
3077
2722
|
};
|
|
@@ -3092,7 +2737,6 @@ declare global {
|
|
|
3092
2737
|
}
|
|
3093
2738
|
|
|
3094
2739
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3095
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3096
2740
|
attributesMeta: {
|
|
3097
2741
|
'ctx-name': string;
|
|
3098
2742
|
};
|
|
@@ -3116,4 +2760,4 @@ declare global {
|
|
|
3116
2760
|
}
|
|
3117
2761
|
}
|
|
3118
2762
|
|
|
3119
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2763
|
+
export { LitActivityBlock as ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, PubSub as Data, DropArea, Dropdown, 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, SmartBtn, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
|