@uploadcare/file-uploader 1.29.0-alpha.2 → 1.30.0-alpha.1

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 +0 -2
  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 +337 -691
  6. package/dist/index.js +5 -5
  7. package/dist/index.layered.css +3 -3
  8. package/dist/index.ssr.js +82 -115
  9. package/dist/locales/file-uploader/ar.d.ts +2 -0
  10. package/dist/locales/file-uploader/ar.js +3 -3
  11. package/dist/locales/file-uploader/az.d.ts +2 -0
  12. package/dist/locales/file-uploader/az.js +3 -3
  13. package/dist/locales/file-uploader/ca.d.ts +2 -0
  14. package/dist/locales/file-uploader/ca.js +3 -3
  15. package/dist/locales/file-uploader/cs.d.ts +2 -0
  16. package/dist/locales/file-uploader/cs.js +3 -3
  17. package/dist/locales/file-uploader/da.d.ts +2 -0
  18. package/dist/locales/file-uploader/da.js +3 -3
  19. package/dist/locales/file-uploader/de.d.ts +2 -0
  20. package/dist/locales/file-uploader/de.js +3 -3
  21. package/dist/locales/file-uploader/el.d.ts +2 -0
  22. package/dist/locales/file-uploader/el.js +3 -3
  23. package/dist/locales/file-uploader/en.d.ts +2 -0
  24. package/dist/locales/file-uploader/en.js +3 -3
  25. package/dist/locales/file-uploader/es.d.ts +2 -0
  26. package/dist/locales/file-uploader/es.js +3 -3
  27. package/dist/locales/file-uploader/et.d.ts +2 -0
  28. package/dist/locales/file-uploader/et.js +3 -3
  29. package/dist/locales/file-uploader/fi.d.ts +2 -0
  30. package/dist/locales/file-uploader/fi.js +3 -3
  31. package/dist/locales/file-uploader/fr.d.ts +2 -0
  32. package/dist/locales/file-uploader/fr.js +3 -3
  33. package/dist/locales/file-uploader/he.d.ts +2 -0
  34. package/dist/locales/file-uploader/he.js +3 -3
  35. package/dist/locales/file-uploader/hy.d.ts +2 -0
  36. package/dist/locales/file-uploader/hy.js +3 -3
  37. package/dist/locales/file-uploader/is.d.ts +2 -0
  38. package/dist/locales/file-uploader/is.js +3 -3
  39. package/dist/locales/file-uploader/it.d.ts +2 -0
  40. package/dist/locales/file-uploader/it.js +3 -3
  41. package/dist/locales/file-uploader/ja.d.ts +2 -0
  42. package/dist/locales/file-uploader/ja.js +3 -3
  43. package/dist/locales/file-uploader/ka.d.ts +2 -0
  44. package/dist/locales/file-uploader/ka.js +3 -3
  45. package/dist/locales/file-uploader/kk.d.ts +2 -0
  46. package/dist/locales/file-uploader/kk.js +3 -3
  47. package/dist/locales/file-uploader/ko.d.ts +2 -0
  48. package/dist/locales/file-uploader/ko.js +3 -3
  49. package/dist/locales/file-uploader/lv.d.ts +2 -0
  50. package/dist/locales/file-uploader/lv.js +3 -3
  51. package/dist/locales/file-uploader/nb.d.ts +2 -0
  52. package/dist/locales/file-uploader/nb.js +3 -3
  53. package/dist/locales/file-uploader/nl.d.ts +2 -0
  54. package/dist/locales/file-uploader/nl.js +3 -3
  55. package/dist/locales/file-uploader/pl.d.ts +2 -0
  56. package/dist/locales/file-uploader/pl.js +3 -3
  57. package/dist/locales/file-uploader/pt.d.ts +2 -0
  58. package/dist/locales/file-uploader/pt.js +3 -3
  59. package/dist/locales/file-uploader/ro.d.ts +2 -0
  60. package/dist/locales/file-uploader/ro.js +3 -3
  61. package/dist/locales/file-uploader/ru.d.ts +2 -0
  62. package/dist/locales/file-uploader/ru.js +3 -3
  63. package/dist/locales/file-uploader/sk.d.ts +2 -0
  64. package/dist/locales/file-uploader/sk.js +3 -3
  65. package/dist/locales/file-uploader/sr.d.ts +2 -0
  66. package/dist/locales/file-uploader/sr.js +3 -3
  67. package/dist/locales/file-uploader/sv.d.ts +2 -0
  68. package/dist/locales/file-uploader/sv.js +3 -3
  69. package/dist/locales/file-uploader/tr.d.ts +2 -0
  70. package/dist/locales/file-uploader/tr.js +3 -3
  71. package/dist/locales/file-uploader/uk.d.ts +2 -0
  72. package/dist/locales/file-uploader/uk.js +3 -3
  73. package/dist/locales/file-uploader/vi.d.ts +2 -0
  74. package/dist/locales/file-uploader/vi.js +3 -3
  75. package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
  76. package/dist/locales/file-uploader/zh-TW.js +3 -3
  77. package/dist/locales/file-uploader/zh.d.ts +2 -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 +339 -691
  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 +339 -691
  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 +291 -643
  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 +339 -691
  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 +339 -691
  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 +339 -691
  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
 
