@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
@@ -2,7 +2,7 @@ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
2
2
  import * as lit_html from 'lit-html';
3
3
  import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
4
4
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
5
- import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
5
+ import { FileFromOptions, Metadata, UploadcareFile, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
6
6
  export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
7
7
  import { Ref } from 'lit/directives/ref.js';
8
8
  import { TelemetryRequest } from '@uploadcare/quality-insights';
@@ -135,7 +135,6 @@ declare const _default: {
135
135
  'src-type-camera': string;
136
136
  'src-type-mobile-video-camera': string;
137
137
  'src-type-mobile-photo-camera': string;
138
- 'src-type-draw': string;
139
138
  'src-type-facebook': string;
140
139
  'src-type-dropbox': string;
141
140
  'src-type-gdrive': string;
@@ -150,7 +149,6 @@ declare const _default: {
150
149
  'src-type-other': string;
151
150
  'caption-from-url': string;
152
151
  'caption-camera': string;
153
- 'caption-draw': string;
154
152
  'caption-edit-file': string;
155
153
  'file-no-name': string;
156
154
  'toggle-fullscreen': string;
@@ -215,12 +213,29 @@ declare const _default: {
215
213
  'crop-to-shape': string;
216
214
  custom: string;
217
215
  'freeform-crop': string;
216
+ 'upload-from': string;
217
+ 'get-from': string;
218
+ 'capture-with': string;
219
+ take: string;
220
+ record: string;
221
+ retake: string;
222
+ accept: string;
218
223
  };
219
224
 
220
225
  type LocaleDefinition = typeof _default;
221
226
  type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
222
227
  declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
223
228
 
229
+ type AfterFileAddContext = {
230
+ historyLength: number;
231
+ };
232
+ type AfterFileAddHook = (ctx: AfterFileAddContext) => boolean;
233
+ declare class RouterHooksLayer extends SharedInstance {
234
+ private _afterFileAddHooks;
235
+ registerAfterFileAddHook(hook: AfterFileAddHook): () => void;
236
+ navigateAfterFileAdd(): void;
237
+ }
238
+
224
239
  declare class A11y implements ISharedInstance {
225
240
  private _destroyKeyUX;
226
241
  private readonly _scopedWindow;
@@ -232,8 +247,72 @@ declare class A11y implements ISharedInstance {
232
247
  declare class LocaleManager extends SharedInstance {
233
248
  private _localeName;
234
249
  constructor(sharedInstancesBag: SharedInstancesBag);
250
+ private _applyOverrides;
251
+ private _applyPluginLocales;
235
252
  }
236
253
 
254
+ /**
255
+ * Custom configuration options registration system for plugins
256
+ */
257
+ type CustomConfigDefinition<T = unknown> = {
258
+ /**
259
+ * Config option name (will be used as property and optionally as attribute)
260
+ */
261
+ name: string;
262
+ /**
263
+ * Default value for the config option
264
+ */
265
+ defaultValue: T;
266
+ /**
267
+ * Whether this config can be set via HTML attribute
268
+ * @default true
269
+ */
270
+ attribute?: boolean;
271
+ /**
272
+ * Convert attribute string to config value
273
+ * Only used if attribute is true
274
+ */
275
+ fromAttribute?: (value: string | null) => T;
276
+ /**
277
+ * Convert config value to attribute string
278
+ * Only used if attribute is true
279
+ */
280
+ toAttribute?: (value: T) => string | null;
281
+ /**
282
+ * Normalize/validate the config value
283
+ */
284
+ normalize?: (value: unknown) => T;
285
+ };
286
+ /**
287
+ * Registry for custom config options defined by plugins
288
+ * This is managed by the PluginManager as a shared instance property
289
+ */
290
+ declare class CustomConfigRegistry {
291
+ private _definitions;
292
+ register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
293
+ unregister(name: string): void;
294
+ unregisterByPlugin(pluginId: string): void;
295
+ get(name: string): CustomConfigDefinition<any> | undefined;
296
+ getAll(): Map<string, CustomConfigDefinition<any>>;
297
+ }
298
+ /**
299
+ * Interface for TypeScript module augmentation
300
+ * Plugins should extend this interface to add their custom config types
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * declare module '@uploadcare/file-uploader' {
305
+ * interface CustomConfig {
306
+ * 'my-custom-option': string;
307
+ * }
308
+ * }
309
+ * ```
310
+ */
311
+ interface CustomConfig {
312
+ }
313
+
314
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
315
+
237
316
  declare class TypedData<T extends Record<string, unknown>> {
238
317
  private _ctxId;
239
318
  private _data;
@@ -246,6 +325,41 @@ declare class TypedData<T extends Record<string, unknown>> {
246
325
  destroy(): void;
247
326
  }
248
327
 
328
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
329
+ signal?: AbortSignal;
330
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
331
+ type FileValidatorDescriptor = {
332
+ runOn: 'add' | 'upload' | 'change';
333
+ validator: FuncFileValidator;
334
+ };
335
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
336
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
337
+ declare class ValidationManager extends SharedInstance {
338
+ private get _uploadCollection();
339
+ private _commonFileValidators;
340
+ private _commonCollectionValidators;
341
+ private _queue;
342
+ private _runQueueDebounced;
343
+ private _isDestroyed;
344
+ private _entryValidationState;
345
+ constructor(sharedInstancesBag: SharedInstancesBag);
346
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
347
+ runCollectionValidators(): void;
348
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
349
+ private _runFileValidatorsForEntry;
350
+ private _addCustomTypeToValidationError;
351
+ private _getEntryValidationState;
352
+ private _getValidatorDescriptors;
353
+ private _getValidatorDescriptorsForEntry;
354
+ destroy(): void;
355
+ }
356
+
357
+ declare class SecureUploadsManager extends SharedInstance {
358
+ private _secureToken;
359
+ getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
360
+ destroy(): void;
361
+ }
362
+
249
363
  type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
250
364
  type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
251
365
  type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
@@ -282,6 +396,8 @@ declare class TypedCollection<T extends Record<string, unknown>> {
282
396
  readProp<K extends keyof T>(id: Uid, propName: K): T[K];
283
397
  publishProp<K extends keyof T>(id: Uid, propName: K, value: T[K]): void;
284
398
  remove(id: Uid): void;
399
+ abort(id: Uid): void;
400
+ abortAll(): void;
285
401
  clearAll(): void;
286
402
  observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
287
403
  unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
@@ -297,155 +413,6 @@ declare const CameraSourceTypes: Readonly<{
297
413
  }>;
298
414
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
299
415
 
300
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
301
-
302
- interface UploadEntryData extends Record<string, unknown> {
303
- file: File | null;
304
- externalUrl: string | null;
305
- fileName: string | null;
306
- fileSize: number | null;
307
- lastModified: number;
308
- uploadProgress: number;
309
- uuid: string | null;
310
- isImage: boolean;
311
- mimeType: string | null;
312
- ctxName: string | null;
313
- cdnUrl: string | null;
314
- cdnUrlModifiers: string | null;
315
- fileInfo: UploadcareFile | null;
316
- isUploading: boolean;
317
- abortController: AbortController | null;
318
- thumbUrl: string | null;
319
- silent: boolean;
320
- source: string | null;
321
- fullPath: string | null;
322
- metadata: Metadata | null;
323
- errors: OutputErrorFile[];
324
- uploadError: Error | null;
325
- isRemoved: boolean;
326
- isQueuedForUploading: boolean;
327
- isValidationPending: boolean;
328
- isQueuedForValidation: boolean;
329
- }
330
- type UploadEntryTypedData = TypedData<UploadEntryData>;
331
- type UploadEntryKeys = keyof UploadEntryData;
332
-
333
- type ApiAddFileCommonOptions = {
334
- silent?: boolean;
335
- fileName?: string;
336
- source?: string;
337
- };
338
- declare class UploaderPublicApi extends SharedInstance {
339
- private _l10n;
340
- get _uploadCollection(): TypedCollection<UploadEntryData>;
341
- get cfg(): Readonly<ConfigType>;
342
- get l10n(): (str: string, variables?: Record<string, string | number>) => string;
343
- /**
344
- * TODO: Probably we should not allow user to override `source` property
345
- */
346
- addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
347
- addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
348
- addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
349
- addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
350
- fullPath?: string;
351
- }) => OutputFileEntry<"idle">;
352
- removeFileByInternalId: (internalId: string) => void;
353
- removeAllFiles(): void;
354
- uploadAll: () => void;
355
- openSystemDialog: (options?: {
356
- captureCamera?: boolean;
357
- modeCamera?: ModeCameraType;
358
- }) => void;
359
- getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
360
- getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
361
- initFlow: (force?: boolean) => void;
362
- doneFlow: () => void;
363
- setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
364
- getCurrentActivity: () => ActivityType;
365
- setModalState: (opened: boolean) => void;
366
- private get _sourceList();
367
- }
368
-
369
- declare const ExternalUploadSource: Readonly<{
370
- readonly FACEBOOK: "facebook";
371
- readonly DROPBOX: "dropbox";
372
- readonly GDRIVE: "gdrive";
373
- readonly GPHOTOS: "gphotos";
374
- readonly FLICKR: "flickr";
375
- readonly VK: "vk";
376
- readonly EVERNOTE: "evernote";
377
- readonly BOX: "box";
378
- readonly ONEDRIVE: "onedrive";
379
- readonly HUDDLE: "huddle";
380
- }>;
381
- declare const UploadSource: Readonly<{
382
- readonly FACEBOOK: "facebook";
383
- readonly DROPBOX: "dropbox";
384
- readonly GDRIVE: "gdrive";
385
- readonly GPHOTOS: "gphotos";
386
- readonly FLICKR: "flickr";
387
- readonly VK: "vk";
388
- readonly EVERNOTE: "evernote";
389
- readonly BOX: "box";
390
- readonly ONEDRIVE: "onedrive";
391
- readonly HUDDLE: "huddle";
392
- readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
393
- readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
394
- readonly LOCAL: "local";
395
- readonly DROP_AREA: "drop-area";
396
- readonly CAMERA: "camera";
397
- readonly EXTERNAL: "external";
398
- readonly API: "js-api";
399
- readonly URL: "url";
400
- readonly DRAW: "draw";
401
- }>;
402
- type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
403
-
404
- declare class LitUploaderBlock extends LitActivityBlock {
405
- static extSrcList: Readonly<typeof ExternalUploadSource>;
406
- static sourceTypes: Readonly<typeof UploadSource>;
407
- protected couldBeCtxOwner: boolean;
408
- private _isCtxOwner;
409
- private _unobserveCollection?;
410
- private _unobserveCollectionProperties?;
411
- init$: {
412
- '*commonProgress': number;
413
- '*uploadList': never[];
414
- '*uploadQueue': _uploadcare_upload_client.Queue;
415
- '*collectionErrors': OutputErrorCollection[];
416
- '*collectionState': OutputCollectionState | null;
417
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
418
- '*uploadTrigger': Set<string>;
419
- '*currentActivity': null;
420
- '*currentActivityParams': {};
421
- '*history': never[];
422
- '*historyBack': null;
423
- '*closeModal': () => void;
424
- };
425
- private get _hasCtxOwner();
426
- initCallback(): void;
427
- getAPI(): UploaderPublicApi;
428
- get validationManager(): ValidationManager;
429
- get api(): UploaderPublicApi;
430
- get uploadCollection(): TypedCollection<UploadEntryData>;
431
- get secureUploadsManager(): SecureUploadsManager;
432
- disconnectedCallback(): void;
433
- connectedCallback(): void;
434
- private _initCtxOwner;
435
- private _observeUploadCollection;
436
- private _unobserveUploadCollection;
437
- private _createGroup;
438
- private _flushOutputItems;
439
- private _handleCollectionUpdate;
440
- private _handleCollectionPropertiesUpdate;
441
- private _flushCommonUploadProgress;
442
- private _openCloudImageEditor;
443
- private _setInitialCrop;
444
- protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
445
- protected getUploadClientOptions(): Promise<FileFromOptions>;
446
- getOutputData(): OutputFileEntry[];
447
- }
448
-
449
416
  /**
450
417
  * Mapping of loading resources per operation
451
418
  */
@@ -560,11 +527,14 @@ declare global {
560
527
  declare class Icon extends LitBlock {
561
528
  name: string;
562
529
  private _resolvedHref;
530
+ private _pluginSvg;
563
531
  private _iconHrefResolver;
532
+ private _unsubscribePlugins?;
564
533
  initCallback(): void;
565
534
  protected willUpdate(changedProperties: PropertyValues<this>): void;
566
535
  private _updateResolvedHref;
567
536
  render(): lit_html.TemplateResult<1>;
537
+ disconnectedCallback(): void;
568
538
  }
569
539
  declare global {
570
540
  interface HTMLElementTagNameMap {
@@ -1095,6 +1065,7 @@ declare class CloudImageEditorBlock extends LitBlock {
1095
1065
  private _hasNetworkProblems;
1096
1066
  private _isInitialized;
1097
1067
  private _pendingInitUpdate;
1068
+ private _pendingSizeWait;
1098
1069
  private readonly _debouncedShowLoader;
1099
1070
  private readonly _imgRef;
1100
1071
  private readonly _cropperRef;
@@ -1144,12 +1115,11 @@ type ActivityParams$1 = {
1144
1115
  internalId: string;
1145
1116
  };
1146
1117
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1147
- couldBeCtxOwner: boolean;
1148
- activityType: "cloud-image-edit";
1149
1118
  private _entry?;
1150
1119
  private _editorConfig;
1151
1120
  get activityParams(): ActivityParams$1;
1152
1121
  initCallback(): void;
1122
+ disconnectedCallback(): void;
1153
1123
  private _handleApply;
1154
1124
  private _handleCancel;
1155
1125
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1186,7 +1156,6 @@ type ActivityParams = {
1186
1156
  };
1187
1157
  declare class ExternalSource extends LitUploaderBlock {
1188
1158
  couldBeCtxOwner: boolean;
1189
- activityType: "external";
1190
1159
  private _messageBridge?;
1191
1160
  private _iframeRef;
1192
1161
  private _latestSelectionSummary;
@@ -1230,22 +1199,26 @@ declare global {
1230
1199
  declare const ACTIVITY_TYPES: Readonly<{
1231
1200
  START_FROM: "start-from";
1232
1201
  CAMERA: "camera";
1233
- DRAW: "draw";
1234
1202
  UPLOAD_LIST: "upload-list";
1235
1203
  URL: "url";
1236
1204
  CLOUD_IMG_EDIT: "cloud-image-edit";
1237
1205
  EXTERNAL: "external";
1238
1206
  }>;
1239
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1240
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1207
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1208
+ type ActivityType = RegisteredActivityType | null;
1241
1209
 
1242
1210
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1211
+ interface CustomActivities {
1212
+ }
1243
1213
  type ActivityParamsMap = {
1244
1214
  'cloud-image-edit': ActivityParams$1;
1245
1215
  external: ActivityParams;
1216
+ } & {
1217
+ [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1246
1218
  };
1247
1219
  declare class LitActivityBlock extends LitBlock {
1248
1220
  protected historyTracked: boolean;
1221
+ activityType: ActivityType;
1249
1222
  private [ACTIVE_PROP]?;
1250
1223
  init$: {
1251
1224
  '*currentActivity': null;
@@ -1259,12 +1232,11 @@ declare class LitActivityBlock extends LitBlock {
1259
1232
  private _activate;
1260
1233
  initCallback(): void;
1261
1234
  private _historyFlush;
1262
- private _isActivityRegistered;
1235
+ protected _isActivityRegistered(): boolean;
1263
1236
  private static _activityCallbacks;
1264
1237
  static activities: Readonly<{
1265
1238
  START_FROM: 'start-from';
1266
1239
  CAMERA: 'camera';
1267
- DRAW: 'draw';
1268
1240
  UPLOAD_LIST: 'upload-list';
1269
1241
  URL: 'url';
1270
1242
  CLOUD_IMG_EDIT: 'cloud-image-edit';
@@ -1280,8 +1252,8 @@ declare class LitActivityBlock extends LitBlock {
1280
1252
  private _unregisterActivity;
1281
1253
  disconnectedCallback(): void;
1282
1254
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1283
- get initActivity(): string | null;
1284
- get doneActivity(): string | null;
1255
+ get initActivity(): RegisteredActivityType | null;
1256
+ get doneActivity(): RegisteredActivityType | null;
1285
1257
  historyBack(): void;
1286
1258
  }
1287
1259
 
@@ -1343,7 +1315,9 @@ type EventPayload = {
1343
1315
  declare class EventEmitter extends SharedInstance {
1344
1316
  private _timeoutStore;
1345
1317
  private _targets;
1318
+ private _listeners;
1346
1319
  bindTarget(target: LitBlock): () => void;
1320
+ on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
1347
1321
  private _dispatch;
1348
1322
  emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
1349
1323
  debounce?: TDebounce;
@@ -1351,20 +1325,123 @@ declare class EventEmitter extends SharedInstance {
1351
1325
  destroy(): void;
1352
1326
  }
1353
1327
 
1354
- type EventMap = {
1355
- [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
1328
+ type ApiAddFileCommonOptions = {
1329
+ silent?: boolean;
1330
+ fileName?: string;
1331
+ source?: string;
1356
1332
  };
1333
+ declare class UploaderPublicApi extends SharedInstance {
1334
+ private _l10n;
1335
+ get _uploadCollection(): TypedCollection<UploadEntryData>;
1336
+ get cfg(): Readonly<ConfigType>;
1337
+ get l10n(): (str: string, variables?: Record<string, string | number>) => string;
1338
+ /**
1339
+ * TODO: Probably we should not allow user to override `source` property
1340
+ */
1341
+ addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1342
+ addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1343
+ addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1344
+ addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
1345
+ fullPath?: string;
1346
+ }) => OutputFileEntry<"idle">;
1347
+ removeFileByInternalId: (internalId: string) => void;
1348
+ removeAllFiles(): void;
1349
+ uploadAll: () => void;
1350
+ openSystemDialog: (options?: {
1351
+ captureCamera?: boolean;
1352
+ modeCamera?: ModeCameraType;
1353
+ }) => void;
1354
+ getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
1355
+ getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
1356
+ initFlow: (force?: boolean) => void;
1357
+ doneFlow: () => void;
1358
+ private _pluginsReady;
1359
+ setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
1360
+ on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
1361
+ getCurrentActivity: () => ActivityType;
1362
+ historyBack: () => void;
1363
+ setModalState: (opened: boolean) => void;
1364
+ private get _sourceList();
1365
+ }
1357
1366
 
1358
- type PasteScope = 'local' | 'global' | false;
1359
- declare class ClipboardLayer extends SharedInstance {
1360
- private scopes;
1361
- private listener;
1362
- constructor(sharedInstancesBag: SharedInstancesBag);
1363
- private openUploadList;
1364
- private _listener;
1365
- private handlePaste;
1366
- registerBlock(scope: Node): () => void;
1367
- destroy(): void;
1367
+ declare const ExternalUploadSource: Readonly<{
1368
+ readonly FACEBOOK: "facebook";
1369
+ readonly DROPBOX: "dropbox";
1370
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
1371
+ readonly GDRIVE: "gdrive";
1372
+ readonly GPHOTOS: "gphotos";
1373
+ readonly FLICKR: "flickr";
1374
+ readonly VK: "vk";
1375
+ readonly EVERNOTE: "evernote";
1376
+ readonly BOX: "box";
1377
+ readonly ONEDRIVE: "onedrive";
1378
+ readonly HUDDLE: "huddle";
1379
+ }>;
1380
+ declare const UploadSource: Readonly<{
1381
+ readonly FACEBOOK: "facebook";
1382
+ readonly DROPBOX: "dropbox";
1383
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
1384
+ readonly GDRIVE: "gdrive";
1385
+ readonly GPHOTOS: "gphotos";
1386
+ readonly FLICKR: "flickr";
1387
+ readonly VK: "vk";
1388
+ readonly EVERNOTE: "evernote";
1389
+ readonly BOX: "box";
1390
+ readonly ONEDRIVE: "onedrive";
1391
+ readonly HUDDLE: "huddle";
1392
+ readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
1393
+ readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
1394
+ readonly LOCAL: "local";
1395
+ readonly DROP_AREA: "drop-area";
1396
+ readonly CAMERA: "camera";
1397
+ readonly EXTERNAL: "external";
1398
+ readonly API: "js-api";
1399
+ readonly URL: "url";
1400
+ }>;
1401
+ type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
1402
+
1403
+ declare class LitUploaderBlock extends LitActivityBlock {
1404
+ static extSrcList: Readonly<typeof ExternalUploadSource>;
1405
+ static sourceTypes: Readonly<typeof UploadSource>;
1406
+ protected couldBeCtxOwner: boolean;
1407
+ private _isCtxOwner;
1408
+ private _unobserveCollection?;
1409
+ private _unobserveCollectionProperties?;
1410
+ init$: {
1411
+ '*commonProgress': number;
1412
+ '*uploadList': never[];
1413
+ '*uploadQueue': _uploadcare_upload_client.Queue;
1414
+ '*collectionErrors': OutputErrorCollection[];
1415
+ '*collectionState': OutputCollectionState | null;
1416
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
1417
+ '*uploadTrigger': Set<string>;
1418
+ '*currentActivity': null;
1419
+ '*currentActivityParams': {};
1420
+ '*history': never[];
1421
+ '*historyBack': null;
1422
+ '*closeModal': () => void;
1423
+ };
1424
+ private get _hasCtxOwner();
1425
+ initCallback(): void;
1426
+ getAPI(): UploaderPublicApi;
1427
+ get validationManager(): ValidationManager;
1428
+ get api(): UploaderPublicApi;
1429
+ get uploadCollection(): TypedCollection<UploadEntryData>;
1430
+ get secureUploadsManager(): SecureUploadsManager;
1431
+ disconnectedCallback(): void;
1432
+ connectedCallback(): void;
1433
+ private _initCtxOwner;
1434
+ private _observeUploadCollection;
1435
+ private _unobserveUploadCollection;
1436
+ private _createGroup;
1437
+ private _flushOutputItems;
1438
+ private _handleCollectionUpdate;
1439
+ private _handleCollectionPropertiesUpdate;
1440
+ private _flushCommonUploadProgress;
1441
+ private _setInitialCrop;
1442
+ protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1443
+ protected getUploadClientOptions(): Promise<FileFromOptions>;
1444
+ getOutputData(): OutputFileEntry[];
1368
1445
  }
1369
1446
 
1370
1447
  type SelectOption = {
@@ -1387,7 +1464,6 @@ declare global {
1387
1464
  type CameraMode = 'photo' | 'video';
1388
1465
  declare class CameraSource extends LitUploaderBlock {
1389
1466
  couldBeCtxOwner: boolean;
1390
- activityType: "camera";
1391
1467
  private _unsubPermissions;
1392
1468
  private _capturing;
1393
1469
  private _chunks;
@@ -1409,7 +1485,6 @@ declare class CameraSource extends LitUploaderBlock {
1409
1485
  private _timerRef;
1410
1486
  private _lineRef;
1411
1487
  private _videoRef;
1412
- private _switcherRef;
1413
1488
  private _startTime;
1414
1489
  private _elapsedTime;
1415
1490
  private _videoTransformCss;
@@ -1507,25 +1582,54 @@ declare global {
1507
1582
  /**
1508
1583
  * Config keys that can't be passed as attribute (because they are object or function)
1509
1584
  */
1510
- declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartBtn"];
1511
- /** Mapping of attribute names to state */
1512
- declare const attrStateMapping: Record<string, string>;
1585
+ declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
1513
1586
  declare class Config extends LitBlock {
1514
1587
  attributesMeta: Partial<ConfigPlainType> & {
1515
1588
  'ctx-name': string;
1516
1589
  };
1517
1590
  init$: LitBlock["init$"] & ConfigType;
1518
1591
  private _computationControllers;
1592
+ private _pluginChangeUnsubscribe?;
1593
+ private _mutationObserver?;
1594
+ /**
1595
+ * Mapping of attribute names to custom config keys for plugin-registered configs.
1596
+ * Updated dynamically when plugins are registered or changed.
1597
+ * Similar to builtinAttrKeyMapping but for custom configs.
1598
+ */
1599
+ private _customAttrKeyMapping;
1600
+ /** Set of all custom config names registered by plugins */
1601
+ private _customConfigKeys;
1602
+ /**
1603
+ * Map of custom config subscriptions (config name -> unsubscribe function)
1604
+ * Used to track and clean up subscriptions when plugins change
1605
+ */
1606
+ private _customConfigSubscriptions;
1607
+ /**
1608
+ * Check if a key is a custom config (registered by plugins)
1609
+ */
1610
+ private _isCustomConfig;
1611
+ /**
1612
+ * Get the custom config definition for a key
1613
+ */
1614
+ private _getCustomConfigDefinition;
1615
+ /**
1616
+ * Get attribute names for a config key (kebab-case and lowercase)
1617
+ */
1618
+ private _getAttributeNames;
1519
1619
  private _flushValueToAttribute;
1520
1620
  private _flushValueToState;
1521
1621
  private _setValue;
1522
1622
  private _getValue;
1523
1623
  private _assertSameValueDifferentReference;
1624
+ private _processCustomConfigs;
1625
+ private _setupCustomConfigs;
1626
+ private _setupMutationObserver;
1524
1627
  initCallback(): void;
1525
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
1628
+ attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
1629
+ disconnectedCallback(): void;
1526
1630
  static get observedAttributes(): string[];
1527
1631
  }
1528
- interface Config extends ConfigType {
1632
+ interface Config extends ConfigType, CustomConfig {
1529
1633
  }
1530
1634
  declare global {
1531
1635
  interface HTMLElementTagNameMap {
@@ -1595,6 +1699,21 @@ declare global {
1595
1699
  }
1596
1700
  }
1597
1701
 
1702
+ declare class FileActionButton extends LitUploaderBlock {
1703
+ static styleAttrs: string[];
1704
+ uploading: boolean;
1705
+ failed: boolean;
1706
+ success: boolean;
1707
+ idle: boolean;
1708
+ private _handleRemove;
1709
+ render(): lit_html.TemplateResult<1>;
1710
+ }
1711
+ declare global {
1712
+ interface HTMLElementTagNameMap {
1713
+ 'uc-file-action-button': FileActionButton;
1714
+ }
1715
+ }
1716
+
1598
1717
  declare class FileItem extends FileItemConfig {
1599
1718
  protected couldBeCtxOwner: boolean;
1600
1719
  private _pauseRender;
@@ -1609,12 +1728,12 @@ declare class FileItem extends FileItemConfig {
1609
1728
  private _isFailed;
1610
1729
  private _isUploading;
1611
1730
  private _isFocused;
1612
- private _isEditable;
1613
1731
  private _showFileNames;
1614
1732
  private _ariaLabelStatusFile;
1733
+ private _pluginFileActions;
1615
1734
  private _renderedOnce;
1616
1735
  private _observer?;
1617
- private _handleEdit;
1736
+ private _unsubscribePlugins?;
1618
1737
  private _handleRemove;
1619
1738
  private _handleUploadClick;
1620
1739
  private _calculateState;
@@ -1626,6 +1745,8 @@ declare class FileItem extends FileItemConfig {
1626
1745
  private _handleEntryId;
1627
1746
  private _updateShowFileNames;
1628
1747
  protected willUpdate(changedProperties: PropertyValues<this>): void;
1748
+ private _updatePluginFileActions;
1749
+ private _handlePluginFileAction;
1629
1750
  initCallback(): void;
1630
1751
  connectedCallback(): void;
1631
1752
  disconnectedCallback(): void;
@@ -1722,67 +1843,116 @@ declare global {
1722
1843
  }
1723
1844
  }
1724
1845
 
1846
+ type SourceButtonConfig = {
1847
+ id: string;
1848
+ label: string;
1849
+ icon?: string;
1850
+ onClick: () => void | Promise<void>;
1851
+ };
1725
1852
  declare class SourceBtn extends LitUploaderBlock {
1726
1853
  couldBeCtxOwner: boolean;
1727
- private _registeredTypes;
1728
- type?: string;
1729
- onlyIcon: boolean;
1854
+ source?: SourceButtonConfig;
1855
+ textOnly: boolean;
1856
+ iconOnly: boolean;
1730
1857
  private _iconName;
1731
1858
  private _srcTypeKey;
1732
- private _initTypes;
1733
- initCallback(): void;
1734
- private _registerType;
1735
- activate(): void;
1736
- private _applyType;
1737
1859
  protected willUpdate(changedProperties: PropertyValues<this>): void;
1860
+ private _applySource;
1861
+ activate(): void;
1738
1862
  render(): lit_html.TemplateResult<1>;
1739
1863
  }
1740
1864
  declare global {
1741
1865
  interface HTMLElementTagNameMap {
1742
- 'uc-source-btn': SourceBtn;
1866
+ 'uc-source-btn': SourceBtn;
1867
+ }
1868
+ }
1869
+
1870
+ declare class PrimaryAction extends LitUploaderBlock {
1871
+ static styleAttrs: string[];
1872
+ private static readonly SOURCE_TEXT_CONFIG;
1873
+ source: SourceButtonConfig | null;
1874
+ entries: OutputCollectionState<OutputCollectionStatus, 'maybe-has-group'>;
1875
+ private showIcon;
1876
+ private _isMultiple;
1877
+ initCallback(): void;
1878
+ private get hasEntries();
1879
+ private get hasSingleSuccessImage();
1880
+ private get hasMultipleEntries();
1881
+ private get localizedSourceLabel();
1882
+ private _translate;
1883
+ private get textBasedOnLocale();
1884
+ private _headerTextDependentOnEntries;
1885
+ private _getSourceLabelText;
1886
+ private _handleClick;
1887
+ private _renderThumbnail;
1888
+ protected render(): lit_html.TemplateResult<1>;
1889
+ }
1890
+ declare global {
1891
+ interface HTMLElementTagNameMap {
1892
+ 'uc-primary-action': PrimaryAction;
1743
1893
  }
1744
1894
  }
1745
1895
 
1746
- declare class Dropdown extends LitBlock {
1896
+ declare class DropDown extends LitBlock {
1897
+ static styleAttrs: string[];
1747
1898
  private _id;
1748
1899
  private readonly _handleContentClick;
1749
- protected render(): unknown;
1900
+ render(): lit_html.TemplateResult<1>;
1750
1901
  }
1751
1902
  declare global {
1752
1903
  interface HTMLElementTagNameMap {
1753
- 'uc-dropdown': Dropdown;
1904
+ 'uc-drop-down': DropDown;
1754
1905
  }
1755
1906
  }
1756
1907
 
1757
- type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
1758
- type AdvancedSmartBtnConfig = {
1759
- sourceList: string;
1760
- mode: SmartButtonMode;
1761
- };
1908
+ declare class NoWrapModeSmartBtn extends LitUploaderBlock {
1909
+ static styleAttrs: string[];
1910
+ }
1911
+ declare global {
1912
+ interface HTMLElementTagNameMap {
1913
+ 'uc-no-wrap-mode-smart-btn': NoWrapModeSmartBtn;
1914
+ }
1915
+ }
1916
+
1917
+ type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap' | 'collapse';
1762
1918
  declare class SmartBtn extends LitUploaderBlock {
1763
1919
  static styleAttrs: string[];
1764
1920
  couldBeCtxOwner: boolean;
1921
+ private _controller?;
1922
+ private _unregisterAfterFileAddHook?;
1765
1923
  dropzone: boolean;
1766
- private _sourceList;
1924
+ private _mode;
1925
+ private _sources;
1767
1926
  private _status;
1768
- private _multiple;
1769
- private _entry;
1770
- private _lastDigest;
1771
- private _progressPercent;
1772
- private _progressFading;
1773
- private _progressFadeTimer;
1774
- private _showDropdown;
1927
+ private _mainAndRemainSources;
1928
+ private _collection;
1929
+ private _progress;
1775
1930
  private get isIdle();
1776
- private get buttonText();
1931
+ private get isSuccess();
1932
+ private get isFailed();
1933
+ private get isUploading();
1934
+ private get isCollapsedMode();
1935
+ private get shouldShowPrimaryAction();
1936
+ private get shouldShowInline();
1937
+ private get shouldShowDropdown();
1938
+ private get hasCollectionEntries();
1939
+ private get shouldShowAbortAction();
1777
1940
  private _throttledHandleCollectionUpdate;
1778
1941
  private _updateButtonBasedOnCollectionState;
1779
- private _cancelProgressFade;
1780
- private _startProgressFade;
1781
- disconnectedCallback(): void;
1782
- private _removeEntries;
1942
+ private _updateSourceSplit;
1783
1943
  initCallback(): void;
1784
- private readonly _handleClickAbort;
1785
- private readonly _handleClick;
1944
+ disconnectedCallback(): void;
1945
+ private _renderInline;
1946
+ private _getDropdownIconName;
1947
+ private _clearAllEntries;
1948
+ private _clearAllFailedEntries;
1949
+ private _abortAllEntries;
1950
+ private _handleRemove;
1951
+ private _renderDropdown;
1952
+ private _renderPrimaryAction;
1953
+ private _renderAbortAction;
1954
+ private _getInnerClassMap;
1955
+ private _renderVisualDropArea;
1786
1956
  render(): lit_html.TemplateResult<1>;
1787
1957
  }
1788
1958
  declare global {
@@ -2003,6 +2173,10 @@ type ConfigType = {
2003
2173
  * Expiry threshold for secure uploads.
2004
2174
  */
2005
2175
  secureUploadsExpireThreshold: number;
2176
+ /**
2177
+ * Array of plugins to register with the uploader instance.
2178
+ */
2179
+ plugins: UploaderPlugin[];
2006
2180
  /**
2007
2181
  * Metadata for the file.
2008
2182
  */
@@ -2088,7 +2262,8 @@ type ConfigType = {
2088
2262
  * Define the clipboard paste scope.
2089
2263
  */
2090
2264
  pasteScope: PasteScope;
2091
- smartBtn: AdvancedSmartBtnConfig | null;
2265
+ smartButtonViewMode: SmartButtonMode;
2266
+ smartButtonShowFirstIcon: boolean;
2092
2267
  };
2093
2268
  type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
2094
2269
  type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -2264,10 +2439,237 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
2264
2439
  allEntries: OutputFileEntry[];
2265
2440
  });
2266
2441
 
2267
- declare class SecureUploadsManager extends SharedInstance {
2268
- private _secureToken;
2269
- getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
2442
+ type PluginIconRegistration = {
2443
+ name: string;
2444
+ svg: string;
2445
+ };
2446
+ type PluginL10nRegistration = Record<string, Record<string, string>>;
2447
+ type PluginSourceRegistration = {
2448
+ id: string;
2449
+ label: string;
2450
+ icon?: string;
2451
+ /**
2452
+ * @internal
2453
+ *
2454
+ * Optional expansion function. When present, SourceList calls this to determine
2455
+ * which source IDs should actually be rendered in place of this source.
2456
+ * Useful for sources that map to multiple device-specific variants (e.g. camera
2457
+ * expanding to separate photo/video buttons on mobile).
2458
+ * Return `[id]` (the source's own id) to render it as-is.
2459
+ */
2460
+ expand?: () => string[];
2461
+ onSelect: () => Promise<void> | void;
2462
+ };
2463
+ type PluginRenderDispose = () => void;
2464
+ type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
2465
+ type PluginActivityRegistration = {
2466
+ id: string;
2467
+ render: PluginRender;
2468
+ };
2469
+ type PluginFileActionRegistration = {
2470
+ /** Unique action identifier. */
2471
+ id: string;
2472
+ /** Icon name to display in the action button. */
2473
+ icon: string;
2474
+ /** Label shown next to the icon in the action button. Accepts a plain string or an l10n key registered via `registerL10n`. */
2475
+ label: string;
2476
+ /** Return `true` to show the action button for the given file entry. */
2477
+ shouldRender: (fileEntry: OutputFileEntry) => boolean;
2478
+ onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
2479
+ };
2480
+ type PluginFileHookResult = {
2481
+ /** The (optionally transformed) file */
2482
+ file: File | Blob;
2483
+ };
2484
+ type PluginFileHookContext = PluginFileHookResult & {
2485
+ /**
2486
+ * An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
2487
+ * Hooks should respect this signal to avoid doing unnecessary work.
2488
+ */
2489
+ signal: AbortSignal;
2490
+ };
2491
+ type PluginFileHookRegistration = {
2492
+ /**
2493
+ * When the hook is called:
2494
+ * - `'beforeUpload'`: called right before the file is uploaded.
2495
+ * - `'onAdd'`: called after the file is added to the upload list.
2496
+ *
2497
+ * Return the (optionally transformed) file. After the hook runs, `mimeType`,
2498
+ * `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
2499
+ */
2500
+ type: 'beforeUpload' | 'onAdd';
2501
+ handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
2502
+ /**
2503
+ * Maximum time in milliseconds to wait for the hook to complete before skipping it.
2504
+ * @default 30000
2505
+ */
2506
+ timeout?: number;
2507
+ };
2508
+ type PluginRegistryApi = {
2509
+ registerSource: (source: PluginSourceRegistration) => void;
2510
+ registerActivity: (activity: PluginActivityRegistration) => void;
2511
+ registerFileAction: (fileAction: PluginFileActionRegistration) => void;
2512
+ registerFileHook: (hook: PluginFileHookRegistration) => void;
2513
+ registerIcon: (icon: PluginIconRegistration) => void;
2514
+ registerL10n: (l10n: PluginL10nRegistration) => void;
2515
+ registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
2516
+ };
2517
+ /**
2518
+ * API for managing plugin config subscriptions
2519
+ */
2520
+ type PluginConfigApi = {
2521
+ get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
2522
+ subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
2523
+ };
2524
+ /**
2525
+ * API for managing plugin activity interactions
2526
+ */
2527
+ type PluginActivityApi = {
2528
+ /**
2529
+ * Get the current activity parameters.
2530
+ *
2531
+ * @returns The current activity parameters object
2532
+ *
2533
+ * @example
2534
+ * ```typescript
2535
+ * const params = pluginApi.activity.getParams();
2536
+ * console.log('Current params:', params);
2537
+ * ```
2538
+ */
2539
+ getParams: () => Record<string, unknown>;
2540
+ /**
2541
+ * Subscribe to changes in activity parameters.
2542
+ * The callback will be called immediately with the current params,
2543
+ * and then whenever the params change.
2544
+ *
2545
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
2546
+ *
2547
+ * @param callback - Function to call with the new params
2548
+ * @returns Unsubscribe function
2549
+ *
2550
+ * @example
2551
+ * ```typescript
2552
+ * pluginApi.activity.subscribeToParams((params) => {
2553
+ * console.log('Activity params changed:', params);
2554
+ * });
2555
+ * // Cleanup happens automatically on plugin disposal
2556
+ * ```
2557
+ */
2558
+ subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
2559
+ };
2560
+ type PluginFileEntryUpdate = {
2561
+ file?: File | Blob;
2562
+ cdnUrl?: string | null;
2563
+ cdnUrlModifiers?: string | null;
2564
+ mimeType?: string | null;
2565
+ };
2566
+ type PluginFilesApi = {
2567
+ /**
2568
+ * Update mutable properties of a file entry by its internalId.
2569
+ * `fileSize` is recalculated automatically when `file` is provided.
2570
+ */
2571
+ update: (internalId: string, changes: PluginFileEntryUpdate) => void;
2572
+ };
2573
+ type PluginApi = {
2574
+ registry: PluginRegistryApi;
2575
+ config: PluginConfigApi;
2576
+ activity: PluginActivityApi;
2577
+ files: PluginFilesApi;
2578
+ };
2579
+ type PluginUploaderApi = UploaderPublicApi;
2580
+ type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
2581
+ type PluginSetupParams = {
2582
+ pluginApi: PluginApi;
2583
+ uploaderApi: PluginUploaderApi;
2584
+ };
2585
+ type UploaderPlugin = {
2586
+ id: string;
2587
+ setup: (params: PluginSetupParams) => PluginSetupResult;
2588
+ };
2589
+ type Owned<T> = T & {
2590
+ pluginId: string;
2591
+ };
2592
+ type PluginRegistrySnapshot = {
2593
+ sources: Owned<PluginSourceRegistration>[];
2594
+ activities: Owned<PluginActivityRegistration>[];
2595
+ fileActions: Owned<PluginFileActionRegistration>[];
2596
+ fileHooks: Owned<PluginFileHookRegistration>[];
2597
+ icons: Owned<PluginIconRegistration>[];
2598
+ l10n: Owned<PluginL10nRegistration>[];
2599
+ };
2600
+
2601
+ type EventMap = {
2602
+ [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
2603
+ };
2604
+
2605
+ interface UploadEntryData extends Record<string, unknown> {
2606
+ file: File | null;
2607
+ externalUrl: string | null;
2608
+ fileName: string | null;
2609
+ fileSize: number | null;
2610
+ lastModified: number;
2611
+ uploadProgress: number;
2612
+ uuid: string | null;
2613
+ isImage: boolean;
2614
+ mimeType: string | null;
2615
+ ctxName: string | null;
2616
+ cdnUrl: string | null;
2617
+ cdnUrlModifiers: string | null;
2618
+ fileInfo: UploadcareFile | null;
2619
+ isUploading: boolean;
2620
+ abortController: AbortController | null;
2621
+ thumbUrl: string | null;
2622
+ silent: boolean;
2623
+ source: string | null;
2624
+ fullPath: string | null;
2625
+ metadata: Metadata | null;
2626
+ errors: OutputErrorFile[];
2627
+ uploadError: Error | null;
2628
+ isRemoved: boolean;
2629
+ isQueuedForUploading: boolean;
2630
+ isValidationPending: boolean;
2631
+ isQueuedForValidation: boolean;
2632
+ }
2633
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
2634
+ type UploadEntryKeys = keyof UploadEntryData;
2635
+
2636
+ declare class PluginRegistry {
2637
+ private _sources;
2638
+ private _activities;
2639
+ private _fileActions;
2640
+ private _fileHooks;
2641
+ private _icons;
2642
+ private _l10n;
2643
+ readonly config: CustomConfigRegistry;
2644
+ private _own;
2645
+ addSource(pluginId: string, item: PluginSourceRegistration): void;
2646
+ addActivity(pluginId: string, item: PluginActivityRegistration): void;
2647
+ addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
2648
+ addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
2649
+ addIcon(pluginId: string, item: PluginIconRegistration): void;
2650
+ addL10n(pluginId: string, item: PluginL10nRegistration): void;
2651
+ addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
2652
+ purge(pluginId: string): void;
2653
+ snapshot(): PluginRegistrySnapshot;
2654
+ }
2655
+
2656
+ declare class PluginManager extends SharedInstance {
2657
+ private _plugins;
2658
+ private _subscribers;
2659
+ private _pluginsUpdate;
2660
+ private _lazyPluginLoader;
2661
+ readonly registry: PluginRegistry;
2662
+ get configRegistry(): CustomConfigRegistry;
2663
+ constructor(sharedInstancesBag: SharedInstancesBag);
2664
+ pluginsReady(): Promise<void>;
2665
+ onPluginsChange(callback: Unsubscriber): Unsubscriber;
2666
+ private _syncPlugins;
2667
+ private _registerPlugin;
2668
+ private _unregisterPlugin;
2669
+ snapshot(): PluginRegistrySnapshot;
2670
+ runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
2270
2671
  destroy(): void;
2672
+ private _notifySubscribers;
2271
2673
  }
2272
2674
 
2273
2675
  type CommonEventType = InternalEventKey | EventKey;
@@ -2308,14 +2710,90 @@ declare class TelemetryManager extends SharedInstance {
2308
2710
  private get _location();
2309
2711
  }
2310
2712
 
2713
+ interface ISharedInstance {
2714
+ destroy?(): void;
2715
+ }
2716
+ declare class SharedInstance {
2717
+ protected _ctx: PubSub<SharedState>;
2718
+ protected _sharedInstancesBag: SharedInstancesBag;
2719
+ private _subscriptions;
2720
+ private _cfgProxy;
2721
+ protected _debugPrint: (...args: unknown[]) => void;
2722
+ constructor(sharedInstancesBag: SharedInstancesBag);
2723
+ protected addSub(unsub: () => void): void;
2724
+ protected get _cfg(): Readonly<ConfigType>;
2725
+ destroy(): void;
2726
+ }
2727
+ declare const instanceKeyMap: {
2728
+ modalManager: "*modalManager";
2729
+ pluginManager: "*pluginManager";
2730
+ telemetryManager: "*telemetryManager";
2731
+ localeManager: "*localeManager";
2732
+ a11y: "*a11y";
2733
+ clipboard: "*clipboard";
2734
+ routerLayer: "*routerLayer";
2735
+ blocksRegistry: "*blocksRegistry";
2736
+ eventEmitter: "*eventEmitter";
2737
+ uploadCollection: "*uploadCollection";
2738
+ secureUploadsManager: "*secureUploadsManager";
2739
+ api: "*publicApi";
2740
+ validationManager: "*validationManager";
2741
+ };
2742
+ type InstanceTypeMap = {
2743
+ [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
2744
+ };
2745
+ type InstanceName = keyof typeof instanceKeyMap;
2746
+ type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
2747
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2748
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2749
+ readonly ctx: PubSub<SharedState>;
2750
+ readonly modalManager: ModalManager | null;
2751
+ readonly pluginManager: PluginManager;
2752
+ readonly telemetryManager: TelemetryManager;
2753
+ readonly localeManager: LocaleManager;
2754
+ readonly a11y: A11y;
2755
+ readonly routerLayer: RouterHooksLayer;
2756
+ readonly blocksRegistry: Set<LitBlock>;
2757
+ readonly eventEmitter: EventEmitter;
2758
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2759
+ readonly secureUploadsManager: SecureUploadsManager;
2760
+ readonly api: UploaderPublicApi;
2761
+ readonly validationManager: ValidationManager;
2762
+ when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
2763
+ wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
2764
+ };
2765
+
2766
+ type PasteScope = 'local' | 'global' | false;
2767
+ declare class ClipboardLayer extends SharedInstance {
2768
+ private scopes;
2769
+ private listener;
2770
+ constructor(sharedInstancesBag: SharedInstancesBag);
2771
+ private _excludingNodes;
2772
+ private openUploadList;
2773
+ private _listener;
2774
+ private handlePaste;
2775
+ registerBlock(scope: Node): () => void;
2776
+ destroy(): void;
2777
+ }
2778
+
2779
+ type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
2780
+ type LazyPluginEntry = {
2781
+ configDeps: readonly (keyof ConfigType)[];
2782
+ isEnabled: (get: ConfigGetter) => boolean;
2783
+ load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
2784
+ };
2785
+
2311
2786
  type SharedConfigState = {
2312
2787
  [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2313
2788
  };
2789
+ type SharedCustomConfigState = {
2790
+ [K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
2791
+ };
2314
2792
  type BlocksRegistry = Set<LitBlock>;
2315
2793
  type ActivityBlockCtxState = {
2316
- '*currentActivity': string | null;
2794
+ '*currentActivity': RegisteredActivityType | null;
2317
2795
  '*currentActivityParams': Record<string, unknown>;
2318
- '*history': (string | null)[];
2796
+ '*history': (RegisteredActivityType | null)[];
2319
2797
  '*historyBack': (() => void) | null;
2320
2798
  '*closeModal': () => void;
2321
2799
  };
@@ -2332,6 +2810,7 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
2332
2810
  };
2333
2811
  type SolutionBlockCtxState = UploaderBlockCtxState & {
2334
2812
  '*solution': string | null;
2813
+ '*lazyPlugins': LazyPluginEntry[] | null;
2335
2814
  };
2336
2815
  type CloudImageEditorState = {
2337
2816
  '*originalUrl': string | null;
@@ -2382,7 +2861,9 @@ type EditorToolbarState = {
2382
2861
  '*currentOperation': string | null;
2383
2862
  '*operationTooltip': string | null;
2384
2863
  };
2864
+ type SharedContextInstances = Map<string, ISharedInstance>;
2385
2865
  type DynamicBlockState = {
2866
+ '*sharedContextInstances': SharedContextInstances;
2386
2867
  '*blocksRegistry': BlocksRegistry;
2387
2868
  '*eventEmitter': EventEmitter;
2388
2869
  '*localeManager': LocaleManager;
@@ -2390,6 +2871,8 @@ type DynamicBlockState = {
2390
2871
  '*a11y': A11y;
2391
2872
  '*modalManager': ModalManager | null;
2392
2873
  '*clipboard': ClipboardLayer;
2874
+ '*routerLayer': RouterHooksLayer;
2875
+ '*pluginManager': PluginManager;
2393
2876
  };
2394
2877
  type DynamicUploaderBlockState = {
2395
2878
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2400,66 +2883,7 @@ type DynamicUploaderBlockState = {
2400
2883
  type LocaleState = {
2401
2884
  [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2402
2885
  };
2403
- type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2404
-
2405
- interface ISharedInstance {
2406
- destroy?(): void;
2407
- }
2408
- declare class SharedInstance {
2409
- protected _ctx: PubSub<SharedState>;
2410
- protected _sharedInstancesBag: SharedInstancesBag;
2411
- private _subscriptions;
2412
- private _cfgProxy;
2413
- protected _debugPrint: (...args: unknown[]) => void;
2414
- constructor(sharedInstancesBag: SharedInstancesBag);
2415
- protected addSub(unsub: () => void): void;
2416
- protected get _cfg(): Readonly<ConfigType>;
2417
- destroy(): void;
2418
- }
2419
- type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2420
- type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2421
- declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2422
- readonly ctx: PubSub<SharedState>;
2423
- readonly modalManager: ModalManager | null;
2424
- readonly telemetryManager: TelemetryManager;
2425
- readonly localeManager: LocaleManager;
2426
- readonly a11y: A11y;
2427
- readonly blocksRegistry: Set<LitBlock>;
2428
- readonly eventEmitter: EventEmitter;
2429
- readonly uploadCollection: TypedCollection<UploadEntryData>;
2430
- readonly secureUploadsManager: SecureUploadsManager;
2431
- readonly api: UploaderPublicApi;
2432
- readonly validationManager: ValidationManager;
2433
- };
2434
-
2435
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2436
- signal?: AbortSignal;
2437
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2438
- type FileValidatorDescriptor = {
2439
- runOn: 'add' | 'upload' | 'change';
2440
- validator: FuncFileValidator;
2441
- };
2442
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2443
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2444
- declare class ValidationManager extends SharedInstance {
2445
- private get _uploadCollection();
2446
- private _commonFileValidators;
2447
- private _commonCollectionValidators;
2448
- private _queue;
2449
- private _runQueueDebounced;
2450
- private _isDestroyed;
2451
- private _entryValidationState;
2452
- constructor(sharedInstancesBag: SharedInstancesBag);
2453
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2454
- runCollectionValidators(): void;
2455
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2456
- private _runFileValidatorsForEntry;
2457
- private _addCustomTypeToValidationError;
2458
- private _getEntryValidationState;
2459
- private _getValidatorDescriptors;
2460
- private _getValidatorDescriptorsForEntry;
2461
- destroy(): void;
2462
- }
2886
+ type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2463
2887
 
2464
2888
  declare const LitBlockBase: typeof LitElement & Constructor<{
2465
2889
  willYield: boolean;
@@ -2471,9 +2895,7 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2471
2895
  };
2472
2896
  declare class LitBlock extends LitBlockBase {
2473
2897
  private _cfgProxy;
2474
- protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2475
2898
  static styleAttrs: string[];
2476
- activityType: ActivityType;
2477
2899
  init$: {};
2478
2900
  constructor();
2479
2901
  l10n: (str: string, variables?: Record<string, string | number>) => string;
@@ -2481,15 +2903,47 @@ declare class LitBlock extends LitBlockBase {
2481
2903
  protected _sharedInstancesBag: {
2482
2904
  readonly ctx: PubSub<SharedState>;
2483
2905
  readonly modalManager: ModalManager | null;
2906
+ readonly pluginManager: PluginManager;
2484
2907
  readonly telemetryManager: TelemetryManager;
2485
2908
  readonly localeManager: LocaleManager;
2486
2909
  readonly a11y: A11y;
2910
+ readonly routerLayer: RouterHooksLayer;
2487
2911
  readonly blocksRegistry: Set<LitBlock>;
2488
2912
  readonly eventEmitter: EventEmitter;
2489
2913
  readonly uploadCollection: TypedCollection<UploadEntryData>;
2490
2914
  readonly secureUploadsManager: SecureUploadsManager;
2491
2915
  readonly api: UploaderPublicApi;
2492
2916
  readonly validationManager: ValidationManager;
2917
+ when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
2918
+ modalManager: ModalManager | null;
2919
+ pluginManager: PluginManager;
2920
+ telemetryManager: TelemetryManager;
2921
+ localeManager: LocaleManager;
2922
+ a11y: A11y;
2923
+ clipboard: ClipboardLayer;
2924
+ routerLayer: RouterHooksLayer;
2925
+ blocksRegistry: BlocksRegistry;
2926
+ eventEmitter: EventEmitter;
2927
+ uploadCollection: TypedCollection<UploadEntryData>;
2928
+ secureUploadsManager: SecureUploadsManager;
2929
+ api: UploaderPublicApi;
2930
+ validationManager: ValidationManager;
2931
+ }[TName]>) => void): () => void;
2932
+ wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
2933
+ modalManager: ModalManager | null;
2934
+ pluginManager: PluginManager;
2935
+ telemetryManager: TelemetryManager;
2936
+ localeManager: LocaleManager;
2937
+ a11y: A11y;
2938
+ clipboard: ClipboardLayer;
2939
+ routerLayer: RouterHooksLayer;
2940
+ blocksRegistry: BlocksRegistry;
2941
+ eventEmitter: EventEmitter;
2942
+ uploadCollection: TypedCollection<UploadEntryData>;
2943
+ secureUploadsManager: SecureUploadsManager;
2944
+ api: UploaderPublicApi;
2945
+ validationManager: ValidationManager;
2946
+ }[TName]>>;
2493
2947
  };
2494
2948
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2495
2949
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2501,6 +2955,7 @@ declare class LitBlock extends LitBlockBase {
2501
2955
  get localeManager(): LocaleManager;
2502
2956
  get a11y(): A11y;
2503
2957
  get clipboardLayer(): ClipboardLayer;
2958
+ get routerLayer(): RouterHooksLayer;
2504
2959
  get blocksRegistry(): Set<LitBlock>;
2505
2960
  get eventEmitter(): EventEmitter;
2506
2961
  disconnectedCallback(): void;
@@ -2508,11 +2963,7 @@ declare class LitBlock extends LitBlockBase {
2508
2963
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2509
2964
  */
2510
2965
  private destroyCtxCallback;
2511
- /**
2512
- * Adds a shared context instance if it does not exist yet.
2513
- * @param key The shared state key.
2514
- * @param resolver The resolver function that creates the instance.
2515
- */
2966
+ private _getSharedContextInstances;
2516
2967
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2517
2968
  private _destroySharedContextInstances;
2518
2969
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
@@ -2539,7 +2990,7 @@ declare class Modal extends LitBlock {
2539
2990
  private _handleDialogClose;
2540
2991
  private _handleDialogMouseDown;
2541
2992
  private _handleDialogMouseUp;
2542
- show(): void;
2993
+ show(): Promise<void>;
2543
2994
  hide(): void;
2544
2995
  private _handleModalOpen;
2545
2996
  private _handleModalClose;
@@ -2611,8 +3062,10 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2611
3062
 
2612
3063
  declare class LitSolutionBlock extends LitBlock {
2613
3064
  static styleAttrs: string[];
3065
+ static lazyPlugins: LazyPluginEntry[] | null;
2614
3066
  init$: {
2615
3067
  '*solution': string | null;
3068
+ '*lazyPlugins': LazyPluginEntry[] | null;
2616
3069
  '*commonProgress': number;
2617
3070
  '*uploadList': never[];
2618
3071
  '*uploadQueue': _uploadcare_upload_client.Queue;
@@ -2744,17 +3197,15 @@ declare global {
2744
3197
  }
2745
3198
  }
2746
3199
 
2747
- declare class SourceList extends LitBlock {
2748
- private _rawSourceList;
2749
- private _cameraModes;
3200
+ declare class SourceList extends LitUploaderBlock {
3201
+ private _controller?;
3202
+ private _sources;
2750
3203
  /**
2751
3204
  * CSS-only attribute
2752
3205
  */
2753
3206
  wrap: boolean;
2754
3207
  initCallback(): void;
2755
3208
  protected updated(changedProperties: PropertyValues<this>): void;
2756
- private _updateSources;
2757
- private _sources;
2758
3209
  render(): lit_html.TemplateResult<1>;
2759
3210
  }
2760
3211
  declare global {
@@ -2809,7 +3260,9 @@ declare class UploadCtxProvider extends LitUploaderBlock {
2809
3260
  }
2810
3261
  interface UploadCtxProvider extends LitUploaderBlock {
2811
3262
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
3263
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
2812
3264
  removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
3265
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
2813
3266
  }
2814
3267
  declare global {
2815
3268
  interface HTMLElementTagNameMap {
@@ -2817,47 +3270,80 @@ declare global {
2817
3270
  }
2818
3271
  }
2819
3272
 
2820
- declare class UrlSource extends LitUploaderBlock {
3273
+ declare class SimpleBtn extends LitUploaderBlock {
3274
+ static styleAttrs: string[];
2821
3275
  couldBeCtxOwner: boolean;
2822
- activityType: ActivityType;
2823
- private _formState;
3276
+ dropzone: boolean;
3277
+ private _buttonTextKey;
3278
+ private readonly _handleClick;
2824
3279
  initCallback(): void;
2825
- private _inputRef;
2826
- private _handleInput;
2827
- private _handleUpload;
2828
3280
  render(): lit_html.TemplateResult<1>;
2829
3281
  }
2830
3282
  declare global {
2831
3283
  interface HTMLElementTagNameMap {
2832
- 'uc-url-source': UrlSource;
3284
+ 'uc-simple-btn': SimpleBtn;
2833
3285
  }
2834
3286
  }
2835
3287
 
2836
- declare class SimpleBtn extends LitUploaderBlock {
2837
- static styleAttrs: string[];
2838
- couldBeCtxOwner: boolean;
2839
- dropzone: boolean;
2840
- private _buttonTextKey;
2841
- private readonly _handleClick;
3288
+ declare class PluginActivityHost extends LitActivityBlock {
3289
+ registration: Owned<PluginActivityRegistration>;
3290
+ private _dispose?;
3291
+ private _containerRef;
3292
+ initCallback(): void;
3293
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
3294
+ private _ensureRegistered;
3295
+ private _renderActivity;
3296
+ private _disposeActivity;
3297
+ disconnectedCallback(): void;
3298
+ render(): lit_html.TemplateResult<1>;
3299
+ }
3300
+ declare class PluginActivityRenderer extends LitBlock {
3301
+ mode: 'modal' | 'inline';
3302
+ private _activities;
3303
+ private _unsubscribePlugins?;
2842
3304
  initCallback(): void;
3305
+ private _syncActivities;
3306
+ disconnectedCallback(): void;
2843
3307
  render(): lit_html.TemplateResult<1>;
2844
3308
  }
2845
3309
  declare global {
2846
3310
  interface HTMLElementTagNameMap {
2847
- 'uc-simple-btn': SimpleBtn;
3311
+ 'uc-plugin-activity-host': PluginActivityHost;
3312
+ 'uc-plugin-activity-renderer': PluginActivityRenderer;
3313
+ }
3314
+ }
3315
+
3316
+ declare class UrlSource extends LitUploaderBlock {
3317
+ private _url;
3318
+ private _handleInput;
3319
+ private _handleUpload;
3320
+ render(): lit_html.TemplateResult<1>;
3321
+ }
3322
+ declare global {
3323
+ interface HTMLElementTagNameMap {
3324
+ 'uc-url-source': UrlSource;
2848
3325
  }
2849
3326
  }
2850
3327
 
2851
3328
  declare class FileUploaderRegular extends LitSolutionBlock {
3329
+ static lazyPlugins: LazyPluginEntry[];
2852
3330
  attributesMeta: {
2853
3331
  headless?: boolean;
3332
+ 'smart-button'?: boolean;
2854
3333
  'ctx-name': string;
2855
3334
  };
2856
3335
  static styleAttrs: string[];
2857
3336
  headless: boolean;
2858
- smart: boolean;
3337
+ smartButton: boolean;
2859
3338
  constructor();
2860
3339
  initCallback(): void;
3340
+ /**
3341
+ * Exposes whether SmartBtn is active for non-Lit classes that can't use context
3342
+ */
3343
+ get isSmartBtnActive(): boolean;
3344
+ private _renderSmartButton;
3345
+ private _renderStaticButton;
3346
+ private _renderButton;
2861
3347
  render(): lit_html.TemplateResult<1>;
2862
3348
  }
2863
3349
  declare global {
@@ -2867,6 +3353,7 @@ declare global {
2867
3353
  }
2868
3354
 
2869
3355
  declare class FileUploaderInline extends LitSolutionBlock {
3356
+ static lazyPlugins: LazyPluginEntry[];
2870
3357
  attributesMeta: {
2871
3358
  'ctx-name': string;
2872
3359
  };
@@ -2887,6 +3374,7 @@ declare global {
2887
3374
  }
2888
3375
 
2889
3376
  declare class FileUploaderMinimal extends LitSolutionBlock {
3377
+ static lazyPlugins: LazyPluginEntry[];
2890
3378
  attributesMeta: {
2891
3379
  'ctx-name': string;
2892
3380
  };
@@ -2913,4 +3401,4 @@ declare global {
2913
3401
  declare const PACKAGE_NAME = "blocks";
2914
3402
  declare const PACKAGE_VERSION: string;
2915
3403
 
2916
- export { LitActivityBlock as ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, PubSub as Data, DropArea, Dropdown, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PACKAGE_NAME, PACKAGE_VERSION, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SmartBtn, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, loadFileUploaderFrom, toKebabCase };
3404
+ export { LitActivityBlock as ActivityBlock, ActivityHeader, type ActivityType, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, type CustomActivities, type CustomConfig, type CustomConfigDefinition, PubSub as Data, DropArea, DropDown, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileActionButton, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, NoWrapModeSmartBtn, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, type Owned, PACKAGE_NAME, PACKAGE_VERSION, type PluginActivityApi, PluginActivityHost, type PluginActivityRegistration, PluginActivityRenderer, type PluginApi, type PluginConfigApi, type PluginFileActionRegistration, type PluginFileEntryUpdate, type PluginFileHookContext, type PluginFileHookRegistration, type PluginFileHookResult, type PluginFilesApi, type PluginIconRegistration, type PluginL10nRegistration, type PluginRegistryApi, type PluginRegistrySnapshot, type PluginRender, type PluginRenderDispose, type PluginSetupParams, type PluginSetupResult, type PluginSourceRegistration, type PluginUploaderApi, PresenceToggle, PrimaryAction, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SmartBtn, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, type UploaderPlugin, UploaderPublicApi, UrlSource, defineComponents, defineLocale, loadFileUploaderFrom, toKebabCase };