@uploadcare/file-uploader 1.28.0 → 1.29.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/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +676 -280
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +111 -38
- package/dist/locales/file-uploader/ar.d.ts +0 -2
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +0 -2
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +0 -2
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +0 -2
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +0 -2
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +0 -2
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +0 -2
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +0 -2
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +0 -2
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +0 -2
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +0 -2
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +0 -2
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +0 -2
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +0 -2
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +0 -2
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +0 -2
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +0 -2
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +0 -2
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +0 -2
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +0 -2
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +0 -2
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +0 -2
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +0 -2
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +0 -2
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +0 -2
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +0 -2
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +0 -2
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +0 -2
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +0 -2
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +0 -2
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +0 -2
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +0 -2
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +0 -2
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +0 -2
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +0 -2
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +676 -282
- 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 +676 -282
- 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 +626 -232
- 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 +676 -282
- 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 +676 -282
- 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 +676 -282
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import { PropertyValues, nothing, LitElement, TemplateResult } from 'lit';
|
|
3
|
-
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
4
3
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
5
4
|
import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions, Queue } from '@uploadcare/upload-client';
|
|
5
|
+
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
6
6
|
import { Ref } from 'lit/directives/ref.js';
|
|
7
7
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
8
8
|
|
|
@@ -113,7 +113,6 @@ declare const _default: {
|
|
|
113
113
|
'src-type-camera': string;
|
|
114
114
|
'src-type-mobile-video-camera': string;
|
|
115
115
|
'src-type-mobile-photo-camera': string;
|
|
116
|
-
'src-type-draw': string;
|
|
117
116
|
'src-type-facebook': string;
|
|
118
117
|
'src-type-dropbox': string;
|
|
119
118
|
'src-type-gdrive': string;
|
|
@@ -128,7 +127,6 @@ declare const _default: {
|
|
|
128
127
|
'src-type-other': string;
|
|
129
128
|
'caption-from-url': string;
|
|
130
129
|
'caption-camera': string;
|
|
131
|
-
'caption-draw': string;
|
|
132
130
|
'caption-edit-file': string;
|
|
133
131
|
'file-no-name': string;
|
|
134
132
|
'toggle-fullscreen': string;
|
|
@@ -215,7 +213,7 @@ declare class Modal extends LitBlock {
|
|
|
215
213
|
private _handleDialogClose;
|
|
216
214
|
private _handleDialogMouseDown;
|
|
217
215
|
private _handleDialogMouseUp;
|
|
218
|
-
show(): void
|
|
216
|
+
show(): Promise<void>;
|
|
219
217
|
hide(): void;
|
|
220
218
|
private _handleModalOpen;
|
|
221
219
|
private _handleModalClose;
|
|
@@ -231,81 +229,176 @@ declare global {
|
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
231
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
|
|
266
|
-
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
|
|
267
|
-
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
|
|
268
|
-
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
|
|
269
|
-
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
|
|
270
|
-
[EventType.MODAL_OPEN]: {
|
|
271
|
-
modalId: ModalId;
|
|
272
|
-
};
|
|
273
|
-
[EventType.MODAL_CLOSE]: {
|
|
274
|
-
modalId: ModalId;
|
|
275
|
-
hasActiveModals: boolean;
|
|
276
|
-
};
|
|
277
|
-
[EventType.ACTIVITY_CHANGE]: {
|
|
278
|
-
activity: ActivityType;
|
|
279
|
-
};
|
|
280
|
-
[EventType.UPLOAD_CLICK]: undefined;
|
|
281
|
-
[EventType.DONE_CLICK]: OutputCollectionState;
|
|
282
|
-
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
|
|
283
|
-
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
|
|
284
|
-
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
|
|
285
|
-
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
|
|
286
|
-
[EventType.CHANGE]: OutputCollectionState;
|
|
287
|
-
[EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
|
|
232
|
+
/**
|
|
233
|
+
* Custom configuration options registration system for plugins
|
|
234
|
+
*/
|
|
235
|
+
type CustomConfigDefinition<T = unknown> = {
|
|
236
|
+
/**
|
|
237
|
+
* Config option name (will be used as property and optionally as attribute)
|
|
238
|
+
*/
|
|
239
|
+
name: string;
|
|
240
|
+
/**
|
|
241
|
+
* Default value for the config option
|
|
242
|
+
*/
|
|
243
|
+
defaultValue: T;
|
|
244
|
+
/**
|
|
245
|
+
* Whether this config can be set via HTML attribute
|
|
246
|
+
* @default true
|
|
247
|
+
*/
|
|
248
|
+
attribute?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Convert attribute string to config value
|
|
251
|
+
* Only used if attribute is true
|
|
252
|
+
*/
|
|
253
|
+
fromAttribute?: (value: string | null) => T;
|
|
254
|
+
/**
|
|
255
|
+
* Convert config value to attribute string
|
|
256
|
+
* Only used if attribute is true
|
|
257
|
+
*/
|
|
258
|
+
toAttribute?: (value: T) => string | null;
|
|
259
|
+
/**
|
|
260
|
+
* Normalize/validate the config value
|
|
261
|
+
*/
|
|
262
|
+
normalize?: (value: unknown) => T;
|
|
288
263
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Registry for custom config options defined by plugins
|
|
266
|
+
* This is managed by the PluginManager as a shared instance property
|
|
267
|
+
*/
|
|
268
|
+
declare class CustomConfigRegistry {
|
|
269
|
+
private _definitions;
|
|
270
|
+
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
271
|
+
unregister(name: string): void;
|
|
272
|
+
unregisterByPlugin(pluginId: string): void;
|
|
273
|
+
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
274
|
+
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Interface for TypeScript module augmentation
|
|
278
|
+
* Plugins should extend this interface to add their custom config types
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* declare module '@uploadcare/file-uploader' {
|
|
283
|
+
* interface CustomConfig {
|
|
284
|
+
* 'my-custom-option': string;
|
|
285
|
+
* }
|
|
286
|
+
* }
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
interface CustomConfig {
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare class TypedData<T extends Record<string, unknown>> {
|
|
293
|
+
private _ctxId;
|
|
294
|
+
private _data;
|
|
295
|
+
constructor(initialValue: T);
|
|
296
|
+
get uid(): Uid;
|
|
297
|
+
setValue<K extends keyof T>(prop: K, value: T[K]): void;
|
|
298
|
+
setMultipleValues(updObj: Partial<T>): void;
|
|
299
|
+
getValue<K extends keyof T>(prop: K): T[K];
|
|
300
|
+
subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
|
|
297
301
|
destroy(): void;
|
|
298
302
|
}
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
+
interface UploadEntryData extends Record<string, unknown> {
|
|
305
|
+
file: File | null;
|
|
306
|
+
externalUrl: string | null;
|
|
307
|
+
fileName: string | null;
|
|
308
|
+
fileSize: number | null;
|
|
309
|
+
lastModified: number;
|
|
310
|
+
uploadProgress: number;
|
|
311
|
+
uuid: string | null;
|
|
312
|
+
isImage: boolean;
|
|
313
|
+
mimeType: string | null;
|
|
314
|
+
ctxName: string | null;
|
|
315
|
+
cdnUrl: string | null;
|
|
316
|
+
cdnUrlModifiers: string | null;
|
|
317
|
+
fileInfo: UploadcareFile | null;
|
|
318
|
+
isUploading: boolean;
|
|
319
|
+
abortController: AbortController | null;
|
|
320
|
+
thumbUrl: string | null;
|
|
321
|
+
silent: boolean;
|
|
322
|
+
source: string | null;
|
|
323
|
+
fullPath: string | null;
|
|
324
|
+
metadata: Metadata | null;
|
|
325
|
+
errors: OutputErrorFile[];
|
|
326
|
+
uploadError: Error | null;
|
|
327
|
+
isRemoved: boolean;
|
|
328
|
+
isQueuedForUploading: boolean;
|
|
329
|
+
isValidationPending: boolean;
|
|
330
|
+
isQueuedForValidation: boolean;
|
|
331
|
+
}
|
|
332
|
+
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
333
|
+
type UploadEntryKeys = keyof UploadEntryData;
|
|
334
|
+
|
|
335
|
+
declare class PluginRegistry {
|
|
336
|
+
private _sources;
|
|
337
|
+
private _activities;
|
|
338
|
+
private _fileActions;
|
|
339
|
+
private _fileHooks;
|
|
340
|
+
private _icons;
|
|
341
|
+
private _i18n;
|
|
342
|
+
readonly config: CustomConfigRegistry;
|
|
343
|
+
private _own;
|
|
344
|
+
addSource(pluginId: string, item: PluginSourceRegistration): void;
|
|
345
|
+
addActivity(pluginId: string, item: PluginActivityRegistration): void;
|
|
346
|
+
addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
|
|
347
|
+
addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
|
|
348
|
+
addIcon(pluginId: string, item: PluginIconRegistration): void;
|
|
349
|
+
addI18n(pluginId: string, item: PluginI18nRegistration): void;
|
|
350
|
+
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
351
|
+
purge(pluginId: string): void;
|
|
352
|
+
snapshot(): PluginRegistrySnapshot;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
declare class PluginManager extends SharedInstance {
|
|
356
|
+
private _plugins;
|
|
357
|
+
private _subscribers;
|
|
358
|
+
private _pluginsUpdate;
|
|
359
|
+
private _lazyPluginLoader;
|
|
360
|
+
readonly registry: PluginRegistry;
|
|
361
|
+
get configRegistry(): CustomConfigRegistry;
|
|
304
362
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
private
|
|
308
|
-
|
|
363
|
+
pluginsReady(): Promise<void>;
|
|
364
|
+
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
365
|
+
private _syncPlugins;
|
|
366
|
+
private _registerPlugin;
|
|
367
|
+
private _unregisterPlugin;
|
|
368
|
+
snapshot(): PluginRegistrySnapshot;
|
|
369
|
+
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
370
|
+
destroy(): void;
|
|
371
|
+
private _notifySubscribers;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
375
|
+
|
|
376
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
377
|
+
signal?: AbortSignal;
|
|
378
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
379
|
+
type FileValidatorDescriptor = {
|
|
380
|
+
runOn: 'add' | 'upload' | 'change';
|
|
381
|
+
validator: FuncFileValidator;
|
|
382
|
+
};
|
|
383
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
384
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
385
|
+
declare class ValidationManager extends SharedInstance {
|
|
386
|
+
private get _uploadCollection();
|
|
387
|
+
private _commonFileValidators;
|
|
388
|
+
private _commonCollectionValidators;
|
|
389
|
+
private _queue;
|
|
390
|
+
private _runQueueDebounced;
|
|
391
|
+
private _isDestroyed;
|
|
392
|
+
private _entryValidationState;
|
|
393
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
394
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
395
|
+
runCollectionValidators(): void;
|
|
396
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
397
|
+
private _runFileValidatorsForEntry;
|
|
398
|
+
private _addCustomTypeToValidationError;
|
|
399
|
+
private _getEntryValidationState;
|
|
400
|
+
private _getValidatorDescriptors;
|
|
401
|
+
private _getValidatorDescriptorsForEntry;
|
|
309
402
|
destroy(): void;
|
|
310
403
|
}
|
|
311
404
|
|
|
@@ -320,11 +413,14 @@ declare global {
|
|
|
320
413
|
declare class Icon extends LitBlock {
|
|
321
414
|
name: string;
|
|
322
415
|
private _resolvedHref;
|
|
416
|
+
private _pluginSvg;
|
|
323
417
|
private _iconHrefResolver;
|
|
418
|
+
private _unsubscribePlugins?;
|
|
324
419
|
initCallback(): void;
|
|
325
420
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
326
421
|
private _updateResolvedHref;
|
|
327
422
|
render(): lit_html.TemplateResult<1>;
|
|
423
|
+
disconnectedCallback(): void;
|
|
328
424
|
}
|
|
329
425
|
declare global {
|
|
330
426
|
interface HTMLElementTagNameMap {
|
|
@@ -352,7 +448,6 @@ declare global {
|
|
|
352
448
|
type CameraMode = 'photo' | 'video';
|
|
353
449
|
declare class CameraSource extends LitUploaderBlock {
|
|
354
450
|
couldBeCtxOwner: boolean;
|
|
355
|
-
activityType: "camera";
|
|
356
451
|
private _unsubPermissions;
|
|
357
452
|
private _capturing;
|
|
358
453
|
private _chunks;
|
|
@@ -472,25 +567,54 @@ declare global {
|
|
|
472
567
|
/**
|
|
473
568
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
474
569
|
*/
|
|
475
|
-
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
476
|
-
/** Mapping of attribute names to state */
|
|
477
|
-
declare const attrStateMapping: Record<string, string>;
|
|
570
|
+
declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
478
571
|
declare class Config extends LitBlock {
|
|
479
572
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
480
573
|
'ctx-name': string;
|
|
481
574
|
};
|
|
482
575
|
init$: LitBlock["init$"] & ConfigType;
|
|
483
576
|
private _computationControllers;
|
|
577
|
+
private _pluginChangeUnsubscribe?;
|
|
578
|
+
private _mutationObserver?;
|
|
579
|
+
/**
|
|
580
|
+
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
581
|
+
* Updated dynamically when plugins are registered or changed.
|
|
582
|
+
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
583
|
+
*/
|
|
584
|
+
private _customAttrKeyMapping;
|
|
585
|
+
/** Set of all custom config names registered by plugins */
|
|
586
|
+
private _customConfigKeys;
|
|
587
|
+
/**
|
|
588
|
+
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
589
|
+
* Used to track and clean up subscriptions when plugins change
|
|
590
|
+
*/
|
|
591
|
+
private _customConfigSubscriptions;
|
|
592
|
+
/**
|
|
593
|
+
* Check if a key is a custom config (registered by plugins)
|
|
594
|
+
*/
|
|
595
|
+
private _isCustomConfig;
|
|
596
|
+
/**
|
|
597
|
+
* Get the custom config definition for a key
|
|
598
|
+
*/
|
|
599
|
+
private _getCustomConfigDefinition;
|
|
600
|
+
/**
|
|
601
|
+
* Get attribute names for a config key (kebab-case and lowercase)
|
|
602
|
+
*/
|
|
603
|
+
private _getAttributeNames;
|
|
484
604
|
private _flushValueToAttribute;
|
|
485
605
|
private _flushValueToState;
|
|
486
606
|
private _setValue;
|
|
487
607
|
private _getValue;
|
|
488
608
|
private _assertSameValueDifferentReference;
|
|
609
|
+
private _processCustomConfigs;
|
|
610
|
+
private _setupCustomConfigs;
|
|
611
|
+
private _setupMutationObserver;
|
|
489
612
|
initCallback(): void;
|
|
490
|
-
attributeChangedCallback(name:
|
|
613
|
+
attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
|
|
614
|
+
disconnectedCallback(): void;
|
|
491
615
|
static get observedAttributes(): string[];
|
|
492
616
|
}
|
|
493
|
-
interface Config extends ConfigType {
|
|
617
|
+
interface Config extends ConfigType, CustomConfig {
|
|
494
618
|
}
|
|
495
619
|
declare global {
|
|
496
620
|
interface HTMLElementTagNameMap {
|
|
@@ -498,49 +622,6 @@ declare global {
|
|
|
498
622
|
}
|
|
499
623
|
}
|
|
500
624
|
|
|
501
|
-
declare class TypedData<T extends Record<string, unknown>> {
|
|
502
|
-
private _ctxId;
|
|
503
|
-
private _data;
|
|
504
|
-
constructor(initialValue: T);
|
|
505
|
-
get uid(): Uid;
|
|
506
|
-
setValue<K extends keyof T>(prop: K, value: T[K]): void;
|
|
507
|
-
setMultipleValues(updObj: Partial<T>): void;
|
|
508
|
-
getValue<K extends keyof T>(prop: K): T[K];
|
|
509
|
-
subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
|
|
510
|
-
destroy(): void;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
514
|
-
file: File | null;
|
|
515
|
-
externalUrl: string | null;
|
|
516
|
-
fileName: string | null;
|
|
517
|
-
fileSize: number | null;
|
|
518
|
-
lastModified: number;
|
|
519
|
-
uploadProgress: number;
|
|
520
|
-
uuid: string | null;
|
|
521
|
-
isImage: boolean;
|
|
522
|
-
mimeType: string | null;
|
|
523
|
-
ctxName: string | null;
|
|
524
|
-
cdnUrl: string | null;
|
|
525
|
-
cdnUrlModifiers: string | null;
|
|
526
|
-
fileInfo: UploadcareFile | null;
|
|
527
|
-
isUploading: boolean;
|
|
528
|
-
abortController: AbortController | null;
|
|
529
|
-
thumbUrl: string | null;
|
|
530
|
-
silent: boolean;
|
|
531
|
-
source: string | null;
|
|
532
|
-
fullPath: string | null;
|
|
533
|
-
metadata: Metadata | null;
|
|
534
|
-
errors: OutputErrorFile[];
|
|
535
|
-
uploadError: Error | null;
|
|
536
|
-
isRemoved: boolean;
|
|
537
|
-
isQueuedForUploading: boolean;
|
|
538
|
-
isValidationPending: boolean;
|
|
539
|
-
isQueuedForValidation: boolean;
|
|
540
|
-
}
|
|
541
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
542
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
543
|
-
|
|
544
625
|
declare class FileItemConfig extends LitUploaderBlock {
|
|
545
626
|
private _entrySubs;
|
|
546
627
|
protected entry: UploadEntryTypedData | null;
|
|
@@ -617,12 +698,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
617
698
|
private _isFailed;
|
|
618
699
|
private _isUploading;
|
|
619
700
|
private _isFocused;
|
|
620
|
-
private _isEditable;
|
|
621
701
|
private _showFileNames;
|
|
622
702
|
private _ariaLabelStatusFile;
|
|
703
|
+
private _pluginFileActions;
|
|
623
704
|
private _renderedOnce;
|
|
624
705
|
private _observer?;
|
|
625
|
-
private
|
|
706
|
+
private _unsubscribePlugins?;
|
|
626
707
|
private _handleRemove;
|
|
627
708
|
private _handleUploadClick;
|
|
628
709
|
private _calculateState;
|
|
@@ -634,6 +715,8 @@ declare class FileItem extends FileItemConfig {
|
|
|
634
715
|
private _handleEntryId;
|
|
635
716
|
private _updateShowFileNames;
|
|
636
717
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
718
|
+
private _updatePluginFileActions;
|
|
719
|
+
private _handlePluginFileAction;
|
|
637
720
|
initCallback(): void;
|
|
638
721
|
connectedCallback(): void;
|
|
639
722
|
disconnectedCallback(): void;
|
|
@@ -763,7 +846,6 @@ declare const UploadSource: Readonly<{
|
|
|
763
846
|
readonly EXTERNAL: "external";
|
|
764
847
|
readonly API: "js-api";
|
|
765
848
|
readonly URL: "url";
|
|
766
|
-
readonly DRAW: "draw";
|
|
767
849
|
}>;
|
|
768
850
|
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
769
851
|
|
|
@@ -818,7 +900,73 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
818
900
|
}>;
|
|
819
901
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
820
902
|
|
|
821
|
-
declare
|
|
903
|
+
declare const InternalEventType: Readonly<{
|
|
904
|
+
readonly INIT_SOLUTION: "init-solution";
|
|
905
|
+
readonly CHANGE_CONFIG: "change-config";
|
|
906
|
+
readonly ACTION_EVENT: "action-event";
|
|
907
|
+
readonly ERROR_EVENT: "error-event";
|
|
908
|
+
}>;
|
|
909
|
+
declare const EventType: Readonly<{
|
|
910
|
+
readonly FILE_ADDED: "file-added";
|
|
911
|
+
readonly FILE_REMOVED: "file-removed";
|
|
912
|
+
readonly FILE_UPLOAD_START: "file-upload-start";
|
|
913
|
+
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
|
|
914
|
+
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
|
|
915
|
+
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
|
|
916
|
+
readonly FILE_URL_CHANGED: "file-url-changed";
|
|
917
|
+
readonly MODAL_OPEN: "modal-open";
|
|
918
|
+
readonly MODAL_CLOSE: "modal-close";
|
|
919
|
+
readonly DONE_CLICK: "done-click";
|
|
920
|
+
readonly UPLOAD_CLICK: "upload-click";
|
|
921
|
+
readonly ACTIVITY_CHANGE: "activity-change";
|
|
922
|
+
readonly COMMON_UPLOAD_START: "common-upload-start";
|
|
923
|
+
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
|
|
924
|
+
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
|
|
925
|
+
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
|
|
926
|
+
readonly CHANGE: "change";
|
|
927
|
+
readonly GROUP_CREATED: "group-created";
|
|
928
|
+
}>;
|
|
929
|
+
type EventKey = (typeof EventType)[keyof typeof EventType];
|
|
930
|
+
type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
|
|
931
|
+
type EventPayload = {
|
|
932
|
+
[EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
|
|
933
|
+
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
|
|
934
|
+
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
|
|
935
|
+
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
|
|
936
|
+
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
|
|
937
|
+
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
|
|
938
|
+
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
|
|
939
|
+
[EventType.MODAL_OPEN]: {
|
|
940
|
+
modalId: ModalId;
|
|
941
|
+
};
|
|
942
|
+
[EventType.MODAL_CLOSE]: {
|
|
943
|
+
modalId: ModalId;
|
|
944
|
+
hasActiveModals: boolean;
|
|
945
|
+
};
|
|
946
|
+
[EventType.ACTIVITY_CHANGE]: {
|
|
947
|
+
activity: ActivityType;
|
|
948
|
+
};
|
|
949
|
+
[EventType.UPLOAD_CLICK]: undefined;
|
|
950
|
+
[EventType.DONE_CLICK]: OutputCollectionState;
|
|
951
|
+
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
|
|
952
|
+
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
|
|
953
|
+
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
|
|
954
|
+
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
|
|
955
|
+
[EventType.CHANGE]: OutputCollectionState;
|
|
956
|
+
[EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
|
|
957
|
+
};
|
|
958
|
+
declare class EventEmitter extends SharedInstance {
|
|
959
|
+
private _timeoutStore;
|
|
960
|
+
private _targets;
|
|
961
|
+
private _listeners;
|
|
962
|
+
bindTarget(target: LitBlock): () => void;
|
|
963
|
+
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
964
|
+
private _dispatch;
|
|
965
|
+
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
966
|
+
debounce?: TDebounce;
|
|
967
|
+
}): void;
|
|
968
|
+
destroy(): void;
|
|
969
|
+
}
|
|
822
970
|
|
|
823
971
|
type ApiAddFileCommonOptions = {
|
|
824
972
|
silent?: boolean;
|
|
@@ -850,8 +998,11 @@ declare class UploaderPublicApi extends SharedInstance {
|
|
|
850
998
|
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
851
999
|
initFlow: (force?: boolean) => void;
|
|
852
1000
|
doneFlow: () => void;
|
|
853
|
-
|
|
1001
|
+
private _pluginsReady;
|
|
1002
|
+
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1003
|
+
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
854
1004
|
getCurrentActivity: () => ActivityType;
|
|
1005
|
+
historyBack: () => void;
|
|
855
1006
|
setModalState: (opened: boolean) => void;
|
|
856
1007
|
private get _sourceList();
|
|
857
1008
|
}
|
|
@@ -1068,6 +1219,10 @@ type ConfigType = {
|
|
|
1068
1219
|
* Expiry threshold for secure uploads.
|
|
1069
1220
|
*/
|
|
1070
1221
|
secureUploadsExpireThreshold: number;
|
|
1222
|
+
/**
|
|
1223
|
+
* Array of plugins to register with the uploader instance.
|
|
1224
|
+
*/
|
|
1225
|
+
plugins: UploaderPlugin[];
|
|
1071
1226
|
/**
|
|
1072
1227
|
* Metadata for the file.
|
|
1073
1228
|
*/
|
|
@@ -1319,6 +1474,165 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
1319
1474
|
allEntries: OutputFileEntry[];
|
|
1320
1475
|
});
|
|
1321
1476
|
|
|
1477
|
+
type PluginIconRegistration = {
|
|
1478
|
+
name: string;
|
|
1479
|
+
svg: string;
|
|
1480
|
+
};
|
|
1481
|
+
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
1482
|
+
type PluginSourceRegistration = {
|
|
1483
|
+
id: string;
|
|
1484
|
+
label: string;
|
|
1485
|
+
icon?: string;
|
|
1486
|
+
/**
|
|
1487
|
+
* @internal
|
|
1488
|
+
*
|
|
1489
|
+
* Optional expansion function. When present, SourceList calls this to determine
|
|
1490
|
+
* which source IDs should actually be rendered in place of this source.
|
|
1491
|
+
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
1492
|
+
* expanding to separate photo/video buttons on mobile).
|
|
1493
|
+
* Return `[id]` (the source's own id) to render it as-is.
|
|
1494
|
+
*/
|
|
1495
|
+
expand?: () => string[];
|
|
1496
|
+
onSelect: () => Promise<void> | void;
|
|
1497
|
+
};
|
|
1498
|
+
type PluginRenderDispose = () => void;
|
|
1499
|
+
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
1500
|
+
type PluginActivityRegistration = {
|
|
1501
|
+
id: string;
|
|
1502
|
+
render: PluginRender;
|
|
1503
|
+
};
|
|
1504
|
+
type PluginFileActionRegistration = {
|
|
1505
|
+
/** Unique action identifier. */
|
|
1506
|
+
id: string;
|
|
1507
|
+
/** Icon name to display in the action button. */
|
|
1508
|
+
icon: string;
|
|
1509
|
+
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
1510
|
+
label: string;
|
|
1511
|
+
/** Return `true` to show the action button for the given file entry. */
|
|
1512
|
+
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
1513
|
+
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
1514
|
+
};
|
|
1515
|
+
type PluginFileHookResult = {
|
|
1516
|
+
/** The (optionally transformed) file */
|
|
1517
|
+
file: File | Blob;
|
|
1518
|
+
};
|
|
1519
|
+
type PluginFileHookContext = PluginFileHookResult & {
|
|
1520
|
+
/**
|
|
1521
|
+
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
1522
|
+
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
1523
|
+
*/
|
|
1524
|
+
signal: AbortSignal;
|
|
1525
|
+
};
|
|
1526
|
+
type PluginFileHookRegistration = {
|
|
1527
|
+
/**
|
|
1528
|
+
* When the hook is called:
|
|
1529
|
+
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
1530
|
+
* - `'onAdd'`: called after the file is added to the upload list.
|
|
1531
|
+
*
|
|
1532
|
+
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
1533
|
+
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
1534
|
+
*/
|
|
1535
|
+
type: 'beforeUpload' | 'onAdd';
|
|
1536
|
+
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
1537
|
+
/**
|
|
1538
|
+
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
1539
|
+
* @default 30000
|
|
1540
|
+
*/
|
|
1541
|
+
timeout?: number;
|
|
1542
|
+
};
|
|
1543
|
+
type PluginRegistryApi = {
|
|
1544
|
+
registerSource: (source: PluginSourceRegistration) => void;
|
|
1545
|
+
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
1546
|
+
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
1547
|
+
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
1548
|
+
registerIcon: (icon: PluginIconRegistration) => void;
|
|
1549
|
+
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
1550
|
+
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
1551
|
+
};
|
|
1552
|
+
/**
|
|
1553
|
+
* API for managing plugin config subscriptions
|
|
1554
|
+
*/
|
|
1555
|
+
type PluginConfigApi = {
|
|
1556
|
+
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
1557
|
+
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
1558
|
+
};
|
|
1559
|
+
/**
|
|
1560
|
+
* API for managing plugin activity interactions
|
|
1561
|
+
*/
|
|
1562
|
+
type PluginActivityApi = {
|
|
1563
|
+
/**
|
|
1564
|
+
* Get the current activity parameters.
|
|
1565
|
+
*
|
|
1566
|
+
* @returns The current activity parameters object
|
|
1567
|
+
*
|
|
1568
|
+
* @example
|
|
1569
|
+
* ```typescript
|
|
1570
|
+
* const params = pluginApi.activity.getParams();
|
|
1571
|
+
* console.log('Current params:', params);
|
|
1572
|
+
* ```
|
|
1573
|
+
*/
|
|
1574
|
+
getParams: () => Record<string, unknown>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Subscribe to changes in activity parameters.
|
|
1577
|
+
* The callback will be called immediately with the current params,
|
|
1578
|
+
* and then whenever the params change.
|
|
1579
|
+
*
|
|
1580
|
+
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
1581
|
+
*
|
|
1582
|
+
* @param callback - Function to call with the new params
|
|
1583
|
+
* @returns Unsubscribe function
|
|
1584
|
+
*
|
|
1585
|
+
* @example
|
|
1586
|
+
* ```typescript
|
|
1587
|
+
* pluginApi.activity.subscribeToParams((params) => {
|
|
1588
|
+
* console.log('Activity params changed:', params);
|
|
1589
|
+
* });
|
|
1590
|
+
* // Cleanup happens automatically on plugin disposal
|
|
1591
|
+
* ```
|
|
1592
|
+
*/
|
|
1593
|
+
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
1594
|
+
};
|
|
1595
|
+
type PluginFileEntryUpdate = {
|
|
1596
|
+
file?: File | Blob;
|
|
1597
|
+
cdnUrl?: string | null;
|
|
1598
|
+
cdnUrlModifiers?: string | null;
|
|
1599
|
+
mimeType?: string | null;
|
|
1600
|
+
};
|
|
1601
|
+
type PluginFilesApi = {
|
|
1602
|
+
/**
|
|
1603
|
+
* Update mutable properties of a file entry by its internalId.
|
|
1604
|
+
* `fileSize` is recalculated automatically when `file` is provided.
|
|
1605
|
+
*/
|
|
1606
|
+
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
1607
|
+
};
|
|
1608
|
+
type PluginApi = {
|
|
1609
|
+
registry: PluginRegistryApi;
|
|
1610
|
+
config: PluginConfigApi;
|
|
1611
|
+
activity: PluginActivityApi;
|
|
1612
|
+
files: PluginFilesApi;
|
|
1613
|
+
};
|
|
1614
|
+
type PluginUploaderApi = UploaderPublicApi;
|
|
1615
|
+
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
1616
|
+
type PluginSetupParams = {
|
|
1617
|
+
pluginApi: PluginApi;
|
|
1618
|
+
uploaderApi: PluginUploaderApi;
|
|
1619
|
+
};
|
|
1620
|
+
type UploaderPlugin = {
|
|
1621
|
+
id: string;
|
|
1622
|
+
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
1623
|
+
};
|
|
1624
|
+
type Owned<T> = T & {
|
|
1625
|
+
pluginId: string;
|
|
1626
|
+
};
|
|
1627
|
+
type PluginRegistrySnapshot = {
|
|
1628
|
+
sources: Owned<PluginSourceRegistration>[];
|
|
1629
|
+
activities: Owned<PluginActivityRegistration>[];
|
|
1630
|
+
fileActions: Owned<PluginFileActionRegistration>[];
|
|
1631
|
+
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
1632
|
+
icons: Owned<PluginIconRegistration>[];
|
|
1633
|
+
i18n: Owned<PluginI18nRegistration>[];
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1322
1636
|
declare class SecureUploadsManager extends SharedInstance {
|
|
1323
1637
|
private _secureToken;
|
|
1324
1638
|
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
@@ -1363,7 +1677,6 @@ declare class LitUploaderBlock extends LitActivityBlock {
|
|
|
1363
1677
|
private _handleCollectionUpdate;
|
|
1364
1678
|
private _handleCollectionPropertiesUpdate;
|
|
1365
1679
|
private _flushCommonUploadProgress;
|
|
1366
|
-
private _openCloudImageEditor;
|
|
1367
1680
|
private _setInitialCrop;
|
|
1368
1681
|
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1369
1682
|
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
@@ -1433,12 +1746,11 @@ type ActivityParams$1 = {
|
|
|
1433
1746
|
internalId: string;
|
|
1434
1747
|
};
|
|
1435
1748
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1436
|
-
couldBeCtxOwner: boolean;
|
|
1437
|
-
activityType: "cloud-image-edit";
|
|
1438
1749
|
private _entry?;
|
|
1439
1750
|
private _editorConfig;
|
|
1440
1751
|
get activityParams(): ActivityParams$1;
|
|
1441
1752
|
initCallback(): void;
|
|
1753
|
+
disconnectedCallback(): void;
|
|
1442
1754
|
private _handleApply;
|
|
1443
1755
|
private _handleCancel;
|
|
1444
1756
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1467,7 +1779,6 @@ type ActivityParams = {
|
|
|
1467
1779
|
};
|
|
1468
1780
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1469
1781
|
couldBeCtxOwner: boolean;
|
|
1470
|
-
activityType: "external";
|
|
1471
1782
|
private _messageBridge?;
|
|
1472
1783
|
private _iframeRef;
|
|
1473
1784
|
private _latestSelectionSummary;
|
|
@@ -1511,22 +1822,26 @@ declare global {
|
|
|
1511
1822
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1512
1823
|
START_FROM: "start-from";
|
|
1513
1824
|
CAMERA: "camera";
|
|
1514
|
-
DRAW: "draw";
|
|
1515
1825
|
UPLOAD_LIST: "upload-list";
|
|
1516
1826
|
URL: "url";
|
|
1517
1827
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1518
1828
|
EXTERNAL: "external";
|
|
1519
1829
|
}>;
|
|
1520
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1521
|
-
type ActivityType = RegisteredActivityType |
|
|
1830
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
|
|
1831
|
+
type ActivityType = RegisteredActivityType | null;
|
|
1522
1832
|
|
|
1523
1833
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1834
|
+
interface CustomActivities {
|
|
1835
|
+
}
|
|
1524
1836
|
type ActivityParamsMap = {
|
|
1525
1837
|
'cloud-image-edit': ActivityParams$1;
|
|
1526
1838
|
external: ActivityParams;
|
|
1839
|
+
} & {
|
|
1840
|
+
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1527
1841
|
};
|
|
1528
1842
|
declare class LitActivityBlock extends LitBlock {
|
|
1529
1843
|
protected historyTracked: boolean;
|
|
1844
|
+
activityType: ActivityType;
|
|
1530
1845
|
private [ACTIVE_PROP]?;
|
|
1531
1846
|
init$: {
|
|
1532
1847
|
'*currentActivity': null;
|
|
@@ -1540,12 +1855,11 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1540
1855
|
private _activate;
|
|
1541
1856
|
initCallback(): void;
|
|
1542
1857
|
private _historyFlush;
|
|
1543
|
-
|
|
1858
|
+
protected _isActivityRegistered(): boolean;
|
|
1544
1859
|
private static _activityCallbacks;
|
|
1545
1860
|
static activities: Readonly<{
|
|
1546
1861
|
START_FROM: 'start-from';
|
|
1547
1862
|
CAMERA: 'camera';
|
|
1548
|
-
DRAW: 'draw';
|
|
1549
1863
|
UPLOAD_LIST: 'upload-list';
|
|
1550
1864
|
URL: 'url';
|
|
1551
1865
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1561,8 +1875,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1561
1875
|
private _unregisterActivity;
|
|
1562
1876
|
disconnectedCallback(): void;
|
|
1563
1877
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1564
|
-
get initActivity():
|
|
1565
|
-
get doneActivity():
|
|
1878
|
+
get initActivity(): RegisteredActivityType | null;
|
|
1879
|
+
get doneActivity(): RegisteredActivityType | null;
|
|
1566
1880
|
historyBack(): void;
|
|
1567
1881
|
}
|
|
1568
1882
|
|
|
@@ -1617,10 +1931,19 @@ declare class ModalManager extends SharedInstance {
|
|
|
1617
1931
|
destroy(): void;
|
|
1618
1932
|
}
|
|
1619
1933
|
|
|
1934
|
+
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
1935
|
+
type LazyPluginEntry = {
|
|
1936
|
+
configDeps: readonly (keyof ConfigType)[];
|
|
1937
|
+
isEnabled: (get: ConfigGetter) => boolean;
|
|
1938
|
+
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1620
1941
|
declare class LitSolutionBlock extends LitBlock {
|
|
1621
1942
|
static styleAttrs: string[];
|
|
1943
|
+
static lazyPlugins: LazyPluginEntry[] | null;
|
|
1622
1944
|
init$: {
|
|
1623
1945
|
'*solution': string | null;
|
|
1946
|
+
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
1624
1947
|
'*commonProgress': number;
|
|
1625
1948
|
'*uploadList': never[];
|
|
1626
1949
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -1752,18 +2075,20 @@ declare global {
|
|
|
1752
2075
|
}
|
|
1753
2076
|
}
|
|
1754
2077
|
|
|
2078
|
+
type SourceButtonConfig = {
|
|
2079
|
+
id: string;
|
|
2080
|
+
label: string;
|
|
2081
|
+
icon?: string;
|
|
2082
|
+
onClick: () => void | Promise<void>;
|
|
2083
|
+
};
|
|
1755
2084
|
declare class SourceBtn extends LitUploaderBlock {
|
|
1756
2085
|
couldBeCtxOwner: boolean;
|
|
1757
|
-
|
|
1758
|
-
type?: string;
|
|
2086
|
+
source?: SourceButtonConfig;
|
|
1759
2087
|
private _iconName;
|
|
1760
2088
|
private _srcTypeKey;
|
|
1761
|
-
private _initTypes;
|
|
1762
|
-
initCallback(): void;
|
|
1763
|
-
private _registerType;
|
|
1764
|
-
activate(): void;
|
|
1765
|
-
private _applyType;
|
|
1766
2089
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2090
|
+
private _applySource;
|
|
2091
|
+
activate(): void;
|
|
1767
2092
|
render(): lit_html.TemplateResult<1>;
|
|
1768
2093
|
}
|
|
1769
2094
|
declare global {
|
|
@@ -1772,9 +2097,10 @@ declare global {
|
|
|
1772
2097
|
}
|
|
1773
2098
|
}
|
|
1774
2099
|
|
|
1775
|
-
declare class SourceList extends
|
|
2100
|
+
declare class SourceList extends LitUploaderBlock {
|
|
1776
2101
|
private _rawSourceList;
|
|
1777
|
-
private
|
|
2102
|
+
private _unsubscribePlugins?;
|
|
2103
|
+
private _sources;
|
|
1778
2104
|
/**
|
|
1779
2105
|
* CSS-only attribute
|
|
1780
2106
|
*/
|
|
@@ -1782,8 +2108,10 @@ declare class SourceList extends LitBlock {
|
|
|
1782
2108
|
initCallback(): void;
|
|
1783
2109
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1784
2110
|
private _updateSources;
|
|
1785
|
-
private
|
|
2111
|
+
private _expandSource;
|
|
2112
|
+
private _makePluginSourceConfig;
|
|
1786
2113
|
render(): lit_html.TemplateResult<1>;
|
|
2114
|
+
disconnectedCallback(): void;
|
|
1787
2115
|
}
|
|
1788
2116
|
declare global {
|
|
1789
2117
|
interface HTMLElementTagNameMap {
|
|
@@ -1847,38 +2175,65 @@ declare global {
|
|
|
1847
2175
|
}
|
|
1848
2176
|
}
|
|
1849
2177
|
|
|
1850
|
-
declare class
|
|
2178
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2179
|
+
static styleAttrs: string[];
|
|
1851
2180
|
couldBeCtxOwner: boolean;
|
|
1852
|
-
|
|
1853
|
-
private
|
|
2181
|
+
dropzone: boolean;
|
|
2182
|
+
private _buttonTextKey;
|
|
2183
|
+
private readonly _handleClick;
|
|
1854
2184
|
initCallback(): void;
|
|
1855
|
-
private _inputRef;
|
|
1856
|
-
private _handleInput;
|
|
1857
|
-
private _handleUpload;
|
|
1858
2185
|
render(): lit_html.TemplateResult<1>;
|
|
1859
2186
|
}
|
|
1860
2187
|
declare global {
|
|
1861
2188
|
interface HTMLElementTagNameMap {
|
|
1862
|
-
'uc-
|
|
2189
|
+
'uc-simple-btn': SimpleBtn;
|
|
1863
2190
|
}
|
|
1864
2191
|
}
|
|
1865
2192
|
|
|
1866
|
-
declare class
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2193
|
+
declare class PluginActivityHost extends LitActivityBlock {
|
|
2194
|
+
registration: Owned<PluginActivityRegistration>;
|
|
2195
|
+
private _dispose?;
|
|
2196
|
+
private _containerRef;
|
|
2197
|
+
initCallback(): void;
|
|
2198
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2199
|
+
private _ensureRegistered;
|
|
2200
|
+
private _renderActivity;
|
|
2201
|
+
private _disposeActivity;
|
|
2202
|
+
disconnectedCallback(): void;
|
|
2203
|
+
render(): lit_html.TemplateResult<1>;
|
|
2204
|
+
}
|
|
2205
|
+
declare class PluginActivityRenderer extends LitBlock {
|
|
2206
|
+
mode: 'modal' | 'inline';
|
|
2207
|
+
private _activities;
|
|
2208
|
+
private _unsubscribePlugins?;
|
|
1872
2209
|
initCallback(): void;
|
|
2210
|
+
private _syncActivities;
|
|
2211
|
+
disconnectedCallback(): void;
|
|
1873
2212
|
render(): lit_html.TemplateResult<1>;
|
|
1874
2213
|
}
|
|
1875
2214
|
declare global {
|
|
1876
2215
|
interface HTMLElementTagNameMap {
|
|
1877
|
-
'uc-
|
|
2216
|
+
'uc-plugin-activity-host': PluginActivityHost;
|
|
2217
|
+
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
2222
|
+
private _formState;
|
|
2223
|
+
private _inputRef;
|
|
2224
|
+
private _handleInput;
|
|
2225
|
+
private _handleUpload;
|
|
2226
|
+
firstUpdated(): void;
|
|
2227
|
+
render(): lit_html.TemplateResult<1>;
|
|
2228
|
+
}
|
|
2229
|
+
declare global {
|
|
2230
|
+
interface HTMLElementTagNameMap {
|
|
2231
|
+
'uc-url-source': UrlSource;
|
|
1878
2232
|
}
|
|
1879
2233
|
}
|
|
1880
2234
|
|
|
1881
2235
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
2236
|
+
static lazyPlugins: LazyPluginEntry[];
|
|
1882
2237
|
attributesMeta: {
|
|
1883
2238
|
headless?: boolean;
|
|
1884
2239
|
'ctx-name': string;
|
|
@@ -1896,6 +2251,7 @@ declare global {
|
|
|
1896
2251
|
}
|
|
1897
2252
|
|
|
1898
2253
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
2254
|
+
static lazyPlugins: LazyPluginEntry[];
|
|
1899
2255
|
attributesMeta: {
|
|
1900
2256
|
'ctx-name': string;
|
|
1901
2257
|
};
|
|
@@ -1916,6 +2272,7 @@ declare global {
|
|
|
1916
2272
|
}
|
|
1917
2273
|
|
|
1918
2274
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
2275
|
+
static lazyPlugins: LazyPluginEntry[];
|
|
1919
2276
|
attributesMeta: {
|
|
1920
2277
|
'ctx-name': string;
|
|
1921
2278
|
};
|
|
@@ -1950,6 +2307,8 @@ declare class A11y implements ISharedInstance {
|
|
|
1950
2307
|
declare class LocaleManager extends SharedInstance {
|
|
1951
2308
|
private _localeName;
|
|
1952
2309
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2310
|
+
private _applyOverrides;
|
|
2311
|
+
private _applyPluginLocales;
|
|
1953
2312
|
}
|
|
1954
2313
|
|
|
1955
2314
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -1990,6 +2349,69 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
1990
2349
|
private get _location();
|
|
1991
2350
|
}
|
|
1992
2351
|
|
|
2352
|
+
interface ISharedInstance {
|
|
2353
|
+
destroy?(): void;
|
|
2354
|
+
}
|
|
2355
|
+
declare class SharedInstance {
|
|
2356
|
+
protected _ctx: PubSub<SharedState>;
|
|
2357
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2358
|
+
private _subscriptions;
|
|
2359
|
+
private _cfgProxy;
|
|
2360
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2361
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2362
|
+
protected addSub(unsub: () => void): void;
|
|
2363
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2364
|
+
destroy(): void;
|
|
2365
|
+
}
|
|
2366
|
+
declare const instanceKeyMap: {
|
|
2367
|
+
modalManager: "*modalManager";
|
|
2368
|
+
pluginManager: "*pluginManager";
|
|
2369
|
+
telemetryManager: "*telemetryManager";
|
|
2370
|
+
localeManager: "*localeManager";
|
|
2371
|
+
a11y: "*a11y";
|
|
2372
|
+
clipboard: "*clipboard";
|
|
2373
|
+
blocksRegistry: "*blocksRegistry";
|
|
2374
|
+
eventEmitter: "*eventEmitter";
|
|
2375
|
+
uploadCollection: "*uploadCollection";
|
|
2376
|
+
secureUploadsManager: "*secureUploadsManager";
|
|
2377
|
+
api: "*publicApi";
|
|
2378
|
+
validationManager: "*validationManager";
|
|
2379
|
+
};
|
|
2380
|
+
type InstanceTypeMap = {
|
|
2381
|
+
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2382
|
+
};
|
|
2383
|
+
type InstanceName = keyof typeof instanceKeyMap;
|
|
2384
|
+
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2385
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2386
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2387
|
+
readonly ctx: PubSub<SharedState>;
|
|
2388
|
+
readonly modalManager: ModalManager | null;
|
|
2389
|
+
readonly pluginManager: PluginManager;
|
|
2390
|
+
readonly telemetryManager: TelemetryManager;
|
|
2391
|
+
readonly localeManager: LocaleManager;
|
|
2392
|
+
readonly a11y: A11y;
|
|
2393
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2394
|
+
readonly eventEmitter: EventEmitter;
|
|
2395
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2396
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2397
|
+
readonly api: UploaderPublicApi;
|
|
2398
|
+
readonly validationManager: ValidationManager;
|
|
2399
|
+
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2400
|
+
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2401
|
+
};
|
|
2402
|
+
|
|
2403
|
+
type PasteScope = 'local' | 'global' | false;
|
|
2404
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
2405
|
+
private scopes;
|
|
2406
|
+
private listener;
|
|
2407
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2408
|
+
private openUploadList;
|
|
2409
|
+
private _listener;
|
|
2410
|
+
private handlePaste;
|
|
2411
|
+
registerBlock(scope: Node): () => void;
|
|
2412
|
+
destroy(): void;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
1993
2415
|
declare const TabId: Readonly<{
|
|
1994
2416
|
readonly CROP: "crop";
|
|
1995
2417
|
readonly TUNING: "tuning";
|
|
@@ -2054,11 +2476,14 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
|
|
|
2054
2476
|
type SharedConfigState = {
|
|
2055
2477
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2056
2478
|
};
|
|
2479
|
+
type SharedCustomConfigState = {
|
|
2480
|
+
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2481
|
+
};
|
|
2057
2482
|
type BlocksRegistry = Set<LitBlock>;
|
|
2058
2483
|
type ActivityBlockCtxState = {
|
|
2059
|
-
'*currentActivity':
|
|
2484
|
+
'*currentActivity': RegisteredActivityType | null;
|
|
2060
2485
|
'*currentActivityParams': Record<string, unknown>;
|
|
2061
|
-
'*history': (
|
|
2486
|
+
'*history': (RegisteredActivityType | null)[];
|
|
2062
2487
|
'*historyBack': (() => void) | null;
|
|
2063
2488
|
'*closeModal': () => void;
|
|
2064
2489
|
};
|
|
@@ -2075,6 +2500,7 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2075
2500
|
};
|
|
2076
2501
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2077
2502
|
'*solution': string | null;
|
|
2503
|
+
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2078
2504
|
};
|
|
2079
2505
|
type CloudImageEditorState = {
|
|
2080
2506
|
'*originalUrl': string | null;
|
|
@@ -2125,7 +2551,9 @@ type EditorToolbarState = {
|
|
|
2125
2551
|
'*currentOperation': string | null;
|
|
2126
2552
|
'*operationTooltip': string | null;
|
|
2127
2553
|
};
|
|
2554
|
+
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2128
2555
|
type DynamicBlockState = {
|
|
2556
|
+
'*sharedContextInstances': SharedContextInstances;
|
|
2129
2557
|
'*blocksRegistry': BlocksRegistry;
|
|
2130
2558
|
'*eventEmitter': EventEmitter;
|
|
2131
2559
|
'*localeManager': LocaleManager;
|
|
@@ -2133,6 +2561,7 @@ type DynamicBlockState = {
|
|
|
2133
2561
|
'*a11y': A11y;
|
|
2134
2562
|
'*modalManager': ModalManager | null;
|
|
2135
2563
|
'*clipboard': ClipboardLayer;
|
|
2564
|
+
'*pluginManager': PluginManager;
|
|
2136
2565
|
};
|
|
2137
2566
|
type DynamicUploaderBlockState = {
|
|
2138
2567
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2143,66 +2572,7 @@ type DynamicUploaderBlockState = {
|
|
|
2143
2572
|
type LocaleState = {
|
|
2144
2573
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2145
2574
|
};
|
|
2146
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2147
|
-
|
|
2148
|
-
interface ISharedInstance {
|
|
2149
|
-
destroy?(): void;
|
|
2150
|
-
}
|
|
2151
|
-
declare class SharedInstance {
|
|
2152
|
-
protected _ctx: PubSub<SharedState>;
|
|
2153
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2154
|
-
private _subscriptions;
|
|
2155
|
-
private _cfgProxy;
|
|
2156
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2157
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2158
|
-
protected addSub(unsub: () => void): void;
|
|
2159
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2160
|
-
destroy(): void;
|
|
2161
|
-
}
|
|
2162
|
-
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2163
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2164
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2165
|
-
readonly ctx: PubSub<SharedState>;
|
|
2166
|
-
readonly modalManager: ModalManager | null;
|
|
2167
|
-
readonly telemetryManager: TelemetryManager;
|
|
2168
|
-
readonly localeManager: LocaleManager;
|
|
2169
|
-
readonly a11y: A11y;
|
|
2170
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2171
|
-
readonly eventEmitter: EventEmitter;
|
|
2172
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2173
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2174
|
-
readonly api: UploaderPublicApi;
|
|
2175
|
-
readonly validationManager: ValidationManager;
|
|
2176
|
-
};
|
|
2177
|
-
|
|
2178
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2179
|
-
signal?: AbortSignal;
|
|
2180
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2181
|
-
type FileValidatorDescriptor = {
|
|
2182
|
-
runOn: 'add' | 'upload' | 'change';
|
|
2183
|
-
validator: FuncFileValidator;
|
|
2184
|
-
};
|
|
2185
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2186
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2187
|
-
declare class ValidationManager extends SharedInstance {
|
|
2188
|
-
private get _uploadCollection();
|
|
2189
|
-
private _commonFileValidators;
|
|
2190
|
-
private _commonCollectionValidators;
|
|
2191
|
-
private _queue;
|
|
2192
|
-
private _runQueueDebounced;
|
|
2193
|
-
private _isDestroyed;
|
|
2194
|
-
private _entryValidationState;
|
|
2195
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2196
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2197
|
-
runCollectionValidators(): void;
|
|
2198
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2199
|
-
private _runFileValidatorsForEntry;
|
|
2200
|
-
private _addCustomTypeToValidationError;
|
|
2201
|
-
private _getEntryValidationState;
|
|
2202
|
-
private _getValidatorDescriptors;
|
|
2203
|
-
private _getValidatorDescriptorsForEntry;
|
|
2204
|
-
destroy(): void;
|
|
2205
|
-
}
|
|
2575
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2206
2576
|
|
|
2207
2577
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2208
2578
|
willYield: boolean;
|
|
@@ -2214,9 +2584,7 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2214
2584
|
};
|
|
2215
2585
|
declare class LitBlock extends LitBlockBase {
|
|
2216
2586
|
private _cfgProxy;
|
|
2217
|
-
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2218
2587
|
static styleAttrs: string[];
|
|
2219
|
-
activityType: ActivityType;
|
|
2220
2588
|
init$: {};
|
|
2221
2589
|
constructor();
|
|
2222
2590
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2224,6 +2592,7 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2224
2592
|
protected _sharedInstancesBag: {
|
|
2225
2593
|
readonly ctx: PubSub<SharedState>;
|
|
2226
2594
|
readonly modalManager: ModalManager | null;
|
|
2595
|
+
readonly pluginManager: PluginManager;
|
|
2227
2596
|
readonly telemetryManager: TelemetryManager;
|
|
2228
2597
|
readonly localeManager: LocaleManager;
|
|
2229
2598
|
readonly a11y: A11y;
|
|
@@ -2233,6 +2602,34 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2233
2602
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2234
2603
|
readonly api: UploaderPublicApi;
|
|
2235
2604
|
readonly validationManager: ValidationManager;
|
|
2605
|
+
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2606
|
+
modalManager: ModalManager | null;
|
|
2607
|
+
pluginManager: PluginManager;
|
|
2608
|
+
telemetryManager: TelemetryManager;
|
|
2609
|
+
localeManager: LocaleManager;
|
|
2610
|
+
a11y: A11y;
|
|
2611
|
+
clipboard: ClipboardLayer;
|
|
2612
|
+
blocksRegistry: BlocksRegistry;
|
|
2613
|
+
eventEmitter: EventEmitter;
|
|
2614
|
+
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2615
|
+
secureUploadsManager: SecureUploadsManager;
|
|
2616
|
+
api: UploaderPublicApi;
|
|
2617
|
+
validationManager: ValidationManager;
|
|
2618
|
+
}[TName]>) => void): () => void;
|
|
2619
|
+
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2620
|
+
modalManager: ModalManager | null;
|
|
2621
|
+
pluginManager: PluginManager;
|
|
2622
|
+
telemetryManager: TelemetryManager;
|
|
2623
|
+
localeManager: LocaleManager;
|
|
2624
|
+
a11y: A11y;
|
|
2625
|
+
clipboard: ClipboardLayer;
|
|
2626
|
+
blocksRegistry: BlocksRegistry;
|
|
2627
|
+
eventEmitter: EventEmitter;
|
|
2628
|
+
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2629
|
+
secureUploadsManager: SecureUploadsManager;
|
|
2630
|
+
api: UploaderPublicApi;
|
|
2631
|
+
validationManager: ValidationManager;
|
|
2632
|
+
}[TName]>>;
|
|
2236
2633
|
};
|
|
2237
2634
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2238
2635
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2251,11 +2648,7 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2251
2648
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2252
2649
|
*/
|
|
2253
2650
|
private destroyCtxCallback;
|
|
2254
|
-
|
|
2255
|
-
* Adds a shared context instance if it does not exist yet.
|
|
2256
|
-
* @param key The shared state key.
|
|
2257
|
-
* @param resolver The resolver function that creates the instance.
|
|
2258
|
-
*/
|
|
2651
|
+
private _getSharedContextInstances;
|
|
2259
2652
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2260
2653
|
private _destroySharedContextInstances;
|
|
2261
2654
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2789,6 +3182,7 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
2789
3182
|
private _hasNetworkProblems;
|
|
2790
3183
|
private _isInitialized;
|
|
2791
3184
|
private _pendingInitUpdate;
|
|
3185
|
+
private _pendingSizeWait;
|
|
2792
3186
|
private readonly _debouncedShowLoader;
|
|
2793
3187
|
private readonly _imgRef;
|
|
2794
3188
|
private readonly _cropperRef;
|