@@ -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(): 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;
@@ -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", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
475
+ declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartBtn"];
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: string, oldVal: string, newVal: string): void;
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, CustomConfig {
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 _unsubscribePlugins?;
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,73 +816,7 @@ declare const CameraSourceTypes: Readonly<{
899
816
  }>;
900
817
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
901
818
 
902
- declare const InternalEventType: Readonly<{
903
- readonly INIT_SOLUTION: "init-solution";
904
- readonly CHANGE_CONFIG: "change-config";
905
- readonly ACTION_EVENT: "action-event";
906
- readonly ERROR_EVENT: "error-event";
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'>;
956
- };
957
- declare class EventEmitter extends SharedInstance {
958
- private _timeoutStore;
959
- private _targets;
960
- private _listeners;
961
- bindTarget(target: LitBlock): () => void;
962
- on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
963
- private _dispatch;
964
- emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
965
- debounce?: TDebounce;
966
- }): void;
967
- destroy(): void;
968
- }
819
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
969
820
 
970
821
  type ApiAddFileCommonOptions = {
971
822
  silent?: boolean;
@@ -997,15 +848,75 @@ declare class UploaderPublicApi extends SharedInstance {
997
848
  getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
998
849
  initFlow: (force?: boolean) => void;
999
850
  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);
851
+ setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
1003
852
  getCurrentActivity: () => ActivityType;
1004
- historyBack: () => void;
1005
853
  setModalState: (opened: boolean) => void;
1006
854
  private get _sourceList();
1007
855
  }
1008
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
+ private readonly _handleContentClick;
881
+ protected render(): unknown;
882
+ }
883
+ declare global {
884
+ interface HTMLElementTagNameMap {
885
+ 'uc-dropdown': Dropdown;
886
+ }
887
+ }
888
+
889
+ type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
890
+ type AdvancedSmartBtnConfig = {
891
+ sourceList: string;
892
+ mode: SmartButtonMode;
893
+ };
894
+ declare class SmartBtn extends LitUploaderBlock {
895
+ static styleAttrs: string[];
896
+ couldBeCtxOwner: boolean;
897
+ dropzone: boolean;
898
+ private _sourceList;
899
+ private _status;
900
+ private _multiple;
901
+ private _entry;
902
+ private _lastDigest;
903
+ private _showDropdown;
904
+ private get isIdle();
905
+ private get buttonText();
906
+ private _throttledHandleCollectionUpdate;
907
+ private _updateButtonBasedOnCollectionState;
908
+ private _removeEntries;
909
+ initCallback(): void;
910
+ private readonly _handleClickAbort;
911
+ private readonly _handleClick;
912
+ render(): lit_html.TemplateResult<1>;
913
+ }
914
+ declare global {
915
+ interface HTMLElementTagNameMap {
916
+ 'uc-smart-btn': SmartBtn;
917
+ }
918
+ }
919
+
1009
920
  type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
1010
921
  type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
1011
922
  type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
@@ -1218,10 +1129,6 @@ type ConfigType = {
1218
1129
  * Expiry threshold for secure uploads.
1219
1130
  */
1220
1131
  secureUploadsExpireThreshold: number;
1221
- /**
1222
- * Array of plugins to register with the uploader instance.
1223
- */
1224
- plugins: UploaderPlugin[];
1225
1132
  /**
1226
1133
  * Metadata for the file.
1227
1134
  */
@@ -1307,6 +1214,7 @@ type ConfigType = {
1307
1214
  * Define the clipboard paste scope.
1308
1215
  */
1309
1216
  pasteScope: PasteScope;
1217
+ smartBtn: AdvancedSmartBtnConfig | null;
1310
1218
  };
1311
1219
  type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
1312
1220
  type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -1473,165 +1381,6 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
1473
1381
  allEntries: OutputFileEntry[];
1474
1382
  });
