@uploadcare/file-uploader 1.29.0-alpha.1 → 1.30.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +334 -691
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +82 -115
- package/dist/locales/file-uploader/ar.d.ts +2 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +2 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +2 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +2 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +2 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +2 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +2 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +2 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +2 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +2 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +2 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +2 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +2 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +2 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +2 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +2 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +2 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +2 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +2 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +2 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +2 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +2 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +2 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +2 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +2 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +2 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +2 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +2 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +2 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +2 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +2 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +2 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +2 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +2 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +336 -691
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
- package/web/file-uploader.min.d.ts +336 -691
- package/web/file-uploader.min.js +4 -4
- package/web/file-uploader.min.js.LEGAL.txt +1 -1
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +3 -3
- package/web/uc-cloud-image-editor.layered.min.css +3 -3
- package/web/uc-cloud-image-editor.min.css +3 -3
- package/web/uc-cloud-image-editor.min.d.ts +320 -675
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +3 -3
- package/web/uc-file-uploader-inline.min.d.ts +336 -691
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.d.ts +336 -691
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +3 -3
- package/web/uc-file-uploader-regular.min.d.ts +336 -691
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
- package/web/uc-img.min.js +3 -3
|
@@ -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';
|
|
3
4
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
4
5
|
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,6 +113,7 @@ 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;
|
|
116
117
|
'src-type-facebook': string;
|
|
117
118
|
'src-type-dropbox': string;
|
|
118
119
|
'src-type-gdrive': string;
|
|
@@ -127,6 +128,7 @@ declare const _default: {
|
|
|
127
128
|
'src-type-other': string;
|
|
128
129
|
'caption-from-url': string;
|
|
129
130
|
'caption-camera': string;
|
|
131
|
+
'caption-draw': string;
|
|
130
132
|
'caption-edit-file': string;
|
|
131
133
|
'file-no-name': string;
|
|
132
134
|
'toggle-fullscreen': string;
|
|
@@ -213,7 +215,7 @@ declare class Modal extends LitBlock {
|
|
|
213
215
|
private _handleDialogClose;
|
|
214
216
|
private _handleDialogMouseDown;
|
|
215
217
|
private _handleDialogMouseUp;
|
|
216
|
-
show():
|
|
218
|
+
show(): void;
|
|
217
219
|
hide(): void;
|
|
218
220
|
private _handleModalOpen;
|
|
219
221
|
private _handleModalClose;
|
|
@@ -229,176 +231,81 @@ declare global {
|
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
233
|
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
234
|
+
declare const InternalEventType: Readonly<{
|
|
235
|
+
readonly INIT_SOLUTION: "init-solution";
|
|
236
|
+
readonly CHANGE_CONFIG: "change-config";
|
|
237
|
+
readonly ACTION_EVENT: "action-event";
|
|
238
|
+
readonly ERROR_EVENT: "error-event";
|
|
239
|
+
}>;
|
|
240
|
+
declare const EventType: Readonly<{
|
|
241
|
+
readonly FILE_ADDED: "file-added";
|
|
242
|
+
readonly FILE_REMOVED: "file-removed";
|
|
243
|
+
readonly FILE_UPLOAD_START: "file-upload-start";
|
|
244
|
+
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
|
|
245
|
+
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
|
|
246
|
+
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
|
|
247
|
+
readonly FILE_URL_CHANGED: "file-url-changed";
|
|
248
|
+
readonly MODAL_OPEN: "modal-open";
|
|
249
|
+
readonly MODAL_CLOSE: "modal-close";
|
|
250
|
+
readonly DONE_CLICK: "done-click";
|
|
251
|
+
readonly UPLOAD_CLICK: "upload-click";
|
|
252
|
+
readonly ACTIVITY_CHANGE: "activity-change";
|
|
253
|
+
readonly COMMON_UPLOAD_START: "common-upload-start";
|
|
254
|
+
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
|
|
255
|
+
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
|
|
256
|
+
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
|
|
257
|
+
readonly CHANGE: "change";
|
|
258
|
+
readonly GROUP_CREATED: "group-created";
|
|
259
|
+
}>;
|
|
260
|
+
type EventKey = (typeof EventType)[keyof typeof EventType];
|
|
261
|
+
type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
|
|
262
|
+
type EventPayload = {
|
|
263
|
+
[EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
|
|
264
|
+
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
|
|
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'>;
|
|
263
288
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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;
|
|
301
|
-
destroy(): void;
|
|
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;
|
|
362
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
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>;
|
|
289
|
+
declare class EventEmitter extends SharedInstance {
|
|
290
|
+
private _timeoutStore;
|
|
291
|
+
private _targets;
|
|
292
|
+
bindTarget(target: LitBlock): () => void;
|
|
293
|
+
private _dispatch;
|
|
294
|
+
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
295
|
+
debounce?: TDebounce;
|
|
296
|
+
}): void;
|
|
370
297
|
destroy(): void;
|
|
371
|
-
private _notifySubscribers;
|
|
372
298
|
}
|
|
373
299
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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;
|
|
300
|
+
type PasteScope = 'local' | 'global' | false;
|
|
301
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
302
|
+
private scopes;
|
|
303
|
+
private listener;
|
|
393
304
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
private _addCustomTypeToValidationError;
|
|
399
|
-
private _getEntryValidationState;
|
|
400
|
-
private _getValidatorDescriptors;
|
|
401
|
-
private _getValidatorDescriptorsForEntry;
|
|
305
|
+
private openUploadList;
|
|
306
|
+
private _listener;
|
|
307
|
+
private handlePaste;
|
|
308
|
+
registerBlock(scope: Node): () => void;
|
|
402
309
|
destroy(): void;
|
|
403
310
|
}
|
|
404
311
|
|
|
@@ -413,14 +320,11 @@ declare global {
|
|
|
413
320
|
declare class Icon extends LitBlock {
|
|
414
321
|
name: string;
|
|
415
322
|
private _resolvedHref;
|
|
416
|
-
private _pluginSvg;
|
|
417
323
|
private _iconHrefResolver;
|
|
418
|
-
private _unsubscribePlugins?;
|
|
419
324
|
initCallback(): void;
|
|
420
325
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
421
326
|
private _updateResolvedHref;
|
|
422
327
|
render(): lit_html.TemplateResult<1>;
|
|
423
|
-
disconnectedCallback(): void;
|
|
424
328
|
}
|
|
425
329
|
declare global {
|
|
426
330
|
interface HTMLElementTagNameMap {
|
|
@@ -448,6 +352,7 @@ declare global {
|
|
|
448
352
|
type CameraMode = 'photo' | 'video';
|
|
449
353
|
declare class CameraSource extends LitUploaderBlock {
|
|
450
354
|
couldBeCtxOwner: boolean;
|
|
355
|
+
activityType: "camera";
|
|
451
356
|
private _unsubPermissions;
|
|
452
357
|
private _capturing;
|
|
453
358
|
private _chunks;
|
|
@@ -567,54 +472,25 @@ declare global {
|
|
|
567
472
|
/**
|
|
568
473
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
569
474
|
*/
|
|
570
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
475
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartButtonSettings"];
|
|
476
|
+
/** Mapping of attribute names to state */
|
|
477
|
+
declare const attrStateMapping: Record<string, string>;
|
|
571
478
|
declare class Config extends LitBlock {
|
|
572
479
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
573
480
|
'ctx-name': string;
|
|
574
481
|
};
|
|
575
482
|
init$: LitBlock["init$"] & ConfigType;
|
|
576
483
|
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;
|
|
604
484
|
private _flushValueToAttribute;
|
|
605
485
|
private _flushValueToState;
|
|
606
486
|
private _setValue;
|
|
607
487
|
private _getValue;
|
|
608
488
|
private _assertSameValueDifferentReference;
|
|
609
|
-
private _processCustomConfigs;
|
|
610
|
-
private _setupCustomConfigs;
|
|
611
|
-
private _setupMutationObserver;
|
|
612
489
|
initCallback(): void;
|
|
613
|
-
attributeChangedCallback(name:
|
|
614
|
-
disconnectedCallback(): void;
|
|
490
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
615
491
|
static get observedAttributes(): string[];
|
|
616
492
|
}
|
|
617
|
-
interface Config extends ConfigType
|
|
493
|
+
interface Config extends ConfigType {
|
|
618
494
|
}
|
|
619
495
|
declare global {
|
|
620
496
|
interface HTMLElementTagNameMap {
|
|
@@ -622,6 +498,49 @@ declare global {
|
|
|
622
498
|
}
|
|
623
499
|
}
|
|
624
500
|
|
|
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
|
+
|
|
625
544
|
declare class FileItemConfig extends LitUploaderBlock {
|
|
626
545
|
private _entrySubs;
|
|
627
546
|
protected entry: UploadEntryTypedData | null;
|
|
@@ -698,12 +617,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
698
617
|
private _isFailed;
|
|
699
618
|
private _isUploading;
|
|
700
619
|
private _isFocused;
|
|
620
|
+
private _isEditable;
|
|
701
621
|
private _showFileNames;
|
|
702
622
|
private _ariaLabelStatusFile;
|
|
703
|
-
private _pluginFileActions;
|
|
704
623
|
private _renderedOnce;
|
|
705
624
|
private _observer?;
|
|
706
|
-
private
|
|
625
|
+
private _handleEdit;
|
|
707
626
|
private _handleRemove;
|
|
708
627
|
private _handleUploadClick;
|
|
709
628
|
private _calculateState;
|
|
@@ -715,8 +634,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
715
634
|
private _handleEntryId;
|
|
716
635
|
private _updateShowFileNames;
|
|
717
636
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
718
|
-
private _updatePluginFileActions;
|
|
719
|
-
private _handlePluginFileAction;
|
|
720
637
|
initCallback(): void;
|
|
721
638
|
connectedCallback(): void;
|
|
722
639
|
disconnectedCallback(): void;
|
|
@@ -816,7 +733,6 @@ declare global {
|
|
|
816
733
|
declare const ExternalUploadSource: Readonly<{
|
|
817
734
|
readonly FACEBOOK: "facebook";
|
|
818
735
|
readonly DROPBOX: "dropbox";
|
|
819
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
820
736
|
readonly GDRIVE: "gdrive";
|
|
821
737
|
readonly GPHOTOS: "gphotos";
|
|
822
738
|
readonly FLICKR: "flickr";
|
|
@@ -829,7 +745,6 @@ declare const ExternalUploadSource: Readonly<{
|
|
|
829
745
|
declare const UploadSource: Readonly<{
|
|
830
746
|
readonly FACEBOOK: "facebook";
|
|
831
747
|
readonly DROPBOX: "dropbox";
|
|
832
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
833
748
|
readonly GDRIVE: "gdrive";
|
|
834
749
|
readonly GPHOTOS: "gphotos";
|
|
835
750
|
readonly FLICKR: "flickr";
|
|
@@ -846,6 +761,7 @@ declare const UploadSource: Readonly<{
|
|
|
846
761
|
readonly EXTERNAL: "external";
|
|
847
762
|
readonly API: "js-api";
|
|
848
763
|
readonly URL: "url";
|
|
764
|
+
readonly DRAW: "draw";
|
|
849
765
|
}>;
|
|
850
766
|
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
851
767
|
|
|
@@ -900,111 +816,103 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
900
816
|
}>;
|
|
901
817
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
902
818
|
|
|
903
|
-
declare
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
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'>;
|
|
819
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
820
|
+
|
|
821
|
+
type ApiAddFileCommonOptions = {
|
|
822
|
+
silent?: boolean;
|
|
823
|
+
fileName?: string;
|
|
824
|
+
source?: string;
|
|
957
825
|
};
|
|
958
|
-
declare class
|
|
959
|
-
private
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
})
|
|
968
|
-
|
|
826
|
+
declare class UploaderPublicApi extends SharedInstance {
|
|
827
|
+
private _l10n;
|
|
828
|
+
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
829
|
+
get cfg(): Readonly<ConfigType>;
|
|
830
|
+
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
831
|
+
/**
|
|
832
|
+
* TODO: Probably we should not allow user to override `source` property
|
|
833
|
+
*/
|
|
834
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
835
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
836
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
837
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
838
|
+
fullPath?: string;
|
|
839
|
+
}) => OutputFileEntry<"idle">;
|
|
840
|
+
removeFileByInternalId: (internalId: string) => void;
|
|
841
|
+
removeAllFiles(): void;
|
|
842
|
+
uploadAll: () => void;
|
|
843
|
+
openSystemDialog: (options?: {
|
|
844
|
+
captureCamera?: boolean;
|
|
845
|
+
modeCamera?: ModeCameraType;
|
|
846
|
+
}) => void;
|
|
847
|
+
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
848
|
+
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
849
|
+
initFlow: (force?: boolean) => void;
|
|
850
|
+
doneFlow: () => void;
|
|
851
|
+
setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
|
|
852
|
+
getCurrentActivity: () => ActivityType;
|
|
853
|
+
setModalState: (opened: boolean) => void;
|
|
854
|
+
private get _sourceList();
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
declare class SourceBtn extends LitUploaderBlock {
|
|
858
|
+
couldBeCtxOwner: boolean;
|
|
859
|
+
private _registeredTypes;
|
|
860
|
+
type?: string;
|
|
861
|
+
onlyIcon: boolean;
|
|
862
|
+
private _iconName;
|
|
863
|
+
private _srcTypeKey;
|
|
864
|
+
private _initTypes;
|
|
865
|
+
initCallback(): void;
|
|
866
|
+
private _registerType;
|
|
867
|
+
activate(): void;
|
|
868
|
+
private _applyType;
|
|
869
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
870
|
+
render(): lit_html.TemplateResult<1>;
|
|
871
|
+
}
|
|
872
|
+
declare global {
|
|
873
|
+
interface HTMLElementTagNameMap {
|
|
874
|
+
'uc-source-btn': SourceBtn;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
declare class Dropdown extends LitBlock {
|
|
879
|
+
private _id;
|
|
880
|
+
protected render(): unknown;
|
|
881
|
+
}
|
|
882
|
+
declare global {
|
|
883
|
+
interface HTMLElementTagNameMap {
|
|
884
|
+
'uc-dropdown': Dropdown;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
|
|
889
|
+
type AdvancedSmartBtnConfig = {
|
|
890
|
+
sourceList: string;
|
|
891
|
+
mode: SmartButtonMode;
|
|
892
|
+
};
|
|
893
|
+
declare class SmartBtn extends LitUploaderBlock {
|
|
894
|
+
static styleAttrs: string[];
|
|
895
|
+
couldBeCtxOwner: boolean;
|
|
896
|
+
dropzone: boolean;
|
|
897
|
+
private _sourceList;
|
|
898
|
+
private _status;
|
|
899
|
+
private _buttonTextKey;
|
|
900
|
+
private _entry;
|
|
901
|
+
private _lastDigest;
|
|
902
|
+
private _visible;
|
|
903
|
+
private get isIdle();
|
|
904
|
+
private get buttonText();
|
|
905
|
+
private _throttledHandleCollectionUpdate;
|
|
906
|
+
private _updateButtonBasedOnCollectionState;
|
|
907
|
+
initCallback(): void;
|
|
908
|
+
private readonly _handleClickAbort;
|
|
909
|
+
private readonly _handleClick;
|
|
910
|
+
render(): lit_html.TemplateResult<1>;
|
|
969
911
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
source?: string;
|
|
975
|
-
};
|
|
976
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
977
|
-
private _l10n;
|
|
978
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
979
|
-
get cfg(): Readonly<ConfigType>;
|
|
980
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
981
|
-
/**
|
|
982
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
983
|
-
*/
|
|
984
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
985
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
986
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
987
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
988
|
-
fullPath?: string;
|
|
989
|
-
}) => OutputFileEntry<"idle">;
|
|
990
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
991
|
-
removeAllFiles(): void;
|
|
992
|
-
uploadAll: () => void;
|
|
993
|
-
openSystemDialog: (options?: {
|
|
994
|
-
captureCamera?: boolean;
|
|
995
|
-
modeCamera?: ModeCameraType;
|
|
996
|
-
}) => void;
|
|
997
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
998
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
999
|
-
initFlow: (force?: boolean) => void;
|
|
1000
|
-
doneFlow: () => void;
|
|
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);
|
|
1004
|
-
getCurrentActivity: () => ActivityType;
|
|
1005
|
-
historyBack: () => void;
|
|
1006
|
-
setModalState: (opened: boolean) => void;
|
|
1007
|
-
private get _sourceList();
|
|
912
|
+
declare global {
|
|
913
|
+
interface HTMLElementTagNameMap {
|
|
914
|
+
'uc-smart-btn': SmartBtn;
|
|
915
|
+
}
|
|
1008
916
|
}
|
|
1009
917
|
|
|
1010
918
|
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
|
|
@@ -1219,10 +1127,6 @@ type ConfigType = {
|
|
|
1219
1127
|
* Expiry threshold for secure uploads.
|
|
1220
1128
|
*/
|
|
1221
1129
|
secureUploadsExpireThreshold: number;
|
|
1222
|
-
/**
|
|
1223
|
-
* Array of plugins to register with the uploader instance.
|
|
1224
|
-
*/
|
|
1225
|
-
plugins: UploaderPlugin[];
|
|
1226
1130
|
/**
|
|
1227
1131
|
* Metadata for the file.
|
|
1228
1132
|
*/
|
|
@@ -1308,6 +1212,7 @@ type ConfigType = {
|
|
|
1308
1212
|
* Define the clipboard paste scope.
|
|
1309
1213
|
*/
|
|
1310
1214
|
pasteScope: PasteScope;
|
|
1215
|
+
smartButtonSettings: AdvancedSmartBtnConfig | null;
|
|
1311
1216
|
};
|
|
1312
1217
|
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
1313
1218
|
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -1474,165 +1379,6 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
1474
1379
|
allEntries: OutputFileEntry[];
|
|
1475
1380
|
});
|
|
1476
1381
|
|
|
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
|
-
|
|
1636
1382
|
declare class SecureUploadsManager extends SharedInstance {
|
|
1637
1383
|
private _secureToken;
|
|
1638
1384
|
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
@@ -1677,6 +1423,7 @@ declare class LitUploaderBlock extends LitActivityBlock {
|
|
|
1677
1423
|
private _handleCollectionUpdate;
|
|
1678
1424
|
private _handleCollectionPropertiesUpdate;
|
|
1679
1425
|
private _flushCommonUploadProgress;
|
|
1426
|
+
private _openCloudImageEditor;
|
|
1680
1427
|
private _setInitialCrop;
|
|
1681
1428
|
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1682
1429
|
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
@@ -1746,11 +1493,12 @@ type ActivityParams$1 = {
|
|
|
1746
1493
|
internalId: string;
|
|
1747
1494
|
};
|
|
1748
1495
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1496
|
+
couldBeCtxOwner: boolean;
|
|
1497
|
+
activityType: "cloud-image-edit";
|
|
1749
1498
|
private _entry?;
|
|
1750
1499
|
private _editorConfig;
|
|
1751
1500
|
get activityParams(): ActivityParams$1;
|
|
1752
1501
|
initCallback(): void;
|
|
1753
|
-
disconnectedCallback(): void;
|
|
1754
1502
|
private _handleApply;
|
|
1755
1503
|
private _handleCancel;
|
|
1756
1504
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1779,6 +1527,7 @@ type ActivityParams = {
|
|
|
1779
1527
|
};
|
|
1780
1528
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1781
1529
|
couldBeCtxOwner: boolean;
|
|
1530
|
+
activityType: "external";
|
|
1782
1531
|
private _messageBridge?;
|
|
1783
1532
|
private _iframeRef;
|
|
1784
1533
|
private _latestSelectionSummary;
|
|
@@ -1822,26 +1571,22 @@ declare global {
|
|
|
1822
1571
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1823
1572
|
START_FROM: "start-from";
|
|
1824
1573
|
CAMERA: "camera";
|
|
1574
|
+
DRAW: "draw";
|
|
1825
1575
|
UPLOAD_LIST: "upload-list";
|
|
1826
1576
|
URL: "url";
|
|
1827
1577
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1828
1578
|
EXTERNAL: "external";
|
|
1829
1579
|
}>;
|
|
1830
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1831
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1580
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1581
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1832
1582
|
|
|
1833
1583
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1834
|
-
interface CustomActivities {
|
|
1835
|
-
}
|
|
1836
1584
|
type ActivityParamsMap = {
|
|
1837
1585
|
'cloud-image-edit': ActivityParams$1;
|
|
1838
1586
|
external: ActivityParams;
|
|
1839
|
-
} & {
|
|
1840
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1841
1587
|
};
|
|
1842
1588
|
declare class LitActivityBlock extends LitBlock {
|
|
1843
1589
|
protected historyTracked: boolean;
|
|
1844
|
-
activityType: ActivityType;
|
|
1845
1590
|
private [ACTIVE_PROP]?;
|
|
1846
1591
|
init$: {
|
|
1847
1592
|
'*currentActivity': null;
|
|
@@ -1855,11 +1600,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1855
1600
|
private _activate;
|
|
1856
1601
|
initCallback(): void;
|
|
1857
1602
|
private _historyFlush;
|
|
1858
|
-
|
|
1603
|
+
private _isActivityRegistered;
|
|
1859
1604
|
private static _activityCallbacks;
|
|
1860
1605
|
static activities: Readonly<{
|
|
1861
1606
|
START_FROM: 'start-from';
|
|
1862
1607
|
CAMERA: 'camera';
|
|
1608
|
+
DRAW: 'draw';
|
|
1863
1609
|
UPLOAD_LIST: 'upload-list';
|
|
1864
1610
|
URL: 'url';
|
|
1865
1611
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1875,8 +1621,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1875
1621
|
private _unregisterActivity;
|
|
1876
1622
|
disconnectedCallback(): void;
|
|
1877
1623
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1878
|
-
get initActivity():
|
|
1879
|
-
get doneActivity():
|
|
1624
|
+
get initActivity(): string | null;
|
|
1625
|
+
get doneActivity(): string | null;
|
|
1880
1626
|
historyBack(): void;
|
|
1881
1627
|
}
|
|
1882
1628
|
|
|
@@ -1931,19 +1677,10 @@ declare class ModalManager extends SharedInstance {
|
|
|
1931
1677
|
destroy(): void;
|
|
1932
1678
|
}
|
|
1933
1679
|
|
|
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
|
-
|
|
1941
1680
|
declare class LitSolutionBlock extends LitBlock {
|
|
1942
1681
|
static styleAttrs: string[];
|
|
1943
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
1944
1682
|
init$: {
|
|
1945
1683
|
'*solution': string | null;
|
|
1946
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
1947
1684
|
'*commonProgress': number;
|
|
1948
1685
|
'*uploadList': never[];
|
|
1949
1686
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -2075,32 +1812,9 @@ declare global {
|
|
|
2075
1812
|
}
|
|
2076
1813
|
}
|
|
2077
1814
|
|
|
2078
|
-
|
|
2079
|
-
id: string;
|
|
2080
|
-
label: string;
|
|
2081
|
-
icon?: string;
|
|
2082
|
-
onClick: () => void | Promise<void>;
|
|
2083
|
-
};
|
|
2084
|
-
declare class SourceBtn extends LitUploaderBlock {
|
|
2085
|
-
couldBeCtxOwner: boolean;
|
|
2086
|
-
source?: SourceButtonConfig;
|
|
2087
|
-
private _iconName;
|
|
2088
|
-
private _srcTypeKey;
|
|
2089
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2090
|
-
private _applySource;
|
|
2091
|
-
activate(): void;
|
|
2092
|
-
render(): lit_html.TemplateResult<1>;
|
|
2093
|
-
}
|
|
2094
|
-
declare global {
|
|
2095
|
-
interface HTMLElementTagNameMap {
|
|
2096
|
-
'uc-source-btn': SourceBtn;
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
|
-
declare class SourceList extends LitUploaderBlock {
|
|
1815
|
+
declare class SourceList extends LitBlock {
|
|
2101
1816
|
private _rawSourceList;
|
|
2102
|
-
private
|
|
2103
|
-
private _sources;
|
|
1817
|
+
private _cameraModes;
|
|
2104
1818
|
/**
|
|
2105
1819
|
* CSS-only attribute
|
|
2106
1820
|
*/
|
|
@@ -2108,10 +1822,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
2108
1822
|
initCallback(): void;
|
|
2109
1823
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
2110
1824
|
private _updateSources;
|
|
2111
|
-
private
|
|
2112
|
-
private _makePluginSourceConfig;
|
|
1825
|
+
private _sources;
|
|
2113
1826
|
render(): lit_html.TemplateResult<1>;
|
|
2114
|
-
disconnectedCallback(): void;
|
|
2115
1827
|
}
|
|
2116
1828
|
declare global {
|
|
2117
1829
|
interface HTMLElementTagNameMap {
|
|
@@ -2166,8 +1878,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
2166
1878
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
2167
1879
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
2168
1880
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2169
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2170
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
2171
1881
|
}
|
|
2172
1882
|
declare global {
|
|
2173
1883
|
interface HTMLElementTagNameMap {
|
|
@@ -2175,71 +1885,45 @@ declare global {
|
|
|
2175
1885
|
}
|
|
2176
1886
|
}
|
|
2177
1887
|
|
|
2178
|
-
declare class
|
|
2179
|
-
static styleAttrs: string[];
|
|
1888
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
2180
1889
|
couldBeCtxOwner: boolean;
|
|
2181
|
-
|
|
2182
|
-
private
|
|
2183
|
-
private readonly _handleClick;
|
|
1890
|
+
activityType: ActivityType;
|
|
1891
|
+
private _formState;
|
|
2184
1892
|
initCallback(): void;
|
|
1893
|
+
private _inputRef;
|
|
1894
|
+
private _handleInput;
|
|
1895
|
+
private _handleUpload;
|
|
2185
1896
|
render(): lit_html.TemplateResult<1>;
|
|
2186
1897
|
}
|
|
2187
1898
|
declare global {
|
|
2188
1899
|
interface HTMLElementTagNameMap {
|
|
2189
|
-
'uc-
|
|
1900
|
+
'uc-url-source': UrlSource;
|
|
2190
1901
|
}
|
|
2191
1902
|
}
|
|
2192
1903
|
|
|
2193
|
-
declare class
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
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?;
|
|
1904
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
1905
|
+
static styleAttrs: string[];
|
|
1906
|
+
couldBeCtxOwner: boolean;
|
|
1907
|
+
dropzone: boolean;
|
|
1908
|
+
private _buttonTextKey;
|
|
1909
|
+
private readonly _handleClick;
|
|
2209
1910
|
initCallback(): void;
|
|
2210
|
-
private _syncActivities;
|
|
2211
|
-
disconnectedCallback(): void;
|
|
2212
|
-
render(): lit_html.TemplateResult<1>;
|
|
2213
|
-
}
|
|
2214
|
-
declare global {
|
|
2215
|
-
interface HTMLElementTagNameMap {
|
|
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
1911
|
render(): lit_html.TemplateResult<1>;
|
|
2228
1912
|
}
|
|
2229
1913
|
declare global {
|
|
2230
1914
|
interface HTMLElementTagNameMap {
|
|
2231
|
-
'uc-
|
|
1915
|
+
'uc-simple-btn': SimpleBtn;
|
|
2232
1916
|
}
|
|
2233
1917
|
}
|
|
2234
1918
|
|
|
2235
1919
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
2236
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2237
1920
|
attributesMeta: {
|
|
2238
1921
|
headless?: boolean;
|
|
2239
1922
|
'ctx-name': string;
|
|
2240
1923
|
};
|
|
2241
1924
|
static styleAttrs: string[];
|
|
2242
1925
|
headless: boolean;
|
|
1926
|
+
smart: boolean;
|
|
2243
1927
|
constructor();
|
|
2244
1928
|
initCallback(): void;
|
|
2245
1929
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -2251,7 +1935,6 @@ declare global {
|
|
|
2251
1935
|
}
|
|
2252
1936
|
|
|
2253
1937
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
2254
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2255
1938
|
attributesMeta: {
|
|
2256
1939
|
'ctx-name': string;
|
|
2257
1940
|
};
|
|
@@ -2272,7 +1955,6 @@ declare global {
|
|
|
2272
1955
|
}
|
|
2273
1956
|
|
|
2274
1957
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
2275
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2276
1958
|
attributesMeta: {
|
|
2277
1959
|
'ctx-name': string;
|
|
2278
1960
|
};
|
|
@@ -2307,8 +1989,6 @@ declare class A11y implements ISharedInstance {
|
|
|
2307
1989
|
declare class LocaleManager extends SharedInstance {
|
|
2308
1990
|
private _localeName;
|
|
2309
1991
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2310
|
-
private _applyOverrides;
|
|
2311
|
-
private _applyPluginLocales;
|
|
2312
1992
|
}
|
|
2313
1993
|
|
|
2314
1994
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2349,69 +2029,6 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2349
2029
|
private get _location();
|
|
2350
2030
|
}
|
|
2351
2031
|
|
|
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
|
-
|
|
2415
2032
|
declare const TabId: Readonly<{
|
|
2416
2033
|
readonly CROP: "crop";
|
|
2417
2034
|
readonly TUNING: "tuning";
|
|
@@ -2476,14 +2093,11 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
|
|
|
2476
2093
|
type SharedConfigState = {
|
|
2477
2094
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2478
2095
|
};
|
|
2479
|
-
type SharedCustomConfigState = {
|
|
2480
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2481
|
-
};
|
|
2482
2096
|
type BlocksRegistry = Set<LitBlock>;
|
|
2483
2097
|
type ActivityBlockCtxState = {
|
|
2484
|
-
'*currentActivity':
|
|
2098
|
+
'*currentActivity': string | null;
|
|
2485
2099
|
'*currentActivityParams': Record<string, unknown>;
|
|
2486
|
-
'*history': (
|
|
2100
|
+
'*history': (string | null)[];
|
|
2487
2101
|
'*historyBack': (() => void) | null;
|
|
2488
2102
|
'*closeModal': () => void;
|
|
2489
2103
|
};
|
|
@@ -2500,7 +2114,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2500
2114
|
};
|
|
2501
2115
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2502
2116
|
'*solution': string | null;
|
|
2503
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2504
2117
|
};
|
|
2505
2118
|
type CloudImageEditorState = {
|
|
2506
2119
|
'*originalUrl': string | null;
|
|
@@ -2551,9 +2164,7 @@ type EditorToolbarState = {
|
|
|
2551
2164
|
'*currentOperation': string | null;
|
|
2552
2165
|
'*operationTooltip': string | null;
|
|
2553
2166
|
};
|
|
2554
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2555
2167
|
type DynamicBlockState = {
|
|
2556
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2557
2168
|
'*blocksRegistry': BlocksRegistry;
|
|
2558
2169
|
'*eventEmitter': EventEmitter;
|
|
2559
2170
|
'*localeManager': LocaleManager;
|
|
@@ -2561,7 +2172,6 @@ type DynamicBlockState = {
|
|
|
2561
2172
|
'*a11y': A11y;
|
|
2562
2173
|
'*modalManager': ModalManager | null;
|
|
2563
2174
|
'*clipboard': ClipboardLayer;
|
|
2564
|
-
'*pluginManager': PluginManager;
|
|
2565
2175
|
};
|
|
2566
2176
|
type DynamicUploaderBlockState = {
|
|
2567
2177
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2572,7 +2182,66 @@ type DynamicUploaderBlockState = {
|
|
|
2572
2182
|
type LocaleState = {
|
|
2573
2183
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2574
2184
|
};
|
|
2575
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2185
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2186
|
+
|
|
2187
|
+
interface ISharedInstance {
|
|
2188
|
+
destroy?(): void;
|
|
2189
|
+
}
|
|
2190
|
+
declare class SharedInstance {
|
|
2191
|
+
protected _ctx: PubSub<SharedState>;
|
|
2192
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2193
|
+
private _subscriptions;
|
|
2194
|
+
private _cfgProxy;
|
|
2195
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2196
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2197
|
+
protected addSub(unsub: () => void): void;
|
|
2198
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2199
|
+
destroy(): void;
|
|
2200
|
+
}
|
|
2201
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2202
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2203
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2204
|
+
readonly ctx: PubSub<SharedState>;
|
|
2205
|
+
readonly modalManager: ModalManager | null;
|
|
2206
|
+
readonly telemetryManager: TelemetryManager;
|
|
2207
|
+
readonly localeManager: LocaleManager;
|
|
2208
|
+
readonly a11y: A11y;
|
|
2209
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2210
|
+
readonly eventEmitter: EventEmitter;
|
|
2211
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2212
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2213
|
+
readonly api: UploaderPublicApi;
|
|
2214
|
+
readonly validationManager: ValidationManager;
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2218
|
+
signal?: AbortSignal;
|
|
2219
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2220
|
+
type FileValidatorDescriptor = {
|
|
2221
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2222
|
+
validator: FuncFileValidator;
|
|
2223
|
+
};
|
|
2224
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2225
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2226
|
+
declare class ValidationManager extends SharedInstance {
|
|
2227
|
+
private get _uploadCollection();
|
|
2228
|
+
private _commonFileValidators;
|
|
2229
|
+
private _commonCollectionValidators;
|
|
2230
|
+
private _queue;
|
|
2231
|
+
private _runQueueDebounced;
|
|
2232
|
+
private _isDestroyed;
|
|
2233
|
+
private _entryValidationState;
|
|
2234
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2235
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2236
|
+
runCollectionValidators(): void;
|
|
2237
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2238
|
+
private _runFileValidatorsForEntry;
|
|
2239
|
+
private _addCustomTypeToValidationError;
|
|
2240
|
+
private _getEntryValidationState;
|
|
2241
|
+
private _getValidatorDescriptors;
|
|
2242
|
+
private _getValidatorDescriptorsForEntry;
|
|
2243
|
+
destroy(): void;
|
|
2244
|
+
}
|
|
2576
2245
|
|
|
2577
2246
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2578
2247
|
willYield: boolean;
|
|
@@ -2584,7 +2253,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2584
2253
|
};
|
|
2585
2254
|
declare class LitBlock extends LitBlockBase {
|
|
2586
2255
|
private _cfgProxy;
|
|
2256
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2587
2257
|
static styleAttrs: string[];
|
|
2258
|
+
activityType: ActivityType;
|
|
2588
2259
|
init$: {};
|
|
2589
2260
|
constructor();
|
|
2590
2261
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2592,7 +2263,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2592
2263
|
protected _sharedInstancesBag: {
|
|
2593
2264
|
readonly ctx: PubSub<SharedState>;
|
|
2594
2265
|
readonly modalManager: ModalManager | null;
|
|
2595
|
-
readonly pluginManager: PluginManager;
|
|
2596
2266
|
readonly telemetryManager: TelemetryManager;
|
|
2597
2267
|
readonly localeManager: LocaleManager;
|
|
2598
2268
|
readonly a11y: A11y;
|
|
@@ -2602,34 +2272,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2602
2272
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2603
2273
|
readonly api: UploaderPublicApi;
|
|
2604
2274
|
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]>>;
|
|
2633
2275
|
};
|
|
2634
2276
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2635
2277
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2648,7 +2290,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2648
2290
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2649
2291
|
*/
|
|
2650
2292
|
private destroyCtxCallback;
|
|
2651
|
-
|
|
2293
|
+
/**
|
|
2294
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2295
|
+
* @param key The shared state key.
|
|
2296
|
+
* @param resolver The resolver function that creates the instance.
|
|
2297
|
+
*/
|
|
2652
2298
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2653
2299
|
private _destroySharedContextInstances;
|
|
2654
2300
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -3182,7 +2828,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
3182
2828
|
private _hasNetworkProblems;
|
|
3183
2829
|
private _isInitialized;
|
|
3184
2830
|
private _pendingInitUpdate;
|
|
3185
|
-
private _pendingSizeWait;
|
|
3186
2831
|
private readonly _debouncedShowLoader;
|
|
3187
2832
|
private readonly _imgRef;
|
|
3188
2833
|
private readonly _cropperRef;
|