@uploadcare/file-uploader 1.29.0-alpha.2 → 1.30.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +335 -691
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +82 -115
- package/dist/locales/file-uploader/ar.d.ts +2 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +2 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +2 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +2 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +2 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +2 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +2 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +2 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +2 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +2 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +2 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +2 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +2 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +2 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +2 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +2 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +2 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +2 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +2 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +2 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +2 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +2 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +2 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +2 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +2 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +2 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +2 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +2 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +2 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +2 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +2 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +2 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +2 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +2 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +337 -691
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
- package/web/file-uploader.min.d.ts +337 -691
- package/web/file-uploader.min.js +4 -4
- package/web/file-uploader.min.js.LEGAL.txt +1 -1
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +3 -3
- package/web/uc-cloud-image-editor.layered.min.css +3 -3
- package/web/uc-cloud-image-editor.min.css +3 -3
- package/web/uc-cloud-image-editor.min.d.ts +321 -675
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +3 -3
- package/web/uc-file-uploader-inline.min.d.ts +337 -691
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.d.ts +337 -691
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +3 -3
- package/web/uc-file-uploader-regular.min.d.ts +337 -691
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
- package/web/uc-img.min.js +3 -3
|
@@ -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;
|
|
@@ -469,6 +374,7 @@ declare class CameraSource extends LitUploaderBlock {
|
|
|
469
374
|
private _timerRef;
|
|
470
375
|
private _lineRef;
|
|
471
376
|
private _videoRef;
|
|
377
|
+
private _switcherRef;
|
|
472
378
|
private _startTime;
|
|
473
379
|
private _elapsedTime;
|
|
474
380
|
private _videoTransformCss;
|
|
@@ -566,54 +472,25 @@ declare global {
|
|
|
566
472
|
/**
|
|
567
473
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
568
474
|
*/
|
|
569
|
-
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>;
|
|
570
478
|
declare class Config extends LitBlock {
|
|
571
479
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
572
480
|
'ctx-name': string;
|
|
573
481
|
};
|
|
574
482
|
init$: LitBlock["init$"] & ConfigType;
|
|
575
483
|
private _computationControllers;
|
|
576
|
-
private _pluginChangeUnsubscribe?;
|
|
577
|
-
private _mutationObserver?;
|
|
578
|
-
/**
|
|
579
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
580
|
-
* Updated dynamically when plugins are registered or changed.
|
|
581
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
582
|
-
*/
|
|
583
|
-
private _customAttrKeyMapping;
|
|
584
|
-
/** Set of all custom config names registered by plugins */
|
|
585
|
-
private _customConfigKeys;
|
|
586
|
-
/**
|
|
587
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
588
|
-
* Used to track and clean up subscriptions when plugins change
|
|
589
|
-
*/
|
|
590
|
-
private _customConfigSubscriptions;
|
|
591
|
-
/**
|
|
592
|
-
* Check if a key is a custom config (registered by plugins)
|
|
593
|
-
*/
|
|
594
|
-
private _isCustomConfig;
|
|
595
|
-
/**
|
|
596
|
-
* Get the custom config definition for a key
|
|
597
|
-
*/
|
|
598
|
-
private _getCustomConfigDefinition;
|
|
599
|
-
/**
|
|
600
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
601
|
-
*/
|
|
602
|
-
private _getAttributeNames;
|
|
603
484
|
private _flushValueToAttribute;
|
|
604
485
|
private _flushValueToState;
|
|
605
486
|
private _setValue;
|
|
606
487
|
private _getValue;
|
|
607
488
|
private _assertSameValueDifferentReference;
|
|
608
|
-
private _processCustomConfigs;
|
|
609
|
-
private _setupCustomConfigs;
|
|
610
|
-
private _setupMutationObserver;
|
|
611
489
|
initCallback(): void;
|
|
612
|
-
attributeChangedCallback(name:
|
|
613
|
-
disconnectedCallback(): void;
|
|
490
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
614
491
|
static get observedAttributes(): string[];
|
|
615
492
|
}
|
|
616
|
-
interface Config extends ConfigType
|
|
493
|
+
interface Config extends ConfigType {
|
|
617
494
|
}
|
|
618
495
|
declare global {
|
|
619
496
|
interface HTMLElementTagNameMap {
|
|
@@ -621,6 +498,49 @@ declare global {
|
|
|
621
498
|
}
|
|
622
499
|
}
|
|
623
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
|
+
|
|
624
544
|
declare class FileItemConfig extends LitUploaderBlock {
|
|
625
545
|
private _entrySubs;
|
|
626
546
|
protected entry: UploadEntryTypedData | null;
|
|
@@ -697,12 +617,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
697
617
|
private _isFailed;
|
|
698
618
|
private _isUploading;
|
|
699
619
|
private _isFocused;
|
|
620
|
+
private _isEditable;
|
|
700
621
|
private _showFileNames;
|
|
701
622
|
private _ariaLabelStatusFile;
|
|
702
|
-
private _pluginFileActions;
|
|
703
623
|
private _renderedOnce;
|
|
704
624
|
private _observer?;
|
|
705
|
-
private
|
|
625
|
+
private _handleEdit;
|
|
706
626
|
private _handleRemove;
|
|
707
627
|
private _handleUploadClick;
|
|
708
628
|
private _calculateState;
|
|
@@ -714,8 +634,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
714
634
|
private _handleEntryId;
|
|
715
635
|
private _updateShowFileNames;
|
|
716
636
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
717
|
-
private _updatePluginFileActions;
|
|
718
|
-
private _handlePluginFileAction;
|
|
719
637
|
initCallback(): void;
|
|
720
638
|
connectedCallback(): void;
|
|
721
639
|
disconnectedCallback(): void;
|
|
@@ -815,7 +733,6 @@ declare global {
|
|
|
815
733
|
declare const ExternalUploadSource: Readonly<{
|
|
816
734
|
readonly FACEBOOK: "facebook";
|
|
817
735
|
readonly DROPBOX: "dropbox";
|
|
818
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
819
736
|
readonly GDRIVE: "gdrive";
|
|
820
737
|
readonly GPHOTOS: "gphotos";
|
|
821
738
|
readonly FLICKR: "flickr";
|
|
@@ -828,7 +745,6 @@ declare const ExternalUploadSource: Readonly<{
|
|
|
828
745
|
declare const UploadSource: Readonly<{
|
|
829
746
|
readonly FACEBOOK: "facebook";
|
|
830
747
|
readonly DROPBOX: "dropbox";
|
|
831
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
832
748
|
readonly GDRIVE: "gdrive";
|
|
833
749
|
readonly GPHOTOS: "gphotos";
|
|
834
750
|
readonly FLICKR: "flickr";
|
|
@@ -845,6 +761,7 @@ declare const UploadSource: Readonly<{
|
|
|
845
761
|
readonly EXTERNAL: "external";
|
|
846
762
|
readonly API: "js-api";
|
|
847
763
|
readonly URL: "url";
|
|
764
|
+
readonly DRAW: "draw";
|
|
848
765
|
}>;
|
|
849
766
|
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
850
767
|
|
|
@@ -899,111 +816,103 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
899
816
|
}>;
|
|
900
817
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
901
818
|
|
|
902
|
-
declare
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
declare const EventType: Readonly<{
|
|
909
|
-
readonly FILE_ADDED: "file-added";
|
|
910
|
-
readonly FILE_REMOVED: "file-removed";
|
|
911
|
-
readonly FILE_UPLOAD_START: "file-upload-start";
|
|
912
|
-
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
|
|
913
|
-
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
|
|
914
|
-
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
|
|
915
|
-
readonly FILE_URL_CHANGED: "file-url-changed";
|
|
916
|
-
readonly MODAL_OPEN: "modal-open";
|
|
917
|
-
readonly MODAL_CLOSE: "modal-close";
|
|
918
|
-
readonly DONE_CLICK: "done-click";
|
|
919
|
-
readonly UPLOAD_CLICK: "upload-click";
|
|
920
|
-
readonly ACTIVITY_CHANGE: "activity-change";
|
|
921
|
-
readonly COMMON_UPLOAD_START: "common-upload-start";
|
|
922
|
-
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
|
|
923
|
-
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
|
|
924
|
-
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
|
|
925
|
-
readonly CHANGE: "change";
|
|
926
|
-
readonly GROUP_CREATED: "group-created";
|
|
927
|
-
}>;
|
|
928
|
-
type EventKey = (typeof EventType)[keyof typeof EventType];
|
|
929
|
-
type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
|
|
930
|
-
type EventPayload = {
|
|
931
|
-
[EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
|
|
932
|
-
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
|
|
933
|
-
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
|
|
934
|
-
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
|
|
935
|
-
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
|
|
936
|
-
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
|
|
937
|
-
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
|
|
938
|
-
[EventType.MODAL_OPEN]: {
|
|
939
|
-
modalId: ModalId;
|
|
940
|
-
};
|
|
941
|
-
[EventType.MODAL_CLOSE]: {
|
|
942
|
-
modalId: ModalId;
|
|
943
|
-
hasActiveModals: boolean;
|
|
944
|
-
};
|
|
945
|
-
[EventType.ACTIVITY_CHANGE]: {
|
|
946
|
-
activity: ActivityType;
|
|
947
|
-
};
|
|
948
|
-
[EventType.UPLOAD_CLICK]: undefined;
|
|
949
|
-
[EventType.DONE_CLICK]: OutputCollectionState;
|
|
950
|
-
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
|
|
951
|
-
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
|
|
952
|
-
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
|
|
953
|
-
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
|
|
954
|
-
[EventType.CHANGE]: OutputCollectionState;
|
|
955
|
-
[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;
|
|
956
825
|
};
|
|
957
|
-
declare class
|
|
958
|
-
private
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
})
|
|
967
|
-
|
|
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>;
|
|
968
911
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
source?: string;
|
|
974
|
-
};
|
|
975
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
976
|
-
private _l10n;
|
|
977
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
978
|
-
get cfg(): Readonly<ConfigType>;
|
|
979
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
980
|
-
/**
|
|
981
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
982
|
-
*/
|
|
983
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
984
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
985
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
986
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
987
|
-
fullPath?: string;
|
|
988
|
-
}) => OutputFileEntry<"idle">;
|
|
989
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
990
|
-
removeAllFiles(): void;
|
|
991
|
-
uploadAll: () => void;
|
|
992
|
-
openSystemDialog: (options?: {
|
|
993
|
-
captureCamera?: boolean;
|
|
994
|
-
modeCamera?: ModeCameraType;
|
|
995
|
-
}) => void;
|
|
996
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
997
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
998
|
-
initFlow: (force?: boolean) => void;
|
|
999
|
-
doneFlow: () => void;
|
|
1000
|
-
private _pluginsReady;
|
|
1001
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1002
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1003
|
-
getCurrentActivity: () => ActivityType;
|
|
1004
|
-
historyBack: () => void;
|
|
1005
|
-
setModalState: (opened: boolean) => void;
|
|
1006
|
-
private get _sourceList();
|
|
912
|
+
declare global {
|
|
913
|
+
interface HTMLElementTagNameMap {
|
|
914
|
+
'uc-smart-btn': SmartBtn;
|
|
915
|
+
}
|
|
1007
916
|
}
|
|
1008
917
|
|
|
1009
918
|
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
|
|
@@ -1218,10 +1127,6 @@ type ConfigType = {
|
|
|
1218
1127
|
* Expiry threshold for secure uploads.
|
|
1219
1128
|
*/
|
|
1220
1129
|
secureUploadsExpireThreshold: number;
|
|
1221
|
-
/**
|
|
1222
|
-
* Array of plugins to register with the uploader instance.
|
|
1223
|
-
*/
|
|
1224
|
-
plugins: UploaderPlugin[];
|
|
1225
1130
|
/**
|
|
1226
1131
|
* Metadata for the file.
|
|
1227
1132
|
*/
|
|
@@ -1307,6 +1212,7 @@ type ConfigType = {
|
|
|
1307
1212
|
* Define the clipboard paste scope.
|
|
1308
1213
|
*/
|
|
1309
1214
|
pasteScope: PasteScope;
|
|
1215
|
+
smartButtonSettings: AdvancedSmartBtnConfig | null;
|
|
1310
1216
|
};
|
|
1311
1217
|
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
1312
1218
|
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -1473,165 +1379,6 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
1473
1379
|
allEntries: OutputFileEntry[];
|
|
1474
1380
|
});
|
|
1475
1381
|
|
|
1476
|
-
type PluginIconRegistration = {
|
|
1477
|
-
name: string;
|
|
1478
|
-
svg: string;
|
|
1479
|
-
};
|
|
1480
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
1481
|
-
type PluginSourceRegistration = {
|
|
1482
|
-
id: string;
|
|
1483
|
-
label: string;
|
|
1484
|
-
icon?: string;
|
|
1485
|
-
/**
|
|
1486
|
-
* @internal
|
|
1487
|
-
*
|
|
1488
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
1489
|
-
* which source IDs should actually be rendered in place of this source.
|
|
1490
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
1491
|
-
* expanding to separate photo/video buttons on mobile).
|
|
1492
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
1493
|
-
*/
|
|
1494
|
-
expand?: () => string[];
|
|
1495
|
-
onSelect: () => Promise<void> | void;
|
|
1496
|
-
};
|
|
1497
|
-
type PluginRenderDispose = () => void;
|
|
1498
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
1499
|
-
type PluginActivityRegistration = {
|
|
1500
|
-
id: string;
|
|
1501
|
-
render: PluginRender;
|
|
1502
|
-
};
|
|
1503
|
-
type PluginFileActionRegistration = {
|
|
1504
|
-
/** Unique action identifier. */
|
|
1505
|
-
id: string;
|
|
1506
|
-
/** Icon name to display in the action button. */
|
|
1507
|
-
icon: string;
|
|
1508
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
1509
|
-
label: string;
|
|
1510
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
1511
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
1512
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
1513
|
-
};
|
|
1514
|
-
type PluginFileHookResult = {
|
|
1515
|
-
/** The (optionally transformed) file */
|
|
1516
|
-
file: File | Blob;
|
|
1517
|
-
};
|
|
1518
|
-
type PluginFileHookContext = PluginFileHookResult & {
|
|
1519
|
-
/**
|
|
1520
|
-
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
1521
|
-
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
1522
|
-
*/
|
|
1523
|
-
signal: AbortSignal;
|
|
1524
|
-
};
|
|
1525
|
-
type PluginFileHookRegistration = {
|
|
1526
|
-
/**
|
|
1527
|
-
* When the hook is called:
|
|
1528
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
1529
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
1530
|
-
*
|
|
1531
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
1532
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
1533
|
-
*/
|
|
1534
|
-
type: 'beforeUpload' | 'onAdd';
|
|
1535
|
-
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
1536
|
-
/**
|
|
1537
|
-
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
1538
|
-
* @default 30000
|
|
1539
|
-
*/
|
|
1540
|
-
timeout?: number;
|
|
1541
|
-
};
|
|
1542
|
-
type PluginRegistryApi = {
|
|
1543
|
-
registerSource: (source: PluginSourceRegistration) => void;
|
|
1544
|
-
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
1545
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
1546
|
-
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
1547
|
-
registerIcon: (icon: PluginIconRegistration) => void;
|
|
1548
|
-
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
1549
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
1550
|
-
};
|
|
1551
|
-
/**
|
|
1552
|
-
* API for managing plugin config subscriptions
|
|
1553
|
-
*/
|
|
1554
|
-
type PluginConfigApi = {
|
|
1555
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
1556
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
1557
|
-
};
|
|
1558
|
-
/**
|
|
1559
|
-
* API for managing plugin activity interactions
|
|
1560
|
-
*/
|
|
1561
|
-
type PluginActivityApi = {
|
|
1562
|
-
/**
|
|
1563
|
-
* Get the current activity parameters.
|
|
1564
|
-
*
|
|
1565
|
-
* @returns The current activity parameters object
|
|
1566
|
-
*
|
|
1567
|
-
* @example
|
|
1568
|
-
* ```typescript
|
|
1569
|
-
* const params = pluginApi.activity.getParams();
|
|
1570
|
-
* console.log('Current params:', params);
|
|
1571
|
-
* ```
|
|
1572
|
-
*/
|
|
1573
|
-
getParams: () => Record<string, unknown>;
|
|
1574
|
-
/**
|
|
1575
|
-
* Subscribe to changes in activity parameters.
|
|
1576
|
-
* The callback will be called immediately with the current params,
|
|
1577
|
-
* and then whenever the params change.
|
|
1578
|
-
*
|
|
1579
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
1580
|
-
*
|
|
1581
|
-
* @param callback - Function to call with the new params
|
|
1582
|
-
* @returns Unsubscribe function
|
|
1583
|
-
*
|
|
1584
|
-
* @example
|
|
1585
|
-
* ```typescript
|
|
1586
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
1587
|
-
* console.log('Activity params changed:', params);
|
|
1588
|
-
* });
|
|
1589
|
-
* // Cleanup happens automatically on plugin disposal
|
|
1590
|
-
* ```
|
|
1591
|
-
*/
|
|
1592
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
1593
|
-
};
|
|
1594
|
-
type PluginFileEntryUpdate = {
|
|
1595
|
-
file?: File | Blob;
|
|
1596
|
-
cdnUrl?: string | null;
|
|
1597
|
-
cdnUrlModifiers?: string | null;
|
|
1598
|
-
mimeType?: string | null;
|
|
1599
|
-
};
|
|
1600
|
-
type PluginFilesApi = {
|
|
1601
|
-
/**
|
|
1602
|
-
* Update mutable properties of a file entry by its internalId.
|
|
1603
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
1604
|
-
*/
|
|
1605
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
1606
|
-
};
|
|
1607
|
-
type PluginApi = {
|
|
1608
|
-
registry: PluginRegistryApi;
|
|
1609
|
-
config: PluginConfigApi;
|
|
1610
|
-
activity: PluginActivityApi;
|
|
1611
|
-
files: PluginFilesApi;
|
|
1612
|
-
};
|
|
1613
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
1614
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
1615
|
-
type PluginSetupParams = {
|
|
1616
|
-
pluginApi: PluginApi;
|
|
1617
|
-
uploaderApi: PluginUploaderApi;
|
|
1618
|
-
};
|
|
1619
|
-
type UploaderPlugin = {
|
|
1620
|
-
id: string;
|
|
1621
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
1622
|
-
};
|
|
1623
|
-
type Owned<T> = T & {
|
|
1624
|
-
pluginId: string;
|
|
1625
|
-
};
|
|
1626
|
-
type PluginRegistrySnapshot = {
|
|
1627
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
1628
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
1629
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
1630
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
1631
|
-
icons: Owned<PluginIconRegistration>[];
|
|
1632
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
1382
|
declare class SecureUploadsManager extends SharedInstance {
|
|
1636
1383
|
private _secureToken;
|
|
1637
1384
|
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
@@ -1676,6 +1423,7 @@ declare class LitUploaderBlock extends LitActivityBlock {
|
|
|
1676
1423
|
private _handleCollectionUpdate;
|
|
1677
1424
|
private _handleCollectionPropertiesUpdate;
|
|
1678
1425
|
private _flushCommonUploadProgress;
|
|
1426
|
+
private _openCloudImageEditor;
|
|
1679
1427
|
private _setInitialCrop;
|
|
1680
1428
|
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1681
1429
|
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
@@ -1745,11 +1493,12 @@ type ActivityParams$1 = {
|
|
|
1745
1493
|
internalId: string;
|
|
1746
1494
|
};
|
|
1747
1495
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1496
|
+
couldBeCtxOwner: boolean;
|
|
1497
|
+
activityType: "cloud-image-edit";
|
|
1748
1498
|
private _entry?;
|
|
1749
1499
|
private _editorConfig;
|
|
1750
1500
|
get activityParams(): ActivityParams$1;
|
|
1751
1501
|
initCallback(): void;
|
|
1752
|
-
disconnectedCallback(): void;
|
|
1753
1502
|
private _handleApply;
|
|
1754
1503
|
private _handleCancel;
|
|
1755
1504
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1778,6 +1527,7 @@ type ActivityParams = {
|
|
|
1778
1527
|
};
|
|
1779
1528
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1780
1529
|
couldBeCtxOwner: boolean;
|
|
1530
|
+
activityType: "external";
|
|
1781
1531
|
private _messageBridge?;
|
|
1782
1532
|
private _iframeRef;
|
|
1783
1533
|
private _latestSelectionSummary;
|
|
@@ -1821,26 +1571,22 @@ declare global {
|
|
|
1821
1571
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1822
1572
|
START_FROM: "start-from";
|
|
1823
1573
|
CAMERA: "camera";
|
|
1574
|
+
DRAW: "draw";
|
|
1824
1575
|
UPLOAD_LIST: "upload-list";
|
|
1825
1576
|
URL: "url";
|
|
1826
1577
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1827
1578
|
EXTERNAL: "external";
|
|
1828
1579
|
}>;
|
|
1829
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1830
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1580
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1581
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1831
1582
|
|
|
1832
1583
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1833
|
-
interface CustomActivities {
|
|
1834
|
-
}
|
|
1835
1584
|
type ActivityParamsMap = {
|
|
1836
1585
|
'cloud-image-edit': ActivityParams$1;
|
|
1837
1586
|
external: ActivityParams;
|
|
1838
|
-
} & {
|
|
1839
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1840
1587
|
};
|
|
1841
1588
|
declare class LitActivityBlock extends LitBlock {
|
|
1842
1589
|
protected historyTracked: boolean;
|
|
1843
|
-
activityType: ActivityType;
|
|
1844
1590
|
private [ACTIVE_PROP]?;
|
|
1845
1591
|
init$: {
|
|
1846
1592
|
'*currentActivity': null;
|
|
@@ -1854,11 +1600,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1854
1600
|
private _activate;
|
|
1855
1601
|
initCallback(): void;
|
|
1856
1602
|
private _historyFlush;
|
|
1857
|
-
|
|
1603
|
+
private _isActivityRegistered;
|
|
1858
1604
|
private static _activityCallbacks;
|
|
1859
1605
|
static activities: Readonly<{
|
|
1860
1606
|
START_FROM: 'start-from';
|
|
1861
1607
|
CAMERA: 'camera';
|
|
1608
|
+
DRAW: 'draw';
|
|
1862
1609
|
UPLOAD_LIST: 'upload-list';
|
|
1863
1610
|
URL: 'url';
|
|
1864
1611
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1874,8 +1621,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1874
1621
|
private _unregisterActivity;
|
|
1875
1622
|
disconnectedCallback(): void;
|
|
1876
1623
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1877
|
-
get initActivity():
|
|
1878
|
-
get doneActivity():
|
|
1624
|
+
get initActivity(): string | null;
|
|
1625
|
+
get doneActivity(): string | null;
|
|
1879
1626
|
historyBack(): void;
|
|
1880
1627
|
}
|
|
1881
1628
|
|
|
@@ -1930,19 +1677,10 @@ declare class ModalManager extends SharedInstance {
|
|
|
1930
1677
|
destroy(): void;
|
|
1931
1678
|
}
|
|
1932
1679
|
|
|
1933
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
1934
|
-
type LazyPluginEntry = {
|
|
1935
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
1936
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
1937
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
1938
|
-
};
|
|
1939
|
-
|
|
1940
1680
|
declare class LitSolutionBlock extends LitBlock {
|
|
1941
1681
|
static styleAttrs: string[];
|
|
1942
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
1943
1682
|
init$: {
|
|
1944
1683
|
'*solution': string | null;
|
|
1945
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
1946
1684
|
'*commonProgress': number;
|
|
1947
1685
|
'*uploadList': never[];
|
|
1948
1686
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -2074,32 +1812,9 @@ declare global {
|
|
|
2074
1812
|
}
|
|
2075
1813
|
}
|
|
2076
1814
|
|
|
2077
|
-
|
|
2078
|
-
id: string;
|
|
2079
|
-
label: string;
|
|
2080
|
-
icon?: string;
|
|
2081
|
-
onClick: () => void | Promise<void>;
|
|
2082
|
-
};
|
|
2083
|
-
declare class SourceBtn extends LitUploaderBlock {
|
|
2084
|
-
couldBeCtxOwner: boolean;
|
|
2085
|
-
source?: SourceButtonConfig;
|
|
2086
|
-
private _iconName;
|
|
2087
|
-
private _srcTypeKey;
|
|
2088
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2089
|
-
private _applySource;
|
|
2090
|
-
activate(): void;
|
|
2091
|
-
render(): lit_html.TemplateResult<1>;
|
|
2092
|
-
}
|
|
2093
|
-
declare global {
|
|
2094
|
-
interface HTMLElementTagNameMap {
|
|
2095
|
-
'uc-source-btn': SourceBtn;
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
declare class SourceList extends LitUploaderBlock {
|
|
1815
|
+
declare class SourceList extends LitBlock {
|
|
2100
1816
|
private _rawSourceList;
|
|
2101
|
-
private
|
|
2102
|
-
private _sources;
|
|
1817
|
+
private _cameraModes;
|
|
2103
1818
|
/**
|
|
2104
1819
|
* CSS-only attribute
|
|
2105
1820
|
*/
|
|
@@ -2107,10 +1822,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
2107
1822
|
initCallback(): void;
|
|
2108
1823
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
2109
1824
|
private _updateSources;
|
|
2110
|
-
private
|
|
2111
|
-
private _makePluginSourceConfig;
|
|
1825
|
+
private _sources;
|
|
2112
1826
|
render(): lit_html.TemplateResult<1>;
|
|
2113
|
-
disconnectedCallback(): void;
|
|
2114
1827
|
}
|
|
2115
1828
|
declare global {
|
|
2116
1829
|
interface HTMLElementTagNameMap {
|
|
@@ -2165,8 +1878,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
2165
1878
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
2166
1879
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
2167
1880
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2168
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2169
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
2170
1881
|
}
|
|
2171
1882
|
declare global {
|
|
2172
1883
|
interface HTMLElementTagNameMap {
|
|
@@ -2174,71 +1885,45 @@ declare global {
|
|
|
2174
1885
|
}
|
|
2175
1886
|
}
|
|
2176
1887
|
|
|
2177
|
-
declare class
|
|
2178
|
-
static styleAttrs: string[];
|
|
1888
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
2179
1889
|
couldBeCtxOwner: boolean;
|
|
2180
|
-
|
|
2181
|
-
private
|
|
2182
|
-
private readonly _handleClick;
|
|
1890
|
+
activityType: ActivityType;
|
|
1891
|
+
private _formState;
|
|
2183
1892
|
initCallback(): void;
|
|
1893
|
+
private _inputRef;
|
|
1894
|
+
private _handleInput;
|
|
1895
|
+
private _handleUpload;
|
|
2184
1896
|
render(): lit_html.TemplateResult<1>;
|
|
2185
1897
|
}
|
|
2186
1898
|
declare global {
|
|
2187
1899
|
interface HTMLElementTagNameMap {
|
|
2188
|
-
'uc-
|
|
1900
|
+
'uc-url-source': UrlSource;
|
|
2189
1901
|
}
|
|
2190
1902
|
}
|
|
2191
1903
|
|
|
2192
|
-
declare class
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
private _ensureRegistered;
|
|
2199
|
-
private _renderActivity;
|
|
2200
|
-
private _disposeActivity;
|
|
2201
|
-
disconnectedCallback(): void;
|
|
2202
|
-
render(): lit_html.TemplateResult<1>;
|
|
2203
|
-
}
|
|
2204
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
2205
|
-
mode: 'modal' | 'inline';
|
|
2206
|
-
private _activities;
|
|
2207
|
-
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;
|
|
2208
1910
|
initCallback(): void;
|
|
2209
|
-
private _syncActivities;
|
|
2210
|
-
disconnectedCallback(): void;
|
|
2211
|
-
render(): lit_html.TemplateResult<1>;
|
|
2212
|
-
}
|
|
2213
|
-
declare global {
|
|
2214
|
-
interface HTMLElementTagNameMap {
|
|
2215
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
2216
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
2221
|
-
private _formState;
|
|
2222
|
-
private _inputRef;
|
|
2223
|
-
private _handleInput;
|
|
2224
|
-
private _handleUpload;
|
|
2225
|
-
firstUpdated(): void;
|
|
2226
1911
|
render(): lit_html.TemplateResult<1>;
|
|
2227
1912
|
}
|
|
2228
1913
|
declare global {
|
|
2229
1914
|
interface HTMLElementTagNameMap {
|
|
2230
|
-
'uc-
|
|
1915
|
+
'uc-simple-btn': SimpleBtn;
|
|
2231
1916
|
}
|
|
2232
1917
|
}
|
|
2233
1918
|
|
|
2234
1919
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
2235
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2236
1920
|
attributesMeta: {
|
|
2237
1921
|
headless?: boolean;
|
|
2238
1922
|
'ctx-name': string;
|
|
2239
1923
|
};
|
|
2240
1924
|
static styleAttrs: string[];
|
|
2241
1925
|
headless: boolean;
|
|
1926
|
+
smart: boolean;
|
|
2242
1927
|
constructor();
|
|
2243
1928
|
initCallback(): void;
|
|
2244
1929
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -2250,7 +1935,6 @@ declare global {
|
|
|
2250
1935
|
}
|
|
2251
1936
|
|
|
2252
1937
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
2253
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2254
1938
|
attributesMeta: {
|
|
2255
1939
|
'ctx-name': string;
|
|
2256
1940
|
};
|
|
@@ -2271,7 +1955,6 @@ declare global {
|
|
|
2271
1955
|
}
|
|
2272
1956
|
|
|
2273
1957
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
2274
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
2275
1958
|
attributesMeta: {
|
|
2276
1959
|
'ctx-name': string;
|
|
2277
1960
|
};
|
|
@@ -2306,8 +1989,6 @@ declare class A11y implements ISharedInstance {
|
|
|
2306
1989
|
declare class LocaleManager extends SharedInstance {
|
|
2307
1990
|
private _localeName;
|
|
2308
1991
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2309
|
-
private _applyOverrides;
|
|
2310
|
-
private _applyPluginLocales;
|
|
2311
1992
|
}
|
|
2312
1993
|
|
|
2313
1994
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2348,69 +2029,6 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2348
2029
|
private get _location();
|
|
2349
2030
|
}
|
|
2350
2031
|
|
|
2351
|
-
interface ISharedInstance {
|
|
2352
|
-
destroy?(): void;
|
|
2353
|
-
}
|
|
2354
|
-
declare class SharedInstance {
|
|
2355
|
-
protected _ctx: PubSub<SharedState>;
|
|
2356
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2357
|
-
private _subscriptions;
|
|
2358
|
-
private _cfgProxy;
|
|
2359
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2360
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2361
|
-
protected addSub(unsub: () => void): void;
|
|
2362
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2363
|
-
destroy(): void;
|
|
2364
|
-
}
|
|
2365
|
-
declare const instanceKeyMap: {
|
|
2366
|
-
modalManager: "*modalManager";
|
|
2367
|
-
pluginManager: "*pluginManager";
|
|
2368
|
-
telemetryManager: "*telemetryManager";
|
|
2369
|
-
localeManager: "*localeManager";
|
|
2370
|
-
a11y: "*a11y";
|
|
2371
|
-
clipboard: "*clipboard";
|
|
2372
|
-
blocksRegistry: "*blocksRegistry";
|
|
2373
|
-
eventEmitter: "*eventEmitter";
|
|
2374
|
-
uploadCollection: "*uploadCollection";
|
|
2375
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2376
|
-
api: "*publicApi";
|
|
2377
|
-
validationManager: "*validationManager";
|
|
2378
|
-
};
|
|
2379
|
-
type InstanceTypeMap = {
|
|
2380
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2381
|
-
};
|
|
2382
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2383
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2384
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2385
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2386
|
-
readonly ctx: PubSub<SharedState>;
|
|
2387
|
-
readonly modalManager: ModalManager | null;
|
|
2388
|
-
readonly pluginManager: PluginManager;
|
|
2389
|
-
readonly telemetryManager: TelemetryManager;
|
|
2390
|
-
readonly localeManager: LocaleManager;
|
|
2391
|
-
readonly a11y: A11y;
|
|
2392
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2393
|
-
readonly eventEmitter: EventEmitter;
|
|
2394
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2395
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2396
|
-
readonly api: UploaderPublicApi;
|
|
2397
|
-
readonly validationManager: ValidationManager;
|
|
2398
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2399
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2400
|
-
};
|
|
2401
|
-
|
|
2402
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2403
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2404
|
-
private scopes;
|
|
2405
|
-
private listener;
|
|
2406
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2407
|
-
private openUploadList;
|
|
2408
|
-
private _listener;
|
|
2409
|
-
private handlePaste;
|
|
2410
|
-
registerBlock(scope: Node): () => void;
|
|
2411
|
-
destroy(): void;
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
2032
|
declare const TabId: Readonly<{
|
|
2415
2033
|
readonly CROP: "crop";
|
|
2416
2034
|
readonly TUNING: "tuning";
|
|
@@ -2475,14 +2093,11 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
|
|
|
2475
2093
|
type SharedConfigState = {
|
|
2476
2094
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2477
2095
|
};
|
|
2478
|
-
type SharedCustomConfigState = {
|
|
2479
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2480
|
-
};
|
|
2481
2096
|
type BlocksRegistry = Set<LitBlock>;
|
|
2482
2097
|
type ActivityBlockCtxState = {
|
|
2483
|
-
'*currentActivity':
|
|
2098
|
+
'*currentActivity': string | null;
|
|
2484
2099
|
'*currentActivityParams': Record<string, unknown>;
|
|
2485
|
-
'*history': (
|
|
2100
|
+
'*history': (string | null)[];
|
|
2486
2101
|
'*historyBack': (() => void) | null;
|
|
2487
2102
|
'*closeModal': () => void;
|
|
2488
2103
|
};
|
|
@@ -2499,7 +2114,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2499
2114
|
};
|
|
2500
2115
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2501
2116
|
'*solution': string | null;
|
|
2502
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2503
2117
|
};
|
|
2504
2118
|
type CloudImageEditorState = {
|
|
2505
2119
|
'*originalUrl': string | null;
|
|
@@ -2550,9 +2164,7 @@ type EditorToolbarState = {
|
|
|
2550
2164
|
'*currentOperation': string | null;
|
|
2551
2165
|
'*operationTooltip': string | null;
|
|
2552
2166
|
};
|
|
2553
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2554
2167
|
type DynamicBlockState = {
|
|
2555
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2556
2168
|
'*blocksRegistry': BlocksRegistry;
|
|
2557
2169
|
'*eventEmitter': EventEmitter;
|
|
2558
2170
|
'*localeManager': LocaleManager;
|
|
@@ -2560,7 +2172,6 @@ type DynamicBlockState = {
|
|
|
2560
2172
|
'*a11y': A11y;
|
|
2561
2173
|
'*modalManager': ModalManager | null;
|
|
2562
2174
|
'*clipboard': ClipboardLayer;
|
|
2563
|
-
'*pluginManager': PluginManager;
|
|
2564
2175
|
};
|
|
2565
2176
|
type DynamicUploaderBlockState = {
|
|
2566
2177
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2571,7 +2182,66 @@ type DynamicUploaderBlockState = {
|
|
|
2571
2182
|
type LocaleState = {
|
|
2572
2183
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2573
2184
|
};
|
|
2574
|
-
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
|
+
}
|
|
2575
2245
|
|
|
2576
2246
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2577
2247
|
willYield: boolean;
|
|
@@ -2583,7 +2253,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2583
2253
|
};
|
|
2584
2254
|
declare class LitBlock extends LitBlockBase {
|
|
2585
2255
|
private _cfgProxy;
|
|
2256
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2586
2257
|
static styleAttrs: string[];
|
|
2258
|
+
activityType: ActivityType;
|
|
2587
2259
|
init$: {};
|
|
2588
2260
|
constructor();
|
|
2589
2261
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2591,7 +2263,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2591
2263
|
protected _sharedInstancesBag: {
|
|
2592
2264
|
readonly ctx: PubSub<SharedState>;
|
|
2593
2265
|
readonly modalManager: ModalManager | null;
|
|
2594
|
-
readonly pluginManager: PluginManager;
|
|
2595
2266
|
readonly telemetryManager: TelemetryManager;
|
|
2596
2267
|
readonly localeManager: LocaleManager;
|
|
2597
2268
|
readonly a11y: A11y;
|
|
@@ -2601,34 +2272,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2601
2272
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2602
2273
|
readonly api: UploaderPublicApi;
|
|
2603
2274
|
readonly validationManager: ValidationManager;
|
|
2604
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2605
|
-
modalManager: ModalManager | null;
|
|
2606
|
-
pluginManager: PluginManager;
|
|
2607
|
-
telemetryManager: TelemetryManager;
|
|
2608
|
-
localeManager: LocaleManager;
|
|
2609
|
-
a11y: A11y;
|
|
2610
|
-
clipboard: ClipboardLayer;
|
|
2611
|
-
blocksRegistry: BlocksRegistry;
|
|
2612
|
-
eventEmitter: EventEmitter;
|
|
2613
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2614
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2615
|
-
api: UploaderPublicApi;
|
|
2616
|
-
validationManager: ValidationManager;
|
|
2617
|
-
}[TName]>) => void): () => void;
|
|
2618
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2619
|
-
modalManager: ModalManager | null;
|
|
2620
|
-
pluginManager: PluginManager;
|
|
2621
|
-
telemetryManager: TelemetryManager;
|
|
2622
|
-
localeManager: LocaleManager;
|
|
2623
|
-
a11y: A11y;
|
|
2624
|
-
clipboard: ClipboardLayer;
|
|
2625
|
-
blocksRegistry: BlocksRegistry;
|
|
2626
|
-
eventEmitter: EventEmitter;
|
|
2627
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2628
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2629
|
-
api: UploaderPublicApi;
|
|
2630
|
-
validationManager: ValidationManager;
|
|
2631
|
-
}[TName]>>;
|
|
2632
2275
|
};
|
|
2633
2276
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2634
2277
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2647,7 +2290,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2647
2290
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2648
2291
|
*/
|
|
2649
2292
|
private destroyCtxCallback;
|
|
2650
|
-
|
|
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
|
+
*/
|
|
2651
2298
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2652
2299
|
private _destroySharedContextInstances;
|
|
2653
2300
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -3181,7 +2828,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
3181
2828
|
private _hasNetworkProblems;
|
|
3182
2829
|
private _isInitialized;
|
|
3183
2830
|
private _pendingInitUpdate;
|
|
3184
|
-
private _pendingSizeWait;
|
|
3185
2831
|
private readonly _debouncedShowLoader;
|
|
3186
2832
|
private readonly _imgRef;
|
|
3187
2833
|
private readonly _cropperRef;
|