@uploadcare/file-uploader 1.28.0-alpha.669 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +2 -1
  2. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  3. package/dist/env.js +3 -3
  4. package/dist/index.css +3 -3
  5. package/dist/index.d.ts +296 -684
  6. package/dist/index.js +5 -5
  7. package/dist/index.layered.css +3 -3
  8. package/dist/index.ssr.js +68 -109
  9. package/dist/locales/file-uploader/ar.d.ts +3 -0
  10. package/dist/locales/file-uploader/ar.js +3 -3
  11. package/dist/locales/file-uploader/az.d.ts +3 -0
  12. package/dist/locales/file-uploader/az.js +3 -3
  13. package/dist/locales/file-uploader/ca.d.ts +3 -0
  14. package/dist/locales/file-uploader/ca.js +3 -3
  15. package/dist/locales/file-uploader/cs.d.ts +3 -0
  16. package/dist/locales/file-uploader/cs.js +3 -3
  17. package/dist/locales/file-uploader/da.d.ts +3 -0
  18. package/dist/locales/file-uploader/da.js +3 -3
  19. package/dist/locales/file-uploader/de.d.ts +3 -0
  20. package/dist/locales/file-uploader/de.js +3 -3
  21. package/dist/locales/file-uploader/el.d.ts +3 -0
  22. package/dist/locales/file-uploader/el.js +3 -3
  23. package/dist/locales/file-uploader/en.d.ts +3 -0
  24. package/dist/locales/file-uploader/en.js +3 -3
  25. package/dist/locales/file-uploader/es.d.ts +3 -0
  26. package/dist/locales/file-uploader/es.js +3 -3
  27. package/dist/locales/file-uploader/et.d.ts +3 -0
  28. package/dist/locales/file-uploader/et.js +3 -3
  29. package/dist/locales/file-uploader/fi.d.ts +3 -0
  30. package/dist/locales/file-uploader/fi.js +3 -3
  31. package/dist/locales/file-uploader/fr.d.ts +3 -0
  32. package/dist/locales/file-uploader/fr.js +3 -3
  33. package/dist/locales/file-uploader/he.d.ts +3 -0
  34. package/dist/locales/file-uploader/he.js +3 -3
  35. package/dist/locales/file-uploader/hy.d.ts +3 -0
  36. package/dist/locales/file-uploader/hy.js +3 -3
  37. package/dist/locales/file-uploader/is.d.ts +3 -0
  38. package/dist/locales/file-uploader/is.js +3 -3
  39. package/dist/locales/file-uploader/it.d.ts +3 -0
  40. package/dist/locales/file-uploader/it.js +3 -3
  41. package/dist/locales/file-uploader/ja.d.ts +3 -0
  42. package/dist/locales/file-uploader/ja.js +3 -3
  43. package/dist/locales/file-uploader/ka.d.ts +3 -0
  44. package/dist/locales/file-uploader/ka.js +3 -3
  45. package/dist/locales/file-uploader/kk.d.ts +3 -0
  46. package/dist/locales/file-uploader/kk.js +3 -3
  47. package/dist/locales/file-uploader/ko.d.ts +3 -0
  48. package/dist/locales/file-uploader/ko.js +3 -3
  49. package/dist/locales/file-uploader/lv.d.ts +3 -0
  50. package/dist/locales/file-uploader/lv.js +3 -3
  51. package/dist/locales/file-uploader/nb.d.ts +3 -0
  52. package/dist/locales/file-uploader/nb.js +3 -3
  53. package/dist/locales/file-uploader/nl.d.ts +3 -0
  54. package/dist/locales/file-uploader/nl.js +3 -3
  55. package/dist/locales/file-uploader/pl.d.ts +3 -0
  56. package/dist/locales/file-uploader/pl.js +3 -3
  57. package/dist/locales/file-uploader/pt.d.ts +3 -0
  58. package/dist/locales/file-uploader/pt.js +3 -3
  59. package/dist/locales/file-uploader/ro.d.ts +3 -0
  60. package/dist/locales/file-uploader/ro.js +3 -3
  61. package/dist/locales/file-uploader/ru.d.ts +3 -0
  62. package/dist/locales/file-uploader/ru.js +3 -3
  63. package/dist/locales/file-uploader/sk.d.ts +3 -0
  64. package/dist/locales/file-uploader/sk.js +3 -3
  65. package/dist/locales/file-uploader/sr.d.ts +3 -0
  66. package/dist/locales/file-uploader/sr.js +3 -3
  67. package/dist/locales/file-uploader/sv.d.ts +3 -0
  68. package/dist/locales/file-uploader/sv.js +3 -3
  69. package/dist/locales/file-uploader/tr.d.ts +3 -0
  70. package/dist/locales/file-uploader/tr.js +3 -3
  71. package/dist/locales/file-uploader/uk.d.ts +3 -0
  72. package/dist/locales/file-uploader/uk.js +3 -3
  73. package/dist/locales/file-uploader/vi.d.ts +3 -0
  74. package/dist/locales/file-uploader/vi.js +3 -3
  75. package/dist/locales/file-uploader/zh-TW.d.ts +3 -0
  76. package/dist/locales/file-uploader/zh-TW.js +3 -3
  77. package/dist/locales/file-uploader/zh.d.ts +3 -0
  78. package/dist/locales/file-uploader/zh.js +3 -3
  79. package/package.json +29 -29
  80. package/web/file-uploader.iife.min.d.ts +299 -684
  81. package/web/file-uploader.iife.min.js +4 -4
  82. package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
  83. package/web/file-uploader.min.d.ts +299 -684
  84. package/web/file-uploader.min.js +4 -4
  85. package/web/file-uploader.min.js.LEGAL.txt +1 -1
  86. package/web/uc-basic.layered.min.css +3 -3
  87. package/web/uc-basic.min.css +3 -3
  88. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  89. package/web/uc-cloud-image-editor.min.css +3 -3
  90. package/web/uc-cloud-image-editor.min.d.ts +244 -629
  91. package/web/uc-cloud-image-editor.min.js +4 -4
  92. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  93. package/web/uc-file-uploader-inline.min.css +3 -3
  94. package/web/uc-file-uploader-inline.min.d.ts +299 -684
  95. package/web/uc-file-uploader-inline.min.js +4 -4
  96. package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
  97. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  98. package/web/uc-file-uploader-minimal.min.css +3 -3
  99. package/web/uc-file-uploader-minimal.min.d.ts +299 -684
  100. package/web/uc-file-uploader-minimal.min.js +4 -4
  101. package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
  102. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  103. package/web/uc-file-uploader-regular.min.css +3 -3
  104. package/web/uc-file-uploader-regular.min.d.ts +299 -684
  105. package/web/uc-file-uploader-regular.min.js +4 -4
  106. package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
  107. 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
 
