@uploadcare/file-uploader 1.30.0-alpha.3 → 1.30.0-alpha.6

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 -0
  2. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  3. package/dist/env.js +3 -3
  4. package/dist/index.css +4 -4
  5. package/dist/index.d.ts +791 -308
  6. package/dist/index.js +5 -5
  7. package/dist/index.layered.css +3 -3
  8. package/dist/index.ssr.js +324 -42
  9. package/dist/locales/file-uploader/ar.d.ts +7 -2
  10. package/dist/locales/file-uploader/ar.js +3 -3
  11. package/dist/locales/file-uploader/az.d.ts +7 -2
  12. package/dist/locales/file-uploader/az.js +3 -3
  13. package/dist/locales/file-uploader/ca.d.ts +7 -2
  14. package/dist/locales/file-uploader/ca.js +3 -3
  15. package/dist/locales/file-uploader/cs.d.ts +7 -2
  16. package/dist/locales/file-uploader/cs.js +3 -3
  17. package/dist/locales/file-uploader/da.d.ts +7 -2
  18. package/dist/locales/file-uploader/da.js +3 -3
  19. package/dist/locales/file-uploader/de.d.ts +7 -2
  20. package/dist/locales/file-uploader/de.js +3 -3
  21. package/dist/locales/file-uploader/el.d.ts +7 -2
  22. package/dist/locales/file-uploader/el.js +3 -3
  23. package/dist/locales/file-uploader/en.d.ts +7 -2
  24. package/dist/locales/file-uploader/en.js +3 -3
  25. package/dist/locales/file-uploader/es.d.ts +7 -2
  26. package/dist/locales/file-uploader/es.js +3 -3
  27. package/dist/locales/file-uploader/et.d.ts +7 -2
  28. package/dist/locales/file-uploader/et.js +3 -3
  29. package/dist/locales/file-uploader/fi.d.ts +7 -2
  30. package/dist/locales/file-uploader/fi.js +3 -3
  31. package/dist/locales/file-uploader/fr.d.ts +7 -2
  32. package/dist/locales/file-uploader/fr.js +3 -3
  33. package/dist/locales/file-uploader/he.d.ts +7 -2
  34. package/dist/locales/file-uploader/he.js +3 -3
  35. package/dist/locales/file-uploader/hy.d.ts +7 -2
  36. package/dist/locales/file-uploader/hy.js +3 -3
  37. package/dist/locales/file-uploader/is.d.ts +7 -2
  38. package/dist/locales/file-uploader/is.js +3 -3
  39. package/dist/locales/file-uploader/it.d.ts +7 -2
  40. package/dist/locales/file-uploader/it.js +3 -3
  41. package/dist/locales/file-uploader/ja.d.ts +7 -2
  42. package/dist/locales/file-uploader/ja.js +3 -3
  43. package/dist/locales/file-uploader/ka.d.ts +7 -2
  44. package/dist/locales/file-uploader/ka.js +3 -3
  45. package/dist/locales/file-uploader/kk.d.ts +7 -2
  46. package/dist/locales/file-uploader/kk.js +3 -3
  47. package/dist/locales/file-uploader/ko.d.ts +7 -2
  48. package/dist/locales/file-uploader/ko.js +3 -3
  49. package/dist/locales/file-uploader/lv.d.ts +7 -2
  50. package/dist/locales/file-uploader/lv.js +3 -3
  51. package/dist/locales/file-uploader/nb.d.ts +7 -2
  52. package/dist/locales/file-uploader/nb.js +3 -3
  53. package/dist/locales/file-uploader/nl.d.ts +7 -2
  54. package/dist/locales/file-uploader/nl.js +3 -3
  55. package/dist/locales/file-uploader/pl.d.ts +7 -2
  56. package/dist/locales/file-uploader/pl.js +3 -3
  57. package/dist/locales/file-uploader/pt.d.ts +7 -2
  58. package/dist/locales/file-uploader/pt.js +3 -3
  59. package/dist/locales/file-uploader/ro.d.ts +7 -2
  60. package/dist/locales/file-uploader/ro.js +3 -3
  61. package/dist/locales/file-uploader/ru.d.ts +7 -2
  62. package/dist/locales/file-uploader/ru.js +3 -3
  63. package/dist/locales/file-uploader/sk.d.ts +7 -2
  64. package/dist/locales/file-uploader/sk.js +3 -3
  65. package/dist/locales/file-uploader/sr.d.ts +7 -2
  66. package/dist/locales/file-uploader/sr.js +3 -3
  67. package/dist/locales/file-uploader/sv.d.ts +7 -2
  68. package/dist/locales/file-uploader/sv.js +3 -3
  69. package/dist/locales/file-uploader/tr.d.ts +7 -2
  70. package/dist/locales/file-uploader/tr.js +3 -3
  71. package/dist/locales/file-uploader/uk.d.ts +7 -2
  72. package/dist/locales/file-uploader/uk.js +3 -3
  73. package/dist/locales/file-uploader/vi.d.ts +7 -2
  74. package/dist/locales/file-uploader/vi.js +3 -3
  75. package/dist/locales/file-uploader/zh-TW.d.ts +7 -2
  76. package/dist/locales/file-uploader/zh-TW.js +3 -3
  77. package/dist/locales/file-uploader/zh.d.ts +7 -2
  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 +798 -310
  81. package/web/file-uploader.iife.min.js +4 -4
  82. package/web/file-uploader.iife.min.js.LEGAL.txt +2 -1
  83. package/web/file-uploader.min.d.ts +798 -310
  84. package/web/file-uploader.min.js +4 -4
  85. package/web/file-uploader.min.js.LEGAL.txt +2 -1
  86. package/web/uc-basic.layered.min.css +3 -3
  87. package/web/uc-basic.min.css +4 -4
  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 +756 -268
  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 +4 -4
  94. package/web/uc-file-uploader-inline.min.d.ts +798 -310
  95. package/web/uc-file-uploader-inline.min.js +4 -4
  96. package/web/uc-file-uploader-inline.min.js.LEGAL.txt +2 -1
  97. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  98. package/web/uc-file-uploader-minimal.min.css +4 -4
  99. package/web/uc-file-uploader-minimal.min.d.ts +798 -310
  100. package/web/uc-file-uploader-minimal.min.js +4 -4
  101. package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +2 -1
  102. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  103. package/web/uc-file-uploader-regular.min.css +4 -4
  104. package/web/uc-file-uploader-regular.min.d.ts +798 -310
  105. package/web/uc-file-uploader-regular.min.js +4 -4
  106. package/web/uc-file-uploader-regular.min.js.LEGAL.txt +2 -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';
4
3
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
5
4
  import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions, Queue } from '@uploadcare/upload-client';
5
+ import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
6
6
  import { Ref } from 'lit/directives/ref.js';
7
7
  import { TelemetryRequest } from '@uploadcare/quality-insights';
8
8
 
