@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
|
@@ -2,7 +2,7 @@ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
|
|
|
2
2
|
import * as lit_html from 'lit-html';
|
|
3
3
|
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
4
4
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
5
|
-
import {
|
|
5
|
+
import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
|
|
6
6
|
export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
|
|
7
7
|
import { Ref } from 'lit/directives/ref.js';
|
|
8
8
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
@@ -135,6 +135,7 @@ declare const _default: {
|
|
|
135
135
|
'src-type-camera': string;
|
|
136
136
|
'src-type-mobile-video-camera': string;
|
|
137
137
|
'src-type-mobile-photo-camera': string;
|
|
138
|
+
'src-type-draw': string;
|
|
138
139
|
'src-type-facebook': string;
|
|
139
140
|
'src-type-dropbox': string;
|
|
140
141
|
'src-type-gdrive': string;
|
|
@@ -149,6 +150,7 @@ declare const _default: {
|
|
|
149
150
|
'src-type-other': string;
|
|
150
151
|
'caption-from-url': string;
|
|
151
152
|
'caption-camera': string;
|
|
153
|
+
'caption-draw': string;
|
|
152
154
|
'caption-edit-file': string;
|
|
153
155
|
'file-no-name': string;
|
|
154
156
|
'toggle-fullscreen': string;
|
|
@@ -230,72 +232,8 @@ declare class A11y implements ISharedInstance {
|
|
|
230
232
|
declare class LocaleManager extends SharedInstance {
|
|
231
233
|
private _localeName;
|
|
232
234
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
233
|
-
private _applyOverrides;
|
|
234
|
-
private _applyPluginLocales;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
/**
|
|
238
|
-
* Custom configuration options registration system for plugins
|
|
239
|
-
*/
|
|
240
|
-
type CustomConfigDefinition<T = unknown> = {
|
|
241
|
-
/**
|
|
242
|
-
* Config option name (will be used as property and optionally as attribute)
|
|
243
|
-
*/
|
|
244
|
-
name: string;
|
|
245
|
-
/**
|
|
246
|
-
* Default value for the config option
|
|
247
|
-
*/
|
|
248
|
-
defaultValue: T;
|
|
249
|
-
/**
|
|
250
|
-
* Whether this config can be set via HTML attribute
|
|
251
|
-
* @default true
|
|
252
|
-
*/
|
|
253
|
-
attribute?: boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Convert attribute string to config value
|
|
256
|
-
* Only used if attribute is true
|
|
257
|
-
*/
|
|
258
|
-
fromAttribute?: (value: string | null) => T;
|
|
259
|
-
/**
|
|
260
|
-
* Convert config value to attribute string
|
|
261
|
-
* Only used if attribute is true
|
|
262
|
-
*/
|
|
263
|
-
toAttribute?: (value: T) => string | null;
|
|
264
|
-
/**
|
|
265
|
-
* Normalize/validate the config value
|
|
266
|
-
*/
|
|
267
|
-
normalize?: (value: unknown) => T;
|
|
268
|
-
};
|
|
269
|
-
/**
|
|
270
|
-
* Registry for custom config options defined by plugins
|
|
271
|
-
* This is managed by the PluginManager as a shared instance property
|
|
272
|
-
*/
|
|
273
|
-
declare class CustomConfigRegistry {
|
|
274
|
-
private _definitions;
|
|
275
|
-
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
276
|
-
unregister(name: string): void;
|
|
277
|
-
unregisterByPlugin(pluginId: string): void;
|
|
278
|
-
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
279
|
-
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Interface for TypeScript module augmentation
|
|
283
|
-
* Plugins should extend this interface to add their custom config types
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* ```typescript
|
|
287
|
-
* declare module '@uploadcare/file-uploader' {
|
|
288
|
-
* interface CustomConfig {
|
|
289
|
-
* 'my-custom-option': string;
|
|
290
|
-
* }
|
|
291
|
-
* }
|
|
292
|
-
* ```
|
|
293
|
-
*/
|
|
294
|
-
interface CustomConfig {
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
298
|
-
|
|
299
237
|
declare class TypedData<T extends Record<string, unknown>> {
|
|
300
238
|
private _ctxId;
|
|
301
239
|
private _data;
|
|
@@ -308,41 +246,6 @@ declare class TypedData<T extends Record<string, unknown>> {
|
|
|
308
246
|
destroy(): void;
|
|
309
247
|
}
|
|
310
248
|
|
|
311
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
312
|
-
signal?: AbortSignal;
|
|
313
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
314
|
-
type FileValidatorDescriptor = {
|
|
315
|
-
runOn: 'add' | 'upload' | 'change';
|
|
316
|
-
validator: FuncFileValidator;
|
|
317
|
-
};
|
|
318
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
319
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
320
|
-
declare class ValidationManager extends SharedInstance {
|
|
321
|
-
private get _uploadCollection();
|
|
322
|
-
private _commonFileValidators;
|
|
323
|
-
private _commonCollectionValidators;
|
|
324
|
-
private _queue;
|
|
325
|
-
private _runQueueDebounced;
|
|
326
|
-
private _isDestroyed;
|
|
327
|
-
private _entryValidationState;
|
|
328
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
329
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
330
|
-
runCollectionValidators(): void;
|
|
331
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
332
|
-
private _runFileValidatorsForEntry;
|
|
333
|
-
private _addCustomTypeToValidationError;
|
|
334
|
-
private _getEntryValidationState;
|
|
335
|
-
private _getValidatorDescriptors;
|
|
336
|
-
private _getValidatorDescriptorsForEntry;
|
|
337
|
-
destroy(): void;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
declare class SecureUploadsManager extends SharedInstance {
|
|
341
|
-
private _secureToken;
|
|
342
|
-
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
343
|
-
destroy(): void;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
249
|
type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
|
|
347
250
|
type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
|
|
348
251
|
type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
@@ -394,6 +297,155 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
394
297
|
}>;
|
|
395
298
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
396
299
|
|
|
300
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
301
|
+
|
|
302
|
+
interface UploadEntryData extends Record<string, unknown> {
|
|
303
|
+
file: File | null;
|
|
304
|
+
externalUrl: string | null;
|
|
305
|
+
fileName: string | null;
|
|
306
|
+
fileSize: number | null;
|
|
307
|
+
lastModified: number;
|
|
308
|
+
uploadProgress: number;
|
|
309
|
+
uuid: string | null;
|
|
310
|
+
isImage: boolean;
|
|
311
|
+
mimeType: string | null;
|
|
312
|
+
ctxName: string | null;
|
|
313
|
+
cdnUrl: string | null;
|
|
314
|
+
cdnUrlModifiers: string | null;
|
|
315
|
+
fileInfo: UploadcareFile | null;
|
|
316
|
+
isUploading: boolean;
|
|
317
|
+
abortController: AbortController | null;
|
|
318
|
+
thumbUrl: string | null;
|
|
319
|
+
silent: boolean;
|
|
320
|
+
source: string | null;
|
|
321
|
+
fullPath: string | null;
|
|
322
|
+
metadata: Metadata | null;
|
|
323
|
+
errors: OutputErrorFile[];
|
|
324
|
+
uploadError: Error | null;
|
|
325
|
+
isRemoved: boolean;
|
|
326
|
+
isQueuedForUploading: boolean;
|
|
327
|
+
isValidationPending: boolean;
|
|
328
|
+
isQueuedForValidation: boolean;
|
|
329
|
+
}
|
|
330
|
+
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
331
|
+
type UploadEntryKeys = keyof UploadEntryData;
|
|
332
|
+
|
|
333
|
+
type ApiAddFileCommonOptions = {
|
|
334
|
+
silent?: boolean;
|
|
335
|
+
fileName?: string;
|
|
336
|
+
source?: string;
|
|
337
|
+
};
|
|
338
|
+
declare class UploaderPublicApi extends SharedInstance {
|
|
339
|
+
private _l10n;
|
|
340
|
+
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
341
|
+
get cfg(): Readonly<ConfigType>;
|
|
342
|
+
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
343
|
+
/**
|
|
344
|
+
* TODO: Probably we should not allow user to override `source` property
|
|
345
|
+
*/
|
|
346
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
347
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
348
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
349
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
350
|
+
fullPath?: string;
|
|
351
|
+
}) => OutputFileEntry<"idle">;
|
|
352
|
+
removeFileByInternalId: (internalId: string) => void;
|
|
353
|
+
removeAllFiles(): void;
|
|
354
|
+
uploadAll: () => void;
|
|
355
|
+
openSystemDialog: (options?: {
|
|
356
|
+
captureCamera?: boolean;
|
|
357
|
+
modeCamera?: ModeCameraType;
|
|
358
|
+
}) => void;
|
|
359
|
+
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
360
|
+
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
361
|
+
initFlow: (force?: boolean) => void;
|
|
362
|
+
doneFlow: () => void;
|
|
363
|
+
setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
|
|
364
|
+
getCurrentActivity: () => ActivityType;
|
|
365
|
+
setModalState: (opened: boolean) => void;
|
|
366
|
+
private get _sourceList();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare const ExternalUploadSource: Readonly<{
|
|
370
|
+
readonly FACEBOOK: "facebook";
|
|
371
|
+
readonly DROPBOX: "dropbox";
|
|
372
|
+
readonly GDRIVE: "gdrive";
|
|
373
|
+
readonly GPHOTOS: "gphotos";
|
|
374
|
+
readonly FLICKR: "flickr";
|
|
375
|
+
readonly VK: "vk";
|
|
376
|
+
readonly EVERNOTE: "evernote";
|
|
377
|
+
readonly BOX: "box";
|
|
378
|
+
readonly ONEDRIVE: "onedrive";
|
|
379
|
+
readonly HUDDLE: "huddle";
|
|
380
|
+
}>;
|
|
381
|
+
declare const UploadSource: Readonly<{
|
|
382
|
+
readonly FACEBOOK: "facebook";
|
|
383
|
+
readonly DROPBOX: "dropbox";
|
|
384
|
+
readonly GDRIVE: "gdrive";
|
|
385
|
+
readonly GPHOTOS: "gphotos";
|
|
386
|
+
readonly FLICKR: "flickr";
|
|
387
|
+
readonly VK: "vk";
|
|
388
|
+
readonly EVERNOTE: "evernote";
|
|
389
|
+
readonly BOX: "box";
|
|
390
|
+
readonly ONEDRIVE: "onedrive";
|
|
391
|
+
readonly HUDDLE: "huddle";
|
|
392
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
393
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
394
|
+
readonly LOCAL: "local";
|
|
395
|
+
readonly DROP_AREA: "drop-area";
|
|
396
|
+
readonly CAMERA: "camera";
|
|
397
|
+
readonly EXTERNAL: "external";
|
|
398
|
+
readonly API: "js-api";
|
|
399
|
+
readonly URL: "url";
|
|
400
|
+
readonly DRAW: "draw";
|
|
401
|
+
}>;
|
|
402
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
403
|
+
|
|
404
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
405
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
406
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
407
|
+
protected couldBeCtxOwner: boolean;
|
|
408
|
+
private _isCtxOwner;
|
|
409
|
+
private _unobserveCollection?;
|
|
410
|
+
private _unobserveCollectionProperties?;
|
|
411
|
+
init$: {
|
|
412
|
+
'*commonProgress': number;
|
|
413
|
+
'*uploadList': never[];
|
|
414
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
415
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
416
|
+
'*collectionState': OutputCollectionState | null;
|
|
417
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
418
|
+
'*uploadTrigger': Set<string>;
|
|
419
|
+
'*currentActivity': null;
|
|
420
|
+
'*currentActivityParams': {};
|
|
421
|
+
'*history': never[];
|
|
422
|
+
'*historyBack': null;
|
|
423
|
+
'*closeModal': () => void;
|
|
424
|
+
};
|
|
425
|
+
private get _hasCtxOwner();
|
|
426
|
+
initCallback(): void;
|
|
427
|
+
getAPI(): UploaderPublicApi;
|
|
428
|
+
get validationManager(): ValidationManager;
|
|
429
|
+
get api(): UploaderPublicApi;
|
|
430
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
431
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
432
|
+
disconnectedCallback(): void;
|
|
433
|
+
connectedCallback(): void;
|
|
434
|
+
private _initCtxOwner;
|
|
435
|
+
private _observeUploadCollection;
|
|
436
|
+
private _unobserveUploadCollection;
|
|
437
|
+
private _createGroup;
|
|
438
|
+
private _flushOutputItems;
|
|
439
|
+
private _handleCollectionUpdate;
|
|
440
|
+
private _handleCollectionPropertiesUpdate;
|
|
441
|
+
private _flushCommonUploadProgress;
|
|
442
|
+
private _openCloudImageEditor;
|
|
443
|
+
private _setInitialCrop;
|
|
444
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
445
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
446
|
+
getOutputData(): OutputFileEntry[];
|
|
447
|
+
}
|
|
448
|
+
|
|
397
449
|
/**
|
|
398
450
|
* Mapping of loading resources per operation
|
|
399
451
|
*/
|
|
@@ -508,14 +560,11 @@ declare global {
|
|
|
508
560
|
declare class Icon extends LitBlock {
|
|
509
561
|
name: string;
|
|
510
562
|
private _resolvedHref;
|
|
511
|
-
private _pluginSvg;
|
|
512
563
|
private _iconHrefResolver;
|
|
513
|
-
private _unsubscribePlugins?;
|
|
514
564
|
initCallback(): void;
|
|
515
565
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
516
566
|
private _updateResolvedHref;
|
|
517
567
|
render(): lit_html.TemplateResult<1>;
|
|
518
|
-
disconnectedCallback(): void;
|
|
519
568
|
}
|
|
520
569
|
declare global {
|
|
521
570
|
interface HTMLElementTagNameMap {
|
|
@@ -1046,7 +1095,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
1046
1095
|
private _hasNetworkProblems;
|
|
1047
1096
|
private _isInitialized;
|
|
1048
1097
|
private _pendingInitUpdate;
|
|
1049
|
-
private _pendingSizeWait;
|
|
1050
1098
|
private readonly _debouncedShowLoader;
|
|
1051
1099
|
private readonly _imgRef;
|
|
1052
1100
|
private readonly _cropperRef;
|
|
@@ -1096,11 +1144,12 @@ type ActivityParams$1 = {
|
|
|
1096
1144
|
internalId: string;
|
|
1097
1145
|
};
|
|
1098
1146
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1147
|
+
couldBeCtxOwner: boolean;
|
|
1148
|
+
activityType: "cloud-image-edit";
|
|
1099
1149
|
private _entry?;
|
|
1100
1150
|
private _editorConfig;
|
|
1101
1151
|
get activityParams(): ActivityParams$1;
|
|
1102
1152
|
initCallback(): void;
|
|
1103
|
-
disconnectedCallback(): void;
|
|
1104
1153
|
private _handleApply;
|
|
1105
1154
|
private _handleCancel;
|
|
1106
1155
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1137,6 +1186,7 @@ type ActivityParams = {
|
|
|
1137
1186
|
};
|
|
1138
1187
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1139
1188
|
couldBeCtxOwner: boolean;
|
|
1189
|
+
activityType: "external";
|
|
1140
1190
|
private _messageBridge?;
|
|
1141
1191
|
private _iframeRef;
|
|
1142
1192
|
private _latestSelectionSummary;
|
|
@@ -1180,26 +1230,22 @@ declare global {
|
|
|
1180
1230
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1181
1231
|
START_FROM: "start-from";
|
|
1182
1232
|
CAMERA: "camera";
|
|
1233
|
+
DRAW: "draw";
|
|
1183
1234
|
UPLOAD_LIST: "upload-list";
|
|
1184
1235
|
URL: "url";
|
|
1185
1236
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1186
1237
|
EXTERNAL: "external";
|
|
1187
1238
|
}>;
|
|
1188
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1189
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1239
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1240
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1190
1241
|
|
|
1191
1242
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1192
|
-
interface CustomActivities {
|
|
1193
|
-
}
|
|
1194
1243
|
type ActivityParamsMap = {
|
|
1195
1244
|
'cloud-image-edit': ActivityParams$1;
|
|
1196
1245
|
external: ActivityParams;
|
|
1197
|
-
} & {
|
|
1198
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1199
1246
|
};
|
|
1200
1247
|
declare class LitActivityBlock extends LitBlock {
|
|
1201
1248
|
protected historyTracked: boolean;
|
|
1202
|
-
activityType: ActivityType;
|
|
1203
1249
|
private [ACTIVE_PROP]?;
|
|
1204
1250
|
init$: {
|
|
1205
1251
|
'*currentActivity': null;
|
|
@@ -1213,11 +1259,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1213
1259
|
private _activate;
|
|
1214
1260
|
initCallback(): void;
|
|
1215
1261
|
private _historyFlush;
|
|
1216
|
-
|
|
1262
|
+
private _isActivityRegistered;
|
|
1217
1263
|
private static _activityCallbacks;
|
|
1218
1264
|
static activities: Readonly<{
|
|
1219
1265
|
START_FROM: 'start-from';
|
|
1220
1266
|
CAMERA: 'camera';
|
|
1267
|
+
DRAW: 'draw';
|
|
1221
1268
|
UPLOAD_LIST: 'upload-list';
|
|
1222
1269
|
URL: 'url';
|
|
1223
1270
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1233,8 +1280,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1233
1280
|
private _unregisterActivity;
|
|
1234
1281
|
disconnectedCallback(): void;
|
|
1235
1282
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1236
|
-
get initActivity():
|
|
1237
|
-
get doneActivity():
|
|
1283
|
+
get initActivity(): string | null;
|
|
1284
|
+
get doneActivity(): string | null;
|
|
1238
1285
|
historyBack(): void;
|
|
1239
1286
|
}
|
|
1240
1287
|
|
|
@@ -1296,9 +1343,7 @@ type EventPayload = {
|
|
|
1296
1343
|
declare class EventEmitter extends SharedInstance {
|
|
1297
1344
|
private _timeoutStore;
|
|
1298
1345
|
private _targets;
|
|
1299
|
-
private _listeners;
|
|
1300
1346
|
bindTarget(target: LitBlock): () => void;
|
|
1301
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1302
1347
|
private _dispatch;
|
|
1303
1348
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1304
1349
|
debounce?: TDebounce;
|
|
@@ -1306,123 +1351,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1306
1351
|
destroy(): void;
|
|
1307
1352
|
}
|
|
1308
1353
|
|
|
1309
|
-
type
|
|
1310
|
-
|
|
1311
|
-
fileName?: string;
|
|
1312
|
-
source?: string;
|
|
1354
|
+
type EventMap = {
|
|
1355
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1313
1356
|
};
|
|
1314
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
1315
|
-
private _l10n;
|
|
1316
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1317
|
-
get cfg(): Readonly<ConfigType>;
|
|
1318
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
1319
|
-
/**
|
|
1320
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
1321
|
-
*/
|
|
1322
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1323
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1324
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1325
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
1326
|
-
fullPath?: string;
|
|
1327
|
-
}) => OutputFileEntry<"idle">;
|
|
1328
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
1329
|
-
removeAllFiles(): void;
|
|
1330
|
-
uploadAll: () => void;
|
|
1331
|
-
openSystemDialog: (options?: {
|
|
1332
|
-
captureCamera?: boolean;
|
|
1333
|
-
modeCamera?: ModeCameraType;
|
|
1334
|
-
}) => void;
|
|
1335
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
1336
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
1337
|
-
initFlow: (force?: boolean) => void;
|
|
1338
|
-
doneFlow: () => void;
|
|
1339
|
-
private _pluginsReady;
|
|
1340
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1341
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1342
|
-
getCurrentActivity: () => ActivityType;
|
|
1343
|
-
historyBack: () => void;
|
|
1344
|
-
setModalState: (opened: boolean) => void;
|
|
1345
|
-
private get _sourceList();
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
declare const ExternalUploadSource: Readonly<{
|
|
1349
|
-
readonly FACEBOOK: "facebook";
|
|
1350
|
-
readonly DROPBOX: "dropbox";
|
|
1351
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
1352
|
-
readonly GDRIVE: "gdrive";
|
|
1353
|
-
readonly GPHOTOS: "gphotos";
|
|
1354
|
-
readonly FLICKR: "flickr";
|
|
1355
|
-
readonly VK: "vk";
|
|
1356
|
-
readonly EVERNOTE: "evernote";
|
|
1357
|
-
readonly BOX: "box";
|
|
1358
|
-
readonly ONEDRIVE: "onedrive";
|
|
1359
|
-
readonly HUDDLE: "huddle";
|
|
1360
|
-
}>;
|
|
1361
|
-
declare const UploadSource: Readonly<{
|
|
1362
|
-
readonly FACEBOOK: "facebook";
|
|
1363
|
-
readonly DROPBOX: "dropbox";
|
|
1364
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
1365
|
-
readonly GDRIVE: "gdrive";
|
|
1366
|
-
readonly GPHOTOS: "gphotos";
|
|
1367
|
-
readonly FLICKR: "flickr";
|
|
1368
|
-
readonly VK: "vk";
|
|
1369
|
-
readonly EVERNOTE: "evernote";
|
|
1370
|
-
readonly BOX: "box";
|
|
1371
|
-
readonly ONEDRIVE: "onedrive";
|
|
1372
|
-
readonly HUDDLE: "huddle";
|
|
1373
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1374
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1375
|
-
readonly LOCAL: "local";
|
|
1376
|
-
readonly DROP_AREA: "drop-area";
|
|
1377
|
-
readonly CAMERA: "camera";
|
|
1378
|
-
readonly EXTERNAL: "external";
|
|
1379
|
-
readonly API: "js-api";
|
|
1380
|
-
readonly URL: "url";
|
|
1381
|
-
}>;
|
|
1382
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1383
1357
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
private
|
|
1390
|
-
private
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1395
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1396
|
-
'*collectionState': OutputCollectionState | null;
|
|
1397
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1398
|
-
'*uploadTrigger': Set<string>;
|
|
1399
|
-
'*currentActivity': null;
|
|
1400
|
-
'*currentActivityParams': {};
|
|
1401
|
-
'*history': never[];
|
|
1402
|
-
'*historyBack': null;
|
|
1403
|
-
'*closeModal': () => void;
|
|
1404
|
-
};
|
|
1405
|
-
private get _hasCtxOwner();
|
|
1406
|
-
initCallback(): void;
|
|
1407
|
-
getAPI(): UploaderPublicApi;
|
|
1408
|
-
get validationManager(): ValidationManager;
|
|
1409
|
-
get api(): UploaderPublicApi;
|
|
1410
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1411
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1412
|
-
disconnectedCallback(): void;
|
|
1413
|
-
connectedCallback(): void;
|
|
1414
|
-
private _initCtxOwner;
|
|
1415
|
-
private _observeUploadCollection;
|
|
1416
|
-
private _unobserveUploadCollection;
|
|
1417
|
-
private _createGroup;
|
|
1418
|
-
private _flushOutputItems;
|
|
1419
|
-
private _handleCollectionUpdate;
|
|
1420
|
-
private _handleCollectionPropertiesUpdate;
|
|
1421
|
-
private _flushCommonUploadProgress;
|
|
1422
|
-
private _setInitialCrop;
|
|
1423
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1424
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1425
|
-
getOutputData(): OutputFileEntry[];
|
|
1358
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1359
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1360
|
+
private scopes;
|
|
1361
|
+
private listener;
|
|
1362
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1363
|
+
private openUploadList;
|
|
1364
|
+
private _listener;
|
|
1365
|
+
private handlePaste;
|
|
1366
|
+
registerBlock(scope: Node): () => void;
|
|
1367
|
+
destroy(): void;
|
|
1426
1368
|
}
|
|
1427
1369
|
|
|
1428
1370
|
type SelectOption = {
|
|
@@ -1445,6 +1387,7 @@ declare global {
|
|
|
1445
1387
|
type CameraMode = 'photo' | 'video';
|
|
1446
1388
|
declare class CameraSource extends LitUploaderBlock {
|
|
1447
1389
|
couldBeCtxOwner: boolean;
|
|
1390
|
+
activityType: "camera";
|
|
1448
1391
|
private _unsubPermissions;
|
|
1449
1392
|
private _capturing;
|
|
1450
1393
|
private _chunks;
|
|
@@ -1466,6 +1409,7 @@ declare class CameraSource extends LitUploaderBlock {
|
|
|
1466
1409
|
private _timerRef;
|
|
1467
1410
|
private _lineRef;
|
|
1468
1411
|
private _videoRef;
|
|
1412
|
+
private _switcherRef;
|
|
1469
1413
|
private _startTime;
|
|
1470
1414
|
private _elapsedTime;
|
|
1471
1415
|
private _videoTransformCss;
|
|
@@ -1563,54 +1507,25 @@ declare global {
|
|
|
1563
1507
|
/**
|
|
1564
1508
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1565
1509
|
*/
|
|
1566
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1510
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartButtonSettings"];
|
|
1511
|
+
/** Mapping of attribute names to state */
|
|
1512
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1567
1513
|
declare class Config extends LitBlock {
|
|
1568
1514
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
1569
1515
|
'ctx-name': string;
|
|
1570
1516
|
};
|
|
1571
1517
|
init$: LitBlock["init$"] & ConfigType;
|
|
1572
1518
|
private _computationControllers;
|
|
1573
|
-
private _pluginChangeUnsubscribe?;
|
|
1574
|
-
private _mutationObserver?;
|
|
1575
|
-
/**
|
|
1576
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1577
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1578
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1579
|
-
*/
|
|
1580
|
-
private _customAttrKeyMapping;
|
|
1581
|
-
/** Set of all custom config names registered by plugins */
|
|
1582
|
-
private _customConfigKeys;
|
|
1583
|
-
/**
|
|
1584
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1585
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1586
|
-
*/
|
|
1587
|
-
private _customConfigSubscriptions;
|
|
1588
|
-
/**
|
|
1589
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1590
|
-
*/
|
|
1591
|
-
private _isCustomConfig;
|
|
1592
|
-
/**
|
|
1593
|
-
* Get the custom config definition for a key
|
|
1594
|
-
*/
|
|
1595
|
-
private _getCustomConfigDefinition;
|
|
1596
|
-
/**
|
|
1597
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1598
|
-
*/
|
|
1599
|
-
private _getAttributeNames;
|
|
1600
1519
|
private _flushValueToAttribute;
|
|
1601
1520
|
private _flushValueToState;
|
|
1602
1521
|
private _setValue;
|
|
1603
1522
|
private _getValue;
|
|
1604
1523
|
private _assertSameValueDifferentReference;
|
|
1605
|
-
private _processCustomConfigs;
|
|
1606
|
-
private _setupCustomConfigs;
|
|
1607
|
-
private _setupMutationObserver;
|
|
1608
1524
|
initCallback(): void;
|
|
1609
|
-
attributeChangedCallback(name:
|
|
1610
|
-
disconnectedCallback(): void;
|
|
1525
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1611
1526
|
static get observedAttributes(): string[];
|
|
1612
1527
|
}
|
|
1613
|
-
interface Config extends ConfigType
|
|
1528
|
+
interface Config extends ConfigType {
|
|
1614
1529
|
}
|
|
1615
1530
|
declare global {
|
|
1616
1531
|
interface HTMLElementTagNameMap {
|
|
@@ -1694,12 +1609,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1694
1609
|
private _isFailed;
|
|
1695
1610
|
private _isUploading;
|
|
1696
1611
|
private _isFocused;
|
|
1612
|
+
private _isEditable;
|
|
1697
1613
|
private _showFileNames;
|
|
1698
1614
|
private _ariaLabelStatusFile;
|
|
1699
|
-
private _pluginFileActions;
|
|
1700
1615
|
private _renderedOnce;
|
|
1701
1616
|
private _observer?;
|
|
1702
|
-
private
|
|
1617
|
+
private _handleEdit;
|
|
1703
1618
|
private _handleRemove;
|
|
1704
1619
|
private _handleUploadClick;
|
|
1705
1620
|
private _calculateState;
|
|
@@ -1711,8 +1626,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1711
1626
|
private _handleEntryId;
|
|
1712
1627
|
private _updateShowFileNames;
|
|
1713
1628
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1714
|
-
private _updatePluginFileActions;
|
|
1715
|
-
private _handlePluginFileAction;
|
|
1716
1629
|
initCallback(): void;
|
|
1717
1630
|
connectedCallback(): void;
|
|
1718
1631
|
disconnectedCallback(): void;
|
|
@@ -1809,6 +1722,67 @@ declare global {
|
|
|
1809
1722
|
}
|
|
1810
1723
|
}
|
|
1811
1724
|
|
|
1725
|
+
declare class SourceBtn extends LitUploaderBlock {
|
|
1726
|
+
couldBeCtxOwner: boolean;
|
|
1727
|
+
private _registeredTypes;
|
|
1728
|
+
type?: string;
|
|
1729
|
+
onlyIcon: boolean;
|
|
1730
|
+
private _iconName;
|
|
1731
|
+
private _srcTypeKey;
|
|
1732
|
+
private _initTypes;
|
|
1733
|
+
initCallback(): void;
|
|
1734
|
+
private _registerType;
|
|
1735
|
+
activate(): void;
|
|
1736
|
+
private _applyType;
|
|
1737
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1738
|
+
render(): lit_html.TemplateResult<1>;
|
|
1739
|
+
}
|
|
1740
|
+
declare global {
|
|
1741
|
+
interface HTMLElementTagNameMap {
|
|
1742
|
+
'uc-source-btn': SourceBtn;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
declare class Dropdown extends LitBlock {
|
|
1747
|
+
private _id;
|
|
1748
|
+
protected render(): unknown;
|
|
1749
|
+
}
|
|
1750
|
+
declare global {
|
|
1751
|
+
interface HTMLElementTagNameMap {
|
|
1752
|
+
'uc-dropdown': Dropdown;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
|
|
1757
|
+
type AdvancedSmartBtnConfig = {
|
|
1758
|
+
sourceList: string;
|
|
1759
|
+
mode: SmartButtonMode;
|
|
1760
|
+
};
|
|
1761
|
+
declare class SmartBtn extends LitUploaderBlock {
|
|
1762
|
+
static styleAttrs: string[];
|
|
1763
|
+
couldBeCtxOwner: boolean;
|
|
1764
|
+
dropzone: boolean;
|
|
1765
|
+
private _sourceList;
|
|
1766
|
+
private _status;
|
|
1767
|
+
private _buttonTextKey;
|
|
1768
|
+
private _entry;
|
|
1769
|
+
private _lastDigest;
|
|
1770
|
+
private _visible;
|
|
1771
|
+
private get isIdle();
|
|
1772
|
+
private get buttonText();
|
|
1773
|
+
private _throttledHandleCollectionUpdate;
|
|
1774
|
+
private _updateButtonBasedOnCollectionState;
|
|
1775
|
+
initCallback(): void;
|
|
1776
|
+
private readonly _handleClickAbort;
|
|
1777
|
+
private readonly _handleClick;
|
|
1778
|
+
render(): lit_html.TemplateResult<1>;
|
|
1779
|
+
}
|
|
1780
|
+
declare global {
|
|
1781
|
+
interface HTMLElementTagNameMap {
|
|
1782
|
+
'uc-smart-btn': SmartBtn;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1812
1786
|
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
|
|
1813
1787
|
type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
|
|
1814
1788
|
type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
|
|
@@ -2021,10 +1995,6 @@ type ConfigType = {
|
|
|
2021
1995
|
* Expiry threshold for secure uploads.
|
|
2022
1996
|
*/
|
|
2023
1997
|
secureUploadsExpireThreshold: number;
|
|
2024
|
-
/**
|
|
2025
|
-
* Array of plugins to register with the uploader instance.
|
|
2026
|
-
*/
|
|
2027
|
-
plugins: UploaderPlugin[];
|
|
2028
1998
|
/**
|
|
2029
1999
|
* Metadata for the file.
|
|
2030
2000
|
*/
|
|
@@ -2110,6 +2080,7 @@ type ConfigType = {
|
|
|
2110
2080
|
* Define the clipboard paste scope.
|
|
2111
2081
|
*/
|
|
2112
2082
|
pasteScope: PasteScope;
|
|
2083
|
+
smartButtonSettings: AdvancedSmartBtnConfig | null;
|
|
2113
2084
|
};
|
|
2114
2085
|
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
2115
2086
|
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -2285,237 +2256,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2285
2256
|
allEntries: OutputFileEntry[];
|
|
2286
2257
|
});
|
|
2287
2258
|
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
};
|
|
2292
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2293
|
-
type PluginSourceRegistration = {
|
|
2294
|
-
id: string;
|
|
2295
|
-
label: string;
|
|
2296
|
-
icon?: string;
|
|
2297
|
-
/**
|
|
2298
|
-
* @internal
|
|
2299
|
-
*
|
|
2300
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2301
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2302
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2303
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2304
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2305
|
-
*/
|
|
2306
|
-
expand?: () => string[];
|
|
2307
|
-
onSelect: () => Promise<void> | void;
|
|
2308
|
-
};
|
|
2309
|
-
type PluginRenderDispose = () => void;
|
|
2310
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2311
|
-
type PluginActivityRegistration = {
|
|
2312
|
-
id: string;
|
|
2313
|
-
render: PluginRender;
|
|
2314
|
-
};
|
|
2315
|
-
type PluginFileActionRegistration = {
|
|
2316
|
-
/** Unique action identifier. */
|
|
2317
|
-
id: string;
|
|
2318
|
-
/** Icon name to display in the action button. */
|
|
2319
|
-
icon: string;
|
|
2320
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2321
|
-
label: string;
|
|
2322
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2323
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2324
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2325
|
-
};
|
|
2326
|
-
type PluginFileHookResult = {
|
|
2327
|
-
/** The (optionally transformed) file */
|
|
2328
|
-
file: File | Blob;
|
|
2329
|
-
};
|
|
2330
|
-
type PluginFileHookContext = PluginFileHookResult & {
|
|
2331
|
-
/**
|
|
2332
|
-
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
2333
|
-
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
2334
|
-
*/
|
|
2335
|
-
signal: AbortSignal;
|
|
2336
|
-
};
|
|
2337
|
-
type PluginFileHookRegistration = {
|
|
2338
|
-
/**
|
|
2339
|
-
* When the hook is called:
|
|
2340
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2341
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2342
|
-
*
|
|
2343
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2344
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2345
|
-
*/
|
|
2346
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2347
|
-
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
2348
|
-
/**
|
|
2349
|
-
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
2350
|
-
* @default 30000
|
|
2351
|
-
*/
|
|
2352
|
-
timeout?: number;
|
|
2353
|
-
};
|
|
2354
|
-
type PluginRegistryApi = {
|
|
2355
|
-
registerSource: (source: PluginSourceRegistration) => void;
|
|
2356
|
-
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
2357
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
2358
|
-
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
2359
|
-
registerIcon: (icon: PluginIconRegistration) => void;
|
|
2360
|
-
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
2361
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2362
|
-
};
|
|
2363
|
-
/**
|
|
2364
|
-
* API for managing plugin config subscriptions
|
|
2365
|
-
*/
|
|
2366
|
-
type PluginConfigApi = {
|
|
2367
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2368
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2369
|
-
};
|
|
2370
|
-
/**
|
|
2371
|
-
* API for managing plugin activity interactions
|
|
2372
|
-
*/
|
|
2373
|
-
type PluginActivityApi = {
|
|
2374
|
-
/**
|
|
2375
|
-
* Get the current activity parameters.
|
|
2376
|
-
*
|
|
2377
|
-
* @returns The current activity parameters object
|
|
2378
|
-
*
|
|
2379
|
-
* @example
|
|
2380
|
-
* ```typescript
|
|
2381
|
-
* const params = pluginApi.activity.getParams();
|
|
2382
|
-
* console.log('Current params:', params);
|
|
2383
|
-
* ```
|
|
2384
|
-
*/
|
|
2385
|
-
getParams: () => Record<string, unknown>;
|
|
2386
|
-
/**
|
|
2387
|
-
* Subscribe to changes in activity parameters.
|
|
2388
|
-
* The callback will be called immediately with the current params,
|
|
2389
|
-
* and then whenever the params change.
|
|
2390
|
-
*
|
|
2391
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2392
|
-
*
|
|
2393
|
-
* @param callback - Function to call with the new params
|
|
2394
|
-
* @returns Unsubscribe function
|
|
2395
|
-
*
|
|
2396
|
-
* @example
|
|
2397
|
-
* ```typescript
|
|
2398
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2399
|
-
* console.log('Activity params changed:', params);
|
|
2400
|
-
* });
|
|
2401
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2402
|
-
* ```
|
|
2403
|
-
*/
|
|
2404
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2405
|
-
};
|
|
2406
|
-
type PluginFileEntryUpdate = {
|
|
2407
|
-
file?: File | Blob;
|
|
2408
|
-
cdnUrl?: string | null;
|
|
2409
|
-
cdnUrlModifiers?: string | null;
|
|
2410
|
-
mimeType?: string | null;
|
|
2411
|
-
};
|
|
2412
|
-
type PluginFilesApi = {
|
|
2413
|
-
/**
|
|
2414
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2415
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2416
|
-
*/
|
|
2417
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2418
|
-
};
|
|
2419
|
-
type PluginApi = {
|
|
2420
|
-
registry: PluginRegistryApi;
|
|
2421
|
-
config: PluginConfigApi;
|
|
2422
|
-
activity: PluginActivityApi;
|
|
2423
|
-
files: PluginFilesApi;
|
|
2424
|
-
};
|
|
2425
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2426
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2427
|
-
type PluginSetupParams = {
|
|
2428
|
-
pluginApi: PluginApi;
|
|
2429
|
-
uploaderApi: PluginUploaderApi;
|
|
2430
|
-
};
|
|
2431
|
-
type UploaderPlugin = {
|
|
2432
|
-
id: string;
|
|
2433
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2434
|
-
};
|
|
2435
|
-
type Owned<T> = T & {
|
|
2436
|
-
pluginId: string;
|
|
2437
|
-
};
|
|
2438
|
-
type PluginRegistrySnapshot = {
|
|
2439
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2440
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2441
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2442
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2443
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2444
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2445
|
-
};
|
|
2446
|
-
|
|
2447
|
-
type EventMap = {
|
|
2448
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2449
|
-
};
|
|
2450
|
-
|
|
2451
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2452
|
-
file: File | null;
|
|
2453
|
-
externalUrl: string | null;
|
|
2454
|
-
fileName: string | null;
|
|
2455
|
-
fileSize: number | null;
|
|
2456
|
-
lastModified: number;
|
|
2457
|
-
uploadProgress: number;
|
|
2458
|
-
uuid: string | null;
|
|
2459
|
-
isImage: boolean;
|
|
2460
|
-
mimeType: string | null;
|
|
2461
|
-
ctxName: string | null;
|
|
2462
|
-
cdnUrl: string | null;
|
|
2463
|
-
cdnUrlModifiers: string | null;
|
|
2464
|
-
fileInfo: UploadcareFile | null;
|
|
2465
|
-
isUploading: boolean;
|
|
2466
|
-
abortController: AbortController | null;
|
|
2467
|
-
thumbUrl: string | null;
|
|
2468
|
-
silent: boolean;
|
|
2469
|
-
source: string | null;
|
|
2470
|
-
fullPath: string | null;
|
|
2471
|
-
metadata: Metadata | null;
|
|
2472
|
-
errors: OutputErrorFile[];
|
|
2473
|
-
uploadError: Error | null;
|
|
2474
|
-
isRemoved: boolean;
|
|
2475
|
-
isQueuedForUploading: boolean;
|
|
2476
|
-
isValidationPending: boolean;
|
|
2477
|
-
isQueuedForValidation: boolean;
|
|
2478
|
-
}
|
|
2479
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2480
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2481
|
-
|
|
2482
|
-
declare class PluginRegistry {
|
|
2483
|
-
private _sources;
|
|
2484
|
-
private _activities;
|
|
2485
|
-
private _fileActions;
|
|
2486
|
-
private _fileHooks;
|
|
2487
|
-
private _icons;
|
|
2488
|
-
private _i18n;
|
|
2489
|
-
readonly config: CustomConfigRegistry;
|
|
2490
|
-
private _own;
|
|
2491
|
-
addSource(pluginId: string, item: PluginSourceRegistration): void;
|
|
2492
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): void;
|
|
2493
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
|
|
2494
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
|
|
2495
|
-
addIcon(pluginId: string, item: PluginIconRegistration): void;
|
|
2496
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): void;
|
|
2497
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2498
|
-
purge(pluginId: string): void;
|
|
2499
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
declare class PluginManager extends SharedInstance {
|
|
2503
|
-
private _plugins;
|
|
2504
|
-
private _subscribers;
|
|
2505
|
-
private _pluginsUpdate;
|
|
2506
|
-
private _lazyPluginLoader;
|
|
2507
|
-
readonly registry: PluginRegistry;
|
|
2508
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2509
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2510
|
-
pluginsReady(): Promise<void>;
|
|
2511
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2512
|
-
private _syncPlugins;
|
|
2513
|
-
private _registerPlugin;
|
|
2514
|
-
private _unregisterPlugin;
|
|
2515
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2516
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2259
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2260
|
+
private _secureToken;
|
|
2261
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2517
2262
|
destroy(): void;
|
|
2518
|
-
private _notifySubscribers;
|
|
2519
2263
|
}
|
|
2520
2264
|
|
|
2521
2265
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2556,87 +2300,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2556
2300
|
private get _location();
|
|
2557
2301
|
}
|
|
2558
2302
|
|
|
2559
|
-
interface ISharedInstance {
|
|
2560
|
-
destroy?(): void;
|
|
2561
|
-
}
|
|
2562
|
-
declare class SharedInstance {
|
|
2563
|
-
protected _ctx: PubSub<SharedState>;
|
|
2564
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2565
|
-
private _subscriptions;
|
|
2566
|
-
private _cfgProxy;
|
|
2567
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2568
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2569
|
-
protected addSub(unsub: () => void): void;
|
|
2570
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2571
|
-
destroy(): void;
|
|
2572
|
-
}
|
|
2573
|
-
declare const instanceKeyMap: {
|
|
2574
|
-
modalManager: "*modalManager";
|
|
2575
|
-
pluginManager: "*pluginManager";
|
|
2576
|
-
telemetryManager: "*telemetryManager";
|
|
2577
|
-
localeManager: "*localeManager";
|
|
2578
|
-
a11y: "*a11y";
|
|
2579
|
-
clipboard: "*clipboard";
|
|
2580
|
-
blocksRegistry: "*blocksRegistry";
|
|
2581
|
-
eventEmitter: "*eventEmitter";
|
|
2582
|
-
uploadCollection: "*uploadCollection";
|
|
2583
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2584
|
-
api: "*publicApi";
|
|
2585
|
-
validationManager: "*validationManager";
|
|
2586
|
-
};
|
|
2587
|
-
type InstanceTypeMap = {
|
|
2588
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2589
|
-
};
|
|
2590
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2591
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2592
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2593
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2594
|
-
readonly ctx: PubSub<SharedState>;
|
|
2595
|
-
readonly modalManager: ModalManager | null;
|
|
2596
|
-
readonly pluginManager: PluginManager;
|
|
2597
|
-
readonly telemetryManager: TelemetryManager;
|
|
2598
|
-
readonly localeManager: LocaleManager;
|
|
2599
|
-
readonly a11y: A11y;
|
|
2600
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2601
|
-
readonly eventEmitter: EventEmitter;
|
|
2602
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2603
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2604
|
-
readonly api: UploaderPublicApi;
|
|
2605
|
-
readonly validationManager: ValidationManager;
|
|
2606
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2607
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2608
|
-
};
|
|
2609
|
-
|
|
2610
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2611
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2612
|
-
private scopes;
|
|
2613
|
-
private listener;
|
|
2614
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2615
|
-
private openUploadList;
|
|
2616
|
-
private _listener;
|
|
2617
|
-
private handlePaste;
|
|
2618
|
-
registerBlock(scope: Node): () => void;
|
|
2619
|
-
destroy(): void;
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2623
|
-
type LazyPluginEntry = {
|
|
2624
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2625
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2626
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2627
|
-
};
|
|
2628
|
-
|
|
2629
2303
|
type SharedConfigState = {
|
|
2630
2304
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2631
2305
|
};
|
|
2632
|
-
type SharedCustomConfigState = {
|
|
2633
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2634
|
-
};
|
|
2635
2306
|
type BlocksRegistry = Set<LitBlock>;
|
|
2636
2307
|
type ActivityBlockCtxState = {
|
|
2637
|
-
'*currentActivity':
|
|
2308
|
+
'*currentActivity': string | null;
|
|
2638
2309
|
'*currentActivityParams': Record<string, unknown>;
|
|
2639
|
-
'*history': (
|
|
2310
|
+
'*history': (string | null)[];
|
|
2640
2311
|
'*historyBack': (() => void) | null;
|
|
2641
2312
|
'*closeModal': () => void;
|
|
2642
2313
|
};
|
|
@@ -2653,7 +2324,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2653
2324
|
};
|
|
2654
2325
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2655
2326
|
'*solution': string | null;
|
|
2656
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2657
2327
|
};
|
|
2658
2328
|
type CloudImageEditorState = {
|
|
2659
2329
|
'*originalUrl': string | null;
|
|
@@ -2704,9 +2374,7 @@ type EditorToolbarState = {
|
|
|
2704
2374
|
'*currentOperation': string | null;
|
|
2705
2375
|
'*operationTooltip': string | null;
|
|
2706
2376
|
};
|
|
2707
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2708
2377
|
type DynamicBlockState = {
|
|
2709
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2710
2378
|
'*blocksRegistry': BlocksRegistry;
|
|
2711
2379
|
'*eventEmitter': EventEmitter;
|
|
2712
2380
|
'*localeManager': LocaleManager;
|
|
@@ -2714,7 +2382,6 @@ type DynamicBlockState = {
|
|
|
2714
2382
|
'*a11y': A11y;
|
|
2715
2383
|
'*modalManager': ModalManager | null;
|
|
2716
2384
|
'*clipboard': ClipboardLayer;
|
|
2717
|
-
'*pluginManager': PluginManager;
|
|
2718
2385
|
};
|
|
2719
2386
|
type DynamicUploaderBlockState = {
|
|
2720
2387
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2725,7 +2392,66 @@ type DynamicUploaderBlockState = {
|
|
|
2725
2392
|
type LocaleState = {
|
|
2726
2393
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2727
2394
|
};
|
|
2728
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2395
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2396
|
+
|
|
2397
|
+
interface ISharedInstance {
|
|
2398
|
+
destroy?(): void;
|
|
2399
|
+
}
|
|
2400
|
+
declare class SharedInstance {
|
|
2401
|
+
protected _ctx: PubSub<SharedState>;
|
|
2402
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2403
|
+
private _subscriptions;
|
|
2404
|
+
private _cfgProxy;
|
|
2405
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2406
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2407
|
+
protected addSub(unsub: () => void): void;
|
|
2408
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2409
|
+
destroy(): void;
|
|
2410
|
+
}
|
|
2411
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2412
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2413
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2414
|
+
readonly ctx: PubSub<SharedState>;
|
|
2415
|
+
readonly modalManager: ModalManager | null;
|
|
2416
|
+
readonly telemetryManager: TelemetryManager;
|
|
2417
|
+
readonly localeManager: LocaleManager;
|
|
2418
|
+
readonly a11y: A11y;
|
|
2419
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2420
|
+
readonly eventEmitter: EventEmitter;
|
|
2421
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2422
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2423
|
+
readonly api: UploaderPublicApi;
|
|
2424
|
+
readonly validationManager: ValidationManager;
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2427
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2428
|
+
signal?: AbortSignal;
|
|
2429
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2430
|
+
type FileValidatorDescriptor = {
|
|
2431
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2432
|
+
validator: FuncFileValidator;
|
|
2433
|
+
};
|
|
2434
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2435
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2436
|
+
declare class ValidationManager extends SharedInstance {
|
|
2437
|
+
private get _uploadCollection();
|
|
2438
|
+
private _commonFileValidators;
|
|
2439
|
+
private _commonCollectionValidators;
|
|
2440
|
+
private _queue;
|
|
2441
|
+
private _runQueueDebounced;
|
|
2442
|
+
private _isDestroyed;
|
|
2443
|
+
private _entryValidationState;
|
|
2444
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2445
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2446
|
+
runCollectionValidators(): void;
|
|
2447
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2448
|
+
private _runFileValidatorsForEntry;
|
|
2449
|
+
private _addCustomTypeToValidationError;
|
|
2450
|
+
private _getEntryValidationState;
|
|
2451
|
+
private _getValidatorDescriptors;
|
|
2452
|
+
private _getValidatorDescriptorsForEntry;
|
|
2453
|
+
destroy(): void;
|
|
2454
|
+
}
|
|
2729
2455
|
|
|
2730
2456
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2731
2457
|
willYield: boolean;
|
|
@@ -2737,7 +2463,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2737
2463
|
};
|
|
2738
2464
|
declare class LitBlock extends LitBlockBase {
|
|
2739
2465
|
private _cfgProxy;
|
|
2466
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2740
2467
|
static styleAttrs: string[];
|
|
2468
|
+
activityType: ActivityType;
|
|
2741
2469
|
init$: {};
|
|
2742
2470
|
constructor();
|
|
2743
2471
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2745,7 +2473,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2745
2473
|
protected _sharedInstancesBag: {
|
|
2746
2474
|
readonly ctx: PubSub<SharedState>;
|
|
2747
2475
|
readonly modalManager: ModalManager | null;
|
|
2748
|
-
readonly pluginManager: PluginManager;
|
|
2749
2476
|
readonly telemetryManager: TelemetryManager;
|
|
2750
2477
|
readonly localeManager: LocaleManager;
|
|
2751
2478
|
readonly a11y: A11y;
|
|
@@ -2755,34 +2482,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2755
2482
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2756
2483
|
readonly api: UploaderPublicApi;
|
|
2757
2484
|
readonly validationManager: ValidationManager;
|
|
2758
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2759
|
-
modalManager: ModalManager | null;
|
|
2760
|
-
pluginManager: PluginManager;
|
|
2761
|
-
telemetryManager: TelemetryManager;
|
|
2762
|
-
localeManager: LocaleManager;
|
|
2763
|
-
a11y: A11y;
|
|
2764
|
-
clipboard: ClipboardLayer;
|
|
2765
|
-
blocksRegistry: BlocksRegistry;
|
|
2766
|
-
eventEmitter: EventEmitter;
|
|
2767
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2768
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2769
|
-
api: UploaderPublicApi;
|
|
2770
|
-
validationManager: ValidationManager;
|
|
2771
|
-
}[TName]>) => void): () => void;
|
|
2772
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2773
|
-
modalManager: ModalManager | null;
|
|
2774
|
-
pluginManager: PluginManager;
|
|
2775
|
-
telemetryManager: TelemetryManager;
|
|
2776
|
-
localeManager: LocaleManager;
|
|
2777
|
-
a11y: A11y;
|
|
2778
|
-
clipboard: ClipboardLayer;
|
|
2779
|
-
blocksRegistry: BlocksRegistry;
|
|
2780
|
-
eventEmitter: EventEmitter;
|
|
2781
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2782
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2783
|
-
api: UploaderPublicApi;
|
|
2784
|
-
validationManager: ValidationManager;
|
|
2785
|
-
}[TName]>>;
|
|
2786
2485
|
};
|
|
2787
2486
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2788
2487
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2801,7 +2500,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2801
2500
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2802
2501
|
*/
|
|
2803
2502
|
private destroyCtxCallback;
|
|
2804
|
-
|
|
2503
|
+
/**
|
|
2504
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2505
|
+
* @param key The shared state key.
|
|
2506
|
+
* @param resolver The resolver function that creates the instance.
|
|
2507
|
+
*/
|
|
2805
2508
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2806
2509
|
private _destroySharedContextInstances;
|
|
2807
2510
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2828,7 +2531,7 @@ declare class Modal extends LitBlock {
|
|
|
2828
2531
|
private _handleDialogClose;
|
|
2829
2532
|
private _handleDialogMouseDown;
|
|
2830
2533
|
private _handleDialogMouseUp;
|
|
2831
|
-
show():
|
|
2534
|
+
show(): void;
|
|
2832
2535
|
hide(): void;
|
|
2833
2536
|
private _handleModalOpen;
|
|
2834
2537
|
private _handleModalClose;
|
|
@@ -2900,10 +2603,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2900
2603
|
|
|
2901
2604
|
declare class LitSolutionBlock extends LitBlock {
|
|
2902
2605
|
static styleAttrs: string[];
|
|
2903
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2904
2606
|
init$: {
|
|
2905
2607
|
'*solution': string | null;
|
|
2906
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2907
2608
|
'*commonProgress': number;
|
|
2908
2609
|
'*uploadList': never[];
|
|
2909
2610
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -3035,32 +2736,9 @@ declare global {
|
|
|
3035
2736
|
}
|
|
3036
2737
|
}
|
|
3037
2738
|
|
|
3038
|
-
|
|
3039
|
-
id: string;
|
|
3040
|
-
label: string;
|
|
3041
|
-
icon?: string;
|
|
3042
|
-
onClick: () => void | Promise<void>;
|
|
3043
|
-
};
|
|
3044
|
-
declare class SourceBtn extends LitUploaderBlock {
|
|
3045
|
-
couldBeCtxOwner: boolean;
|
|
3046
|
-
source?: SourceButtonConfig;
|
|
3047
|
-
private _iconName;
|
|
3048
|
-
private _srcTypeKey;
|
|
3049
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
3050
|
-
private _applySource;
|
|
3051
|
-
activate(): void;
|
|
3052
|
-
render(): lit_html.TemplateResult<1>;
|
|
3053
|
-
}
|
|
3054
|
-
declare global {
|
|
3055
|
-
interface HTMLElementTagNameMap {
|
|
3056
|
-
'uc-source-btn': SourceBtn;
|
|
3057
|
-
}
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
declare class SourceList extends LitUploaderBlock {
|
|
2739
|
+
declare class SourceList extends LitBlock {
|
|
3061
2740
|
private _rawSourceList;
|
|
3062
|
-
private
|
|
3063
|
-
private _sources;
|
|
2741
|
+
private _cameraModes;
|
|
3064
2742
|
/**
|
|
3065
2743
|
* CSS-only attribute
|
|
3066
2744
|
*/
|
|
@@ -3068,10 +2746,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
3068
2746
|
initCallback(): void;
|
|
3069
2747
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
3070
2748
|
private _updateSources;
|
|
3071
|
-
private
|
|
3072
|
-
private _makePluginSourceConfig;
|
|
2749
|
+
private _sources;
|
|
3073
2750
|
render(): lit_html.TemplateResult<1>;
|
|
3074
|
-
disconnectedCallback(): void;
|
|
3075
2751
|
}
|
|
3076
2752
|
declare global {
|
|
3077
2753
|
interface HTMLElementTagNameMap {
|
|
@@ -3126,8 +2802,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
3126
2802
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
3127
2803
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
3128
2804
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
3129
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
3130
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
3131
2805
|
}
|
|
3132
2806
|
declare global {
|
|
3133
2807
|
interface HTMLElementTagNameMap {
|
|
@@ -3135,71 +2809,45 @@ declare global {
|
|
|
3135
2809
|
}
|
|
3136
2810
|
}
|
|
3137
2811
|
|
|
3138
|
-
declare class
|
|
3139
|
-
static styleAttrs: string[];
|
|
2812
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
3140
2813
|
couldBeCtxOwner: boolean;
|
|
3141
|
-
|
|
3142
|
-
private
|
|
3143
|
-
private readonly _handleClick;
|
|
2814
|
+
activityType: ActivityType;
|
|
2815
|
+
private _formState;
|
|
3144
2816
|
initCallback(): void;
|
|
2817
|
+
private _inputRef;
|
|
2818
|
+
private _handleInput;
|
|
2819
|
+
private _handleUpload;
|
|
3145
2820
|
render(): lit_html.TemplateResult<1>;
|
|
3146
2821
|
}
|
|
3147
2822
|
declare global {
|
|
3148
2823
|
interface HTMLElementTagNameMap {
|
|
3149
|
-
'uc-
|
|
2824
|
+
'uc-url-source': UrlSource;
|
|
3150
2825
|
}
|
|
3151
2826
|
}
|
|
3152
2827
|
|
|
3153
|
-
declare class
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
private _ensureRegistered;
|
|
3160
|
-
private _renderActivity;
|
|
3161
|
-
private _disposeActivity;
|
|
3162
|
-
disconnectedCallback(): void;
|
|
3163
|
-
render(): lit_html.TemplateResult<1>;
|
|
3164
|
-
}
|
|
3165
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3166
|
-
mode: 'modal' | 'inline';
|
|
3167
|
-
private _activities;
|
|
3168
|
-
private _unsubscribePlugins?;
|
|
2828
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2829
|
+
static styleAttrs: string[];
|
|
2830
|
+
couldBeCtxOwner: boolean;
|
|
2831
|
+
dropzone: boolean;
|
|
2832
|
+
private _buttonTextKey;
|
|
2833
|
+
private readonly _handleClick;
|
|
3169
2834
|
initCallback(): void;
|
|
3170
|
-
private _syncActivities;
|
|
3171
|
-
disconnectedCallback(): void;
|
|
3172
|
-
render(): lit_html.TemplateResult<1>;
|
|
3173
|
-
}
|
|
3174
|
-
declare global {
|
|
3175
|
-
interface HTMLElementTagNameMap {
|
|
3176
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3177
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3182
|
-
private _formState;
|
|
3183
|
-
private _inputRef;
|
|
3184
|
-
private _handleInput;
|
|
3185
|
-
private _handleUpload;
|
|
3186
|
-
firstUpdated(): void;
|
|
3187
2835
|
render(): lit_html.TemplateResult<1>;
|
|
3188
2836
|
}
|
|
3189
2837
|
declare global {
|
|
3190
2838
|
interface HTMLElementTagNameMap {
|
|
3191
|
-
'uc-
|
|
2839
|
+
'uc-simple-btn': SimpleBtn;
|
|
3192
2840
|
}
|
|
3193
2841
|
}
|
|
3194
2842
|
|
|
3195
2843
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3196
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3197
2844
|
attributesMeta: {
|
|
3198
2845
|
headless?: boolean;
|
|
3199
2846
|
'ctx-name': string;
|
|
3200
2847
|
};
|
|
3201
2848
|
static styleAttrs: string[];
|
|
3202
2849
|
headless: boolean;
|
|
2850
|
+
smart: boolean;
|
|
3203
2851
|
constructor();
|
|
3204
2852
|
initCallback(): void;
|
|
3205
2853
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -3211,7 +2859,6 @@ declare global {
|
|
|
3211
2859
|
}
|
|
3212
2860
|
|
|
3213
2861
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3214
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3215
2862
|
attributesMeta: {
|
|
3216
2863
|
'ctx-name': string;
|
|
3217
2864
|
};
|
|
@@ -3232,7 +2879,6 @@ declare global {
|
|
|
3232
2879
|
}
|
|
3233
2880
|
|
|
3234
2881
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3235
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3236
2882
|
attributesMeta: {
|
|
3237
2883
|
'ctx-name': string;
|
|
3238
2884
|
};
|
|
@@ -3259,4 +2905,4 @@ declare global {
|
|
|
3259
2905
|
declare const PACKAGE_NAME = "blocks";
|
|
3260
2906
|
declare const PACKAGE_VERSION: string;
|
|
3261
2907
|
|
|
3262
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2908
|
+
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, PACKAGE_NAME, PACKAGE_VERSION, 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, loadFileUploaderFrom, toKebabCase };
|