@uploadcare/file-uploader 1.28.0-rc.0 → 1.28.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 +2 -1
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +289 -664
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +68 -109
- package/dist/locales/file-uploader/ar.d.ts +3 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +3 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +3 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +3 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +3 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +3 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +3 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +3 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +3 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +3 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +3 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +3 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +3 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +3 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +3 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +3 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +3 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +3 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +3 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +3 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +3 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +3 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +3 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +3 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +3 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +3 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +3 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +3 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +3 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +3 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +3 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +3 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +3 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +3 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +3 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +292 -664
- 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 +292 -664
- 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 +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +244 -616
- 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 +292 -664
- 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 +292 -664
- 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 +292 -664
- 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';
|
|
@@ -93,6 +93,7 @@ declare const _default: {
|
|
|
93
93
|
'choose-file': string;
|
|
94
94
|
'choose-files': string;
|
|
95
95
|
'drop-files-here': string;
|
|
96
|
+
'drop-file-here': string;
|
|
96
97
|
'select-file-source': string;
|
|
97
98
|
selected: string;
|
|
98
99
|
upload: string;
|
|
@@ -134,6 +135,7 @@ declare const _default: {
|
|
|
134
135
|
'src-type-camera': string;
|
|
135
136
|
'src-type-mobile-video-camera': string;
|
|
136
137
|
'src-type-mobile-photo-camera': string;
|
|
138
|
+
'src-type-draw': string;
|
|
137
139
|
'src-type-facebook': string;
|
|
138
140
|
'src-type-dropbox': string;
|
|
139
141
|
'src-type-gdrive': string;
|
|
@@ -148,6 +150,7 @@ declare const _default: {
|
|
|
148
150
|
'src-type-other': string;
|
|
149
151
|
'caption-from-url': string;
|
|
150
152
|
'caption-camera': string;
|
|
153
|
+
'caption-draw': string;
|
|
151
154
|
'caption-edit-file': string;
|
|
152
155
|
'file-no-name': string;
|
|
153
156
|
'toggle-fullscreen': string;
|
|
@@ -229,72 +232,8 @@ declare class A11y implements ISharedInstance {
|
|
|
229
232
|
declare class LocaleManager extends SharedInstance {
|
|
230
233
|
private _localeName;
|
|
231
234
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
232
|
-
private _applyOverrides;
|
|
233
|
-
private _applyPluginLocales;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
|
-
/**
|
|
237
|
-
* Custom configuration options registration system for plugins
|
|
238
|
-
*/
|
|
239
|
-
type CustomConfigDefinition<T = unknown> = {
|
|
240
|
-
/**
|
|
241
|
-
* Config option name (will be used as property and optionally as attribute)
|
|
242
|
-
*/
|
|
243
|
-
name: string;
|
|
244
|
-
/**
|
|
245
|
-
* Default value for the config option
|
|
246
|
-
*/
|
|
247
|
-
defaultValue: T;
|
|
248
|
-
/**
|
|
249
|
-
* Whether this config can be set via HTML attribute
|
|
250
|
-
* @default true
|
|
251
|
-
*/
|
|
252
|
-
attribute?: boolean;
|
|
253
|
-
/**
|
|
254
|
-
* Convert attribute string to config value
|
|
255
|
-
* Only used if attribute is true
|
|
256
|
-
*/
|
|
257
|
-
fromAttribute?: (value: string | null) => T;
|
|
258
|
-
/**
|
|
259
|
-
* Convert config value to attribute string
|
|
260
|
-
* Only used if attribute is true
|
|
261
|
-
*/
|
|
262
|
-
toAttribute?: (value: T) => string | null;
|
|
263
|
-
/**
|
|
264
|
-
* Normalize/validate the config value
|
|
265
|
-
*/
|
|
266
|
-
normalize?: (value: unknown) => T;
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* Registry for custom config options defined by plugins
|
|
270
|
-
* This is managed by the PluginManager as a shared instance property
|
|
271
|
-
*/
|
|
272
|
-
declare class CustomConfigRegistry {
|
|
273
|
-
private _definitions;
|
|
274
|
-
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
275
|
-
unregister(name: string): void;
|
|
276
|
-
unregisterByPlugin(pluginId: string): void;
|
|
277
|
-
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
278
|
-
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Interface for TypeScript module augmentation
|
|
282
|
-
* Plugins should extend this interface to add their custom config types
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* ```typescript
|
|
286
|
-
* declare module '@uploadcare/file-uploader' {
|
|
287
|
-
* interface CustomConfig {
|
|
288
|
-
* 'my-custom-option': string;
|
|
289
|
-
* }
|
|
290
|
-
* }
|
|
291
|
-
* ```
|
|
292
|
-
*/
|
|
293
|
-
interface CustomConfig {
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
297
|
-
|
|
298
237
|
declare class TypedData<T extends Record<string, unknown>> {
|
|
299
238
|
private _ctxId;
|
|
300
239
|
private _data;
|
|
@@ -307,41 +246,6 @@ declare class TypedData<T extends Record<string, unknown>> {
|
|
|
307
246
|
destroy(): void;
|
|
308
247
|
}
|
|
309
248
|
|
|
310
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
311
|
-
signal?: AbortSignal;
|
|
312
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
313
|
-
type FileValidatorDescriptor = {
|
|
314
|
-
runOn: 'add' | 'upload' | 'change';
|
|
315
|
-
validator: FuncFileValidator;
|
|
316
|
-
};
|
|
317
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
318
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
319
|
-
declare class ValidationManager extends SharedInstance {
|
|
320
|
-
private get _uploadCollection();
|
|
321
|
-
private _commonFileValidators;
|
|
322
|
-
private _commonCollectionValidators;
|
|
323
|
-
private _queue;
|
|
324
|
-
private _runQueueDebounced;
|
|
325
|
-
private _isDestroyed;
|
|
326
|
-
private _entryValidationState;
|
|
327
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
328
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
329
|
-
runCollectionValidators(): void;
|
|
330
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
331
|
-
private _runFileValidatorsForEntry;
|
|
332
|
-
private _addCustomTypeToValidationError;
|
|
333
|
-
private _getEntryValidationState;
|
|
334
|
-
private _getValidatorDescriptors;
|
|
335
|
-
private _getValidatorDescriptorsForEntry;
|
|
336
|
-
destroy(): void;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
declare class SecureUploadsManager extends SharedInstance {
|
|
340
|
-
private _secureToken;
|
|
341
|
-
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
342
|
-
destroy(): void;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
249
|
type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
|
|
346
250
|
type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
|
|
347
251
|
type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
@@ -393,6 +297,157 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
393
297
|
}>;
|
|
394
298
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
395
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 DROPBOX_CHOOSER: "dropboxchooser";
|
|
373
|
+
readonly GDRIVE: "gdrive";
|
|
374
|
+
readonly GPHOTOS: "gphotos";
|
|
375
|
+
readonly FLICKR: "flickr";
|
|
376
|
+
readonly VK: "vk";
|
|
377
|
+
readonly EVERNOTE: "evernote";
|
|
378
|
+
readonly BOX: "box";
|
|
379
|
+
readonly ONEDRIVE: "onedrive";
|
|
380
|
+
readonly HUDDLE: "huddle";
|
|
381
|
+
}>;
|
|
382
|
+
declare const UploadSource: Readonly<{
|
|
383
|
+
readonly FACEBOOK: "facebook";
|
|
384
|
+
readonly DROPBOX: "dropbox";
|
|
385
|
+
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
386
|
+
readonly GDRIVE: "gdrive";
|
|
387
|
+
readonly GPHOTOS: "gphotos";
|
|
388
|
+
readonly FLICKR: "flickr";
|
|
389
|
+
readonly VK: "vk";
|
|
390
|
+
readonly EVERNOTE: "evernote";
|
|
391
|
+
readonly BOX: "box";
|
|
392
|
+
readonly ONEDRIVE: "onedrive";
|
|
393
|
+
readonly HUDDLE: "huddle";
|
|
394
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
395
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
396
|
+
readonly LOCAL: "local";
|
|
397
|
+
readonly DROP_AREA: "drop-area";
|
|
398
|
+
readonly CAMERA: "camera";
|
|
399
|
+
readonly EXTERNAL: "external";
|
|
400
|
+
readonly API: "js-api";
|
|
401
|
+
readonly URL: "url";
|
|
402
|
+
readonly DRAW: "draw";
|
|
403
|
+
}>;
|
|
404
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
405
|
+
|
|
406
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
407
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
408
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
409
|
+
protected couldBeCtxOwner: boolean;
|
|
410
|
+
private _isCtxOwner;
|
|
411
|
+
private _unobserveCollection?;
|
|
412
|
+
private _unobserveCollectionProperties?;
|
|
413
|
+
init$: {
|
|
414
|
+
'*commonProgress': number;
|
|
415
|
+
'*uploadList': never[];
|
|
416
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
417
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
418
|
+
'*collectionState': OutputCollectionState | null;
|
|
419
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
420
|
+
'*uploadTrigger': Set<string>;
|
|
421
|
+
'*currentActivity': null;
|
|
422
|
+
'*currentActivityParams': {};
|
|
423
|
+
'*history': never[];
|
|
424
|
+
'*historyBack': null;
|
|
425
|
+
'*closeModal': () => void;
|
|
426
|
+
};
|
|
427
|
+
private get _hasCtxOwner();
|
|
428
|
+
initCallback(): void;
|
|
429
|
+
getAPI(): UploaderPublicApi;
|
|
430
|
+
get validationManager(): ValidationManager;
|
|
431
|
+
get api(): UploaderPublicApi;
|
|
432
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
433
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
434
|
+
disconnectedCallback(): void;
|
|
435
|
+
connectedCallback(): void;
|
|
436
|
+
private _initCtxOwner;
|
|
437
|
+
private _observeUploadCollection;
|
|
438
|
+
private _unobserveUploadCollection;
|
|
439
|
+
private _createGroup;
|
|
440
|
+
private _flushOutputItems;
|
|
441
|
+
private _handleCollectionUpdate;
|
|
442
|
+
private _handleCollectionPropertiesUpdate;
|
|
443
|
+
private _flushCommonUploadProgress;
|
|
444
|
+
private _openCloudImageEditor;
|
|
445
|
+
private _setInitialCrop;
|
|
446
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
447
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
448
|
+
getOutputData(): OutputFileEntry[];
|
|
449
|
+
}
|
|
450
|
+
|
|
396
451
|
/**
|
|
397
452
|
* Mapping of loading resources per operation
|
|
398
453
|
*/
|
|
@@ -507,14 +562,11 @@ declare global {
|
|
|
507
562
|
declare class Icon extends LitBlock {
|
|
508
563
|
name: string;
|
|
509
564
|
private _resolvedHref;
|
|
510
|
-
private _pluginSvg;
|
|
511
565
|
private _iconHrefResolver;
|
|
512
|
-
private _unsubscribePlugins?;
|
|
513
566
|
initCallback(): void;
|
|
514
567
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
515
568
|
private _updateResolvedHref;
|
|
516
569
|
render(): lit_html.TemplateResult<1>;
|
|
517
|
-
disconnectedCallback(): void;
|
|
518
570
|
}
|
|
519
571
|
declare global {
|
|
520
572
|
interface HTMLElementTagNameMap {
|
|
@@ -1045,7 +1097,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
1045
1097
|
private _hasNetworkProblems;
|
|
1046
1098
|
private _isInitialized;
|
|
1047
1099
|
private _pendingInitUpdate;
|
|
1048
|
-
private _pendingSizeWait;
|
|
1049
1100
|
private readonly _debouncedShowLoader;
|
|
1050
1101
|
private readonly _imgRef;
|
|
1051
1102
|
private readonly _cropperRef;
|
|
@@ -1095,11 +1146,12 @@ type ActivityParams$1 = {
|
|
|
1095
1146
|
internalId: string;
|
|
1096
1147
|
};
|
|
1097
1148
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1149
|
+
couldBeCtxOwner: boolean;
|
|
1150
|
+
activityType: "cloud-image-edit";
|
|
1098
1151
|
private _entry?;
|
|
1099
1152
|
private _editorConfig;
|
|
1100
1153
|
get activityParams(): ActivityParams$1;
|
|
1101
1154
|
initCallback(): void;
|
|
1102
|
-
disconnectedCallback(): void;
|
|
1103
1155
|
private _handleApply;
|
|
1104
1156
|
private _handleCancel;
|
|
1105
1157
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1136,6 +1188,7 @@ type ActivityParams = {
|
|
|
1136
1188
|
};
|
|
1137
1189
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1138
1190
|
couldBeCtxOwner: boolean;
|
|
1191
|
+
activityType: "external";
|
|
1139
1192
|
private _messageBridge?;
|
|
1140
1193
|
private _iframeRef;
|
|
1141
1194
|
private _latestSelectionSummary;
|
|
@@ -1179,26 +1232,22 @@ declare global {
|
|
|
1179
1232
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1180
1233
|
START_FROM: "start-from";
|
|
1181
1234
|
CAMERA: "camera";
|
|
1235
|
+
DRAW: "draw";
|
|
1182
1236
|
UPLOAD_LIST: "upload-list";
|
|
1183
1237
|
URL: "url";
|
|
1184
1238
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1185
1239
|
EXTERNAL: "external";
|
|
1186
1240
|
}>;
|
|
1187
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1188
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1241
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1242
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1189
1243
|
|
|
1190
1244
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1191
|
-
interface CustomActivities {
|
|
1192
|
-
}
|
|
1193
1245
|
type ActivityParamsMap = {
|
|
1194
1246
|
'cloud-image-edit': ActivityParams$1;
|
|
1195
1247
|
external: ActivityParams;
|
|
1196
|
-
} & {
|
|
1197
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1198
1248
|
};
|
|
1199
1249
|
declare class LitActivityBlock extends LitBlock {
|
|
1200
1250
|
protected historyTracked: boolean;
|
|
1201
|
-
activityType: ActivityType;
|
|
1202
1251
|
private [ACTIVE_PROP]?;
|
|
1203
1252
|
init$: {
|
|
1204
1253
|
'*currentActivity': null;
|
|
@@ -1212,11 +1261,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1212
1261
|
private _activate;
|
|
1213
1262
|
initCallback(): void;
|
|
1214
1263
|
private _historyFlush;
|
|
1215
|
-
|
|
1264
|
+
private _isActivityRegistered;
|
|
1216
1265
|
private static _activityCallbacks;
|
|
1217
1266
|
static activities: Readonly<{
|
|
1218
1267
|
START_FROM: 'start-from';
|
|
1219
1268
|
CAMERA: 'camera';
|
|
1269
|
+
DRAW: 'draw';
|
|
1220
1270
|
UPLOAD_LIST: 'upload-list';
|
|
1221
1271
|
URL: 'url';
|
|
1222
1272
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1232,8 +1282,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1232
1282
|
private _unregisterActivity;
|
|
1233
1283
|
disconnectedCallback(): void;
|
|
1234
1284
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1235
|
-
get initActivity():
|
|
1236
|
-
get doneActivity():
|
|
1285
|
+
get initActivity(): string | null;
|
|
1286
|
+
get doneActivity(): string | null;
|
|
1237
1287
|
historyBack(): void;
|
|
1238
1288
|
}
|
|
1239
1289
|
|
|
@@ -1295,9 +1345,7 @@ type EventPayload = {
|
|
|
1295
1345
|
declare class EventEmitter extends SharedInstance {
|
|
1296
1346
|
private _timeoutStore;
|
|
1297
1347
|
private _targets;
|
|
1298
|
-
private _listeners;
|
|
1299
1348
|
bindTarget(target: LitBlock): () => void;
|
|
1300
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1301
1349
|
private _dispatch;
|
|
1302
1350
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1303
1351
|
debounce?: TDebounce;
|
|
@@ -1305,121 +1353,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1305
1353
|
destroy(): void;
|
|
1306
1354
|
}
|
|
1307
1355
|
|
|
1308
|
-
type
|
|
1309
|
-
|
|
1310
|
-
fileName?: string;
|
|
1311
|
-
source?: string;
|
|
1356
|
+
type EventMap = {
|
|
1357
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1312
1358
|
};
|
|
1313
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
1314
|
-
private _l10n;
|
|
1315
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1316
|
-
get cfg(): Readonly<ConfigType>;
|
|
1317
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
1318
|
-
/**
|
|
1319
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
1320
|
-
*/
|
|
1321
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1322
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1323
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1324
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
1325
|
-
fullPath?: string;
|
|
1326
|
-
}) => OutputFileEntry<"idle">;
|
|
1327
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
1328
|
-
removeAllFiles(): void;
|
|
1329
|
-
uploadAll: () => void;
|
|
1330
|
-
openSystemDialog: (options?: {
|
|
1331
|
-
captureCamera?: boolean;
|
|
1332
|
-
modeCamera?: ModeCameraType;
|
|
1333
|
-
}) => void;
|
|
1334
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
1335
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
1336
|
-
initFlow: (force?: boolean) => void;
|
|
1337
|
-
doneFlow: () => void;
|
|
1338
|
-
private _pluginsReady;
|
|
1339
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1340
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1341
|
-
getCurrentActivity: () => ActivityType;
|
|
1342
|
-
historyBack: () => void;
|
|
1343
|
-
setModalState: (opened: boolean) => void;
|
|
1344
|
-
private get _sourceList();
|
|
1345
|
-
}
|
|
1346
1359
|
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
readonly HUDDLE: "huddle";
|
|
1358
|
-
}>;
|
|
1359
|
-
declare const UploadSource: Readonly<{
|
|
1360
|
-
readonly FACEBOOK: "facebook";
|
|
1361
|
-
readonly DROPBOX: "dropbox";
|
|
1362
|
-
readonly GDRIVE: "gdrive";
|
|
1363
|
-
readonly GPHOTOS: "gphotos";
|
|
1364
|
-
readonly FLICKR: "flickr";
|
|
1365
|
-
readonly VK: "vk";
|
|
1366
|
-
readonly EVERNOTE: "evernote";
|
|
1367
|
-
readonly BOX: "box";
|
|
1368
|
-
readonly ONEDRIVE: "onedrive";
|
|
1369
|
-
readonly HUDDLE: "huddle";
|
|
1370
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1371
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1372
|
-
readonly LOCAL: "local";
|
|
1373
|
-
readonly DROP_AREA: "drop-area";
|
|
1374
|
-
readonly CAMERA: "camera";
|
|
1375
|
-
readonly EXTERNAL: "external";
|
|
1376
|
-
readonly API: "js-api";
|
|
1377
|
-
readonly URL: "url";
|
|
1378
|
-
}>;
|
|
1379
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1380
|
-
|
|
1381
|
-
declare class LitUploaderBlock extends LitActivityBlock {
|
|
1382
|
-
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
1383
|
-
static sourceTypes: Readonly<typeof UploadSource>;
|
|
1384
|
-
protected couldBeCtxOwner: boolean;
|
|
1385
|
-
private _isCtxOwner;
|
|
1386
|
-
private _unobserveCollection?;
|
|
1387
|
-
private _unobserveCollectionProperties?;
|
|
1388
|
-
init$: {
|
|
1389
|
-
'*commonProgress': number;
|
|
1390
|
-
'*uploadList': never[];
|
|
1391
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1392
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1393
|
-
'*collectionState': OutputCollectionState | null;
|
|
1394
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1395
|
-
'*uploadTrigger': Set<string>;
|
|
1396
|
-
'*currentActivity': null;
|
|
1397
|
-
'*currentActivityParams': {};
|
|
1398
|
-
'*history': never[];
|
|
1399
|
-
'*historyBack': null;
|
|
1400
|
-
'*closeModal': () => void;
|
|
1401
|
-
};
|
|
1402
|
-
private get _hasCtxOwner();
|
|
1403
|
-
initCallback(): void;
|
|
1404
|
-
getAPI(): UploaderPublicApi;
|
|
1405
|
-
get validationManager(): ValidationManager;
|
|
1406
|
-
get api(): UploaderPublicApi;
|
|
1407
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1408
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1409
|
-
disconnectedCallback(): void;
|
|
1410
|
-
connectedCallback(): void;
|
|
1411
|
-
private _initCtxOwner;
|
|
1412
|
-
private _observeUploadCollection;
|
|
1413
|
-
private _unobserveUploadCollection;
|
|
1414
|
-
private _createGroup;
|
|
1415
|
-
private _flushOutputItems;
|
|
1416
|
-
private _handleCollectionUpdate;
|
|
1417
|
-
private _handleCollectionPropertiesUpdate;
|
|
1418
|
-
private _flushCommonUploadProgress;
|
|
1419
|
-
private _setInitialCrop;
|
|
1420
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1421
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1422
|
-
getOutputData(): OutputFileEntry[];
|
|
1360
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1361
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1362
|
+
private scopes;
|
|
1363
|
+
private listener;
|
|
1364
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1365
|
+
private openUploadList;
|
|
1366
|
+
private _listener;
|
|
1367
|
+
private handlePaste;
|
|
1368
|
+
registerBlock(scope: Node): () => void;
|
|
1369
|
+
destroy(): void;
|
|
1423
1370
|
}
|
|
1424
1371
|
|
|
1425
1372
|
type SelectOption = {
|
|
@@ -1442,6 +1389,7 @@ declare global {
|
|
|
1442
1389
|
type CameraMode = 'photo' | 'video';
|
|
1443
1390
|
declare class CameraSource extends LitUploaderBlock {
|
|
1444
1391
|
couldBeCtxOwner: boolean;
|
|
1392
|
+
activityType: "camera";
|
|
1445
1393
|
private _unsubPermissions;
|
|
1446
1394
|
private _capturing;
|
|
1447
1395
|
private _chunks;
|
|
@@ -1561,54 +1509,25 @@ declare global {
|
|
|
1561
1509
|
/**
|
|
1562
1510
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1563
1511
|
*/
|
|
1564
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1512
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
1513
|
+
/** Mapping of attribute names to state */
|
|
1514
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1565
1515
|
declare class Config extends LitBlock {
|
|
1566
1516
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
1567
1517
|
'ctx-name': string;
|
|
1568
1518
|
};
|
|
1569
1519
|
init$: LitBlock["init$"] & ConfigType;
|
|
1570
1520
|
private _computationControllers;
|
|
1571
|
-
private _pluginChangeUnsubscribe?;
|
|
1572
|
-
private _mutationObserver?;
|
|
1573
|
-
/**
|
|
1574
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1575
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1576
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1577
|
-
*/
|
|
1578
|
-
private _customAttrKeyMapping;
|
|
1579
|
-
/** Set of all custom config names registered by plugins */
|
|
1580
|
-
private _customConfigKeys;
|
|
1581
|
-
/**
|
|
1582
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1583
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1584
|
-
*/
|
|
1585
|
-
private _customConfigSubscriptions;
|
|
1586
|
-
/**
|
|
1587
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1588
|
-
*/
|
|
1589
|
-
private _isCustomConfig;
|
|
1590
|
-
/**
|
|
1591
|
-
* Get the custom config definition for a key
|
|
1592
|
-
*/
|
|
1593
|
-
private _getCustomConfigDefinition;
|
|
1594
|
-
/**
|
|
1595
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1596
|
-
*/
|
|
1597
|
-
private _getAttributeNames;
|
|
1598
1521
|
private _flushValueToAttribute;
|
|
1599
1522
|
private _flushValueToState;
|
|
1600
1523
|
private _setValue;
|
|
1601
1524
|
private _getValue;
|
|
1602
1525
|
private _assertSameValueDifferentReference;
|
|
1603
|
-
private _processCustomConfigs;
|
|
1604
|
-
private _setupCustomConfigs;
|
|
1605
|
-
private _setupMutationObserver;
|
|
1606
1526
|
initCallback(): void;
|
|
1607
|
-
attributeChangedCallback(name:
|
|
1608
|
-
disconnectedCallback(): void;
|
|
1527
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1609
1528
|
static get observedAttributes(): string[];
|
|
1610
1529
|
}
|
|
1611
|
-
interface Config extends ConfigType
|
|
1530
|
+
interface Config extends ConfigType {
|
|
1612
1531
|
}
|
|
1613
1532
|
declare global {
|
|
1614
1533
|
interface HTMLElementTagNameMap {
|
|
@@ -1692,12 +1611,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1692
1611
|
private _isFailed;
|
|
1693
1612
|
private _isUploading;
|
|
1694
1613
|
private _isFocused;
|
|
1614
|
+
private _isEditable;
|
|
1695
1615
|
private _showFileNames;
|
|
1696
1616
|
private _ariaLabelStatusFile;
|
|
1697
|
-
private _pluginFileActions;
|
|
1698
1617
|
private _renderedOnce;
|
|
1699
1618
|
private _observer?;
|
|
1700
|
-
private
|
|
1619
|
+
private _handleEdit;
|
|
1701
1620
|
private _handleRemove;
|
|
1702
1621
|
private _handleUploadClick;
|
|
1703
1622
|
private _calculateState;
|
|
@@ -1709,8 +1628,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1709
1628
|
private _handleEntryId;
|
|
1710
1629
|
private _updateShowFileNames;
|
|
1711
1630
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1712
|
-
private _updatePluginFileActions;
|
|
1713
|
-
private _handlePluginFileAction;
|
|
1714
1631
|
initCallback(): void;
|
|
1715
1632
|
connectedCallback(): void;
|
|
1716
1633
|
disconnectedCallback(): void;
|
|
@@ -1743,7 +1660,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1743
1660
|
text?: string;
|
|
1744
1661
|
private _isEnabled;
|
|
1745
1662
|
private _isVisible;
|
|
1746
|
-
private
|
|
1663
|
+
private _dropTextKey;
|
|
1664
|
+
private _isMultiple;
|
|
1665
|
+
private _updateDropText;
|
|
1747
1666
|
private _destroyDropzone;
|
|
1748
1667
|
private _destroyContentWrapperDropzone;
|
|
1749
1668
|
private _contentWrapperRef;
|
|
@@ -1752,7 +1671,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1752
1671
|
private _clickableListenersAttached;
|
|
1753
1672
|
isActive(): boolean;
|
|
1754
1673
|
initCallback(): void;
|
|
1755
|
-
protected willUpdate(changedProperties: PropertyValues<this
|
|
1674
|
+
protected willUpdate(changedProperties: PropertyValues<this & {
|
|
1675
|
+
localeId: string;
|
|
1676
|
+
}>): void;
|
|
1756
1677
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1757
1678
|
/** Ignore drop events if there are other visible drop areas on the page. */
|
|
1758
1679
|
private _shouldIgnore;
|
|
@@ -2015,10 +1936,6 @@ type ConfigType = {
|
|
|
2015
1936
|
* Expiry threshold for secure uploads.
|
|
2016
1937
|
*/
|
|
2017
1938
|
secureUploadsExpireThreshold: number;
|
|
2018
|
-
/**
|
|
2019
|
-
* Array of plugins to register with the uploader instance.
|
|
2020
|
-
*/
|
|
2021
|
-
plugins: UploaderPlugin[];
|
|
2022
1939
|
/**
|
|
2023
1940
|
* Metadata for the file.
|
|
2024
1941
|
*/
|
|
@@ -2279,225 +2196,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2279
2196
|
allEntries: OutputFileEntry[];
|
|
2280
2197
|
});
|
|
2281
2198
|
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
};
|
|
2286
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2287
|
-
type PluginSourceRegistration = {
|
|
2288
|
-
id: string;
|
|
2289
|
-
label: string;
|
|
2290
|
-
icon?: string;
|
|
2291
|
-
/**
|
|
2292
|
-
* @internal
|
|
2293
|
-
*
|
|
2294
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2295
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2296
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2297
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2298
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2299
|
-
*/
|
|
2300
|
-
expand?: () => string[];
|
|
2301
|
-
onSelect: () => Promise<void> | void;
|
|
2302
|
-
};
|
|
2303
|
-
type PluginRenderDispose = () => void;
|
|
2304
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2305
|
-
type PluginActivityRegistration = {
|
|
2306
|
-
id: string;
|
|
2307
|
-
render: PluginRender;
|
|
2308
|
-
};
|
|
2309
|
-
type PluginFileActionRegistration = {
|
|
2310
|
-
/** Unique action identifier. */
|
|
2311
|
-
id: string;
|
|
2312
|
-
/** Icon name to display in the action button. */
|
|
2313
|
-
icon: string;
|
|
2314
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2315
|
-
label: string;
|
|
2316
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2317
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2318
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2319
|
-
};
|
|
2320
|
-
type PluginFileHookContext = {
|
|
2321
|
-
/** The file to transform */
|
|
2322
|
-
file: File | Blob;
|
|
2323
|
-
};
|
|
2324
|
-
type PluginFileHookRegistration = {
|
|
2325
|
-
/**
|
|
2326
|
-
* When the hook is called:
|
|
2327
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2328
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2329
|
-
*
|
|
2330
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2331
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2332
|
-
*/
|
|
2333
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2334
|
-
handler: (context: PluginFileHookContext) => PluginFileHookContext | Promise<PluginFileHookContext>;
|
|
2335
|
-
};
|
|
2336
|
-
type PluginRegistryApi = {
|
|
2337
|
-
registerSource: (source: PluginSourceRegistration) => PluginSourceRegistration;
|
|
2338
|
-
registerActivity: (activity: PluginActivityRegistration) => PluginActivityRegistration;
|
|
2339
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => PluginFileActionRegistration;
|
|
2340
|
-
registerFileHook: (hook: PluginFileHookRegistration) => PluginFileHookRegistration;
|
|
2341
|
-
registerIcon: (icon: PluginIconRegistration) => PluginIconRegistration;
|
|
2342
|
-
registerI18n: (i18n: PluginI18nRegistration) => PluginI18nRegistration;
|
|
2343
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2344
|
-
};
|
|
2345
|
-
/**
|
|
2346
|
-
* API for managing plugin config subscriptions
|
|
2347
|
-
*/
|
|
2348
|
-
type PluginConfigApi = {
|
|
2349
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2350
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2351
|
-
};
|
|
2352
|
-
/**
|
|
2353
|
-
* API for managing plugin activity interactions
|
|
2354
|
-
*/
|
|
2355
|
-
type PluginActivityApi = {
|
|
2356
|
-
/**
|
|
2357
|
-
* Get the current activity parameters.
|
|
2358
|
-
*
|
|
2359
|
-
* @returns The current activity parameters object
|
|
2360
|
-
*
|
|
2361
|
-
* @example
|
|
2362
|
-
* ```typescript
|
|
2363
|
-
* const params = pluginApi.activity.getParams();
|
|
2364
|
-
* console.log('Current params:', params);
|
|
2365
|
-
* ```
|
|
2366
|
-
*/
|
|
2367
|
-
getParams: () => Record<string, unknown>;
|
|
2368
|
-
/**
|
|
2369
|
-
* Subscribe to changes in activity parameters.
|
|
2370
|
-
* The callback will be called immediately with the current params,
|
|
2371
|
-
* and then whenever the params change.
|
|
2372
|
-
*
|
|
2373
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2374
|
-
*
|
|
2375
|
-
* @param callback - Function to call with the new params
|
|
2376
|
-
* @returns Unsubscribe function
|
|
2377
|
-
*
|
|
2378
|
-
* @example
|
|
2379
|
-
* ```typescript
|
|
2380
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2381
|
-
* console.log('Activity params changed:', params);
|
|
2382
|
-
* });
|
|
2383
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2384
|
-
* ```
|
|
2385
|
-
*/
|
|
2386
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2387
|
-
};
|
|
2388
|
-
type PluginFileEntryUpdate = {
|
|
2389
|
-
file?: File | Blob;
|
|
2390
|
-
cdnUrl?: string | null;
|
|
2391
|
-
cdnUrlModifiers?: string | null;
|
|
2392
|
-
mimeType?: string | null;
|
|
2393
|
-
};
|
|
2394
|
-
type PluginFilesApi = {
|
|
2395
|
-
/**
|
|
2396
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2397
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2398
|
-
*/
|
|
2399
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2400
|
-
};
|
|
2401
|
-
type PluginApi = {
|
|
2402
|
-
registry: PluginRegistryApi;
|
|
2403
|
-
config: PluginConfigApi;
|
|
2404
|
-
activity: PluginActivityApi;
|
|
2405
|
-
files: PluginFilesApi;
|
|
2406
|
-
};
|
|
2407
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2408
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2409
|
-
type PluginSetupParams = {
|
|
2410
|
-
pluginApi: PluginApi;
|
|
2411
|
-
uploaderApi: PluginUploaderApi;
|
|
2412
|
-
};
|
|
2413
|
-
type UploaderPlugin = {
|
|
2414
|
-
id: string;
|
|
2415
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2416
|
-
};
|
|
2417
|
-
type Owned<T> = T & {
|
|
2418
|
-
pluginId: string;
|
|
2419
|
-
};
|
|
2420
|
-
type PluginRegistrySnapshot = {
|
|
2421
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2422
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2423
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2424
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2425
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2426
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2427
|
-
};
|
|
2428
|
-
|
|
2429
|
-
type EventMap = {
|
|
2430
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2431
|
-
};
|
|
2432
|
-
|
|
2433
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2434
|
-
file: File | null;
|
|
2435
|
-
externalUrl: string | null;
|
|
2436
|
-
fileName: string | null;
|
|
2437
|
-
fileSize: number | null;
|
|
2438
|
-
lastModified: number;
|
|
2439
|
-
uploadProgress: number;
|
|
2440
|
-
uuid: string | null;
|
|
2441
|
-
isImage: boolean;
|
|
2442
|
-
mimeType: string | null;
|
|
2443
|
-
ctxName: string | null;
|
|
2444
|
-
cdnUrl: string | null;
|
|
2445
|
-
cdnUrlModifiers: string | null;
|
|
2446
|
-
fileInfo: UploadcareFile | null;
|
|
2447
|
-
isUploading: boolean;
|
|
2448
|
-
abortController: AbortController | null;
|
|
2449
|
-
thumbUrl: string | null;
|
|
2450
|
-
silent: boolean;
|
|
2451
|
-
source: string | null;
|
|
2452
|
-
fullPath: string | null;
|
|
2453
|
-
metadata: Metadata | null;
|
|
2454
|
-
errors: OutputErrorFile[];
|
|
2455
|
-
uploadError: Error | null;
|
|
2456
|
-
isRemoved: boolean;
|
|
2457
|
-
isQueuedForUploading: boolean;
|
|
2458
|
-
isValidationPending: boolean;
|
|
2459
|
-
isQueuedForValidation: boolean;
|
|
2460
|
-
}
|
|
2461
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2462
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2463
|
-
|
|
2464
|
-
declare class PluginRegistry {
|
|
2465
|
-
private _sources;
|
|
2466
|
-
private _activities;
|
|
2467
|
-
private _fileActions;
|
|
2468
|
-
private _fileHooks;
|
|
2469
|
-
private _icons;
|
|
2470
|
-
private _i18n;
|
|
2471
|
-
readonly config: CustomConfigRegistry;
|
|
2472
|
-
private _own;
|
|
2473
|
-
addSource(pluginId: string, item: PluginSourceRegistration): PluginSourceRegistration;
|
|
2474
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): PluginActivityRegistration;
|
|
2475
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): PluginFileActionRegistration;
|
|
2476
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): PluginFileHookRegistration;
|
|
2477
|
-
addIcon(pluginId: string, item: PluginIconRegistration): PluginIconRegistration;
|
|
2478
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): PluginI18nRegistration;
|
|
2479
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2480
|
-
purge(pluginId: string): void;
|
|
2481
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
|
-
declare class PluginManager extends SharedInstance {
|
|
2485
|
-
private _plugins;
|
|
2486
|
-
private _subscribers;
|
|
2487
|
-
private _pluginsUpdate;
|
|
2488
|
-
private _lazyPluginLoader;
|
|
2489
|
-
readonly registry: PluginRegistry;
|
|
2490
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2491
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2492
|
-
pluginsReady(): Promise<void>;
|
|
2493
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2494
|
-
private _syncPlugins;
|
|
2495
|
-
private _registerPlugin;
|
|
2496
|
-
private _unregisterPlugin;
|
|
2497
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2498
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2199
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2200
|
+
private _secureToken;
|
|
2201
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2499
2202
|
destroy(): void;
|
|
2500
|
-
private _notifySubscribers;
|
|
2501
2203
|
}
|
|
2502
2204
|
|
|
2503
2205
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2538,87 +2240,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2538
2240
|
private get _location();
|
|
2539
2241
|
}
|
|
2540
2242
|
|
|
2541
|
-
interface ISharedInstance {
|
|
2542
|
-
destroy?(): void;
|
|
2543
|
-
}
|
|
2544
|
-
declare class SharedInstance {
|
|
2545
|
-
protected _ctx: PubSub<SharedState>;
|
|
2546
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2547
|
-
private _subscriptions;
|
|
2548
|
-
private _cfgProxy;
|
|
2549
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2550
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2551
|
-
protected addSub(unsub: () => void): void;
|
|
2552
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2553
|
-
destroy(): void;
|
|
2554
|
-
}
|
|
2555
|
-
declare const instanceKeyMap: {
|
|
2556
|
-
modalManager: "*modalManager";
|
|
2557
|
-
pluginManager: "*pluginManager";
|
|
2558
|
-
telemetryManager: "*telemetryManager";
|
|
2559
|
-
localeManager: "*localeManager";
|
|
2560
|
-
a11y: "*a11y";
|
|
2561
|
-
clipboard: "*clipboard";
|
|
2562
|
-
blocksRegistry: "*blocksRegistry";
|
|
2563
|
-
eventEmitter: "*eventEmitter";
|
|
2564
|
-
uploadCollection: "*uploadCollection";
|
|
2565
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2566
|
-
api: "*publicApi";
|
|
2567
|
-
validationManager: "*validationManager";
|
|
2568
|
-
};
|
|
2569
|
-
type InstanceTypeMap = {
|
|
2570
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2571
|
-
};
|
|
2572
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2573
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2574
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2575
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2576
|
-
readonly ctx: PubSub<SharedState>;
|
|
2577
|
-
readonly modalManager: ModalManager | null;
|
|
2578
|
-
readonly pluginManager: PluginManager;
|
|
2579
|
-
readonly telemetryManager: TelemetryManager;
|
|
2580
|
-
readonly localeManager: LocaleManager;
|
|
2581
|
-
readonly a11y: A11y;
|
|
2582
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2583
|
-
readonly eventEmitter: EventEmitter;
|
|
2584
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2585
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2586
|
-
readonly api: UploaderPublicApi;
|
|
2587
|
-
readonly validationManager: ValidationManager;
|
|
2588
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2589
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2590
|
-
};
|
|
2591
|
-
|
|
2592
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2593
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2594
|
-
private scopes;
|
|
2595
|
-
private listener;
|
|
2596
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2597
|
-
private openUploadList;
|
|
2598
|
-
private _listener;
|
|
2599
|
-
private handlePaste;
|
|
2600
|
-
registerBlock(scope: Node): () => void;
|
|
2601
|
-
destroy(): void;
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2605
|
-
type LazyPluginEntry = {
|
|
2606
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2607
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2608
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2609
|
-
};
|
|
2610
|
-
|
|
2611
2243
|
type SharedConfigState = {
|
|
2612
2244
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2613
2245
|
};
|
|
2614
|
-
type SharedCustomConfigState = {
|
|
2615
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2616
|
-
};
|
|
2617
2246
|
type BlocksRegistry = Set<LitBlock>;
|
|
2618
2247
|
type ActivityBlockCtxState = {
|
|
2619
|
-
'*currentActivity':
|
|
2248
|
+
'*currentActivity': string | null;
|
|
2620
2249
|
'*currentActivityParams': Record<string, unknown>;
|
|
2621
|
-
'*history': (
|
|
2250
|
+
'*history': (string | null)[];
|
|
2622
2251
|
'*historyBack': (() => void) | null;
|
|
2623
2252
|
'*closeModal': () => void;
|
|
2624
2253
|
};
|
|
@@ -2635,7 +2264,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2635
2264
|
};
|
|
2636
2265
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2637
2266
|
'*solution': string | null;
|
|
2638
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2639
2267
|
};
|
|
2640
2268
|
type CloudImageEditorState = {
|
|
2641
2269
|
'*originalUrl': string | null;
|
|
@@ -2686,9 +2314,7 @@ type EditorToolbarState = {
|
|
|
2686
2314
|
'*currentOperation': string | null;
|
|
2687
2315
|
'*operationTooltip': string | null;
|
|
2688
2316
|
};
|
|
2689
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2690
2317
|
type DynamicBlockState = {
|
|
2691
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2692
2318
|
'*blocksRegistry': BlocksRegistry;
|
|
2693
2319
|
'*eventEmitter': EventEmitter;
|
|
2694
2320
|
'*localeManager': LocaleManager;
|
|
@@ -2696,7 +2322,6 @@ type DynamicBlockState = {
|
|
|
2696
2322
|
'*a11y': A11y;
|
|
2697
2323
|
'*modalManager': ModalManager | null;
|
|
2698
2324
|
'*clipboard': ClipboardLayer;
|
|
2699
|
-
'*pluginManager': PluginManager;
|
|
2700
2325
|
};
|
|
2701
2326
|
type DynamicUploaderBlockState = {
|
|
2702
2327
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2707,7 +2332,66 @@ type DynamicUploaderBlockState = {
|
|
|
2707
2332
|
type LocaleState = {
|
|
2708
2333
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2709
2334
|
};
|
|
2710
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2335
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2336
|
+
|
|
2337
|
+
interface ISharedInstance {
|
|
2338
|
+
destroy?(): void;
|
|
2339
|
+
}
|
|
2340
|
+
declare class SharedInstance {
|
|
2341
|
+
protected _ctx: PubSub<SharedState>;
|
|
2342
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2343
|
+
private _subscriptions;
|
|
2344
|
+
private _cfgProxy;
|
|
2345
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2346
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2347
|
+
protected addSub(unsub: () => void): void;
|
|
2348
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2349
|
+
destroy(): void;
|
|
2350
|
+
}
|
|
2351
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2352
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2353
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2354
|
+
readonly ctx: PubSub<SharedState>;
|
|
2355
|
+
readonly modalManager: ModalManager | null;
|
|
2356
|
+
readonly telemetryManager: TelemetryManager;
|
|
2357
|
+
readonly localeManager: LocaleManager;
|
|
2358
|
+
readonly a11y: A11y;
|
|
2359
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2360
|
+
readonly eventEmitter: EventEmitter;
|
|
2361
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2362
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2363
|
+
readonly api: UploaderPublicApi;
|
|
2364
|
+
readonly validationManager: ValidationManager;
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2368
|
+
signal?: AbortSignal;
|
|
2369
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2370
|
+
type FileValidatorDescriptor = {
|
|
2371
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2372
|
+
validator: FuncFileValidator;
|
|
2373
|
+
};
|
|
2374
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2375
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2376
|
+
declare class ValidationManager extends SharedInstance {
|
|
2377
|
+
private get _uploadCollection();
|
|
2378
|
+
private _commonFileValidators;
|
|
2379
|
+
private _commonCollectionValidators;
|
|
2380
|
+
private _queue;
|
|
2381
|
+
private _runQueueDebounced;
|
|
2382
|
+
private _isDestroyed;
|
|
2383
|
+
private _entryValidationState;
|
|
2384
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2385
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2386
|
+
runCollectionValidators(): void;
|
|
2387
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2388
|
+
private _runFileValidatorsForEntry;
|
|
2389
|
+
private _addCustomTypeToValidationError;
|
|
2390
|
+
private _getEntryValidationState;
|
|
2391
|
+
private _getValidatorDescriptors;
|
|
2392
|
+
private _getValidatorDescriptorsForEntry;
|
|
2393
|
+
destroy(): void;
|
|
2394
|
+
}
|
|
2711
2395
|
|
|
2712
2396
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2713
2397
|
willYield: boolean;
|
|
@@ -2719,7 +2403,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2719
2403
|
};
|
|
2720
2404
|
declare class LitBlock extends LitBlockBase {
|
|
2721
2405
|
private _cfgProxy;
|
|
2406
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2722
2407
|
static styleAttrs: string[];
|
|
2408
|
+
activityType: ActivityType;
|
|
2723
2409
|
init$: {};
|
|
2724
2410
|
constructor();
|
|
2725
2411
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2727,7 +2413,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2727
2413
|
protected _sharedInstancesBag: {
|
|
2728
2414
|
readonly ctx: PubSub<SharedState>;
|
|
2729
2415
|
readonly modalManager: ModalManager | null;
|
|
2730
|
-
readonly pluginManager: PluginManager;
|
|
2731
2416
|
readonly telemetryManager: TelemetryManager;
|
|
2732
2417
|
readonly localeManager: LocaleManager;
|
|
2733
2418
|
readonly a11y: A11y;
|
|
@@ -2737,34 +2422,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2737
2422
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2738
2423
|
readonly api: UploaderPublicApi;
|
|
2739
2424
|
readonly validationManager: ValidationManager;
|
|
2740
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2741
|
-
modalManager: ModalManager | null;
|
|
2742
|
-
pluginManager: PluginManager;
|
|
2743
|
-
telemetryManager: TelemetryManager;
|
|
2744
|
-
localeManager: LocaleManager;
|
|
2745
|
-
a11y: A11y;
|
|
2746
|
-
clipboard: ClipboardLayer;
|
|
2747
|
-
blocksRegistry: BlocksRegistry;
|
|
2748
|
-
eventEmitter: EventEmitter;
|
|
2749
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2750
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2751
|
-
api: UploaderPublicApi;
|
|
2752
|
-
validationManager: ValidationManager;
|
|
2753
|
-
}[TName]>) => void): () => void;
|
|
2754
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2755
|
-
modalManager: ModalManager | null;
|
|
2756
|
-
pluginManager: PluginManager;
|
|
2757
|
-
telemetryManager: TelemetryManager;
|
|
2758
|
-
localeManager: LocaleManager;
|
|
2759
|
-
a11y: A11y;
|
|
2760
|
-
clipboard: ClipboardLayer;
|
|
2761
|
-
blocksRegistry: BlocksRegistry;
|
|
2762
|
-
eventEmitter: EventEmitter;
|
|
2763
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2764
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2765
|
-
api: UploaderPublicApi;
|
|
2766
|
-
validationManager: ValidationManager;
|
|
2767
|
-
}[TName]>>;
|
|
2768
2425
|
};
|
|
2769
2426
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2770
2427
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2783,7 +2440,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2783
2440
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2784
2441
|
*/
|
|
2785
2442
|
private destroyCtxCallback;
|
|
2786
|
-
|
|
2443
|
+
/**
|
|
2444
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2445
|
+
* @param key The shared state key.
|
|
2446
|
+
* @param resolver The resolver function that creates the instance.
|
|
2447
|
+
*/
|
|
2787
2448
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2788
2449
|
private _destroySharedContextInstances;
|
|
2789
2450
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2810,7 +2471,7 @@ declare class Modal extends LitBlock {
|
|
|
2810
2471
|
private _handleDialogClose;
|
|
2811
2472
|
private _handleDialogMouseDown;
|
|
2812
2473
|
private _handleDialogMouseUp;
|
|
2813
|
-
show():
|
|
2474
|
+
show(): void;
|
|
2814
2475
|
hide(): void;
|
|
2815
2476
|
private _handleModalOpen;
|
|
2816
2477
|
private _handleModalClose;
|
|
@@ -2882,10 +2543,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2882
2543
|
|
|
2883
2544
|
declare class LitSolutionBlock extends LitBlock {
|
|
2884
2545
|
static styleAttrs: string[];
|
|
2885
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2886
2546
|
init$: {
|
|
2887
2547
|
'*solution': string | null;
|
|
2888
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2889
2548
|
'*commonProgress': number;
|
|
2890
2549
|
'*uploadList': never[];
|
|
2891
2550
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -3017,20 +2676,18 @@ declare global {
|
|
|
3017
2676
|
}
|
|
3018
2677
|
}
|
|
3019
2678
|
|
|
3020
|
-
type SourceButtonConfig = {
|
|
3021
|
-
id: string;
|
|
3022
|
-
label: string;
|
|
3023
|
-
icon?: string;
|
|
3024
|
-
onClick: () => void | Promise<void>;
|
|
3025
|
-
};
|
|
3026
2679
|
declare class SourceBtn extends LitUploaderBlock {
|
|
3027
2680
|
couldBeCtxOwner: boolean;
|
|
3028
|
-
|
|
2681
|
+
private _registeredTypes;
|
|
2682
|
+
type?: string;
|
|
3029
2683
|
private _iconName;
|
|
3030
2684
|
private _srcTypeKey;
|
|
3031
|
-
|
|
3032
|
-
|
|
2685
|
+
private _initTypes;
|
|
2686
|
+
initCallback(): void;
|
|
2687
|
+
private _registerType;
|
|
3033
2688
|
activate(): void;
|
|
2689
|
+
private _applyType;
|
|
2690
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
3034
2691
|
render(): lit_html.TemplateResult<1>;
|
|
3035
2692
|
}
|
|
3036
2693
|
declare global {
|
|
@@ -3039,10 +2696,9 @@ declare global {
|
|
|
3039
2696
|
}
|
|
3040
2697
|
}
|
|
3041
2698
|
|
|
3042
|
-
declare class SourceList extends
|
|
2699
|
+
declare class SourceList extends LitBlock {
|
|
3043
2700
|
private _rawSourceList;
|
|
3044
|
-
private
|
|
3045
|
-
private _sources;
|
|
2701
|
+
private _cameraModes;
|
|
3046
2702
|
/**
|
|
3047
2703
|
* CSS-only attribute
|
|
3048
2704
|
*/
|
|
@@ -3050,10 +2706,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
3050
2706
|
initCallback(): void;
|
|
3051
2707
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
3052
2708
|
private _updateSources;
|
|
3053
|
-
private
|
|
3054
|
-
private _makePluginSourceConfig;
|
|
2709
|
+
private _sources;
|
|
3055
2710
|
render(): lit_html.TemplateResult<1>;
|
|
3056
|
-
disconnectedCallback(): void;
|
|
3057
2711
|
}
|
|
3058
2712
|
declare global {
|
|
3059
2713
|
interface HTMLElementTagNameMap {
|
|
@@ -3108,6 +2762,8 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
3108
2762
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
3109
2763
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
3110
2764
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2765
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2766
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
3111
2767
|
}
|
|
3112
2768
|
declare global {
|
|
3113
2769
|
interface HTMLElementTagNameMap {
|
|
@@ -3115,65 +2771,38 @@ declare global {
|
|
|
3115
2771
|
}
|
|
3116
2772
|
}
|
|
3117
2773
|
|
|
3118
|
-
declare class
|
|
3119
|
-
static styleAttrs: string[];
|
|
2774
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
3120
2775
|
couldBeCtxOwner: boolean;
|
|
3121
|
-
|
|
3122
|
-
private
|
|
3123
|
-
private readonly _handleClick;
|
|
2776
|
+
activityType: ActivityType;
|
|
2777
|
+
private _formState;
|
|
3124
2778
|
initCallback(): void;
|
|
2779
|
+
private _inputRef;
|
|
2780
|
+
private _handleInput;
|
|
2781
|
+
private _handleUpload;
|
|
3125
2782
|
render(): lit_html.TemplateResult<1>;
|
|
3126
2783
|
}
|
|
3127
2784
|
declare global {
|
|
3128
2785
|
interface HTMLElementTagNameMap {
|
|
3129
|
-
'uc-
|
|
2786
|
+
'uc-url-source': UrlSource;
|
|
3130
2787
|
}
|
|
3131
2788
|
}
|
|
3132
2789
|
|
|
3133
|
-
declare class
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
private _ensureRegistered;
|
|
3140
|
-
private _renderActivity;
|
|
3141
|
-
private _disposeActivity;
|
|
3142
|
-
disconnectedCallback(): void;
|
|
3143
|
-
render(): lit_html.TemplateResult<1>;
|
|
3144
|
-
}
|
|
3145
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3146
|
-
mode: 'modal' | 'inline';
|
|
3147
|
-
private _activities;
|
|
3148
|
-
private _unsubscribePlugins?;
|
|
2790
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2791
|
+
static styleAttrs: string[];
|
|
2792
|
+
couldBeCtxOwner: boolean;
|
|
2793
|
+
dropzone: boolean;
|
|
2794
|
+
private _buttonTextKey;
|
|
2795
|
+
private readonly _handleClick;
|
|
3149
2796
|
initCallback(): void;
|
|
3150
|
-
private _syncActivities;
|
|
3151
|
-
disconnectedCallback(): void;
|
|
3152
|
-
render(): lit_html.TemplateResult<1>;
|
|
3153
|
-
}
|
|
3154
|
-
declare global {
|
|
3155
|
-
interface HTMLElementTagNameMap {
|
|
3156
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3157
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3158
|
-
}
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3162
|
-
private _formState;
|
|
3163
|
-
private _inputRef;
|
|
3164
|
-
private _handleInput;
|
|
3165
|
-
private _handleUpload;
|
|
3166
|
-
firstUpdated(): void;
|
|
3167
2797
|
render(): lit_html.TemplateResult<1>;
|
|
3168
2798
|
}
|
|
3169
2799
|
declare global {
|
|
3170
2800
|
interface HTMLElementTagNameMap {
|
|
3171
|
-
'uc-
|
|
2801
|
+
'uc-simple-btn': SimpleBtn;
|
|
3172
2802
|
}
|
|
3173
2803
|
}
|
|
3174
2804
|
|
|
3175
2805
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3176
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3177
2806
|
attributesMeta: {
|
|
3178
2807
|
headless?: boolean;
|
|
3179
2808
|
'ctx-name': string;
|
|
@@ -3191,7 +2820,6 @@ declare global {
|
|
|
3191
2820
|
}
|
|
3192
2821
|
|
|
3193
2822
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3194
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3195
2823
|
attributesMeta: {
|
|
3196
2824
|
'ctx-name': string;
|
|
3197
2825
|
};
|
|
@@ -3212,7 +2840,6 @@ declare global {
|
|
|
3212
2840
|
}
|
|
3213
2841
|
|
|
3214
2842
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3215
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3216
2843
|
attributesMeta: {
|
|
3217
2844
|
'ctx-name': string;
|
|
3218
2845
|
};
|
|
@@ -3221,6 +2848,7 @@ declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
|
3221
2848
|
private _isHiddenStartFrom;
|
|
3222
2849
|
private _classUploadList;
|
|
3223
2850
|
private _classStartFrom;
|
|
2851
|
+
private _buttonTextKey;
|
|
3224
2852
|
private _getInitActivity;
|
|
3225
2853
|
constructor();
|
|
3226
2854
|
private _handleModalOpen;
|
|
@@ -3238,4 +2866,4 @@ declare global {
|
|
|
3238
2866
|
declare const PACKAGE_NAME = "blocks";
|
|
3239
2867
|
declare const PACKAGE_VERSION: string;
|
|
3240
2868
|
|
|
3241
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2869
|
+
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, 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, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, loadFileUploaderFrom, toKebabCase };
|