1475
1383
 
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
1384
  declare class SecureUploadsManager extends SharedInstance {
1636
1385
  private _secureToken;
1637
1386
  getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
@@ -1676,6 +1425,7 @@ declare class LitUploaderBlock extends LitActivityBlock {
1676
1425
  private _handleCollectionUpdate;
1677
1426
  private _handleCollectionPropertiesUpdate;
1678
1427
  private _flushCommonUploadProgress;
1428
+ private _openCloudImageEditor;
1679
1429
  private _setInitialCrop;
1680
1430
  protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1681
1431
  protected getUploadClientOptions(): Promise<FileFromOptions>;
@@ -1745,11 +1495,12 @@ type ActivityParams$1 = {
1745
1495
  internalId: string;
1746
1496
  };
1747
1497
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1498
+ couldBeCtxOwner: boolean;
1499
+ activityType: "cloud-image-edit";
1748
1500
  private _entry?;
1749
1501
  private _editorConfig;
1750
1502
  get activityParams(): ActivityParams$1;
1751
1503
  initCallback(): void;
1752
- disconnectedCallback(): void;
1753
1504
  private _handleApply;
1754
1505
  private _handleCancel;
1755
1506
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1778,6 +1529,7 @@ type ActivityParams = {
1778
1529
  };
1779
1530
  declare class ExternalSource extends LitUploaderBlock {
1780
1531
  couldBeCtxOwner: boolean;
1532
+ activityType: "external";
1781
1533
  private _messageBridge?;
1782
1534
  private _iframeRef;
1783
1535
  private _latestSelectionSummary;
@@ -1821,26 +1573,22 @@ declare global {
1821
1573
  declare const ACTIVITY_TYPES: Readonly<{
1822
1574
  START_FROM: "start-from";
1823
1575
  CAMERA: "camera";
1576
+ DRAW: "draw";
1824
1577
  UPLOAD_LIST: "upload-list";
1825
1578
  URL: "url";
1826
1579
  CLOUD_IMG_EDIT: "cloud-image-edit";
1827
1580
  EXTERNAL: "external";
1828
1581
  }>;
1829
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1830
- type ActivityType = RegisteredActivityType | null;
1582
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1583
+ type ActivityType = RegisteredActivityType | (string & {}) | null;
1831
1584
 
1832
1585
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1833
- interface CustomActivities {
1834
- }
1835
1586
  type ActivityParamsMap = {
1836
1587
  'cloud-image-edit': ActivityParams$1;
1837
1588
  external: ActivityParams;
1838
- } & {
1839
- [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1840
1589
  };
1841
1590
  declare class LitActivityBlock extends LitBlock {
1842
1591
  protected historyTracked: boolean;
1843
- activityType: ActivityType;
1844
1592
  private [ACTIVE_PROP]?;
1845
1593
  init$: {
1846
1594
  '*currentActivity': null;
@@ -1854,11 +1602,12 @@ declare class LitActivityBlock extends LitBlock {
1854
1602
  private _activate;
1855
1603
  initCallback(): void;
1856
1604
  private _historyFlush;
1857
- protected _isActivityRegistered(): boolean;
1605
+ private _isActivityRegistered;
1858
1606
  private static _activityCallbacks;
1859
1607
  static activities: Readonly<{
1860
1608
  START_FROM: 'start-from';
1861
1609
  CAMERA: 'camera';
1610
+ DRAW: 'draw';
1862
1611
  UPLOAD_LIST: 'upload-list';
1863
1612
  URL: 'url';
1864
1613
  CLOUD_IMG_EDIT: 'cloud-image-edit';
@@ -1874,8 +1623,8 @@ declare class LitActivityBlock extends LitBlock {
1874
1623
  private _unregisterActivity;
1875
1624
  disconnectedCallback(): void;
1876
1625
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1877
- get initActivity(): RegisteredActivityType | null;
1878
- get doneActivity(): RegisteredActivityType | null;
1626
+ get initActivity(): string | null;
1627
+ get doneActivity(): string | null;
1879
1628
  historyBack(): void;
1880
1629
  }
1881
1630
 
@@ -1930,19 +1679,10 @@ declare class ModalManager extends SharedInstance {
1930
1679
  destroy(): void;
1931
1680
  }
1932
1681
 
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
1682
  declare class LitSolutionBlock extends LitBlock {
1941
1683
  static styleAttrs: string[];
1942
- static lazyPlugins: LazyPluginEntry[] | null;
1943
1684
  init$: {
1944
1685
  '*solution': string | null;
1945
- '*lazyPlugins': LazyPluginEntry[] | null;
1946
1686
  '*commonProgress': number;
1947
1687
  '*uploadList': never[];
1948
1688
  '*uploadQueue': _uploadcare_upload_client.Queue;
@@ -2074,32 +1814,9 @@ declare global {
2074
1814
  }
2075
1815
  }
2076
1816
 
2077
- type SourceButtonConfig = {
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 {
1817
+ declare class SourceList extends LitBlock {
2100
1818
  private _rawSourceList;
2101
- private _unsubscribePlugins?;
2102
- private _sources;
1819
+ private _cameraModes;
2103
1820
  /**
2104
1821
  * CSS-only attribute
2105
1822
  */
@@ -2107,10 +1824,8 @@ declare class SourceList extends LitUploaderBlock {
2107
1824
  initCallback(): void;
2108
1825
  protected updated(changedProperties: PropertyValues<this>): void;
2109
1826
  private _updateSources;
2110
- private _expandSource;
2111
- private _makePluginSourceConfig;
1827
+ private _sources;
2112
1828
  render(): lit_html.TemplateResult<1>;
2113
- disconnectedCallback(): void;
2114
1829
  }
2115
1830
  declare global {
2116
1831
  interface HTMLElementTagNameMap {
@@ -2165,8 +1880,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
2165
1880
  interface UploadCtxProvider extends LitUploaderBlock {
2166
1881
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
2167
1882
  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
1883
  }
2171
1884
  declare global {
2172
1885
  interface HTMLElementTagNameMap {
@@ -2174,71 +1887,45 @@ declare global {
2174
1887
  }
2175
1888
  }
2176
1889
 
2177
- declare class SimpleBtn extends LitUploaderBlock {
2178
- static styleAttrs: string[];
1890
+ declare class UrlSource extends LitUploaderBlock {
2179
1891
  couldBeCtxOwner: boolean;
2180
- dropzone: boolean;
2181
- private _buttonTextKey;
2182
- private readonly _handleClick;
1892
+ activityType: ActivityType;
1893
+ private _formState;
2183
1894
  initCallback(): void;
1895
+ private _inputRef;
1896
+ private _handleInput;
1897
+ private _handleUpload;
2184
1898
  render(): lit_html.TemplateResult<1>;
2185
1899
  }
2186
1900
  declare global {
2187
1901
  interface HTMLElementTagNameMap {
2188
- 'uc-simple-btn': SimpleBtn;
1902
+ 'uc-url-source': UrlSource;
2189
1903
  }
2190
1904
  }
2191
1905
 
2192
- declare class PluginActivityHost extends LitActivityBlock {
2193
- registration: Owned<PluginActivityRegistration>;
2194
- private _dispose?;
2195
- private _containerRef;
2196
- initCallback(): void;
2197
- protected willUpdate(changedProperties: PropertyValues<this>): void;
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?;
1906
+ declare class SimpleBtn extends LitUploaderBlock {
1907
+ static styleAttrs: string[];
1908
+ couldBeCtxOwner: boolean;
1909
+ dropzone: boolean;
1910
+ private _buttonTextKey;
1911
+ private readonly _handleClick;
2208
1912
  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
1913
  render(): lit_html.TemplateResult<1>;
2227
1914
  }
2228
1915
  declare global {
2229
1916
  interface HTMLElementTagNameMap {
2230
- 'uc-url-source': UrlSource;
1917
+ 'uc-simple-btn': SimpleBtn;
2231
1918
  }
2232
1919
  }
2233
1920
 
2234
1921
  declare class FileUploaderRegular extends LitSolutionBlock {
2235
- static lazyPlugins: LazyPluginEntry[];
2236
1922
  attributesMeta: {
2237
1923
  headless?: boolean;
2238
1924
  'ctx-name': string;
2239
1925
  };
2240
1926
  static styleAttrs: string[];
2241
1927
  headless: boolean;
1928
+ smart: boolean;
2242
1929
  constructor();
2243
1930
  initCallback(): void;
2244
1931
  render(): lit_html.TemplateResult<1>;
@@ -2250,7 +1937,6 @@ declare global {
2250
1937
  }
2251
1938
 
2252
1939
  declare class FileUploaderInline extends LitSolutionBlock {
2253
- static lazyPlugins: LazyPluginEntry[];
2254
1940
  attributesMeta: {
2255
1941
  'ctx-name': string;
2256
1942
  };
@@ -2271,7 +1957,6 @@ declare global {
2271
1957
  }
2272
1958
 
2273
1959
  declare class FileUploaderMinimal extends LitSolutionBlock {
2274
- static lazyPlugins: LazyPluginEntry[];
2275
1960
  attributesMeta: {
2276
1961
  'ctx-name': string;
2277
1962
  };
@@ -2306,8 +1991,6 @@ declare class A11y implements ISharedInstance {
2306
1991
  declare class LocaleManager extends SharedInstance {
2307
1992
  private _localeName;
2308
1993
  constructor(sharedInstancesBag: SharedInstancesBag);
2309
- private _applyOverrides;
2310
- private _applyPluginLocales;
2311
1994
  }
2312
1995
 
2313
1996
  type CommonEventType = InternalEventKey | EventKey;
@@ -2348,69 +2031,6 @@ declare class TelemetryManager extends SharedInstance {
2348
2031
  private get _location();
2349
2032
  }
2350
2033
 
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
2034
  declare const TabId: Readonly<{
2415
2035
  readonly CROP: "crop";
2416
2036
  readonly TUNING: "tuning";
@@ -2475,14 +2095,11 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
2475
2095
  type SharedConfigState = {
2476
2096
  [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2477
2097
  };
2478
- type SharedCustomConfigState = {
2479
- [K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
2480
- };
2481
2098
  type BlocksRegistry = Set<LitBlock>;
2482
2099
  type ActivityBlockCtxState = {
2483
- '*currentActivity': RegisteredActivityType | null;
2100
+ '*currentActivity': string | null;
2484
2101
  '*currentActivityParams': Record<string, unknown>;
2485
- '*history': (RegisteredActivityType | null)[];
2102
+ '*history': (string | null)[];
2486
2103
  '*historyBack': (() => void) | null;
2487
2104
  '*closeModal': () => void;
2488
2105
  };
@@ -2499,7 +2116,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
2499
2116
  };
2500
2117
  type SolutionBlockCtxState = UploaderBlockCtxState & {
2501
2118
  '*solution': string | null;
2502
- '*lazyPlugins': LazyPluginEntry[] | null;
2503
2119
  };
2504
2120
  type CloudImageEditorState = {
2505
2121
  '*originalUrl': string | null;
@@ -2550,9 +2166,7 @@ type EditorToolbarState = {
2550
2166
  '*currentOperation': string | null;
2551
2167
  '*operationTooltip': string | null;
2552
2168
  };
2553
- type SharedContextInstances = Map<string, ISharedInstance>;
2554
2169
  type DynamicBlockState = {
2555
- '*sharedContextInstances': SharedContextInstances;
2556
2170
  '*blocksRegistry': BlocksRegistry;
2557
2171
  '*eventEmitter': EventEmitter;
2558
2172
  '*localeManager': LocaleManager;
@@ -2560,7 +2174,6 @@ type DynamicBlockState = {
2560
2174
  '*a11y': A11y;
2561
2175
  '*modalManager': ModalManager | null;
2562
2176
  '*clipboard': ClipboardLayer;
2563
- '*pluginManager': PluginManager;
2564
2177
  };
2565
2178
  type DynamicUploaderBlockState = {
2566
2179
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2571,7 +2184,66 @@ type DynamicUploaderBlockState = {
2571
2184
  type LocaleState = {
2572
2185
  [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2573
2186
  };
2574
- type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2187
+ type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2188
+
2189
+ interface ISharedInstance {
2190
+ destroy?(): void;
2191
+ }
2192
+ declare class SharedInstance {
2193
+ protected _ctx: PubSub<SharedState>;
2194
+ protected _sharedInstancesBag: SharedInstancesBag;
2195
+ private _subscriptions;
2196
+ private _cfgProxy;
2197
+ protected _debugPrint: (...args: unknown[]) => void;
2198
+ constructor(sharedInstancesBag: SharedInstancesBag);
2199
+ protected addSub(unsub: () => void): void;
2200
+ protected get _cfg(): Readonly<ConfigType>;
2201
+ destroy(): void;
2202
+ }
2203
+ type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2204
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2205
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2206
+ readonly ctx: PubSub<SharedState>;
2207
+ readonly modalManager: ModalManager | null;
2208
+ readonly telemetryManager: TelemetryManager;
2209
+ readonly localeManager: LocaleManager;
2210
+ readonly a11y: A11y;
2211
+ readonly blocksRegistry: Set<LitBlock>;
2212
+ readonly eventEmitter: EventEmitter;
2213
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2214
+ readonly secureUploadsManager: SecureUploadsManager;
2215
+ readonly api: UploaderPublicApi;
2216
+ readonly validationManager: ValidationManager;
2217
+ };
2218
+
2219
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2220
+ signal?: AbortSignal;
2221
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2222
+ type FileValidatorDescriptor = {
2223
+ runOn: 'add' | 'upload' | 'change';
2224
+ validator: FuncFileValidator;
2225
+ };
2226
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2227
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2228
+ declare class ValidationManager extends SharedInstance {
2229
+ private get _uploadCollection();
2230
+ private _commonFileValidators;
2231
+ private _commonCollectionValidators;
2232
+ private _queue;
2233
+ private _runQueueDebounced;
2234
+ private _isDestroyed;
2235
+ private _entryValidationState;
2236
+ constructor(sharedInstancesBag: SharedInstancesBag);
2237
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2238
+ runCollectionValidators(): void;
2239
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2240
+ private _runFileValidatorsForEntry;
2241
+ private _addCustomTypeToValidationError;
2242
+ private _getEntryValidationState;
2243
+ private _getValidatorDescriptors;
2244
+ private _getValidatorDescriptorsForEntry;
2245
+ destroy(): void;
2246
+ }
2575
2247
 
2576
2248
  declare const LitBlockBase: typeof LitElement & Constructor<{
2577
2249
  willYield: boolean;
@@ -2583,7 +2255,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2583
2255
  };
2584
2256
  declare class LitBlock extends LitBlockBase {
2585
2257
  private _cfgProxy;
2258
+ protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2586
2259
  static styleAttrs: string[];
2260
+ activityType: ActivityType;
2587
2261
  init$: {};
2588
2262
  constructor();
2589
2263
  l10n: (str: string, variables?: Record<string, string | number>) => string;
@@ -2591,7 +2265,6 @@ declare class LitBlock extends LitBlockBase {
2591
2265
  protected _sharedInstancesBag: {
2592
2266
  readonly ctx: PubSub<SharedState>;
2593
2267
  readonly modalManager: ModalManager | null;
2594
- readonly pluginManager: PluginManager;
2595
2268
  readonly telemetryManager: TelemetryManager;
2596
2269
  readonly localeManager: LocaleManager;
2597
2270
  readonly a11y: A11y;
@@ -2601,34 +2274,6 @@ declare class LitBlock extends LitBlockBase {
2601
2274
  readonly secureUploadsManager: SecureUploadsManager;
2602
2275
  readonly api: UploaderPublicApi;
2603
2276
  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
2277
  };
2633
2278
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2634
2279
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2647,7 +2292,11 @@ declare class LitBlock extends LitBlockBase {
2647
2292
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2648
2293
  */
2649
2294
  private destroyCtxCallback;
2650
- private _getSharedContextInstances;
2295
+ /**
2296
+ * Adds a shared context instance if it does not exist yet.
2297
+ * @param key The shared state key.
2298
+ * @param resolver The resolver function that creates the instance.
2299
+ */
2651
2300
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2652
2301
  private _destroySharedContextInstances;
2653
2302
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
@@ -3181,7 +2830,6 @@ declare class CloudImageEditorBlock extends LitBlock {
3181
2830
  private _hasNetworkProblems;
3182
2831
  private _isInitialized;
3183
2832
  private _pendingInitUpdate;
3184
- private _pendingSizeWait;
3185
2833
  private readonly _debouncedShowLoader;
3186
2834
  private readonly _imgRef;
3187
2835
  private readonly _cropperRef;