@@ -113,7 +113,6 @@ declare const _default: {
113
113
  'src-type-camera': string;
114
114
  'src-type-mobile-video-camera': string;
115
115
  'src-type-mobile-photo-camera': string;
116
- 'src-type-draw': string;
117
116
  'src-type-facebook': string;
118
117
  'src-type-dropbox': string;
119
118
  'src-type-gdrive': string;
@@ -128,7 +127,6 @@ declare const _default: {
128
127
  'src-type-other': string;
129
128
  'caption-from-url': string;
130
129
  'caption-camera': string;
131
- 'caption-draw': string;
132
130
  'caption-edit-file': string;
133
131
  'file-no-name': string;
134
132
  'toggle-fullscreen': string;
@@ -193,6 +191,13 @@ declare const _default: {
193
191
  'crop-to-shape': string;
194
192
  custom: string;
195
193
  'freeform-crop': string;
194
+ 'upload-from': string;
195
+ 'get-from': string;
196
+ 'capture-with': string;
197
+ take: string;
198
+ record: string;
199
+ retake: string;
200
+ accept: string;
196
201
  };
197
202
 
198
203
  type LocaleDefinition = typeof _default;
@@ -215,7 +220,7 @@ declare class Modal extends LitBlock {
215
220
  private _handleDialogClose;
216
221
  private _handleDialogMouseDown;
217
222
  private _handleDialogMouseUp;
218
- show(): void;
223
+ show(): Promise<void>;
219
224
  hide(): void;
220
225
  private _handleModalOpen;
221
226
  private _handleModalClose;
@@ -231,81 +236,176 @@ declare global {
231
236
  }
232
237
  }
233
238
 
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'>;
239
+ /**
240
+ * Custom configuration options registration system for plugins
241
+ */
242
+ type CustomConfigDefinition<T = unknown> = {
243
+ /**
244
+ * Config option name (will be used as property and optionally as attribute)
245
+ */
246
+ name: string;
247
+ /**
248
+ * Default value for the config option
249
+ */
250
+ defaultValue: T;
251
+ /**
252
+ * Whether this config can be set via HTML attribute
253
+ * @default true
254
+ */
255
+ attribute?: boolean;
256
+ /**
257
+ * Convert attribute string to config value
258
+ * Only used if attribute is true
259
+ */
260
+ fromAttribute?: (value: string | null) => T;
261
+ /**
262
+ * Convert config value to attribute string
263
+ * Only used if attribute is true
264
+ */
265
+ toAttribute?: (value: T) => string | null;
266
+ /**
267
+ * Normalize/validate the config value
268
+ */
269
+ normalize?: (value: unknown) => T;
288
270
  };
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;
271
+ /**
272
+ * Registry for custom config options defined by plugins
273
+ * This is managed by the PluginManager as a shared instance property
274
+ */
275
+ declare class CustomConfigRegistry {
276
+ private _definitions;
277
+ register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
278
+ unregister(name: string): void;
279
+ unregisterByPlugin(pluginId: string): void;
280
+ get(name: string): CustomConfigDefinition<any> | undefined;
281
+ getAll(): Map<string, CustomConfigDefinition<any>>;
282
+ }
283
+ /**
284
+ * Interface for TypeScript module augmentation
285
+ * Plugins should extend this interface to add their custom config types
286
+ *
287
+ * @example
288
+ * ```typescript
289
+ * declare module '@uploadcare/file-uploader' {
290
+ * interface CustomConfig {
291
+ * 'my-custom-option': string;
292
+ * }
293
+ * }
294
+ * ```
295
+ */
296
+ interface CustomConfig {
297
+ }
298
+
299
+ declare class TypedData<T extends Record<string, unknown>> {
300
+ private _ctxId;
301
+ private _data;
302
+ constructor(initialValue: T);
303
+ get uid(): Uid;
304
+ setValue<K extends keyof T>(prop: K, value: T[K]): void;
305
+ setMultipleValues(updObj: Partial<T>): void;
306
+ getValue<K extends keyof T>(prop: K): T[K];
307
+ subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
297
308
  destroy(): void;
298
309
  }
299
310
 
300
- type PasteScope = 'local' | 'global' | false;
301
- declare class ClipboardLayer extends SharedInstance {
302
- private scopes;
303
- private listener;
311
+ interface UploadEntryData extends Record<string, unknown> {
312
+ file: File | null;
313
+ externalUrl: string | null;
314
+ fileName: string | null;
315
+ fileSize: number | null;
316
+ lastModified: number;
317
+ uploadProgress: number;
318
+ uuid: string | null;
319
+ isImage: boolean;
320
+ mimeType: string | null;
321
+ ctxName: string | null;
322
+ cdnUrl: string | null;
323
+ cdnUrlModifiers: string | null;
324
+ fileInfo: UploadcareFile | null;
325
+ isUploading: boolean;
326
+ abortController: AbortController | null;
327
+ thumbUrl: string | null;
328
+ silent: boolean;
329
+ source: string | null;
330
+ fullPath: string | null;
331
+ metadata: Metadata | null;
332
+ errors: OutputErrorFile[];
333
+ uploadError: Error | null;
334
+ isRemoved: boolean;
335
+ isQueuedForUploading: boolean;
336
+ isValidationPending: boolean;
337
+ isQueuedForValidation: boolean;
338
+ }
339
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
340
+ type UploadEntryKeys = keyof UploadEntryData;
341
+
342
+ declare class PluginRegistry {
343
+ private _sources;
344
+ private _activities;
345
+ private _fileActions;
346
+ private _fileHooks;
347
+ private _icons;
348
+ private _l10n;
349
+ readonly config: CustomConfigRegistry;
350
+ private _own;
351
+ addSource(pluginId: string, item: PluginSourceRegistration): void;
352
+ addActivity(pluginId: string, item: PluginActivityRegistration): void;
353
+ addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
354
+ addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
355
+ addIcon(pluginId: string, item: PluginIconRegistration): void;
356
+ addL10n(pluginId: string, item: PluginL10nRegistration): void;
357
+ addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
358
+ purge(pluginId: string): void;
359
+ snapshot(): PluginRegistrySnapshot;
360
+ }
361
+
362
+ declare class PluginManager extends SharedInstance {
363
+ private _plugins;
364
+ private _subscribers;
365
+ private _pluginsUpdate;
366
+ private _lazyPluginLoader;
367
+ readonly registry: PluginRegistry;
368
+ get configRegistry(): CustomConfigRegistry;
304
369
  constructor(sharedInstancesBag: SharedInstancesBag);
305
- private openUploadList;
306
- private _listener;
307
- private handlePaste;
308
- registerBlock(scope: Node): () => void;
370
+ pluginsReady(): Promise<void>;
371
+ onPluginsChange(callback: Unsubscriber): Unsubscriber;
372
+ private _syncPlugins;
373
+ private _registerPlugin;
374
+ private _unregisterPlugin;
375
+ snapshot(): PluginRegistrySnapshot;
376
+ runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
377
+ destroy(): void;
378
+ private _notifySubscribers;
379
+ }
380
+
381
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
382
+
383
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
384
+ signal?: AbortSignal;
385
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
386
+ type FileValidatorDescriptor = {
387
+ runOn: 'add' | 'upload' | 'change';
388
+ validator: FuncFileValidator;
389
+ };
390
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
391
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
392
+ declare class ValidationManager extends SharedInstance {
393
+ private get _uploadCollection();
394
+ private _commonFileValidators;
395
+ private _commonCollectionValidators;
396
+ private _queue;
397
+ private _runQueueDebounced;
398
+ private _isDestroyed;
399
+ private _entryValidationState;
400
+ constructor(sharedInstancesBag: SharedInstancesBag);
401
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
402
+ runCollectionValidators(): void;
403
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
404
+ private _runFileValidatorsForEntry;
405
+ private _addCustomTypeToValidationError;
406
+ private _getEntryValidationState;
407
+ private _getValidatorDescriptors;
408
+ private _getValidatorDescriptorsForEntry;
309
409
  destroy(): void;
310
410
  }
311
411
 
@@ -320,11 +420,14 @@ declare global {
320
420
  declare class Icon extends LitBlock {
321
421
  name: string;
322
422
  private _resolvedHref;
423
+ private _pluginSvg;
323
424
  private _iconHrefResolver;
425
+ private _unsubscribePlugins?;
324
426
  initCallback(): void;
325
427
  protected willUpdate(changedProperties: PropertyValues<this>): void;
326
428
  private _updateResolvedHref;
327
429
  render(): lit_html.TemplateResult<1>;
430
+ disconnectedCallback(): void;
328
431
  }
329
432
  declare global {
330
433
  interface HTMLElementTagNameMap {
@@ -352,7 +455,6 @@ declare global {
352
455
  type CameraMode = 'photo' | 'video';
353
456
  declare class CameraSource extends LitUploaderBlock {
354
457
  couldBeCtxOwner: boolean;
355
- activityType: "camera";
356
458
  private _unsubPermissions;
357
459
  private _capturing;
358
460
  private _chunks;
@@ -374,7 +476,6 @@ declare class CameraSource extends LitUploaderBlock {
374
476
  private _timerRef;
375
477
  private _lineRef;
376
478
  private _videoRef;
377
- private _switcherRef;
378
479
  private _startTime;
379
480
  private _elapsedTime;
380
481
  private _videoTransformCss;
@@ -472,25 +573,54 @@ declare global {
472
573
  /**
473
574
  * Config keys that can't be passed as attribute (because they are object or function)
474
575
  */
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>;
576
+ declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
478
577
  declare class Config extends LitBlock {
479
578
  attributesMeta: Partial<ConfigPlainType> & {
480
579
  'ctx-name': string;
481
580
  };
482
581
  init$: LitBlock["init$"] & ConfigType;
483
582
  private _computationControllers;
583
+ private _pluginChangeUnsubscribe?;
584
+ private _mutationObserver?;
585
+ /**
586
+ * Mapping of attribute names to custom config keys for plugin-registered configs.
587
+ * Updated dynamically when plugins are registered or changed.
588
+ * Similar to builtinAttrKeyMapping but for custom configs.
589
+ */
590
+ private _customAttrKeyMapping;
591
+ /** Set of all custom config names registered by plugins */
592
+ private _customConfigKeys;
593
+ /**
594
+ * Map of custom config subscriptions (config name -> unsubscribe function)
595
+ * Used to track and clean up subscriptions when plugins change
596
+ */
597
+ private _customConfigSubscriptions;
598
+ /**
599
+ * Check if a key is a custom config (registered by plugins)
600
+ */
601
+ private _isCustomConfig;
602
+ /**
603
+ * Get the custom config definition for a key
604
+ */
605
+ private _getCustomConfigDefinition;
606
+ /**
607
+ * Get attribute names for a config key (kebab-case and lowercase)
608
+ */
609
+ private _getAttributeNames;
484
610
  private _flushValueToAttribute;
485
611
  private _flushValueToState;
486
612
  private _setValue;
487
613
  private _getValue;
488
614
  private _assertSameValueDifferentReference;
615
+ private _processCustomConfigs;
616
+ private _setupCustomConfigs;
617
+ private _setupMutationObserver;
489
618
  initCallback(): void;
490
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
619
+ attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
620
+ disconnectedCallback(): void;
491
621
  static get observedAttributes(): string[];
492
622
  }
493
- interface Config extends ConfigType {
623
+ interface Config extends ConfigType, CustomConfig {
494
624
  }
495
625
  declare global {
496
626
  interface HTMLElementTagNameMap {
@@ -498,49 +628,6 @@ declare global {
498
628
  }
499
629
  }
500
630
 
501
- declare class TypedData<T extends Record<string, unknown>> {
502
- private _ctxId;
503
- private _data;
504
- constructor(initialValue: T);
505
- get uid(): Uid;
506
- setValue<K extends keyof T>(prop: K, value: T[K]): void;
507
- setMultipleValues(updObj: Partial<T>): void;
508
- getValue<K extends keyof T>(prop: K): T[K];
509
- subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
510
- destroy(): void;
511
- }
512
-
513
- interface UploadEntryData extends Record<string, unknown> {
514
- file: File | null;
515
- externalUrl: string | null;
516
- fileName: string | null;
517
- fileSize: number | null;
518
- lastModified: number;
519
- uploadProgress: number;
520
- uuid: string | null;
521
- isImage: boolean;
522
- mimeType: string | null;
523
- ctxName: string | null;
524
- cdnUrl: string | null;
525
- cdnUrlModifiers: string | null;
526
- fileInfo: UploadcareFile | null;
527
- isUploading: boolean;
528
- abortController: AbortController | null;
529
- thumbUrl: string | null;
530
- silent: boolean;
531
- source: string | null;
532
- fullPath: string | null;
533
- metadata: Metadata | null;
534
- errors: OutputErrorFile[];
535
- uploadError: Error | null;
536
- isRemoved: boolean;
537
- isQueuedForUploading: boolean;
538
- isValidationPending: boolean;
539
- isQueuedForValidation: boolean;
540
- }
541
- type UploadEntryTypedData = TypedData<UploadEntryData>;
542
- type UploadEntryKeys = keyof UploadEntryData;
543
-
544
631
  declare class FileItemConfig extends LitUploaderBlock {
545
632
  private _entrySubs;
546
633
  protected entry: UploadEntryTypedData | null;
@@ -603,6 +690,21 @@ declare global {
603
690
  }
604
691
  }
605
692
 
693
+ declare class FileActionButton extends LitUploaderBlock {
694
+ static styleAttrs: string[];
695
+ uploading: boolean;
696
+ failed: boolean;
697
+ success: boolean;
698
+ idle: boolean;
699
+ private _handleRemove;
700
+ render(): lit_html.TemplateResult<1>;
701
+ }
702
+ declare global {
703
+ interface HTMLElementTagNameMap {
704
+ 'uc-file-action-button': FileActionButton;
705
+ }
706
+ }
707
+
606
708
  declare class FileItem extends FileItemConfig {
607
709
  protected couldBeCtxOwner: boolean;
608
710
  private _pauseRender;
@@ -617,12 +719,12 @@ declare class FileItem extends FileItemConfig {
617
719
  private _isFailed;
618
720
  private _isUploading;
619
721
  private _isFocused;
620
- private _isEditable;
621
722
  private _showFileNames;
622
723
  private _ariaLabelStatusFile;
724
+ private _pluginFileActions;
623
725
  private _renderedOnce;
624
726
  private _observer?;
625
- private _handleEdit;
727
+ private _unsubscribePlugins?;
626
728
  private _handleRemove;
627
729
  private _handleUploadClick;
628
730
  private _calculateState;
@@ -634,6 +736,8 @@ declare class FileItem extends FileItemConfig {
634
736
  private _handleEntryId;
635
737
  private _updateShowFileNames;
636
738
  protected willUpdate(changedProperties: PropertyValues<this>): void;
739
+ private _updatePluginFileActions;
740
+ private _handlePluginFileAction;
637
741
  initCallback(): void;
638
742
  connectedCallback(): void;
639
743
  disconnectedCallback(): void;
@@ -733,6 +837,7 @@ declare global {
733
837
  declare const ExternalUploadSource: Readonly<{
734
838
  readonly FACEBOOK: "facebook";
735
839
  readonly DROPBOX: "dropbox";
840
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
736
841
  readonly GDRIVE: "gdrive";
737
842
  readonly GPHOTOS: "gphotos";
738
843
  readonly FLICKR: "flickr";
@@ -745,6 +850,7 @@ declare const ExternalUploadSource: Readonly<{
745
850
  declare const UploadSource: Readonly<{
746
851
  readonly FACEBOOK: "facebook";
747
852
  readonly DROPBOX: "dropbox";
853
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
748
854
  readonly GDRIVE: "gdrive";
749
855
  readonly GPHOTOS: "gphotos";
750
856
  readonly FLICKR: "flickr";
@@ -761,7 +867,6 @@ declare const UploadSource: Readonly<{
761
867
  readonly EXTERNAL: "external";
762
868
  readonly API: "js-api";
763
869
  readonly URL: "url";
764
- readonly DRAW: "draw";
765
870
  }>;
766
871
  type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
767
872
 
@@ -801,6 +906,8 @@ declare class TypedCollection<T extends Record<string, unknown>> {
801
906
  readProp<K extends keyof T>(id: Uid, propName: K): T[K];
802
907
  publishProp<K extends keyof T>(id: Uid, propName: K, value: T[K]): void;
803
908
  remove(id: Uid): void;
909
+ abort(id: Uid): void;
910
+ abortAll(): void;
804
911
  clearAll(): void;
805
912
  observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
806
913
  unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
@@ -810,14 +917,80 @@ declare class TypedCollection<T extends Record<string, unknown>> {
810
917
  destroy(): void;
811
918
  }
812
919
 
813
- declare const CameraSourceTypes: Readonly<{
814
- PHOTO: "photo";
815
- VIDEO: "video";
816
- }>;
817
- type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
818
-
819
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
820
-
920
+ declare const CameraSourceTypes: Readonly<{
921
+ PHOTO: "photo";
922
+ VIDEO: "video";
923
+ }>;
924
+ type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
925
+
926
+ declare const InternalEventType: Readonly<{
927
+ readonly INIT_SOLUTION: "init-solution";
928
+ readonly CHANGE_CONFIG: "change-config";
929
+ readonly ACTION_EVENT: "action-event";
930
+ readonly ERROR_EVENT: "error-event";
931
+ }>;
932
+ declare const EventType: Readonly<{
933
+ readonly FILE_ADDED: "file-added";
934
+ readonly FILE_REMOVED: "file-removed";
935
+ readonly FILE_UPLOAD_START: "file-upload-start";
936
+ readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
937
+ readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
938
+ readonly FILE_UPLOAD_FAILED: "file-upload-failed";
939
+ readonly FILE_URL_CHANGED: "file-url-changed";
940
+ readonly MODAL_OPEN: "modal-open";
941
+ readonly MODAL_CLOSE: "modal-close";
942
+ readonly DONE_CLICK: "done-click";
943
+ readonly UPLOAD_CLICK: "upload-click";
944
+ readonly ACTIVITY_CHANGE: "activity-change";
945
+ readonly COMMON_UPLOAD_START: "common-upload-start";
946
+ readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
947
+ readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
948
+ readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
949
+ readonly CHANGE: "change";
950
+ readonly GROUP_CREATED: "group-created";
951
+ }>;
952
+ type EventKey = (typeof EventType)[keyof typeof EventType];
953
+ type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
954
+ type EventPayload = {
955
+ [EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
956
+ [EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
957
+ [EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
958
+ [EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
959
+ [EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
960
+ [EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
961
+ [EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
962
+ [EventType.MODAL_OPEN]: {
963
+ modalId: ModalId;
964
+ };
965
+ [EventType.MODAL_CLOSE]: {
966
+ modalId: ModalId;
967
+ hasActiveModals: boolean;
968
+ };
969
+ [EventType.ACTIVITY_CHANGE]: {
970
+ activity: ActivityType;
971
+ };
972
+ [EventType.UPLOAD_CLICK]: undefined;
973
+ [EventType.DONE_CLICK]: OutputCollectionState;
974
+ [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
975
+ [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
976
+ [EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
977
+ [EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
978
+ [EventType.CHANGE]: OutputCollectionState;
979
+ [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
980
+ };
981
+ declare class EventEmitter extends SharedInstance {
982
+ private _timeoutStore;
983
+ private _targets;
984
+ private _listeners;
985
+ bindTarget(target: LitBlock): () => void;
986
+ on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
987
+ private _dispatch;
988
+ emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
989
+ debounce?: TDebounce;
990
+ }): void;
991
+ destroy(): void;
992
+ }
993
+
821
994
  type ApiAddFileCommonOptions = {
822
995
  silent?: boolean;
823
996
  fileName?: string;
@@ -848,25 +1021,31 @@ declare class UploaderPublicApi extends SharedInstance {
848
1021
  getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
849
1022
  initFlow: (force?: boolean) => void;
850
1023
  doneFlow: () => void;
851
- setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
1024
+ private _pluginsReady;
1025
+ setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
1026
+ on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
852
1027
  getCurrentActivity: () => ActivityType;
1028
+ historyBack: () => void;
853
1029
  setModalState: (opened: boolean) => void;
854
1030
  private get _sourceList();
855
1031
  }
856
1032
 
1033
+ type SourceButtonConfig = {
1034
+ id: string;
1035
+ label: string;
1036
+ icon?: string;
1037
+ onClick: () => void | Promise<void>;
1038
+ };
857
1039
  declare class SourceBtn extends LitUploaderBlock {
858
1040
  couldBeCtxOwner: boolean;
859
- private _registeredTypes;
860
- type?: string;
861
- onlyIcon: boolean;
1041
+ source?: SourceButtonConfig;
1042
+ textOnly: boolean;
1043
+ iconOnly: boolean;
862
1044
  private _iconName;
863
1045
  private _srcTypeKey;
864
- private _initTypes;
865
- initCallback(): void;
866
- private _registerType;
867
- activate(): void;
868
- private _applyType;
869
1046
  protected willUpdate(changedProperties: PropertyValues<this>): void;
1047
+ private _applySource;
1048
+ activate(): void;
870
1049
  render(): lit_html.TemplateResult<1>;
871
1050
  }
872
1051
  declare global {
@@ -875,46 +1054,92 @@ declare global {
875
1054
  }
876
1055
  }
877
1056
 
878
- declare class Dropdown extends LitBlock {
1057
+ declare class PrimaryAction extends LitUploaderBlock {
1058
+ static styleAttrs: string[];
1059
+ private static readonly SOURCE_TEXT_CONFIG;
1060
+ source: SourceButtonConfig | null;
1061
+ entries: OutputCollectionState<OutputCollectionStatus, 'maybe-has-group'>;
1062
+ private showIcon;
1063
+ private _isMultiple;
1064
+ initCallback(): void;
1065
+ private get hasEntries();
1066
+ private get hasSingleSuccessImage();
1067
+ private get hasMultipleEntries();
1068
+ private get localizedSourceLabel();
1069
+ private _translate;
1070
+ private get textBasedOnLocale();
1071
+ private _headerTextDependentOnEntries;
1072
+ private _getSourceLabelText;
1073
+ private _handleClick;
1074
+ private _renderThumbnail;
1075
+ protected render(): lit_html.TemplateResult<1>;
1076
+ }
1077
+ declare global {
1078
+ interface HTMLElementTagNameMap {
1079
+ 'uc-primary-action': PrimaryAction;
1080
+ }
1081
+ }
1082
+
1083
+ declare class DropDown extends LitBlock {
1084
+ static styleAttrs: string[];
879
1085
  private _id;
880
1086
  private readonly _handleContentClick;
881
- protected render(): unknown;
1087
+ render(): lit_html.TemplateResult<1>;
882
1088
  }
883
1089
  declare global {
884
1090
  interface HTMLElementTagNameMap {
885
- 'uc-dropdown': Dropdown;
1091
+ 'uc-drop-down': DropDown;
886
1092
  }
887
1093
  }
888
1094
 
889
- type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
890
- type AdvancedSmartBtnConfig = {
891
- sourceList: string;
892
- mode: SmartButtonMode;
893
- };
1095
+ declare class NoWrapModeSmartBtn extends LitUploaderBlock {
1096
+ static styleAttrs: string[];
1097
+ }
1098
+ declare global {
1099
+ interface HTMLElementTagNameMap {
1100
+ 'uc-no-wrap-mode-smart-btn': NoWrapModeSmartBtn;
1101
+ }
1102
+ }
1103
+
1104
+ type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap' | 'collapse';
894
1105
  declare class SmartBtn extends LitUploaderBlock {
895
1106
  static styleAttrs: string[];
896
1107
  couldBeCtxOwner: boolean;
1108
+ private _controller?;
1109
+ private _unregisterAfterFileAddHook?;
897
1110
  dropzone: boolean;
898
- private _sourceList;
1111
+ private _mode;
1112
+ private _sources;
899
1113
  private _status;
900
- private _multiple;
901
- private _entry;
902
- private _lastDigest;
903
- private _progressPercent;
904
- private _progressFading;
905
- private _progressFadeTimer;
906
- private _showDropdown;
1114
+ private _mainAndRemainSources;
1115
+ private _collection;
1116
+ private _progress;
907
1117
  private get isIdle();
908
- private get buttonText();
1118
+ private get isSuccess();
1119
+ private get isFailed();
1120
+ private get isUploading();
1121
+ private get isCollapsedMode();
1122
+ private get shouldShowPrimaryAction();
1123
+ private get shouldShowInline();
1124
+ private get shouldShowDropdown();
1125
+ private get hasCollectionEntries();
1126
+ private get shouldShowAbortAction();
909
1127
  private _throttledHandleCollectionUpdate;
910
1128
  private _updateButtonBasedOnCollectionState;
911
- private _cancelProgressFade;
912
- private _startProgressFade;
913
- disconnectedCallback(): void;
914
- private _removeEntries;
1129
+ private _updateSourceSplit;
915
1130
  initCallback(): void;
916
- private readonly _handleClickAbort;
917
- private readonly _handleClick;
1131
+ disconnectedCallback(): void;
1132
+ private _renderInline;
1133
+ private _getDropdownIconName;
1134
+ private _clearAllEntries;
1135
+ private _clearAllFailedEntries;
1136
+ private _abortAllEntries;
1137
+ private _handleRemove;
1138
+ private _renderDropdown;
1139
+ private _renderPrimaryAction;
1140
+ private _renderAbortAction;
1141
+ private _getInnerClassMap;
1142
+ private _renderVisualDropArea;
918
1143
  render(): lit_html.TemplateResult<1>;
919
1144
  }
920
1145
  declare global {
@@ -1135,6 +1360,10 @@ type ConfigType = {
1135
1360
  * Expiry threshold for secure uploads.
1136
1361
  */
1137
1362
  secureUploadsExpireThreshold: number;
1363
+ /**
1364
+ * Array of plugins to register with the uploader instance.
1365
+ */
1366
+ plugins: UploaderPlugin[];
1138
1367
  /**
1139
1368
  * Metadata for the file.
1140
1369
  */
@@ -1220,7 +1449,8 @@ type ConfigType = {
1220
1449
  * Define the clipboard paste scope.
1221
1450
  */
1222
1451
  pasteScope: PasteScope;
1223
- smartBtn: AdvancedSmartBtnConfig | null;
1452
+ smartButtonViewMode: SmartButtonMode;
1453
+ smartButtonShowFirstIcon: boolean;
1224
1454
  };
1225
1455
  type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
1226
1456
  type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -1387,6 +1617,165 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
1387
1617
  allEntries: OutputFileEntry[];
1388
1618
  });
1389
1619
 
1620
+ type PluginIconRegistration = {
1621
+ name: string;
1622
+ svg: string;
1623
+ };
1624
+ type PluginL10nRegistration = Record<string, Record<string, string>>;
1625
+ type PluginSourceRegistration = {
1626
+ id: string;
1627
+ label: string;
1628
+ icon?: string;
1629
+ /**
1630
+ * @internal
1631
+ *
1632
+ * Optional expansion function. When present, SourceList calls this to determine
1633
+ * which source IDs should actually be rendered in place of this source.
1634
+ * Useful for sources that map to multiple device-specific variants (e.g. camera
1635
+ * expanding to separate photo/video buttons on mobile).
1636
+ * Return `[id]` (the source's own id) to render it as-is.
1637
+ */
1638
+ expand?: () => string[];
1639
+ onSelect: () => Promise<void> | void;
1640
+ };
1641
+ type PluginRenderDispose = () => void;
1642
+ type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
1643
+ type PluginActivityRegistration = {
1644
+ id: string;
1645
+ render: PluginRender;
1646
+ };
1647
+ type PluginFileActionRegistration = {
1648
+ /** Unique action identifier. */
1649
+ id: string;
1650
+ /** Icon name to display in the action button. */
1651
+ icon: string;
1652
+ /** Label shown next to the icon in the action button. Accepts a plain string or an l10n key registered via `registerL10n`. */
1653
+ label: string;
1654
+ /** Return `true` to show the action button for the given file entry. */
1655
+ shouldRender: (fileEntry: OutputFileEntry) => boolean;
1656
+ onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
1657
+ };
1658
+ type PluginFileHookResult = {
1659
+ /** The (optionally transformed) file */
1660
+ file: File | Blob;
1661
+ };
1662
+ type PluginFileHookContext = PluginFileHookResult & {
1663
+ /**
1664
+ * An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
1665
+ * Hooks should respect this signal to avoid doing unnecessary work.
1666
+ */
1667
+ signal: AbortSignal;
1668
+ };
1669
+ type PluginFileHookRegistration = {
1670
+ /**
1671
+ * When the hook is called:
1672
+ * - `'beforeUpload'`: called right before the file is uploaded.
1673
+ * - `'onAdd'`: called after the file is added to the upload list.
1674
+ *
1675
+ * Return the (optionally transformed) file. After the hook runs, `mimeType`,
1676
+ * `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
1677
+ */
1678
+ type: 'beforeUpload' | 'onAdd';
1679
+ handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
1680
+ /**
1681
+ * Maximum time in milliseconds to wait for the hook to complete before skipping it.
1682
+ * @default 30000
1683
+ */
1684
+ timeout?: number;
1685
+ };
1686
+ type PluginRegistryApi = {
1687
+ registerSource: (source: PluginSourceRegistration) => void;
1688
+ registerActivity: (activity: PluginActivityRegistration) => void;
1689
+ registerFileAction: (fileAction: PluginFileActionRegistration) => void;
1690
+ registerFileHook: (hook: PluginFileHookRegistration) => void;
1691
+ registerIcon: (icon: PluginIconRegistration) => void;
1692
+ registerL10n: (l10n: PluginL10nRegistration) => void;
1693
+ registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
1694
+ };
1695
+ /**
1696
+ * API for managing plugin config subscriptions
1697
+ */
1698
+ type PluginConfigApi = {
1699
+ get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
1700
+ subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
1701
+ };
1702
+ /**
1703
+ * API for managing plugin activity interactions
1704
+ */
1705
+ type PluginActivityApi = {
1706
+ /**
1707
+ * Get the current activity parameters.
1708
+ *
1709
+ * @returns The current activity parameters object
1710
+ *
1711
+ * @example
1712
+ * ```typescript
1713
+ * const params = pluginApi.activity.getParams();
1714
+ * console.log('Current params:', params);
1715
+ * ```
1716
+ */
1717
+ getParams: () => Record<string, unknown>;
1718
+ /**
1719
+ * Subscribe to changes in activity parameters.
1720
+ * The callback will be called immediately with the current params,
1721
+ * and then whenever the params change.
1722
+ *
1723
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
1724
+ *
1725
+ * @param callback - Function to call with the new params
1726
+ * @returns Unsubscribe function
1727
+ *
1728
+ * @example
1729
+ * ```typescript
1730
+ * pluginApi.activity.subscribeToParams((params) => {
1731
+ * console.log('Activity params changed:', params);
1732
+ * });
1733
+ * // Cleanup happens automatically on plugin disposal
1734
+ * ```
1735
+ */
1736
+ subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
1737
+ };
1738
+ type PluginFileEntryUpdate = {
1739
+ file?: File | Blob;
1740
+ cdnUrl?: string | null;
1741
+ cdnUrlModifiers?: string | null;
1742
+ mimeType?: string | null;
1743
+ };
1744
+ type PluginFilesApi = {
1745
+ /**
1746
+ * Update mutable properties of a file entry by its internalId.
1747
+ * `fileSize` is recalculated automatically when `file` is provided.
1748
+ */
1749
+ update: (internalId: string, changes: PluginFileEntryUpdate) => void;
1750
+ };
1751
+ type PluginApi = {
1752
+ registry: PluginRegistryApi;
1753
+ config: PluginConfigApi;
1754
+ activity: PluginActivityApi;
1755
+ files: PluginFilesApi;
1756
+ };
1757
+ type PluginUploaderApi = UploaderPublicApi;
1758
+ type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
1759
+ type PluginSetupParams = {
1760
+ pluginApi: PluginApi;
1761
+ uploaderApi: PluginUploaderApi;
1762
+ };
1763
+ type UploaderPlugin = {
1764
+ id: string;
1765
+ setup: (params: PluginSetupParams) => PluginSetupResult;
1766
+ };
1767
+ type Owned<T> = T & {
1768
+ pluginId: string;
1769
+ };
1770
+ type PluginRegistrySnapshot = {
1771
+ sources: Owned<PluginSourceRegistration>[];
1772
+ activities: Owned<PluginActivityRegistration>[];
1773
+ fileActions: Owned<PluginFileActionRegistration>[];
1774
+ fileHooks: Owned<PluginFileHookRegistration>[];
1775
+ icons: Owned<PluginIconRegistration>[];
1776
+ l10n: Owned<PluginL10nRegistration>[];
1777
+ };
1778
+
1390
1779
  declare class SecureUploadsManager extends SharedInstance {
1391
1780
  private _secureToken;
1392
1781
  getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
@@ -1431,7 +1820,6 @@ declare class LitUploaderBlock extends LitActivityBlock {
1431
1820
  private _handleCollectionUpdate;
1432
1821
  private _handleCollectionPropertiesUpdate;
1433
1822
  private _flushCommonUploadProgress;
1434
- private _openCloudImageEditor;
1435
1823
  private _setInitialCrop;
1436
1824
  protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1437
1825
  protected getUploadClientOptions(): Promise<FileFromOptions>;
@@ -1501,12 +1889,11 @@ type ActivityParams$1 = {
1501
1889
  internalId: string;
1502
1890
  };
1503
1891
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1504
- couldBeCtxOwner: boolean;
1505
- activityType: "cloud-image-edit";
1506
1892
  private _entry?;
1507
1893
  private _editorConfig;
1508
1894
  get activityParams(): ActivityParams$1;
1509
1895
  initCallback(): void;
1896
+ disconnectedCallback(): void;
1510
1897
  private _handleApply;
1511
1898
  private _handleCancel;
1512
1899
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1535,7 +1922,6 @@ type ActivityParams = {
1535
1922
  };
1536
1923
  declare class ExternalSource extends LitUploaderBlock {
1537
1924
  couldBeCtxOwner: boolean;
1538
- activityType: "external";
1539
1925
  private _messageBridge?;
1540
1926
  private _iframeRef;
1541
1927
  private _latestSelectionSummary;
@@ -1579,22 +1965,26 @@ declare global {
1579
1965
  declare const ACTIVITY_TYPES: Readonly<{
1580
1966
  START_FROM: "start-from";
1581
1967
  CAMERA: "camera";
1582
- DRAW: "draw";
1583
1968
  UPLOAD_LIST: "upload-list";
1584
1969
  URL: "url";
1585
1970
  CLOUD_IMG_EDIT: "cloud-image-edit";
1586
1971
  EXTERNAL: "external";
1587
1972
  }>;
1588
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1589
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1973
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1974
+ type ActivityType = RegisteredActivityType | null;
1590
1975
 
1591
1976
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1977
+ interface CustomActivities {
1978
+ }
1592
1979
  type ActivityParamsMap = {
1593
1980
  'cloud-image-edit': ActivityParams$1;
1594
1981
  external: ActivityParams;
1982
+ } & {
1983
+ [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1595
1984
  };
1596
1985
  declare class LitActivityBlock extends LitBlock {
1597
1986
  protected historyTracked: boolean;
1987
+ activityType: ActivityType;
1598
1988
  private [ACTIVE_PROP]?;
1599
1989
  init$: {
1600
1990
  '*currentActivity': null;
@@ -1608,12 +1998,11 @@ declare class LitActivityBlock extends LitBlock {
1608
1998
  private _activate;
1609
1999
  initCallback(): void;
1610
2000
  private _historyFlush;
1611
- private _isActivityRegistered;
2001
+ protected _isActivityRegistered(): boolean;
1612
2002
  private static _activityCallbacks;
1613
2003
  static activities: Readonly<{
1614
2004
  START_FROM: 'start-from';
1615
2005
  CAMERA: 'camera';
1616
- DRAW: 'draw';
1617
2006
  UPLOAD_LIST: 'upload-list';
1618
2007
  URL: 'url';
1619
2008
  CLOUD_IMG_EDIT: 'cloud-image-edit';
@@ -1629,8 +2018,8 @@ declare class LitActivityBlock extends LitBlock {
1629
2018
  private _unregisterActivity;
1630
2019
  disconnectedCallback(): void;
1631
2020
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1632
- get initActivity(): string | null;
1633
- get doneActivity(): string | null;
2021
+ get initActivity(): RegisteredActivityType | null;
2022
+ get doneActivity(): RegisteredActivityType | null;
1634
2023
  historyBack(): void;
1635
2024
  }
1636
2025
 
@@ -1685,10 +2074,19 @@ declare class ModalManager extends SharedInstance {
1685
2074
  destroy(): void;
1686
2075
  }
1687
2076
 
2077
+ type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
2078
+ type LazyPluginEntry = {
2079
+ configDeps: readonly (keyof ConfigType)[];
2080
+ isEnabled: (get: ConfigGetter) => boolean;
2081
+ load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
2082
+ };
2083
+
1688
2084
  declare class LitSolutionBlock extends LitBlock {
1689
2085
  static styleAttrs: string[];
2086
+ static lazyPlugins: LazyPluginEntry[] | null;
1690
2087
  init$: {
1691
2088
  '*solution': string | null;
2089
+ '*lazyPlugins': LazyPluginEntry[] | null;
1692
2090
  '*commonProgress': number;
1693
2091
  '*uploadList': never[];
1694
2092
  '*uploadQueue': _uploadcare_upload_client.Queue;
@@ -1820,17 +2218,15 @@ declare global {
1820
2218
  }
1821
2219
  }
1822
2220
 
1823
- declare class SourceList extends LitBlock {
1824
- private _rawSourceList;
1825
- private _cameraModes;
2221
+ declare class SourceList extends LitUploaderBlock {
2222
+ private _controller?;
2223
+ private _sources;
1826
2224
  /**
1827
2225
  * CSS-only attribute
1828
2226
  */
1829
2227
  wrap: boolean;
1830
2228
  initCallback(): void;
1831
2229
  protected updated(changedProperties: PropertyValues<this>): void;
1832
- private _updateSources;
1833
- private _sources;
1834
2230
  render(): lit_html.TemplateResult<1>;
1835
2231
  }
1836
2232
  declare global {
@@ -1885,7 +2281,9 @@ declare class UploadCtxProvider extends LitUploaderBlock {
1885
2281
  }
1886
2282
  interface UploadCtxProvider extends LitUploaderBlock {
1887
2283
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
2284
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
1888
2285
  removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
2286
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
1889
2287
  }
1890
2288
  declare global {
1891
2289
  interface HTMLElementTagNameMap {
@@ -1893,47 +2291,80 @@ declare global {
1893
2291
  }
1894
2292
  }
1895
2293
 
1896
- declare class UrlSource extends LitUploaderBlock {
2294
+ declare class SimpleBtn extends LitUploaderBlock {
2295
+ static styleAttrs: string[];
1897
2296
  couldBeCtxOwner: boolean;
1898
- activityType: ActivityType;
1899
- private _formState;
2297
+ dropzone: boolean;
2298
+ private _buttonTextKey;
2299
+ private readonly _handleClick;
1900
2300
  initCallback(): void;
1901
- private _inputRef;
1902
- private _handleInput;
1903
- private _handleUpload;
1904
2301
  render(): lit_html.TemplateResult<1>;
1905
2302
  }
1906
2303
  declare global {
1907
2304
  interface HTMLElementTagNameMap {
1908
- 'uc-url-source': UrlSource;
2305
+ 'uc-simple-btn': SimpleBtn;
1909
2306
  }
1910
2307
  }
1911
2308
 
1912
- declare class SimpleBtn extends LitUploaderBlock {
1913
- static styleAttrs: string[];
1914
- couldBeCtxOwner: boolean;
1915
- dropzone: boolean;
1916
- private _buttonTextKey;
1917
- private readonly _handleClick;
2309
+ declare class PluginActivityHost extends LitActivityBlock {
2310
+ registration: Owned<PluginActivityRegistration>;
2311
+ private _dispose?;
2312
+ private _containerRef;
1918
2313
  initCallback(): void;
2314
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2315
+ private _ensureRegistered;
2316
+ private _renderActivity;
2317
+ private _disposeActivity;
2318
+ disconnectedCallback(): void;
2319
+ render(): lit_html.TemplateResult<1>;
2320
+ }
2321
+ declare class PluginActivityRenderer extends LitBlock {
2322
+ mode: 'modal' | 'inline';
2323
+ private _activities;
2324
+ private _unsubscribePlugins?;
2325
+ initCallback(): void;
2326
+ private _syncActivities;
2327
+ disconnectedCallback(): void;
1919
2328
  render(): lit_html.TemplateResult<1>;
1920
2329
  }
1921
2330
  declare global {
1922
2331
  interface HTMLElementTagNameMap {
1923
- 'uc-simple-btn': SimpleBtn;
2332
+ 'uc-plugin-activity-host': PluginActivityHost;
2333
+ 'uc-plugin-activity-renderer': PluginActivityRenderer;
2334
+ }
2335
+ }
2336
+
2337
+ declare class UrlSource extends LitUploaderBlock {
2338
+ private _url;
2339
+ private _handleInput;
2340
+ private _handleUpload;
2341
+ render(): lit_html.TemplateResult<1>;
2342
+ }
2343
+ declare global {
2344
+ interface HTMLElementTagNameMap {
2345
+ 'uc-url-source': UrlSource;
1924
2346
  }
1925
2347
  }
1926
2348
 
1927
2349
  declare class FileUploaderRegular extends LitSolutionBlock {
2350
+ static lazyPlugins: LazyPluginEntry[];
1928
2351
  attributesMeta: {
1929
2352
  headless?: boolean;
2353
+ 'smart-button'?: boolean;
1930
2354
  'ctx-name': string;
1931
2355
  };
1932
2356
  static styleAttrs: string[];
1933
2357
  headless: boolean;
1934
- smart: boolean;
2358
+ smartButton: boolean;
1935
2359
  constructor();
1936
2360
  initCallback(): void;
2361
+ /**
2362
+ * Exposes whether SmartBtn is active for non-Lit classes that can't use context
2363
+ */
2364
+ get isSmartBtnActive(): boolean;
2365
+ private _renderSmartButton;
2366
+ private _renderStaticButton;
2367
+ private _renderButton;
1937
2368
  render(): lit_html.TemplateResult<1>;
1938
2369
  }
1939
2370
  declare global {
@@ -1943,6 +2374,7 @@ declare global {
1943
2374
  }
1944
2375
 
1945
2376
  declare class FileUploaderInline extends LitSolutionBlock {
2377
+ static lazyPlugins: LazyPluginEntry[];
1946
2378
  attributesMeta: {
1947
2379
  'ctx-name': string;
1948
2380
  };
@@ -1963,6 +2395,7 @@ declare global {
1963
2395
  }
1964
2396
 
1965
2397
  declare class FileUploaderMinimal extends LitSolutionBlock {
2398
+ static lazyPlugins: LazyPluginEntry[];
1966
2399
  attributesMeta: {
1967
2400
  'ctx-name': string;
1968
2401
  };
@@ -1986,6 +2419,16 @@ declare global {
1986
2419
  }
1987
2420
  }
1988
2421
 
2422
+ type AfterFileAddContext = {
2423
+ historyLength: number;
2424
+ };
2425
+ type AfterFileAddHook = (ctx: AfterFileAddContext) => boolean;
2426
+ declare class RouterHooksLayer extends SharedInstance {
2427
+ private _afterFileAddHooks;
2428
+ registerAfterFileAddHook(hook: AfterFileAddHook): () => void;
2429
+ navigateAfterFileAdd(): void;
2430
+ }
2431
+
1989
2432
  declare class A11y implements ISharedInstance {
1990
2433
  private _destroyKeyUX;
1991
2434
  private readonly _scopedWindow;
@@ -1997,6 +2440,8 @@ declare class A11y implements ISharedInstance {
1997
2440
  declare class LocaleManager extends SharedInstance {
1998
2441
  private _localeName;
1999
2442
  constructor(sharedInstancesBag: SharedInstancesBag);
2443
+ private _applyOverrides;
2444
+ private _applyPluginLocales;
2000
2445
  }
2001
2446
 
2002
2447
  type CommonEventType = InternalEventKey | EventKey;
@@ -2037,6 +2482,72 @@ declare class TelemetryManager extends SharedInstance {
2037
2482
  private get _location();
2038
2483
  }
2039
2484
 
2485
+ interface ISharedInstance {
2486
+ destroy?(): void;
2487
+ }
2488
+ declare class SharedInstance {
2489
+ protected _ctx: PubSub<SharedState>;
2490
+ protected _sharedInstancesBag: SharedInstancesBag;
2491
+ private _subscriptions;
2492
+ private _cfgProxy;
2493
+ protected _debugPrint: (...args: unknown[]) => void;
2494
+ constructor(sharedInstancesBag: SharedInstancesBag);
2495
+ protected addSub(unsub: () => void): void;
2496
+ protected get _cfg(): Readonly<ConfigType>;
2497
+ destroy(): void;
2498
+ }
2499
+ declare const instanceKeyMap: {
2500
+ modalManager: "*modalManager";
2501
+ pluginManager: "*pluginManager";
2502
+ telemetryManager: "*telemetryManager";
2503
+ localeManager: "*localeManager";
2504
+ a11y: "*a11y";
2505
+ clipboard: "*clipboard";
2506
+ routerLayer: "*routerLayer";
2507
+ blocksRegistry: "*blocksRegistry";
2508
+ eventEmitter: "*eventEmitter";
2509
+ uploadCollection: "*uploadCollection";
2510
+ secureUploadsManager: "*secureUploadsManager";
2511
+ api: "*publicApi";
2512
+ validationManager: "*validationManager";
2513
+ };
2514
+ type InstanceTypeMap = {
2515
+ [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
2516
+ };
2517
+ type InstanceName = keyof typeof instanceKeyMap;
2518
+ type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
2519
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2520
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2521
+ readonly ctx: PubSub<SharedState>;
2522
+ readonly modalManager: ModalManager | null;
2523
+ readonly pluginManager: PluginManager;
2524
+ readonly telemetryManager: TelemetryManager;
2525
+ readonly localeManager: LocaleManager;
2526
+ readonly a11y: A11y;
2527
+ readonly routerLayer: RouterHooksLayer;
2528
+ readonly blocksRegistry: Set<LitBlock>;
2529
+ readonly eventEmitter: EventEmitter;
2530
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2531
+ readonly secureUploadsManager: SecureUploadsManager;
2532
+ readonly api: UploaderPublicApi;
2533
+ readonly validationManager: ValidationManager;
2534
+ when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
2535
+ wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
2536
+ };
2537
+
2538
+ type PasteScope = 'local' | 'global' | false;
2539
+ declare class ClipboardLayer extends SharedInstance {
2540
+ private scopes;
2541
+ private listener;
2542
+ constructor(sharedInstancesBag: SharedInstancesBag);
2543
+ private _excludingNodes;
2544
+ private openUploadList;
2545
+ private _listener;
2546
+ private handlePaste;
2547
+ registerBlock(scope: Node): () => void;
2548
+ destroy(): void;
2549
+ }
2550
+
2040
2551
  declare const TabId: Readonly<{
2041
2552
  readonly CROP: "crop";
2042
2553
  readonly TUNING: "tuning";
@@ -2101,11 +2612,14 @@ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
2101
2612
  type SharedConfigState = {
2102
2613
  [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2103
2614
  };
2615
+ type SharedCustomConfigState = {
2616
+ [K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
2617
+ };
2104
2618
  type BlocksRegistry = Set<LitBlock>;
2105
2619
  type ActivityBlockCtxState = {
2106
- '*currentActivity': string | null;
2620
+ '*currentActivity': RegisteredActivityType | null;
2107
2621
  '*currentActivityParams': Record<string, unknown>;
2108
- '*history': (string | null)[];
2622
+ '*history': (RegisteredActivityType | null)[];
2109
2623
  '*historyBack': (() => void) | null;
2110
2624
  '*closeModal': () => void;
2111
2625
  };
@@ -2122,6 +2636,7 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
2122
2636
  };
2123
2637
  type SolutionBlockCtxState = UploaderBlockCtxState & {
2124
2638
  '*solution': string | null;
2639
+ '*lazyPlugins': LazyPluginEntry[] | null;
2125
2640
  };
2126
2641
  type CloudImageEditorState = {
2127
2642
  '*originalUrl': string | null;
@@ -2172,7 +2687,9 @@ type EditorToolbarState = {
2172
2687
  '*currentOperation': string | null;
2173
2688
  '*operationTooltip': string | null;
2174
2689
  };
2690
+ type SharedContextInstances = Map<string, ISharedInstance>;
2175
2691
  type DynamicBlockState = {
2692
+ '*sharedContextInstances': SharedContextInstances;
2176
2693
  '*blocksRegistry': BlocksRegistry;
2177
2694
  '*eventEmitter': EventEmitter;
2178
2695
  '*localeManager': LocaleManager;
@@ -2180,6 +2697,8 @@ type DynamicBlockState = {
2180
2697
  '*a11y': A11y;
2181
2698
  '*modalManager': ModalManager | null;
2182
2699
  '*clipboard': ClipboardLayer;
2700
+ '*routerLayer': RouterHooksLayer;
2701
+ '*pluginManager': PluginManager;
2183
2702
  };
2184
2703
  type DynamicUploaderBlockState = {
2185
2704
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2190,66 +2709,7 @@ type DynamicUploaderBlockState = {
2190
2709
  type LocaleState = {
2191
2710
  [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2192
2711
  };
2193
- type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2194
-
2195
- interface ISharedInstance {
2196
- destroy?(): void;
2197
- }
2198
- declare class SharedInstance {
2199
- protected _ctx: PubSub<SharedState>;
2200
- protected _sharedInstancesBag: SharedInstancesBag;
2201
- private _subscriptions;
2202
- private _cfgProxy;
2203
- protected _debugPrint: (...args: unknown[]) => void;
2204
- constructor(sharedInstancesBag: SharedInstancesBag);
2205
- protected addSub(unsub: () => void): void;
2206
- protected get _cfg(): Readonly<ConfigType>;
2207
- destroy(): void;
2208
- }
2209
- type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2210
- type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2211
- declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2212
- readonly ctx: PubSub<SharedState>;
2213
- readonly modalManager: ModalManager | null;
2214
- readonly telemetryManager: TelemetryManager;
2215
- readonly localeManager: LocaleManager;
2216
- readonly a11y: A11y;
2217
- readonly blocksRegistry: Set<LitBlock>;
2218
- readonly eventEmitter: EventEmitter;
2219
- readonly uploadCollection: TypedCollection<UploadEntryData>;
2220
- readonly secureUploadsManager: SecureUploadsManager;
2221
- readonly api: UploaderPublicApi;
2222
- readonly validationManager: ValidationManager;
2223
- };
2224
-
2225
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2226
- signal?: AbortSignal;
2227
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2228
- type FileValidatorDescriptor = {
2229
- runOn: 'add' | 'upload' | 'change';
2230
- validator: FuncFileValidator;
2231
- };
2232
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2233
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2234
- declare class ValidationManager extends SharedInstance {
2235
- private get _uploadCollection();
2236
- private _commonFileValidators;
2237
- private _commonCollectionValidators;
2238
- private _queue;
2239
- private _runQueueDebounced;
2240
- private _isDestroyed;
2241
- private _entryValidationState;
2242
- constructor(sharedInstancesBag: SharedInstancesBag);
2243
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2244
- runCollectionValidators(): void;
2245
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2246
- private _runFileValidatorsForEntry;
2247
- private _addCustomTypeToValidationError;
2248
- private _getEntryValidationState;
2249
- private _getValidatorDescriptors;
2250
- private _getValidatorDescriptorsForEntry;
2251
- destroy(): void;
2252
- }
2712
+ type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2253
2713
 
2254
2714
  declare const LitBlockBase: typeof LitElement & Constructor<{
2255
2715
  willYield: boolean;
@@ -2261,9 +2721,7 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2261
2721
  };
2262
2722
  declare class LitBlock extends LitBlockBase {
2263
2723
  private _cfgProxy;
2264
- protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2265
2724
  static styleAttrs: string[];
2266
- activityType: ActivityType;
2267
2725
  init$: {};
2268
2726
  constructor();
2269
2727
  l10n: (str: string, variables?: Record<string, string | number>) => string;
@@ -2271,15 +2729,47 @@ declare class LitBlock extends LitBlockBase {
2271
2729
  protected _sharedInstancesBag: {
2272
2730
  readonly ctx: PubSub<SharedState>;
2273
2731
  readonly modalManager: ModalManager | null;
2732
+ readonly pluginManager: PluginManager;
2274
2733
  readonly telemetryManager: TelemetryManager;
2275
2734
  readonly localeManager: LocaleManager;
2276
2735
  readonly a11y: A11y;
2736
+ readonly routerLayer: RouterHooksLayer;
2277
2737
  readonly blocksRegistry: Set<LitBlock>;
2278
2738
  readonly eventEmitter: EventEmitter;
2279
2739
  readonly uploadCollection: TypedCollection<UploadEntryData>;
2280
2740
  readonly secureUploadsManager: SecureUploadsManager;
2281
2741
  readonly api: UploaderPublicApi;
2282
2742
  readonly validationManager: ValidationManager;
2743
+ when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
2744
+ modalManager: ModalManager | null;
2745
+ pluginManager: PluginManager;
2746
+ telemetryManager: TelemetryManager;
2747
+ localeManager: LocaleManager;
2748
+ a11y: A11y;
2749
+ clipboard: ClipboardLayer;
2750
+ routerLayer: RouterHooksLayer;
2751
+ blocksRegistry: BlocksRegistry;
2752
+ eventEmitter: EventEmitter;
2753
+ uploadCollection: TypedCollection<UploadEntryData>;
2754
+ secureUploadsManager: SecureUploadsManager;
2755
+ api: UploaderPublicApi;
2756
+ validationManager: ValidationManager;
2757
+ }[TName]>) => void): () => void;
2758
+ wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
2759
+ modalManager: ModalManager | null;
2760
+ pluginManager: PluginManager;
2761
+ telemetryManager: TelemetryManager;
2762
+ localeManager: LocaleManager;
2763
+ a11y: A11y;
2764
+ clipboard: ClipboardLayer;
2765
+ routerLayer: RouterHooksLayer;
2766
+ blocksRegistry: BlocksRegistry;
2767
+ eventEmitter: EventEmitter;
2768
+ uploadCollection: TypedCollection<UploadEntryData>;
2769
+ secureUploadsManager: SecureUploadsManager;
2770
+ api: UploaderPublicApi;
2771
+ validationManager: ValidationManager;
2772
+ }[TName]>>;
2283
2773
  };
2284
2774
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2285
2775
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2291,6 +2781,7 @@ declare class LitBlock extends LitBlockBase {
2291
2781
  get localeManager(): LocaleManager;
2292
2782
  get a11y(): A11y;
2293
2783
  get clipboardLayer(): ClipboardLayer;
2784
+ get routerLayer(): RouterHooksLayer;
2294
2785
  get blocksRegistry(): Set<LitBlock>;
2295
2786
  get eventEmitter(): EventEmitter;
2296
2787
  disconnectedCallback(): void;
@@ -2298,11 +2789,7 @@ declare class LitBlock extends LitBlockBase {
2298
2789
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2299
2790
  */
2300
2791
  private destroyCtxCallback;
2301
- /**
2302
- * Adds a shared context instance if it does not exist yet.
2303
- * @param key The shared state key.
2304
- * @param resolver The resolver function that creates the instance.
2305
- */
2792
+ private _getSharedContextInstances;
2306
2793
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2307
2794
  private _destroySharedContextInstances;
2308
2795
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
@@ -2836,6 +3323,7 @@ declare class CloudImageEditorBlock extends LitBlock {
2836
3323
  private _hasNetworkProblems;
2837
3324
  private _isInitialized;
2838
3325
  private _pendingInitUpdate;
3326
+ private _pendingSizeWait;
2839
3327
  private readonly _debouncedShowLoader;
2840
3328
  private readonly _imgRef;
2841
3329
  private readonly _cropperRef;