@@ -71,6 +71,7 @@ declare const _default: {
71
71
  'choose-file': string;
72
72
  'choose-files': string;
73
73
  'drop-files-here': string;
74
+ 'drop-file-here': string;
74
75
  'select-file-source': string;
75
76
  selected: string;
76
77
  upload: string;
@@ -112,6 +113,7 @@ declare const _default: {
112
113
  'src-type-camera': string;
113
114
  'src-type-mobile-video-camera': string;
114
115
  'src-type-mobile-photo-camera': string;
116
+ 'src-type-draw': string;
115
117
  'src-type-facebook': string;
116
118
  'src-type-dropbox': string;
117
119
  'src-type-gdrive': string;
@@ -126,6 +128,7 @@ declare const _default: {
126
128
  'src-type-other': string;
127
129
  'caption-from-url': string;
128
130
  'caption-camera': string;
131
+ 'caption-draw': string;
129
132
  'caption-edit-file': string;
130
133
  'file-no-name': string;
131
134
  'toggle-fullscreen': string;
@@ -197,7 +200,6 @@ type LocaleDefinition = typeof _default;
197
200
  declare class Modal extends LitBlock {
198
201
  static styleAttrs: string[];
199
202
  private _mouseDownTarget;
200
- private _isActive;
201
203
  /** WARNING: Do not rename/change this, it's used in dashboard */
202
204
  protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
203
205
  /**
@@ -213,7 +215,7 @@ declare class Modal extends LitBlock {
213
215
  private _handleDialogClose;
214
216
  private _handleDialogMouseDown;
215
217
  private _handleDialogMouseUp;
216
- show(): Promise<void>;
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
- * Custom configuration options registration system for plugins
234
- */
235
- type CustomConfigDefinition<T = unknown> = {
236
- /**
237
- * Config option name (will be used as property and optionally as attribute)
238
- */
239
- name: string;
240
- /**
241
- * Default value for the config option
242
- */
243
- defaultValue: T;
244
- /**
245
- * Whether this config can be set via HTML attribute
246
- * @default true
247
- */
248
- attribute?: boolean;
249
- /**
250
- * Convert attribute string to config value
251
- * Only used if attribute is true
252
- */
253
- fromAttribute?: (value: string | null) => T;
254
- /**
255
- * Convert config value to attribute string
256
- * Only used if attribute is true
257
- */
258
- toAttribute?: (value: T) => string | null;
259
- /**
260
- * Normalize/validate the config value
261
- */
262
- normalize?: (value: unknown) => T;
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
- * Registry for custom config options defined by plugins
266
- * This is managed by the PluginManager as a shared instance property
267
- */
268
- declare class CustomConfigRegistry {
269
- private _definitions;
270
- register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
271
- unregister(name: string): void;
272
- unregisterByPlugin(pluginId: string): void;
273
- get(name: string): CustomConfigDefinition<any> | undefined;
274
- getAll(): Map<string, CustomConfigDefinition<any>>;
275
- }
276
- /**
277
- * Interface for TypeScript module augmentation
278
- * Plugins should extend this interface to add their custom config types
279
- *
280
- * @example
281
- * ```typescript
282
- * declare module '@uploadcare/file-uploader' {
283
- * interface CustomConfig {
284
- * 'my-custom-option': string;
285
- * }
286
- * }
287
- * ```
288
- */
289
- interface CustomConfig {
290
- }
291
-
292
- declare class TypedData<T extends Record<string, unknown>> {
293
- private _ctxId;
294
- private _data;
295
- constructor(initialValue: T);
296
- get uid(): Uid;
297
- setValue<K extends keyof T>(prop: K, value: T[K]): void;
298
- setMultipleValues(updObj: Partial<T>): void;
299
- getValue<K extends keyof T>(prop: K): T[K];
300
- subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
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
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
375
-
376
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
377
- signal?: AbortSignal;
378
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
379
- type FileValidatorDescriptor = {
380
- runOn: 'add' | 'upload' | 'change';
381
- validator: FuncFileValidator;
382
- };
383
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
384
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
385
- declare class ValidationManager extends SharedInstance {
386
- private get _uploadCollection();
387
- private _commonFileValidators;
388
- private _commonCollectionValidators;
389
- private _queue;
390
- private _runQueueDebounced;
391
- private _isDestroyed;
392
- private _entryValidationState;
300
+ type PasteScope = 'local' | 'global' | false;
301
+ declare class ClipboardLayer extends SharedInstance {
302
+ private scopes;
303
+ private listener;
393
304
  constructor(sharedInstancesBag: SharedInstancesBag);
394
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
395
- runCollectionValidators(): void;
396
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
397
- private _runFileValidatorsForEntry;
398
- private _addCustomTypeToValidationError;
399
- private _getEntryValidationState;
400
- private _getValidatorDescriptors;
401
- private _getValidatorDescriptorsForEntry;
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", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
475
+ declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
476
+ /** Mapping of attribute names to state */
477
+ declare const attrStateMapping: Record<string, string>;
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: string, oldVal: string, newVal: string): void;
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, CustomConfig {
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 _unsubscribePlugins?;
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;
@@ -749,7 +666,9 @@ declare class DropArea extends LitUploaderBlock {
749
666
  text?: string;
750
667
  private _isEnabled;
751
668
  private _isVisible;
752
- private get _localizedText();
669
+ private _dropTextKey;
670
+ private _isMultiple;
671
+ private _updateDropText;
753
672
  private _destroyDropzone;
754
673
  private _destroyContentWrapperDropzone;
755
674
  private _contentWrapperRef;
@@ -758,7 +677,9 @@ declare class DropArea extends LitUploaderBlock {
758
677
  private _clickableListenersAttached;
759
678
  isActive(): boolean;
760
679
  initCallback(): void;
761
- protected willUpdate(changedProperties: PropertyValues<this>): void;
680
+ protected willUpdate(changedProperties: PropertyValues<this & {
681
+ localeId: string;
682
+ }>): void;
762
683
  protected updated(changedProperties: PropertyValues<this>): void;
763
684
  /** Ignore drop events if there are other visible drop areas on the page. */
764
685
  private _shouldIgnore;
@@ -812,6 +733,7 @@ declare global {
812
733
  declare const ExternalUploadSource: Readonly<{
813
734
  readonly FACEBOOK: "facebook";
814
735
  readonly DROPBOX: "dropbox";
736
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
815
737
  readonly GDRIVE: "gdrive";
816
738
  readonly GPHOTOS: "gphotos";
817
739
  readonly FLICKR: "flickr";
@@ -824,6 +746,7 @@ declare const ExternalUploadSource: Readonly<{
824
746
  declare const UploadSource: Readonly<{
825
747
  readonly FACEBOOK: "facebook";
826
748
  readonly DROPBOX: "dropbox";
749
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
827
750
  readonly GDRIVE: "gdrive";
828
751
  readonly GPHOTOS: "gphotos";
829
752
  readonly FLICKR: "flickr";
@@ -840,6 +763,7 @@ declare const UploadSource: Readonly<{
840
763
  readonly EXTERNAL: "external";
841
764
  readonly API: "js-api";
842
765
  readonly URL: "url";
766
+ readonly DRAW: "draw";
843
767
  }>;
844
768
  type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
845
769
 
@@ -894,73 +818,7 @@ declare const CameraSourceTypes: Readonly<{
894
818
  }>;
895
819
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
896
820
 
897
- declare const InternalEventType: Readonly<{
898
- readonly INIT_SOLUTION: "init-solution";
899
- readonly CHANGE_CONFIG: "change-config";
900
- readonly ACTION_EVENT: "action-event";
901
- readonly ERROR_EVENT: "error-event";
902
- }>;
903
- declare const EventType: Readonly<{
904
- readonly FILE_ADDED: "file-added";
905
- readonly FILE_REMOVED: "file-removed";
906
- readonly FILE_UPLOAD_START: "file-upload-start";
907
- readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
908
- readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
909
- readonly FILE_UPLOAD_FAILED: "file-upload-failed";
910
- readonly FILE_URL_CHANGED: "file-url-changed";
911
- readonly MODAL_OPEN: "modal-open";
912
- readonly MODAL_CLOSE: "modal-close";
913
- readonly DONE_CLICK: "done-click";
914
- readonly UPLOAD_CLICK: "upload-click";
915
- readonly ACTIVITY_CHANGE: "activity-change";
916
- readonly COMMON_UPLOAD_START: "common-upload-start";
917
- readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
918
- readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
919
- readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
920
- readonly CHANGE: "change";
921
- readonly GROUP_CREATED: "group-created";
922
- }>;
923
- type EventKey = (typeof EventType)[keyof typeof EventType];
924
- type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
925
- type EventPayload = {
926
- [EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
927
- [EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
928
- [EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
929
- [EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
930
- [EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
931
- [EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
932
- [EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
933
- [EventType.MODAL_OPEN]: {
934
- modalId: ModalId;
935
- };
936
- [EventType.MODAL_CLOSE]: {
937
- modalId: ModalId;
938
- hasActiveModals: boolean;
939
- };
940
- [EventType.ACTIVITY_CHANGE]: {
941
- activity: ActivityType;
942
- };
943
- [EventType.UPLOAD_CLICK]: undefined;
944
- [EventType.DONE_CLICK]: OutputCollectionState;
945
- [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
946
- [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
947
- [EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
948
- [EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
949
- [EventType.CHANGE]: OutputCollectionState;
950
- [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
951
- };
952
- declare class EventEmitter extends SharedInstance {
953
- private _timeoutStore;
954
- private _targets;
955
- private _listeners;
956
- bindTarget(target: LitBlock): () => void;
957
- on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
958
- private _dispatch;
959
- emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
960
- debounce?: TDebounce;
961
- }): void;
962
- destroy(): void;
963
- }
821
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
964
822
 
965
823
  type ApiAddFileCommonOptions = {
966
824
  silent?: boolean;
@@ -992,11 +850,8 @@ declare class UploaderPublicApi extends SharedInstance {
992
850
  getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
993
851
  initFlow: (force?: boolean) => void;
994
852
  doneFlow: () => void;
995
- private _pluginsReady;
996
- setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
997
- on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
853
+ setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
998
854
  getCurrentActivity: () => ActivityType;
999
- historyBack: () => void;
1000
855
  setModalState: (opened: boolean) => void;
1001
856
  private get _sourceList();
1002
857
  }
@@ -1213,10 +1068,6 @@ type ConfigType = {
1213
1068
  * Expiry threshold for secure uploads.
1214
1069
  */
1215
1070
  secureUploadsExpireThreshold: number;
1216
- /**
1217
- * Array of plugins to register with the uploader instance.
1218
- */
1219
- plugins: UploaderPlugin[];
1220
1071
  /**
1221
1072
  * Metadata for the file.
1222
1073
  */
@@ -1468,165 +1319,6 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
1468
1319
  allEntries: OutputFileEntry[];
1469
1320
  });
1470
1321
 
1471
- type PluginIconRegistration = {
1472
- name: string;
1473
- svg: string;
1474
- };
1475
- type PluginI18nRegistration = Record<string, Record<string, string>>;
1476
- type PluginSourceRegistration = {
1477
- id: string;
1478
- label: string;
1479
- icon?: string;
1480
- /**
1481
- * @internal
1482
- *
1483
- * Optional expansion function. When present, SourceList calls this to determine
1484
- * which source IDs should actually be rendered in place of this source.
1485
- * Useful for sources that map to multiple device-specific variants (e.g. camera
1486
- * expanding to separate photo/video buttons on mobile).
1487
- * Return `[id]` (the source's own id) to render it as-is.
1488
- */
1489
- expand?: () => string[];
1490
- onSelect: () => Promise<void> | void;
1491
- };
1492
- type PluginRenderDispose = () => void;
1493
- type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
1494
- type PluginActivityRegistration = {
1495
- id: string;
1496
- render: PluginRender;
1497
- };
1498
- type PluginFileActionRegistration = {
1499
- /** Unique action identifier. */
1500
- id: string;
1501
- /** Icon name to display in the action button. */
1502
- icon: string;
1503
- /** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
1504
- label: string;
1505
- /** Return `true` to show the action button for the given file entry. */
1506
- shouldRender: (fileEntry: OutputFileEntry) => boolean;
1507
- onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
1508
- };
1509
- type PluginFileHookResult = {
1510
- /** The (optionally transformed) file */
1511
- file: File | Blob;
1512
- };
1513
- type PluginFileHookContext = PluginFileHookResult & {
1514
- /**
1515
- * An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
1516
- * Hooks should respect this signal to avoid doing unnecessary work.
1517
- */
1518
- signal: AbortSignal;
1519
- };
1520
- type PluginFileHookRegistration = {
1521
- /**
1522
- * When the hook is called:
1523
- * - `'beforeUpload'`: called right before the file is uploaded.
1524
- * - `'onAdd'`: called after the file is added to the upload list.
1525
- *
1526
- * Return the (optionally transformed) file. After the hook runs, `mimeType`,
1527
- * `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
1528
- */
1529
- type: 'beforeUpload' | 'onAdd';
1530
- handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
1531
- /**
1532
- * Maximum time in milliseconds to wait for the hook to complete before skipping it.
1533
- * @default 30000
1534
- */
1535
- timeout?: number;
1536
- };
1537
- type PluginRegistryApi = {
1538
- registerSource: (source: PluginSourceRegistration) => void;
1539
- registerActivity: (activity: PluginActivityRegistration) => void;
1540
- registerFileAction: (fileAction: PluginFileActionRegistration) => void;
1541
- registerFileHook: (hook: PluginFileHookRegistration) => void;
1542
- registerIcon: (icon: PluginIconRegistration) => void;
1543
- registerI18n: (i18n: PluginI18nRegistration) => void;
1544
- registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
1545
- };
1546
- /**
1547
- * API for managing plugin config subscriptions
1548
- */
1549
- type PluginConfigApi = {
1550
- get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
1551
- subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
1552
- };
1553
- /**
1554
- * API for managing plugin activity interactions
1555
- */
1556
- type PluginActivityApi = {
1557
- /**
1558
- * Get the current activity parameters.
1559
- *
1560
- * @returns The current activity parameters object
1561
- *
1562
- * @example
1563
- * ```typescript
1564
- * const params = pluginApi.activity.getParams();
1565
- * console.log('Current params:', params);
1566
- * ```
1567
- */
1568
- getParams: () => Record<string, unknown>;
1569
- /**
1570
- * Subscribe to changes in activity parameters.
1571
- * The callback will be called immediately with the current params,
1572
- * and then whenever the params change.
1573
- *
1574
- * Subscriptions are automatically cleaned up when the plugin is disposed.
1575
- *
1576
- * @param callback - Function to call with the new params
1577
- * @returns Unsubscribe function
1578
- *
1579
- * @example
1580
- * ```typescript
1581
- * pluginApi.activity.subscribeToParams((params) => {
1582
- * console.log('Activity params changed:', params);
1583
- * });
1584
- * // Cleanup happens automatically on plugin disposal
1585
- * ```
1586
- */
1587
- subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
1588
- };
1589
- type PluginFileEntryUpdate = {
1590
- file?: File | Blob;
1591
- cdnUrl?: string | null;
1592
- cdnUrlModifiers?: string | null;
1593
- mimeType?: string | null;
1594
- };
1595
- type PluginFilesApi = {
1596
- /**
1597
- * Update mutable properties of a file entry by its internalId.
1598
- * `fileSize` is recalculated automatically when `file` is provided.
1599
- */
1600
- update: (internalId: string, changes: PluginFileEntryUpdate) => void;
1601
- };
1602
- type PluginApi = {
1603
- registry: PluginRegistryApi;
1604
- config: PluginConfigApi;
1605
- activity: PluginActivityApi;
1606
- files: PluginFilesApi;
1607
- };
1608
- type PluginUploaderApi = UploaderPublicApi;
1609
- type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
1610
- type PluginSetupParams = {
1611
- pluginApi: PluginApi;
1612
- uploaderApi: PluginUploaderApi;
1613
- };
1614
- type UploaderPlugin = {
1615
- id: string;
1616
- setup: (params: PluginSetupParams) => PluginSetupResult;
1617
- };
1618
- type Owned<T> = T & {
1619
- pluginId: string;
1620
- };
1621
- type PluginRegistrySnapshot = {
1622
- sources: Owned<PluginSourceRegistration>[];
1623
- activities: Owned<PluginActivityRegistration>[];
1624
- fileActions: Owned<PluginFileActionRegistration>[];
1625
- fileHooks: Owned<PluginFileHookRegistration>[];
1626
- icons: Owned<PluginIconRegistration>[];
1627
- i18n: Owned<PluginI18nRegistration>[];
1628
- };
1629
-
1630
1322
  declare class SecureUploadsManager extends SharedInstance {
1631
1323
  private _secureToken;
1632
1324
  getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
@@ -1671,6 +1363,7 @@ declare class LitUploaderBlock extends LitActivityBlock {
1671
1363
  private _handleCollectionUpdate;
1672
1364
  private _handleCollectionPropertiesUpdate;
1673
1365
  private _flushCommonUploadProgress;
1366
+ private _openCloudImageEditor;
1674
1367
  private _setInitialCrop;
1675
1368
  protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1676
1369
  protected getUploadClientOptions(): Promise<FileFromOptions>;
@@ -1740,11 +1433,12 @@ type ActivityParams$1 = {
1740
1433
  internalId: string;
1741
1434
  };
1742
1435
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1436
+ couldBeCtxOwner: boolean;
1437
+ activityType: "cloud-image-edit";
1743
1438
  private _entry?;
1744
1439
  private _editorConfig;
1745
1440
  get activityParams(): ActivityParams$1;
1746
1441
  initCallback(): void;
1747
- disconnectedCallback(): void;
1748
1442
  private _handleApply;
1749
1443
  private _handleCancel;
1750
1444
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1773,6 +1467,7 @@ type ActivityParams = {
1773
1467
  };
1774
1468
  declare class ExternalSource extends LitUploaderBlock {
1775
1469
  couldBeCtxOwner: boolean;
1470
+ activityType: "external";
1776
1471
  private _messageBridge?;
1777
1472
  private _iframeRef;
1778
1473
  private _latestSelectionSummary;
@@ -1816,26 +1511,22 @@ declare global {
1816
1511
  declare const ACTIVITY_TYPES: Readonly<{
1817
1512
  START_FROM: "start-from";
1818
1513
  CAMERA: "camera";
1514
+ DRAW: "draw";
1819
1515
  UPLOAD_LIST: "upload-list";
1820
1516
  URL: "url";
1821
1517
  CLOUD_IMG_EDIT: "cloud-image-edit";
1822
1518
  EXTERNAL: "external";
1823
1519
  }>;
1824
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1825
- type ActivityType = RegisteredActivityType | null;
1520
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1521
+ type ActivityType = RegisteredActivityType | (string & {}) | null;
1826
1522
 
1827
1523
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1828
- interface CustomActivities {
1829
- }
1830
1524
  type ActivityParamsMap = {
1831
1525
  'cloud-image-edit': ActivityParams$1;
1832
1526
  external: ActivityParams;
1833
- } & {
1834
- [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1835
1527
  };
1836
1528
  declare class LitActivityBlock extends LitBlock {
1837
1529
  protected historyTracked: boolean;
1838
- activityType: ActivityType;
1839
1530
  private [ACTIVE_PROP]?;
1840
1531
  init$: {
1841
1532
  '*currentActivity': null;
@@ -1849,11 +1540,12 @@ declare class LitActivityBlock extends LitBlock {
1849
1540
  private _activate;
1850
1541
  initCallback(): void;
1851
1542
  private _historyFlush;
1852
- protected _isActivityRegistered(): boolean;
1543
+ private _isActivityRegistered;
1853
1544
  private static _activityCallbacks;
1854
1545
  static activities: Readonly<{
1855
1546
  START_FROM: 'start-from';
1856
1547
  CAMERA: 'camera';
1548
+ DRAW: 'draw';
1857
1549
  UPLOAD_LIST: 'upload-list';
1858
1550
  URL: 'url';
1859
1551
  CLOUD_IMG_EDIT: 'cloud-image-edit';
@@ -1869,8 +1561,8 @@ declare class LitActivityBlock extends LitBlock {
1869
1561
  private _unregisterActivity;
1870
1562
  disconnectedCallback(): void;
1871
1563
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1872
- get initActivity(): RegisteredActivityType | null;
1873
- get doneActivity(): RegisteredActivityType | null;
1564
+ get initActivity(): string | null;
1565
+ get doneActivity(): string | null;
1874
1566
  historyBack(): void;
1875
1567
  }
1876
1568
 
@@ -1925,19 +1617,10 @@ declare class ModalManager extends SharedInstance {
1925
1617
  destroy(): void;
1926
1618
  }
1927
1619
 
1928
- type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
1929
- type LazyPluginEntry = {
1930
- configDeps: readonly (keyof ConfigType)[];
1931
- isEnabled: (get: ConfigGetter) => boolean;
1932
- load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
1933
- };
1934
-
1935
1620
  declare class LitSolutionBlock extends LitBlock {
1936
1621
  static styleAttrs: string[];
1937
- static lazyPlugins: LazyPluginEntry[] | null;
1938
1622
  init$: {
1939
1623
  '*solution': string | null;
1940
- '*lazyPlugins': LazyPluginEntry[] | null;
1941
1624
  '*commonProgress': number;
1942
1625
  '*uploadList': never[];
1943
1626
  '*uploadQueue': _uploadcare_upload_client.Queue;
@@ -2069,20 +1752,18 @@ declare global {
2069
1752
  }
2070
1753
  }
2071
1754
 
2072
- type SourceButtonConfig = {
2073
- id: string;
2074
- label: string;
2075
- icon?: string;
2076
- onClick: () => void | Promise<void>;
2077
- };
2078
1755
  declare class SourceBtn extends LitUploaderBlock {
2079
1756
  couldBeCtxOwner: boolean;
2080
- source?: SourceButtonConfig;
1757
+ private _registeredTypes;
1758
+ type?: string;
2081
1759
  private _iconName;
2082
1760
  private _srcTypeKey;
2083
- protected willUpdate(changedProperties: PropertyValues<this>): void;
2084
- private _applySource;
1761
+ private _initTypes;
1762
+ initCallback(): void;
1763
+ private _registerType;
2085
1764
  activate(): void;
1765
+ private _applyType;
1766
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2086
1767
  render(): lit_html.TemplateResult<1>;
2087
1768
  }
2088
1769
  declare global {
@@ -2091,10 +1772,9 @@ declare global {
2091
1772
  }
2092
1773
  }
2093
1774
 
2094
- declare class SourceList extends LitUploaderBlock {
1775
+ declare class SourceList extends LitBlock {
2095
1776
  private _rawSourceList;
2096
- private _unsubscribePlugins?;
2097
- private _sources;
1777
+ private _cameraModes;
2098
1778
  /**
2099
1779
  * CSS-only attribute
2100
1780
  */
@@ -2102,10 +1782,8 @@ declare class SourceList extends LitUploaderBlock {
2102
1782
  initCallback(): void;
2103
1783
  protected updated(changedProperties: PropertyValues<this>): void;
2104
1784
  private _updateSources;
2105
- private _expandSource;
2106
- private _makePluginSourceConfig;
1785
+ private _sources;
2107
1786
  render(): lit_html.TemplateResult<1>;
2108
- disconnectedCallback(): void;
2109
1787
  }
2110
1788
  declare global {
2111
1789
  interface HTMLElementTagNameMap {
@@ -2160,6 +1838,8 @@ declare class UploadCtxProvider extends LitUploaderBlock {
2160
1838
  interface UploadCtxProvider extends LitUploaderBlock {
2161
1839
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
2162
1840
  removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
1841
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
1842
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
2163
1843
  }
2164
1844
  declare global {
2165
1845
  interface HTMLElementTagNameMap {
@@ -2167,65 +1847,38 @@ declare global {
2167
1847
  }
2168
1848
  }
2169
1849
 
2170
- declare class SimpleBtn extends LitUploaderBlock {
2171
- static styleAttrs: string[];
1850
+ declare class UrlSource extends LitUploaderBlock {
2172
1851
  couldBeCtxOwner: boolean;
2173
- dropzone: boolean;
2174
- private _buttonTextKey;
2175
- private readonly _handleClick;
1852
+ activityType: ActivityType;
1853
+ private _formState;
2176
1854
  initCallback(): void;
1855
+ private _inputRef;
1856
+ private _handleInput;
1857
+ private _handleUpload;
2177
1858
  render(): lit_html.TemplateResult<1>;
2178
1859
  }
2179
1860
  declare global {
2180
1861
  interface HTMLElementTagNameMap {
2181
- 'uc-simple-btn': SimpleBtn;
1862
+ 'uc-url-source': UrlSource;
2182
1863
  }
2183
1864
  }
2184
1865
 
2185
- declare class PluginActivityHost extends LitActivityBlock {
2186
- registration: Owned<PluginActivityRegistration>;
2187
- private _dispose?;
2188
- private _containerRef;
2189
- initCallback(): void;
2190
- protected willUpdate(changedProperties: PropertyValues<this>): void;
2191
- private _ensureRegistered;
2192
- private _renderActivity;
2193
- private _disposeActivity;
2194
- disconnectedCallback(): void;
2195
- render(): lit_html.TemplateResult<1>;
2196
- }
2197
- declare class PluginActivityRenderer extends LitBlock {
2198
- mode: 'modal' | 'inline';
2199
- private _activities;
2200
- private _unsubscribePlugins?;
1866
+ declare class SimpleBtn extends LitUploaderBlock {
1867
+ static styleAttrs: string[];
1868
+ couldBeCtxOwner: boolean;
1869
+ dropzone: boolean;
1870
+ private _buttonTextKey;
1871
+ private readonly _handleClick;
2201
1872
  initCallback(): void;
2202
- private _syncActivities;
2203
- disconnectedCallback(): void;
2204
- render(): lit_html.TemplateResult<1>;
2205
- }
2206
- declare global {
2207
- interface HTMLElementTagNameMap {
2208
- 'uc-plugin-activity-host': PluginActivityHost;
2209
- 'uc-plugin-activity-renderer': PluginActivityRenderer;
2210
- }
2211
- }
2212
-
2213
- declare class UrlSource extends LitUploaderBlock {
2214
- private _formState;
2215
- private _inputRef;
2216
- private _handleInput;
2217
- private _handleUpload;
2218
- firstUpdated(): void;
2219
1873
  render(): lit_html.TemplateResult<1>;
2220
1874
  }
2221
1875
  declare global {
2222
1876
  interface HTMLElementTagNameMap {
2223
- 'uc-url-source': UrlSource;
1877
+ 'uc-simple-btn': SimpleBtn;
2224
1878
  }
2225
1879
  }
2226
1880
 
2227
1881
  declare class FileUploaderRegular extends LitSolutionBlock {
2228
- static lazyPlugins: LazyPluginEntry[];
2229
1882
  attributesMeta: {
2230
1883
  headless?: boolean;
2231
1884
  'ctx-name': string;
@@ -2243,7 +1896,6 @@ declare global {
2243
1896
  }
2244
1897
 
2245
1898
  declare class FileUploaderInline extends LitSolutionBlock {
2246
- static lazyPlugins: LazyPluginEntry[];
2247
1899
  attributesMeta: {
2248
1900
  'ctx-name': string;
2249
1901
  };
@@ -2264,7 +1916,6 @@ declare global {
2264
1916
  }
2265
1917
 
2266
1918
  declare class FileUploaderMinimal extends LitSolutionBlock {
2267
- static lazyPlugins: LazyPluginEntry[];
2268
1919
  attributesMeta: {
2269
1920
  'ctx-name': string;
2270
1921
  };
@@ -2273,6 +1924,7 @@ declare class FileUploaderMinimal extends LitSolutionBlock {
2273
1924
  private _isHiddenStartFrom;
2274
1925
  private _classUploadList;
2275
1926
  private _classStartFrom;
1927
+ private _buttonTextKey;
2276
1928
  private _getInitActivity;
2277
1929
  constructor();
2278
1930
  private _handleModalOpen;
@@ -2298,8 +1950,6 @@ declare class A11y implements ISharedInstance {
2298
1950
  declare class LocaleManager extends SharedInstance {
2299
1951
  private _localeName;
2300
1952
  constructor(sharedInstancesBag: SharedInstancesBag);
2301
- private _applyOverrides;
2302
- private _applyPluginLocales;
2303
1953
  }
2304
1954
 
2305
1955
  type CommonEventType = InternalEventKey | EventKey;
@@ -2340,69 +1990,6 @@ declare class TelemetryManager extends SharedInstance {
2340
1990
  private get _location();
2341
1991
  }
2342
1992
 
2343
- interface ISharedInstance {
2344
- destroy?(): void;
2345
- }
2346
- declare class SharedInstance {
2347
- protected _ctx: PubSub<SharedState>;
2348
- protected _sharedInstancesBag: SharedInstancesBag;
2349
- private _subscriptions;
2350
- private _cfgProxy;
2351
- protected _debugPrint: (...args: unknown[]) => void;
2352
- constructor(sharedInstancesBag: SharedInstancesBag);
2353
- protected addSub(unsub: () => void): void;
2354
- protected get _cfg(): Readonly<ConfigType>;
2355
- destroy(): void;
2356
- }
2357
- declare const instanceKeyMap: {
2358
- modalManager: "*modalManager";
2359
- pluginManager: "*pluginManager";
2360
- telemetryManager: "*telemetryManager";
2361
- localeManager: "*localeManager";
2362
- a11y: "*a11y";
2363
- clipboard: "*clipboard";
2364
- blocksRegistry: "*blocksRegistry";
2365
- eventEmitter: "*eventEmitter";
2366
- uploadCollection: "*uploadCollection";
2367
- secureUploadsManager: "*secureUploadsManager";
2368
- api: "*publicApi";
2369
- validationManager: "*validationManager";
2370
- };
2371
- type InstanceTypeMap = {
2372
- [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
2373
- };
2374
- type InstanceName = keyof typeof instanceKeyMap;
2375
- type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
2376
- type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2377
- declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2378
- readonly ctx: PubSub<SharedState>;
2379
- readonly modalManager: ModalManager | null;
2380
- readonly pluginManager: PluginManager;
2381
- readonly telemetryManager: TelemetryManager;
2382
- readonly localeManager: LocaleManager;
2383
- readonly a11y: A11y;
2384
- readonly blocksRegistry: Set<LitBlock>;
2385
- readonly eventEmitter: EventEmitter;
2386
- readonly uploadCollection: TypedCollection<UploadEntryData>;
2387
- readonly secureUploadsManager: SecureUploadsManager;
2388
- readonly api: UploaderPublicApi;
2389
- readonly validationManager: ValidationManager;
2390
- when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
2391
- wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
2392
- };
2393
-
2394
- type PasteScope = 'local' | 'global' | false;
2395
- declare class ClipboardLayer extends SharedInstance {
2396
- private scopes;
2397
- private listener;
2398
- constructor(sharedInstancesBag: SharedInstancesBag);
2399
- private openUploadList;
2400
- private _listener;
2401
- private handlePaste;
2402
- registerBlock(scope: Node): () => void;
2403
- destroy(): void;
2404
- }
2405
-
2406
1993
  declare const TabId: Readonly<{
2407
1994
  readonly CROP: "crop";
2408
1995
  readonly TUNING: "tuning";
@@ -2467,14 +2054,11 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
2467
2054
  type SharedConfigState = {
2468
2055
  [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2469
2056
  };
2470
- type SharedCustomConfigState = {
2471
- [K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
2472
- };
2473
2057
  type BlocksRegistry = Set<LitBlock>;
2474
2058
  type ActivityBlockCtxState = {
2475
- '*currentActivity': RegisteredActivityType | null;
2059
+ '*currentActivity': string | null;
2476
2060
  '*currentActivityParams': Record<string, unknown>;
2477
- '*history': (RegisteredActivityType | null)[];
2061
+ '*history': (string | null)[];
2478
2062
  '*historyBack': (() => void) | null;
2479
2063
  '*closeModal': () => void;
2480
2064
  };
@@ -2491,7 +2075,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
2491
2075
  };
2492
2076
  type SolutionBlockCtxState = UploaderBlockCtxState & {
2493
2077
  '*solution': string | null;
2494
- '*lazyPlugins': LazyPluginEntry[] | null;
2495
2078
  };
2496
2079
  type CloudImageEditorState = {
2497
2080
  '*originalUrl': string | null;
@@ -2542,9 +2125,7 @@ type EditorToolbarState = {
2542
2125
  '*currentOperation': string | null;
2543
2126
  '*operationTooltip': string | null;
2544
2127
  };
2545
- type SharedContextInstances = Map<string, ISharedInstance>;
2546
2128
  type DynamicBlockState = {
2547
- '*sharedContextInstances': SharedContextInstances;
2548
2129
  '*blocksRegistry': BlocksRegistry;
2549
2130
  '*eventEmitter': EventEmitter;
2550
2131
  '*localeManager': LocaleManager;
@@ -2552,7 +2133,6 @@ type DynamicBlockState = {
2552
2133
  '*a11y': A11y;
2553
2134
  '*modalManager': ModalManager | null;
2554
2135
  '*clipboard': ClipboardLayer;
2555
- '*pluginManager': PluginManager;
2556
2136
  };
2557
2137
  type DynamicUploaderBlockState = {
2558
2138
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2563,7 +2143,66 @@ type DynamicUploaderBlockState = {
2563
2143
  type LocaleState = {
2564
2144
  [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2565
2145
  };
2566
- type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2146
+ type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2147
+
2148
+ interface ISharedInstance {
2149
+ destroy?(): void;
2150
+ }
2151
+ declare class SharedInstance {
2152
+ protected _ctx: PubSub<SharedState>;
2153
+ protected _sharedInstancesBag: SharedInstancesBag;
2154
+ private _subscriptions;
2155
+ private _cfgProxy;
2156
+ protected _debugPrint: (...args: unknown[]) => void;
2157
+ constructor(sharedInstancesBag: SharedInstancesBag);
2158
+ protected addSub(unsub: () => void): void;
2159
+ protected get _cfg(): Readonly<ConfigType>;
2160
+ destroy(): void;
2161
+ }
2162
+ type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2163
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2164
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2165
+ readonly ctx: PubSub<SharedState>;
2166
+ readonly modalManager: ModalManager | null;
2167
+ readonly telemetryManager: TelemetryManager;
2168
+ readonly localeManager: LocaleManager;
2169
+ readonly a11y: A11y;
2170
+ readonly blocksRegistry: Set<LitBlock>;
2171
+ readonly eventEmitter: EventEmitter;
2172
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2173
+ readonly secureUploadsManager: SecureUploadsManager;
2174
+ readonly api: UploaderPublicApi;
2175
+ readonly validationManager: ValidationManager;
2176
+ };
2177
+
2178
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2179
+ signal?: AbortSignal;
2180
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2181
+ type FileValidatorDescriptor = {
2182
+ runOn: 'add' | 'upload' | 'change';
2183
+ validator: FuncFileValidator;
2184
+ };
2185
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2186
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2187
+ declare class ValidationManager extends SharedInstance {
2188
+ private get _uploadCollection();
2189
+ private _commonFileValidators;
2190
+ private _commonCollectionValidators;
2191
+ private _queue;
2192
+ private _runQueueDebounced;
2193
+ private _isDestroyed;
2194
+ private _entryValidationState;
2195
+ constructor(sharedInstancesBag: SharedInstancesBag);
2196
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2197
+ runCollectionValidators(): void;
2198
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2199
+ private _runFileValidatorsForEntry;
2200
+ private _addCustomTypeToValidationError;
2201
+ private _getEntryValidationState;
2202
+ private _getValidatorDescriptors;
2203
+ private _getValidatorDescriptorsForEntry;
2204
+ destroy(): void;
2205
+ }
2567
2206
 
2568
2207
  declare const LitBlockBase: typeof LitElement & Constructor<{
2569
2208
  willYield: boolean;
@@ -2575,7 +2214,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2575
2214
  };
2576
2215
  declare class LitBlock extends LitBlockBase {
2577
2216
  private _cfgProxy;
2217
+ protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2578
2218
  static styleAttrs: string[];
2219
+ activityType: ActivityType;
2579
2220
  init$: {};
2580
2221
  constructor();
2581
2222
  l10n: (str: string, variables?: Record<string, string | number>) => string;
@@ -2583,7 +2224,6 @@ declare class LitBlock extends LitBlockBase {
2583
2224
  protected _sharedInstancesBag: {
2584
2225
  readonly ctx: PubSub<SharedState>;
2585
2226
  readonly modalManager: ModalManager | null;
2586
- readonly pluginManager: PluginManager;
2587
2227
  readonly telemetryManager: TelemetryManager;
2588
2228
  readonly localeManager: LocaleManager;
2589
2229
  readonly a11y: A11y;
@@ -2593,34 +2233,6 @@ declare class LitBlock extends LitBlockBase {
2593
2233
  readonly secureUploadsManager: SecureUploadsManager;
2594
2234
  readonly api: UploaderPublicApi;
2595
2235
  readonly validationManager: ValidationManager;
2596
- when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
2597
- modalManager: ModalManager | null;
2598
- pluginManager: PluginManager;
2599
- telemetryManager: TelemetryManager;
2600
- localeManager: LocaleManager;
2601
- a11y: A11y;
2602
- clipboard: ClipboardLayer;
2603
- blocksRegistry: BlocksRegistry;
2604
- eventEmitter: EventEmitter;
2605
- uploadCollection: TypedCollection<UploadEntryData>;
2606
- secureUploadsManager: SecureUploadsManager;
2607
- api: UploaderPublicApi;
2608
- validationManager: ValidationManager;
2609
- }[TName]>) => void): () => void;
2610
- wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
2611
- modalManager: ModalManager | null;
2612
- pluginManager: PluginManager;
2613
- telemetryManager: TelemetryManager;
2614
- localeManager: LocaleManager;
2615
- a11y: A11y;
2616
- clipboard: ClipboardLayer;
2617
- blocksRegistry: BlocksRegistry;
2618
- eventEmitter: EventEmitter;
2619
- uploadCollection: TypedCollection<UploadEntryData>;
2620
- secureUploadsManager: SecureUploadsManager;
2621
- api: UploaderPublicApi;
2622
- validationManager: ValidationManager;
2623
- }[TName]>>;
2624
2236
  };
2625
2237
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2626
2238
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2639,7 +2251,11 @@ declare class LitBlock extends LitBlockBase {
2639
2251
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2640
2252
  */
2641
2253
  private destroyCtxCallback;
2642
- private _getSharedContextInstances;
2254
+ /**
2255
+ * Adds a shared context instance if it does not exist yet.
2256
+ * @param key The shared state key.
2257
+ * @param resolver The resolver function that creates the instance.
2258
+ */
2643
2259
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2644
2260
  private _destroySharedContextInstances;
2645
2261
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
@@ -3173,7 +2789,6 @@ declare class CloudImageEditorBlock extends LitBlock {
3173
2789
  private _hasNetworkProblems;
3174
2790
  private _isInitialized;
3175
2791
  private _pendingInitUpdate;
3176
- private _pendingSizeWait;
3177
2792
  private readonly _debouncedShowLoader;
3178
2793
  private readonly _imgRef;
3179
2794
  private readonly _cropperRef;