@uploadcare/file-uploader 1.30.0-alpha.5 → 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
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import _default from './locales/file-uploader/en.js';
4
4
  import * as lit_html from 'lit-html';
5
5
  import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
6
6
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
7
- import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
7
+ import { FileFromOptions, Metadata, UploadcareFile, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
8
8
  export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
9
9
  import { Ref } from 'lit/directives/ref.js';
10
10
  import { TelemetryRequest } from '@uploadcare/quality-insights';
@@ -79,6 +79,16 @@ type LocaleDefinition = typeof _default;
79
79
  type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
80
80
  declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
81
81
 
82
+ type AfterFileAddContext = {
83
+ historyLength: number;
84
+ };
85
+ type AfterFileAddHook = (ctx: AfterFileAddContext) => boolean;
86
+ declare class RouterHooksLayer extends SharedInstance {
87
+ private _afterFileAddHooks;
88
+ registerAfterFileAddHook(hook: AfterFileAddHook): () => void;
89
+ navigateAfterFileAdd(): void;
90
+ }
91
+
82
92
  declare class A11y implements ISharedInstance {
83
93
  private _destroyKeyUX;
84
94
  private readonly _scopedWindow;
@@ -90,8 +100,72 @@ declare class A11y implements ISharedInstance {
90
100
  declare class LocaleManager extends SharedInstance {
91
101
  private _localeName;
92
102
  constructor(sharedInstancesBag: SharedInstancesBag);
103
+ private _applyOverrides;
104
+ private _applyPluginLocales;
93
105
  }
94
106
 
107
+ /**
108
+ * Custom configuration options registration system for plugins
109
+ */
110
+ type CustomConfigDefinition<T = unknown> = {
111
+ /**
112
+ * Config option name (will be used as property and optionally as attribute)
113
+ */
114
+ name: string;
115
+ /**
116
+ * Default value for the config option
117
+ */
118
+ defaultValue: T;
119
+ /**
120
+ * Whether this config can be set via HTML attribute
121
+ * @default true
122
+ */
123
+ attribute?: boolean;
124
+ /**
125
+ * Convert attribute string to config value
126
+ * Only used if attribute is true
127
+ */
128
+ fromAttribute?: (value: string | null) => T;
129
+ /**
130
+ * Convert config value to attribute string
131
+ * Only used if attribute is true
132
+ */
133
+ toAttribute?: (value: T) => string | null;
134
+ /**
135
+ * Normalize/validate the config value
136
+ */
137
+ normalize?: (value: unknown) => T;
138
+ };
139
+ /**
140
+ * Registry for custom config options defined by plugins
141
+ * This is managed by the PluginManager as a shared instance property
142
+ */
143
+ declare class CustomConfigRegistry {
144
+ private _definitions;
145
+ register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
146
+ unregister(name: string): void;
147
+ unregisterByPlugin(pluginId: string): void;
148
+ get(name: string): CustomConfigDefinition<any> | undefined;
149
+ getAll(): Map<string, CustomConfigDefinition<any>>;
150
+ }
151
+ /**
152
+ * Interface for TypeScript module augmentation
153
+ * Plugins should extend this interface to add their custom config types
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * declare module '@uploadcare/file-uploader' {
158
+ * interface CustomConfig {
159
+ * 'my-custom-option': string;
160
+ * }
161
+ * }
162
+ * ```
163
+ */
164
+ interface CustomConfig {
165
+ }
166
+
167
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
168
+
95
169
  declare class TypedData<T extends Record<string, unknown>> {
96
170
  private _ctxId;
97
171
  private _data;
@@ -104,6 +178,41 @@ declare class TypedData<T extends Record<string, unknown>> {
104
178
  destroy(): void;
105
179
  }
106
180
 
181
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
182
+ signal?: AbortSignal;
183
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
184
+ type FileValidatorDescriptor = {
185
+ runOn: 'add' | 'upload' | 'change';
186
+ validator: FuncFileValidator;
187
+ };
188
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
189
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
190
+ declare class ValidationManager extends SharedInstance {
191
+ private get _uploadCollection();
192
+ private _commonFileValidators;
193
+ private _commonCollectionValidators;
194
+ private _queue;
195
+ private _runQueueDebounced;
196
+ private _isDestroyed;
197
+ private _entryValidationState;
198
+ constructor(sharedInstancesBag: SharedInstancesBag);
199
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
200
+ runCollectionValidators(): void;
201
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
202
+ private _runFileValidatorsForEntry;
203
+ private _addCustomTypeToValidationError;
204
+ private _getEntryValidationState;
205
+ private _getValidatorDescriptors;
206
+ private _getValidatorDescriptorsForEntry;
207
+ destroy(): void;
208
+ }
209
+
210
+ declare class SecureUploadsManager extends SharedInstance {
211
+ private _secureToken;
212
+ getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
213
+ destroy(): void;
214
+ }
215
+
107
216
  type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
108
217
  type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
109
218
  type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
@@ -140,6 +249,8 @@ declare class TypedCollection<T extends Record<string, unknown>> {
140
249
  readProp<K extends keyof T>(id: Uid, propName: K): T[K];
141
250
  publishProp<K extends keyof T>(id: Uid, propName: K, value: T[K]): void;
142
251
  remove(id: Uid): void;
252
+ abort(id: Uid): void;
253
+ abortAll(): void;
143
254
  clearAll(): void;
144
255
  observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
145
256
  unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
@@ -155,155 +266,6 @@ declare const CameraSourceTypes: Readonly<{
155
266
  }>;
156
267
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
157
268
 
158
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
159
-
160
- interface UploadEntryData extends Record<string, unknown> {
161
- file: File | null;
162
- externalUrl: string | null;
163
- fileName: string | null;
164
- fileSize: number | null;
165
- lastModified: number;
166
- uploadProgress: number;
167
- uuid: string | null;
168
- isImage: boolean;
169
- mimeType: string | null;
170
- ctxName: string | null;
171
- cdnUrl: string | null;
172
- cdnUrlModifiers: string | null;
173
- fileInfo: UploadcareFile | null;
174
- isUploading: boolean;
175
- abortController: AbortController | null;
176
- thumbUrl: string | null;
177
- silent: boolean;
178
- source: string | null;
179
- fullPath: string | null;
180
- metadata: Metadata | null;
181
- errors: OutputErrorFile[];
182
- uploadError: Error | null;
183
- isRemoved: boolean;
184
- isQueuedForUploading: boolean;
185
- isValidationPending: boolean;
186
- isQueuedForValidation: boolean;
187
- }
188
- type UploadEntryTypedData = TypedData<UploadEntryData>;
189
- type UploadEntryKeys = keyof UploadEntryData;
190
-
191
- type ApiAddFileCommonOptions = {
192
- silent?: boolean;
193
- fileName?: string;
194
- source?: string;
195
- };
196
- declare class UploaderPublicApi extends SharedInstance {
197
- private _l10n;
198
- get _uploadCollection(): TypedCollection<UploadEntryData>;
199
- get cfg(): Readonly<ConfigType>;
200
- get l10n(): (str: string, variables?: Record<string, string | number>) => string;
201
- /**
202
- * TODO: Probably we should not allow user to override `source` property
203
- */
204
- addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
205
- addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
206
- addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
207
- addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
208
- fullPath?: string;
209
- }) => OutputFileEntry<"idle">;
210
- removeFileByInternalId: (internalId: string) => void;
211
- removeAllFiles(): void;
212
- uploadAll: () => void;
213
- openSystemDialog: (options?: {
214
- captureCamera?: boolean;
215
- modeCamera?: ModeCameraType;
216
- }) => void;
217
- getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
218
- getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
219
- initFlow: (force?: boolean) => void;
220
- doneFlow: () => void;
221
- setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
222
- getCurrentActivity: () => ActivityType;
223
- setModalState: (opened: boolean) => void;
224
- private get _sourceList();
225
- }
226
-
227
- declare const ExternalUploadSource: Readonly<{
228
- readonly FACEBOOK: "facebook";
229
- readonly DROPBOX: "dropbox";
230
- readonly GDRIVE: "gdrive";
231
- readonly GPHOTOS: "gphotos";
232
- readonly FLICKR: "flickr";
233
- readonly VK: "vk";
234
- readonly EVERNOTE: "evernote";
235
- readonly BOX: "box";
236
- readonly ONEDRIVE: "onedrive";
237
- readonly HUDDLE: "huddle";
238
- }>;
239
- declare const UploadSource: Readonly<{
240
- readonly FACEBOOK: "facebook";
241
- readonly DROPBOX: "dropbox";
242
- readonly GDRIVE: "gdrive";
243
- readonly GPHOTOS: "gphotos";
244
- readonly FLICKR: "flickr";
245
- readonly VK: "vk";
246
- readonly EVERNOTE: "evernote";
247
- readonly BOX: "box";
248
- readonly ONEDRIVE: "onedrive";
249
- readonly HUDDLE: "huddle";
250
- readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
251
- readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
252
- readonly LOCAL: "local";
253
- readonly DROP_AREA: "drop-area";
254
- readonly CAMERA: "camera";
255
- readonly EXTERNAL: "external";
256
- readonly API: "js-api";
257
- readonly URL: "url";
258
- readonly DRAW: "draw";
259
- }>;
260
- type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
261
-
262
- declare class LitUploaderBlock extends LitActivityBlock {
263
- static extSrcList: Readonly<typeof ExternalUploadSource>;
264
- static sourceTypes: Readonly<typeof UploadSource>;
265
- protected couldBeCtxOwner: boolean;
266
- private _isCtxOwner;
267
- private _unobserveCollection?;
268
- private _unobserveCollectionProperties?;
269
- init$: {
270
- '*commonProgress': number;
271
- '*uploadList': never[];
272
- '*uploadQueue': _uploadcare_upload_client.Queue;
273
- '*collectionErrors': OutputErrorCollection[];
274
- '*collectionState': OutputCollectionState | null;
275
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
276
- '*uploadTrigger': Set<string>;
277
- '*currentActivity': null;
278
- '*currentActivityParams': {};
279
- '*history': never[];
280
- '*historyBack': null;
281
- '*closeModal': () => void;
282
- };
283
- private get _hasCtxOwner();
284
- initCallback(): void;
285
- getAPI(): UploaderPublicApi;
286
- get validationManager(): ValidationManager;
287
- get api(): UploaderPublicApi;
288
- get uploadCollection(): TypedCollection<UploadEntryData>;
289
- get secureUploadsManager(): SecureUploadsManager;
290
- disconnectedCallback(): void;
291
- connectedCallback(): void;
292
- private _initCtxOwner;
293
- private _observeUploadCollection;
294
- private _unobserveUploadCollection;
295
- private _createGroup;
296
- private _flushOutputItems;
297
- private _handleCollectionUpdate;
298
- private _handleCollectionPropertiesUpdate;
299
- private _flushCommonUploadProgress;
300
- private _openCloudImageEditor;
301
- private _setInitialCrop;
302
- protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
303
- protected getUploadClientOptions(): Promise<FileFromOptions>;
304
- getOutputData(): OutputFileEntry[];
305
- }
306
-
307
269
  /**
308
270
  * Mapping of loading resources per operation
309
271
  */
@@ -418,11 +380,14 @@ declare global {
418
380
  declare class Icon extends LitBlock {
419
381
  name: string;
420
382
  private _resolvedHref;
383
+ private _pluginSvg;
421
384
  private _iconHrefResolver;
385
+ private _unsubscribePlugins?;
422
386
  initCallback(): void;
423
387
  protected willUpdate(changedProperties: PropertyValues<this>): void;
424
388
  private _updateResolvedHref;
425
389
  render(): lit_html.TemplateResult<1>;
390
+ disconnectedCallback(): void;
426
391
  }
427
392
  declare global {
428
393
  interface HTMLElementTagNameMap {
@@ -953,6 +918,7 @@ declare class CloudImageEditorBlock extends LitBlock {
953
918
  private _hasNetworkProblems;
954
919
  private _isInitialized;
955
920
  private _pendingInitUpdate;
921
+ private _pendingSizeWait;
956
922
  private readonly _debouncedShowLoader;
957
923
  private readonly _imgRef;
958
924
  private readonly _cropperRef;
@@ -1002,12 +968,11 @@ type ActivityParams$1 = {
1002
968
  internalId: string;
1003
969
  };
1004
970
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1005
- couldBeCtxOwner: boolean;
1006
- activityType: "cloud-image-edit";
1007
971
  private _entry?;
1008
972
  private _editorConfig;
1009
973
  get activityParams(): ActivityParams$1;
1010
974
  initCallback(): void;
975
+ disconnectedCallback(): void;
1011
976
  private _handleApply;
1012
977
  private _handleCancel;
1013
978
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1044,7 +1009,6 @@ type ActivityParams = {
1044
1009
  };
1045
1010
  declare class ExternalSource extends LitUploaderBlock {
1046
1011
  couldBeCtxOwner: boolean;
1047
- activityType: "external";
1048
1012
  private _messageBridge?;
1049
1013
  private _iframeRef;
1050
1014
  private _latestSelectionSummary;
@@ -1088,22 +1052,26 @@ declare global {
1088
1052
  declare const ACTIVITY_TYPES: Readonly<{
1089
1053
  START_FROM: "start-from";
1090
1054
  CAMERA: "camera";
1091
- DRAW: "draw";
1092
1055
  UPLOAD_LIST: "upload-list";
1093
1056
  URL: "url";
1094
1057
  CLOUD_IMG_EDIT: "cloud-image-edit";
1095
1058
  EXTERNAL: "external";
1096
1059
  }>;
1097
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1098
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1060
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1061
+ type ActivityType = RegisteredActivityType | null;
1099
1062
 
1100
1063
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1064
+ interface CustomActivities {
1065
+ }
1101
1066
  type ActivityParamsMap = {
1102
1067
  'cloud-image-edit': ActivityParams$1;
1103
1068
  external: ActivityParams;
1069
+ } & {
1070
+ [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1104
1071
  };
1105
1072
  declare class LitActivityBlock extends LitBlock {
1106
1073
  protected historyTracked: boolean;
1074
+ activityType: ActivityType;
1107
1075
  private [ACTIVE_PROP]?;
1108
1076
  init$: {
1109
1077
  '*currentActivity': null;
@@ -1117,12 +1085,11 @@ declare class LitActivityBlock extends LitBlock {
1117
1085
  private _activate;
1118
1086
  initCallback(): void;
1119
1087
  private _historyFlush;
1120
- private _isActivityRegistered;
1088
+ protected _isActivityRegistered(): boolean;
1121
1089
  private static _activityCallbacks;
1122
1090
  static activities: Readonly<{
1123
1091
  START_FROM: 'start-from';
1124
1092
  CAMERA: 'camera';
1125
- DRAW: 'draw';
1126
1093
  UPLOAD_LIST: 'upload-list';
1127
1094
  URL: 'url';
1128
1095
  CLOUD_IMG_EDIT: 'cloud-image-edit';
@@ -1138,8 +1105,8 @@ declare class LitActivityBlock extends LitBlock {
1138
1105
  private _unregisterActivity;
1139
1106
  disconnectedCallback(): void;
1140
1107
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1141
- get initActivity(): string | null;
1142
- get doneActivity(): string | null;
1108
+ get initActivity(): RegisteredActivityType | null;
1109
+ get doneActivity(): RegisteredActivityType | null;
1143
1110
  historyBack(): void;
1144
1111
  }
1145
1112
 
@@ -1201,7 +1168,9 @@ type EventPayload = {
1201
1168
  declare class EventEmitter extends SharedInstance {
1202
1169
  private _timeoutStore;
1203
1170
  private _targets;
1171
+ private _listeners;
1204
1172
  bindTarget(target: LitBlock): () => void;
1173
+ on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
1205
1174
  private _dispatch;
1206
1175
  emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
1207
1176
  debounce?: TDebounce;
@@ -1209,20 +1178,123 @@ declare class EventEmitter extends SharedInstance {
1209
1178
  destroy(): void;
1210
1179
  }
1211
1180
 
1212
- type EventMap = {
1213
- [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
1181
+ type ApiAddFileCommonOptions = {
1182
+ silent?: boolean;
1183
+ fileName?: string;
1184
+ source?: string;
1214
1185
  };
1186
+ declare class UploaderPublicApi extends SharedInstance {
1187
+ private _l10n;
1188
+ get _uploadCollection(): TypedCollection<UploadEntryData>;
1189
+ get cfg(): Readonly<ConfigType>;
1190
+ get l10n(): (str: string, variables?: Record<string, string | number>) => string;
1191
+ /**
1192
+ * TODO: Probably we should not allow user to override `source` property
1193
+ */
1194
+ addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1195
+ addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1196
+ addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
1197
+ addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
1198
+ fullPath?: string;
1199
+ }) => OutputFileEntry<"idle">;
1200
+ removeFileByInternalId: (internalId: string) => void;
1201
+ removeAllFiles(): void;
1202
+ uploadAll: () => void;
1203
+ openSystemDialog: (options?: {
1204
+ captureCamera?: boolean;
1205
+ modeCamera?: ModeCameraType;
1206
+ }) => void;
1207
+ getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
1208
+ getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
1209
+ initFlow: (force?: boolean) => void;
1210
+ doneFlow: () => void;
1211
+ private _pluginsReady;
1212
+ setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
1213
+ on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
1214
+ getCurrentActivity: () => ActivityType;
1215
+ historyBack: () => void;
1216
+ setModalState: (opened: boolean) => void;
1217
+ private get _sourceList();
1218
+ }
1215
1219
 
1216
- type PasteScope = 'local' | 'global' | false;
1217
- declare class ClipboardLayer extends SharedInstance {
1218
- private scopes;
1219
- private listener;
1220
- constructor(sharedInstancesBag: SharedInstancesBag);
1221
- private openUploadList;
1222
- private _listener;
1223
- private handlePaste;
1224
- registerBlock(scope: Node): () => void;
1225
- destroy(): void;
1220
+ declare const ExternalUploadSource: Readonly<{
1221
+ readonly FACEBOOK: "facebook";
1222
+ readonly DROPBOX: "dropbox";
1223
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
1224
+ readonly GDRIVE: "gdrive";
1225
+ readonly GPHOTOS: "gphotos";
1226
+ readonly FLICKR: "flickr";
1227
+ readonly VK: "vk";
1228
+ readonly EVERNOTE: "evernote";
1229
+ readonly BOX: "box";
1230
+ readonly ONEDRIVE: "onedrive";
1231
+ readonly HUDDLE: "huddle";
1232
+ }>;
1233
+ declare const UploadSource: Readonly<{
1234
+ readonly FACEBOOK: "facebook";
1235
+ readonly DROPBOX: "dropbox";
1236
+ readonly DROPBOX_CHOOSER: "dropboxchooser";
1237
+ readonly GDRIVE: "gdrive";
1238
+ readonly GPHOTOS: "gphotos";
1239
+ readonly FLICKR: "flickr";
1240
+ readonly VK: "vk";
1241
+ readonly EVERNOTE: "evernote";
1242
+ readonly BOX: "box";
1243
+ readonly ONEDRIVE: "onedrive";
1244
+ readonly HUDDLE: "huddle";
1245
+ readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
1246
+ readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
1247
+ readonly LOCAL: "local";
1248
+ readonly DROP_AREA: "drop-area";
1249
+ readonly CAMERA: "camera";
1250
+ readonly EXTERNAL: "external";
1251
+ readonly API: "js-api";
1252
+ readonly URL: "url";
1253
+ }>;
1254
+ type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
1255
+
1256
+ declare class LitUploaderBlock extends LitActivityBlock {
1257
+ static extSrcList: Readonly<typeof ExternalUploadSource>;
1258
+ static sourceTypes: Readonly<typeof UploadSource>;
1259
+ protected couldBeCtxOwner: boolean;
1260
+ private _isCtxOwner;
1261
+ private _unobserveCollection?;
1262
+ private _unobserveCollectionProperties?;
1263
+ init$: {
1264
+ '*commonProgress': number;
1265
+ '*uploadList': never[];
1266
+ '*uploadQueue': _uploadcare_upload_client.Queue;
1267
+ '*collectionErrors': OutputErrorCollection[];
1268
+ '*collectionState': OutputCollectionState | null;
1269
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
1270
+ '*uploadTrigger': Set<string>;
1271
+ '*currentActivity': null;
1272
+ '*currentActivityParams': {};
1273
+ '*history': never[];
1274
+ '*historyBack': null;
1275
+ '*closeModal': () => void;
1276
+ };
1277
+ private get _hasCtxOwner();
1278
+ initCallback(): void;
1279
+ getAPI(): UploaderPublicApi;
1280
+ get validationManager(): ValidationManager;
1281
+ get api(): UploaderPublicApi;
1282
+ get uploadCollection(): TypedCollection<UploadEntryData>;
1283
+ get secureUploadsManager(): SecureUploadsManager;
1284
+ disconnectedCallback(): void;
1285
+ connectedCallback(): void;
1286
+ private _initCtxOwner;
1287
+ private _observeUploadCollection;
1288
+ private _unobserveUploadCollection;
1289
+ private _createGroup;
1290
+ private _flushOutputItems;
1291
+ private _handleCollectionUpdate;
1292
+ private _handleCollectionPropertiesUpdate;
1293
+ private _flushCommonUploadProgress;
1294
+ private _setInitialCrop;
1295
+ protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1296
+ protected getUploadClientOptions(): Promise<FileFromOptions>;
1297
+ getOutputData(): OutputFileEntry[];
1226
1298
  }
1227
1299
 
1228
1300
  type SelectOption = {
@@ -1245,7 +1317,6 @@ declare global {
1245
1317
  type CameraMode = 'photo' | 'video';
1246
1318
  declare class CameraSource extends LitUploaderBlock {
1247
1319
  couldBeCtxOwner: boolean;
1248
- activityType: "camera";
1249
1320
  private _unsubPermissions;
1250
1321
  private _capturing;
1251
1322
  private _chunks;
@@ -1267,7 +1338,6 @@ declare class CameraSource extends LitUploaderBlock {
1267
1338
  private _timerRef;
1268
1339
  private _lineRef;
1269
1340
  private _videoRef;
1270
- private _switcherRef;
1271
1341
  private _startTime;
1272
1342
  private _elapsedTime;
1273
1343
  private _videoTransformCss;
@@ -1365,25 +1435,54 @@ declare global {
1365
1435
  /**
1366
1436
  * Config keys that can't be passed as attribute (because they are object or function)
1367
1437
  */
1368
- declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartBtn"];
1369
- /** Mapping of attribute names to state */
1370
- declare const attrStateMapping: Record<string, string>;
1438
+ declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
1371
1439
  declare class Config extends LitBlock {
1372
1440
  attributesMeta: Partial<ConfigPlainType> & {
1373
1441
  'ctx-name': string;
1374
1442
  };
1375
1443
  init$: LitBlock["init$"] & ConfigType;
1376
1444
  private _computationControllers;
1445
+ private _pluginChangeUnsubscribe?;
1446
+ private _mutationObserver?;
1447
+ /**
1448
+ * Mapping of attribute names to custom config keys for plugin-registered configs.
1449
+ * Updated dynamically when plugins are registered or changed.
1450
+ * Similar to builtinAttrKeyMapping but for custom configs.
1451
+ */
1452
+ private _customAttrKeyMapping;
1453
+ /** Set of all custom config names registered by plugins */
1454
+ private _customConfigKeys;
1455
+ /**
1456
+ * Map of custom config subscriptions (config name -> unsubscribe function)
1457
+ * Used to track and clean up subscriptions when plugins change
1458
+ */
1459
+ private _customConfigSubscriptions;
1460
+ /**
1461
+ * Check if a key is a custom config (registered by plugins)
1462
+ */
1463
+ private _isCustomConfig;
1464
+ /**
1465
+ * Get the custom config definition for a key
1466
+ */
1467
+ private _getCustomConfigDefinition;
1468
+ /**
1469
+ * Get attribute names for a config key (kebab-case and lowercase)
1470
+ */
1471
+ private _getAttributeNames;
1377
1472
  private _flushValueToAttribute;
1378
1473
  private _flushValueToState;
1379
1474
  private _setValue;
1380
1475
  private _getValue;
1381
1476
  private _assertSameValueDifferentReference;
1477
+ private _processCustomConfigs;
1478
+ private _setupCustomConfigs;
1479
+ private _setupMutationObserver;
1382
1480
  initCallback(): void;
1383
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
1481
+ attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
1482
+ disconnectedCallback(): void;
1384
1483
  static get observedAttributes(): string[];
1385
1484
  }
1386
- interface Config extends ConfigType {
1485
+ interface Config extends ConfigType, CustomConfig {
1387
1486
  }
1388
1487
  declare global {
1389
1488
  interface HTMLElementTagNameMap {
@@ -1453,6 +1552,21 @@ declare global {
1453
1552
  }
1454
1553
  }
1455
1554
 
1555
+ declare class FileActionButton extends LitUploaderBlock {
1556
+ static styleAttrs: string[];
1557
+ uploading: boolean;
1558
+ failed: boolean;
1559
+ success: boolean;
1560
+ idle: boolean;
1561
+ private _handleRemove;
1562
+ render(): lit_html.TemplateResult<1>;
1563
+ }
1564
+ declare global {
1565
+ interface HTMLElementTagNameMap {
1566
+ 'uc-file-action-button': FileActionButton;
1567
+ }
1568
+ }
1569
+
1456
1570
  declare class FileItem extends FileItemConfig {
1457
1571
  protected couldBeCtxOwner: boolean;
1458
1572
  private _pauseRender;
@@ -1467,12 +1581,12 @@ declare class FileItem extends FileItemConfig {
1467
1581
  private _isFailed;
1468
1582
  private _isUploading;
1469
1583
  private _isFocused;
1470
- private _isEditable;
1471
1584
  private _showFileNames;
1472
1585
  private _ariaLabelStatusFile;
1586
+ private _pluginFileActions;
1473
1587
  private _renderedOnce;
1474
1588
  private _observer?;
1475
- private _handleEdit;
1589
+ private _unsubscribePlugins?;
1476
1590
  private _handleRemove;
1477
1591
  private _handleUploadClick;
1478
1592
  private _calculateState;
@@ -1484,6 +1598,8 @@ declare class FileItem extends FileItemConfig {
1484
1598
  private _handleEntryId;
1485
1599
  private _updateShowFileNames;
1486
1600
  protected willUpdate(changedProperties: PropertyValues<this>): void;
1601
+ private _updatePluginFileActions;
1602
+ private _handlePluginFileAction;
1487
1603
  initCallback(): void;
1488
1604
  connectedCallback(): void;
1489
1605
  disconnectedCallback(): void;
@@ -1580,67 +1696,116 @@ declare global {
1580
1696
  }
1581
1697
  }
1582
1698
 
1699
+ type SourceButtonConfig = {
1700
+ id: string;
1701
+ label: string;
1702
+ icon?: string;
1703
+ onClick: () => void | Promise<void>;
1704
+ };
1583
1705
  declare class SourceBtn extends LitUploaderBlock {
1584
1706
  couldBeCtxOwner: boolean;
1585
- private _registeredTypes;
1586
- type?: string;
1587
- onlyIcon: boolean;
1707
+ source?: SourceButtonConfig;
1708
+ textOnly: boolean;
1709
+ iconOnly: boolean;
1588
1710
  private _iconName;
1589
1711
  private _srcTypeKey;
1590
- private _initTypes;
1591
- initCallback(): void;
1592
- private _registerType;
1593
- activate(): void;
1594
- private _applyType;
1595
1712
  protected willUpdate(changedProperties: PropertyValues<this>): void;
1713
+ private _applySource;
1714
+ activate(): void;
1596
1715
  render(): lit_html.TemplateResult<1>;
1597
1716
  }
1598
1717
  declare global {
1599
1718
  interface HTMLElementTagNameMap {
1600
- 'uc-source-btn': SourceBtn;
1719
+ 'uc-source-btn': SourceBtn;
1720
+ }
1721
+ }
1722
+
1723
+ declare class PrimaryAction extends LitUploaderBlock {
1724
+ static styleAttrs: string[];
1725
+ private static readonly SOURCE_TEXT_CONFIG;
1726
+ source: SourceButtonConfig | null;
1727
+ entries: OutputCollectionState<OutputCollectionStatus, 'maybe-has-group'>;
1728
+ private showIcon;
1729
+ private _isMultiple;
1730
+ initCallback(): void;
1731
+ private get hasEntries();
1732
+ private get hasSingleSuccessImage();
1733
+ private get hasMultipleEntries();
1734
+ private get localizedSourceLabel();
1735
+ private _translate;
1736
+ private get textBasedOnLocale();
1737
+ private _headerTextDependentOnEntries;
1738
+ private _getSourceLabelText;
1739
+ private _handleClick;
1740
+ private _renderThumbnail;
1741
+ protected render(): lit_html.TemplateResult<1>;
1742
+ }
1743
+ declare global {
1744
+ interface HTMLElementTagNameMap {
1745
+ 'uc-primary-action': PrimaryAction;
1601
1746
  }
1602
1747
  }
1603
1748
 
1604
- declare class Dropdown extends LitBlock {
1749
+ declare class DropDown extends LitBlock {
1750
+ static styleAttrs: string[];
1605
1751
  private _id;
1606
1752
  private readonly _handleContentClick;
1607
- protected render(): unknown;
1753
+ render(): lit_html.TemplateResult<1>;
1608
1754
  }
1609
1755
  declare global {
1610
1756
  interface HTMLElementTagNameMap {
1611
- 'uc-dropdown': Dropdown;
1757
+ 'uc-drop-down': DropDown;
1612
1758
  }
1613
1759
  }
1614
1760
 
1615
- type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
1616
- type AdvancedSmartBtnConfig = {
1617
- sourceList: string;
1618
- mode?: SmartButtonMode;
1619
- };
1761
+ declare class NoWrapModeSmartBtn extends LitUploaderBlock {
1762
+ static styleAttrs: string[];
1763
+ }
1764
+ declare global {
1765
+ interface HTMLElementTagNameMap {
1766
+ 'uc-no-wrap-mode-smart-btn': NoWrapModeSmartBtn;
1767
+ }
1768
+ }
1769
+
1770
+ type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap' | 'collapse';
1620
1771
  declare class SmartBtn extends LitUploaderBlock {
1621
1772
  static styleAttrs: string[];
1622
1773
  couldBeCtxOwner: boolean;
1774
+ private _controller?;
1775
+ private _unregisterAfterFileAddHook?;
1623
1776
  dropzone: boolean;
1624
- private _sourceList;
1777
+ private _mode;
1778
+ private _sources;
1625
1779
  private _status;
1626
- private _multiple;
1627
- private _entry;
1628
- private _lastDigest;
1629
- private _progressPercent;
1630
- private _progressFading;
1631
- private _progressFadeTimer;
1632
- private _showDropdown;
1780
+ private _mainAndRemainSources;
1781
+ private _collection;
1782
+ private _progress;
1633
1783
  private get isIdle();
1634
- private get buttonText();
1784
+ private get isSuccess();
1785
+ private get isFailed();
1786
+ private get isUploading();
1787
+ private get isCollapsedMode();
1788
+ private get shouldShowPrimaryAction();
1789
+ private get shouldShowInline();
1790
+ private get shouldShowDropdown();
1791
+ private get hasCollectionEntries();
1792
+ private get shouldShowAbortAction();
1635
1793
  private _throttledHandleCollectionUpdate;
1636
1794
  private _updateButtonBasedOnCollectionState;
1637
- private _cancelProgressFade;
1638
- private _startProgressFade;
1639
- disconnectedCallback(): void;
1640
- private _removeEntries;
1795
+ private _updateSourceSplit;
1641
1796
  initCallback(): void;
1642
- private readonly _handleClickAbort;
1643
- private readonly _handleClick;
1797
+ disconnectedCallback(): void;
1798
+ private _renderInline;
1799
+ private _getDropdownIconName;
1800
+ private _clearAllEntries;
1801
+ private _clearAllFailedEntries;
1802
+ private _abortAllEntries;
1803
+ private _handleRemove;
1804
+ private _renderDropdown;
1805
+ private _renderPrimaryAction;
1806
+ private _renderAbortAction;
1807
+ private _getInnerClassMap;
1808
+ private _renderVisualDropArea;
1644
1809
  render(): lit_html.TemplateResult<1>;
1645
1810
  }
1646
1811
  declare global {
@@ -1861,6 +2026,10 @@ type ConfigType = {
1861
2026
  * Expiry threshold for secure uploads.
1862
2027
  */
1863
2028
  secureUploadsExpireThreshold: number;
2029
+ /**
2030
+ * Array of plugins to register with the uploader instance.
2031
+ */
2032
+ plugins: UploaderPlugin[];
1864
2033
  /**
1865
2034
  * Metadata for the file.
1866
2035
  */
@@ -1946,7 +2115,8 @@ type ConfigType = {
1946
2115
  * Define the clipboard paste scope.
1947
2116
  */
1948
2117
  pasteScope: PasteScope;
1949
- smartBtn: AdvancedSmartBtnConfig | null;
2118
+ smartButtonViewMode: SmartButtonMode;
2119
+ smartButtonShowFirstIcon: boolean;
1950
2120
  };
1951
2121
  type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
1952
2122
  type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -2122,10 +2292,237 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
2122
2292
  allEntries: OutputFileEntry[];
2123
2293
  });
2124
2294
 
2125
- declare class SecureUploadsManager extends SharedInstance {
2126
- private _secureToken;
2127
- getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
2295
+ type PluginIconRegistration = {
2296
+ name: string;
2297
+ svg: string;
2298
+ };
2299
+ type PluginL10nRegistration = Record<string, Record<string, string>>;
2300
+ type PluginSourceRegistration = {
2301
+ id: string;
2302
+ label: string;
2303
+ icon?: string;
2304
+ /**
2305
+ * @internal
2306
+ *
2307
+ * Optional expansion function. When present, SourceList calls this to determine
2308
+ * which source IDs should actually be rendered in place of this source.
2309
+ * Useful for sources that map to multiple device-specific variants (e.g. camera
2310
+ * expanding to separate photo/video buttons on mobile).
2311
+ * Return `[id]` (the source's own id) to render it as-is.
2312
+ */
2313
+ expand?: () => string[];
2314
+ onSelect: () => Promise<void> | void;
2315
+ };
2316
+ type PluginRenderDispose = () => void;
2317
+ type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
2318
+ type PluginActivityRegistration = {
2319
+ id: string;
2320
+ render: PluginRender;
2321
+ };
2322
+ type PluginFileActionRegistration = {
2323
+ /** Unique action identifier. */
2324
+ id: string;
2325
+ /** Icon name to display in the action button. */
2326
+ icon: string;
2327
+ /** Label shown next to the icon in the action button. Accepts a plain string or an l10n key registered via `registerL10n`. */
2328
+ label: string;
2329
+ /** Return `true` to show the action button for the given file entry. */
2330
+ shouldRender: (fileEntry: OutputFileEntry) => boolean;
2331
+ onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
2332
+ };
2333
+ type PluginFileHookResult = {
2334
+ /** The (optionally transformed) file */
2335
+ file: File | Blob;
2336
+ };
2337
+ type PluginFileHookContext = PluginFileHookResult & {
2338
+ /**
2339
+ * An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
2340
+ * Hooks should respect this signal to avoid doing unnecessary work.
2341
+ */
2342
+ signal: AbortSignal;
2343
+ };
2344
+ type PluginFileHookRegistration = {
2345
+ /**
2346
+ * When the hook is called:
2347
+ * - `'beforeUpload'`: called right before the file is uploaded.
2348
+ * - `'onAdd'`: called after the file is added to the upload list.
2349
+ *
2350
+ * Return the (optionally transformed) file. After the hook runs, `mimeType`,
2351
+ * `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
2352
+ */
2353
+ type: 'beforeUpload' | 'onAdd';
2354
+ handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
2355
+ /**
2356
+ * Maximum time in milliseconds to wait for the hook to complete before skipping it.
2357
+ * @default 30000
2358
+ */
2359
+ timeout?: number;
2360
+ };
2361
+ type PluginRegistryApi = {
2362
+ registerSource: (source: PluginSourceRegistration) => void;
2363
+ registerActivity: (activity: PluginActivityRegistration) => void;
2364
+ registerFileAction: (fileAction: PluginFileActionRegistration) => void;
2365
+ registerFileHook: (hook: PluginFileHookRegistration) => void;
2366
+ registerIcon: (icon: PluginIconRegistration) => void;
2367
+ registerL10n: (l10n: PluginL10nRegistration) => void;
2368
+ registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
2369
+ };
2370
+ /**
2371
+ * API for managing plugin config subscriptions
2372
+ */
2373
+ type PluginConfigApi = {
2374
+ get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
2375
+ subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
2376
+ };
2377
+ /**
2378
+ * API for managing plugin activity interactions
2379
+ */
2380
+ type PluginActivityApi = {
2381
+ /**
2382
+ * Get the current activity parameters.
2383
+ *
2384
+ * @returns The current activity parameters object
2385
+ *
2386
+ * @example
2387
+ * ```typescript
2388
+ * const params = pluginApi.activity.getParams();
2389
+ * console.log('Current params:', params);
2390
+ * ```
2391
+ */
2392
+ getParams: () => Record<string, unknown>;
2393
+ /**
2394
+ * Subscribe to changes in activity parameters.
2395
+ * The callback will be called immediately with the current params,
2396
+ * and then whenever the params change.
2397
+ *
2398
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
2399
+ *
2400
+ * @param callback - Function to call with the new params
2401
+ * @returns Unsubscribe function
2402
+ *
2403
+ * @example
2404
+ * ```typescript
2405
+ * pluginApi.activity.subscribeToParams((params) => {
2406
+ * console.log('Activity params changed:', params);
2407
+ * });
2408
+ * // Cleanup happens automatically on plugin disposal
2409
+ * ```
2410
+ */
2411
+ subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
2412
+ };
2413
+ type PluginFileEntryUpdate = {
2414
+ file?: File | Blob;
2415
+ cdnUrl?: string | null;
2416
+ cdnUrlModifiers?: string | null;
2417
+ mimeType?: string | null;
2418
+ };
2419
+ type PluginFilesApi = {
2420
+ /**
2421
+ * Update mutable properties of a file entry by its internalId.
2422
+ * `fileSize` is recalculated automatically when `file` is provided.
2423
+ */
2424
+ update: (internalId: string, changes: PluginFileEntryUpdate) => void;
2425
+ };
2426
+ type PluginApi = {
2427
+ registry: PluginRegistryApi;
2428
+ config: PluginConfigApi;
2429
+ activity: PluginActivityApi;
2430
+ files: PluginFilesApi;
2431
+ };
2432
+ type PluginUploaderApi = UploaderPublicApi;
2433
+ type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
2434
+ type PluginSetupParams = {
2435
+ pluginApi: PluginApi;
2436
+ uploaderApi: PluginUploaderApi;
2437
+ };
2438
+ type UploaderPlugin = {
2439
+ id: string;
2440
+ setup: (params: PluginSetupParams) => PluginSetupResult;
2441
+ };
2442
+ type Owned<T> = T & {
2443
+ pluginId: string;
2444
+ };
2445
+ type PluginRegistrySnapshot = {
2446
+ sources: Owned<PluginSourceRegistration>[];
2447
+ activities: Owned<PluginActivityRegistration>[];
2448
+ fileActions: Owned<PluginFileActionRegistration>[];
2449
+ fileHooks: Owned<PluginFileHookRegistration>[];
2450
+ icons: Owned<PluginIconRegistration>[];
2451
+ l10n: Owned<PluginL10nRegistration>[];
2452
+ };
2453
+
2454
+ type EventMap = {
2455
+ [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
2456
+ };
2457
+
2458
+ interface UploadEntryData extends Record<string, unknown> {
2459
+ file: File | null;
2460
+ externalUrl: string | null;
2461
+ fileName: string | null;
2462
+ fileSize: number | null;
2463
+ lastModified: number;
2464
+ uploadProgress: number;
2465
+ uuid: string | null;
2466
+ isImage: boolean;
2467
+ mimeType: string | null;
2468
+ ctxName: string | null;
2469
+ cdnUrl: string | null;
2470
+ cdnUrlModifiers: string | null;
2471
+ fileInfo: UploadcareFile | null;
2472
+ isUploading: boolean;
2473
+ abortController: AbortController | null;
2474
+ thumbUrl: string | null;
2475
+ silent: boolean;
2476
+ source: string | null;
2477
+ fullPath: string | null;
2478
+ metadata: Metadata | null;
2479
+ errors: OutputErrorFile[];
2480
+ uploadError: Error | null;
2481
+ isRemoved: boolean;
2482
+ isQueuedForUploading: boolean;
2483
+ isValidationPending: boolean;
2484
+ isQueuedForValidation: boolean;
2485
+ }
2486
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
2487
+ type UploadEntryKeys = keyof UploadEntryData;
2488
+
2489
+ declare class PluginRegistry {
2490
+ private _sources;
2491
+ private _activities;
2492
+ private _fileActions;
2493
+ private _fileHooks;
2494
+ private _icons;
2495
+ private _l10n;
2496
+ readonly config: CustomConfigRegistry;
2497
+ private _own;
2498
+ addSource(pluginId: string, item: PluginSourceRegistration): void;
2499
+ addActivity(pluginId: string, item: PluginActivityRegistration): void;
2500
+ addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
2501
+ addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
2502
+ addIcon(pluginId: string, item: PluginIconRegistration): void;
2503
+ addL10n(pluginId: string, item: PluginL10nRegistration): void;
2504
+ addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
2505
+ purge(pluginId: string): void;
2506
+ snapshot(): PluginRegistrySnapshot;
2507
+ }
2508
+
2509
+ declare class PluginManager extends SharedInstance {
2510
+ private _plugins;
2511
+ private _subscribers;
2512
+ private _pluginsUpdate;
2513
+ private _lazyPluginLoader;
2514
+ readonly registry: PluginRegistry;
2515
+ get configRegistry(): CustomConfigRegistry;
2516
+ constructor(sharedInstancesBag: SharedInstancesBag);
2517
+ pluginsReady(): Promise<void>;
2518
+ onPluginsChange(callback: Unsubscriber): Unsubscriber;
2519
+ private _syncPlugins;
2520
+ private _registerPlugin;
2521
+ private _unregisterPlugin;
2522
+ snapshot(): PluginRegistrySnapshot;
2523
+ runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
2128
2524
  destroy(): void;
2525
+ private _notifySubscribers;
2129
2526
  }
2130
2527
 
2131
2528
  type CommonEventType = InternalEventKey | EventKey;
@@ -2166,14 +2563,90 @@ declare class TelemetryManager extends SharedInstance {
2166
2563
  private get _location();
2167
2564
  }
2168
2565
 
2566
+ interface ISharedInstance {
2567
+ destroy?(): void;
2568
+ }
2569
+ declare class SharedInstance {
2570
+ protected _ctx: PubSub<SharedState>;
2571
+ protected _sharedInstancesBag: SharedInstancesBag;
2572
+ private _subscriptions;
2573
+ private _cfgProxy;
2574
+ protected _debugPrint: (...args: unknown[]) => void;
2575
+ constructor(sharedInstancesBag: SharedInstancesBag);
2576
+ protected addSub(unsub: () => void): void;
2577
+ protected get _cfg(): Readonly<ConfigType>;
2578
+ destroy(): void;
2579
+ }
2580
+ declare const instanceKeyMap: {
2581
+ modalManager: "*modalManager";
2582
+ pluginManager: "*pluginManager";
2583
+ telemetryManager: "*telemetryManager";
2584
+ localeManager: "*localeManager";
2585
+ a11y: "*a11y";
2586
+ clipboard: "*clipboard";
2587
+ routerLayer: "*routerLayer";
2588
+ blocksRegistry: "*blocksRegistry";
2589
+ eventEmitter: "*eventEmitter";
2590
+ uploadCollection: "*uploadCollection";
2591
+ secureUploadsManager: "*secureUploadsManager";
2592
+ api: "*publicApi";
2593
+ validationManager: "*validationManager";
2594
+ };
2595
+ type InstanceTypeMap = {
2596
+ [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
2597
+ };
2598
+ type InstanceName = keyof typeof instanceKeyMap;
2599
+ type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
2600
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2601
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2602
+ readonly ctx: PubSub<SharedState>;
2603
+ readonly modalManager: ModalManager | null;
2604
+ readonly pluginManager: PluginManager;
2605
+ readonly telemetryManager: TelemetryManager;
2606
+ readonly localeManager: LocaleManager;
2607
+ readonly a11y: A11y;
2608
+ readonly routerLayer: RouterHooksLayer;
2609
+ readonly blocksRegistry: Set<LitBlock>;
2610
+ readonly eventEmitter: EventEmitter;
2611
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2612
+ readonly secureUploadsManager: SecureUploadsManager;
2613
+ readonly api: UploaderPublicApi;
2614
+ readonly validationManager: ValidationManager;
2615
+ when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
2616
+ wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
2617
+ };
2618
+
2619
+ type PasteScope = 'local' | 'global' | false;
2620
+ declare class ClipboardLayer extends SharedInstance {
2621
+ private scopes;
2622
+ private listener;
2623
+ constructor(sharedInstancesBag: SharedInstancesBag);
2624
+ private _excludingNodes;
2625
+ private openUploadList;
2626
+ private _listener;
2627
+ private handlePaste;
2628
+ registerBlock(scope: Node): () => void;
2629
+ destroy(): void;
2630
+ }
2631
+
2632
+ type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
2633
+ type LazyPluginEntry = {
2634
+ configDeps: readonly (keyof ConfigType)[];
2635
+ isEnabled: (get: ConfigGetter) => boolean;
2636
+ load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
2637
+ };
2638
+
2169
2639
  type SharedConfigState = {
2170
2640
  [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2171
2641
  };
2642
+ type SharedCustomConfigState = {
2643
+ [K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
2644
+ };
2172
2645
  type BlocksRegistry = Set<LitBlock>;
2173
2646
  type ActivityBlockCtxState = {
2174
- '*currentActivity': string | null;
2647
+ '*currentActivity': RegisteredActivityType | null;
2175
2648
  '*currentActivityParams': Record<string, unknown>;
2176
- '*history': (string | null)[];
2649
+ '*history': (RegisteredActivityType | null)[];
2177
2650
  '*historyBack': (() => void) | null;
2178
2651
  '*closeModal': () => void;
2179
2652
  };
@@ -2190,6 +2663,7 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
2190
2663
  };
2191
2664
  type SolutionBlockCtxState = UploaderBlockCtxState & {
2192
2665
  '*solution': string | null;
2666
+ '*lazyPlugins': LazyPluginEntry[] | null;
2193
2667
  };
2194
2668
  type CloudImageEditorState = {
2195
2669
  '*originalUrl': string | null;
@@ -2240,7 +2714,9 @@ type EditorToolbarState = {
2240
2714
  '*currentOperation': string | null;
2241
2715
  '*operationTooltip': string | null;
2242
2716
  };
2717
+ type SharedContextInstances = Map<string, ISharedInstance>;
2243
2718
  type DynamicBlockState = {
2719
+ '*sharedContextInstances': SharedContextInstances;
2244
2720
  '*blocksRegistry': BlocksRegistry;
2245
2721
  '*eventEmitter': EventEmitter;
2246
2722
  '*localeManager': LocaleManager;
@@ -2248,6 +2724,8 @@ type DynamicBlockState = {
2248
2724
  '*a11y': A11y;
2249
2725
  '*modalManager': ModalManager | null;
2250
2726
  '*clipboard': ClipboardLayer;
2727
+ '*routerLayer': RouterHooksLayer;
2728
+ '*pluginManager': PluginManager;
2251
2729
  };
2252
2730
  type DynamicUploaderBlockState = {
2253
2731
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2258,66 +2736,7 @@ type DynamicUploaderBlockState = {
2258
2736
  type LocaleState = {
2259
2737
  [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2260
2738
  };
2261
- type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2262
-
2263
- interface ISharedInstance {
2264
- destroy?(): void;
2265
- }
2266
- declare class SharedInstance {
2267
- protected _ctx: PubSub<SharedState>;
2268
- protected _sharedInstancesBag: SharedInstancesBag;
2269
- private _subscriptions;
2270
- private _cfgProxy;
2271
- protected _debugPrint: (...args: unknown[]) => void;
2272
- constructor(sharedInstancesBag: SharedInstancesBag);
2273
- protected addSub(unsub: () => void): void;
2274
- protected get _cfg(): Readonly<ConfigType>;
2275
- destroy(): void;
2276
- }
2277
- type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2278
- type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2279
- declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2280
- readonly ctx: PubSub<SharedState>;
2281
- readonly modalManager: ModalManager | null;
2282
- readonly telemetryManager: TelemetryManager;
2283
- readonly localeManager: LocaleManager;
2284
- readonly a11y: A11y;
2285
- readonly blocksRegistry: Set<LitBlock>;
2286
- readonly eventEmitter: EventEmitter;
2287
- readonly uploadCollection: TypedCollection<UploadEntryData>;
2288
- readonly secureUploadsManager: SecureUploadsManager;
2289
- readonly api: UploaderPublicApi;
2290
- readonly validationManager: ValidationManager;
2291
- };
2292
-
2293
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2294
- signal?: AbortSignal;
2295
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2296
- type FileValidatorDescriptor = {
2297
- runOn: 'add' | 'upload' | 'change';
2298
- validator: FuncFileValidator;
2299
- };
2300
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2301
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2302
- declare class ValidationManager extends SharedInstance {
2303
- private get _uploadCollection();
2304
- private _commonFileValidators;
2305
- private _commonCollectionValidators;
2306
- private _queue;
2307
- private _runQueueDebounced;
2308
- private _isDestroyed;
2309
- private _entryValidationState;
2310
- constructor(sharedInstancesBag: SharedInstancesBag);
2311
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2312
- runCollectionValidators(): void;
2313
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2314
- private _runFileValidatorsForEntry;
2315
- private _addCustomTypeToValidationError;
2316
- private _getEntryValidationState;
2317
- private _getValidatorDescriptors;
2318
- private _getValidatorDescriptorsForEntry;
2319
- destroy(): void;
2320
- }
2739
+ type SharedState = SolutionBlockCtxState & SharedConfigState & SharedCustomConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2321
2740
 
2322
2741
  declare const LitBlockBase: typeof LitElement & Constructor<{
2323
2742
  willYield: boolean;
@@ -2329,9 +2748,7 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2329
2748
  };
2330
2749
  declare class LitBlock extends LitBlockBase {
2331
2750
  private _cfgProxy;
2332
- protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2333
2751
  static styleAttrs: string[];
2334
- activityType: ActivityType;
2335
2752
  init$: {};
2336
2753
  constructor();
2337
2754
  l10n: (str: string, variables?: Record<string, string | number>) => string;
@@ -2339,15 +2756,47 @@ declare class LitBlock extends LitBlockBase {
2339
2756
  protected _sharedInstancesBag: {
2340
2757
  readonly ctx: PubSub<SharedState>;
2341
2758
  readonly modalManager: ModalManager | null;
2759
+ readonly pluginManager: PluginManager;
2342
2760
  readonly telemetryManager: TelemetryManager;
2343
2761
  readonly localeManager: LocaleManager;
2344
2762
  readonly a11y: A11y;
2763
+ readonly routerLayer: RouterHooksLayer;
2345
2764
  readonly blocksRegistry: Set<LitBlock>;
2346
2765
  readonly eventEmitter: EventEmitter;
2347
2766
  readonly uploadCollection: TypedCollection<UploadEntryData>;
2348
2767
  readonly secureUploadsManager: SecureUploadsManager;
2349
2768
  readonly api: UploaderPublicApi;
2350
2769
  readonly validationManager: ValidationManager;
2770
+ when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
2771
+ modalManager: ModalManager | null;
2772
+ pluginManager: PluginManager;
2773
+ telemetryManager: TelemetryManager;
2774
+ localeManager: LocaleManager;
2775
+ a11y: A11y;
2776
+ clipboard: ClipboardLayer;
2777
+ routerLayer: RouterHooksLayer;
2778
+ blocksRegistry: BlocksRegistry;
2779
+ eventEmitter: EventEmitter;
2780
+ uploadCollection: TypedCollection<UploadEntryData>;
2781
+ secureUploadsManager: SecureUploadsManager;
2782
+ api: UploaderPublicApi;
2783
+ validationManager: ValidationManager;
2784
+ }[TName]>) => void): () => void;
2785
+ wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "routerLayer" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
2786
+ modalManager: ModalManager | null;
2787
+ pluginManager: PluginManager;
2788
+ telemetryManager: TelemetryManager;
2789
+ localeManager: LocaleManager;
2790
+ a11y: A11y;
2791
+ clipboard: ClipboardLayer;
2792
+ routerLayer: RouterHooksLayer;
2793
+ blocksRegistry: BlocksRegistry;
2794
+ eventEmitter: EventEmitter;
2795
+ uploadCollection: TypedCollection<UploadEntryData>;
2796
+ secureUploadsManager: SecureUploadsManager;
2797
+ api: UploaderPublicApi;
2798
+ validationManager: ValidationManager;
2799
+ }[TName]>>;
2351
2800
  };
2352
2801
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2353
2802
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2359,6 +2808,7 @@ declare class LitBlock extends LitBlockBase {
2359
2808
  get localeManager(): LocaleManager;
2360
2809
  get a11y(): A11y;
2361
2810
  get clipboardLayer(): ClipboardLayer;
2811
+ get routerLayer(): RouterHooksLayer;
2362
2812
  get blocksRegistry(): Set<LitBlock>;
2363
2813
  get eventEmitter(): EventEmitter;
2364
2814
  disconnectedCallback(): void;
@@ -2366,11 +2816,7 @@ declare class LitBlock extends LitBlockBase {
2366
2816
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2367
2817
  */
2368
2818
  private destroyCtxCallback;
2369
- /**
2370
- * Adds a shared context instance if it does not exist yet.
2371
- * @param key The shared state key.
2372
- * @param resolver The resolver function that creates the instance.
2373
- */
2819
+ private _getSharedContextInstances;
2374
2820
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2375
2821
  private _destroySharedContextInstances;
2376
2822
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
@@ -2397,7 +2843,7 @@ declare class Modal extends LitBlock {
2397
2843
  private _handleDialogClose;
2398
2844
  private _handleDialogMouseDown;
2399
2845
  private _handleDialogMouseUp;
2400
- show(): void;
2846
+ show(): Promise<void>;
2401
2847
  hide(): void;
2402
2848
  private _handleModalOpen;
2403
2849
  private _handleModalClose;
@@ -2469,8 +2915,10 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2469
2915
 
2470
2916
  declare class LitSolutionBlock extends LitBlock {
2471
2917
  static styleAttrs: string[];
2918
+ static lazyPlugins: LazyPluginEntry[] | null;
2472
2919
  init$: {
2473
2920
  '*solution': string | null;
2921
+ '*lazyPlugins': LazyPluginEntry[] | null;
2474
2922
  '*commonProgress': number;
2475
2923
  '*uploadList': never[];
2476
2924
  '*uploadQueue': _uploadcare_upload_client.Queue;
@@ -2602,17 +3050,15 @@ declare global {
2602
3050
  }
2603
3051
  }
2604
3052
 
2605
- declare class SourceList extends LitBlock {
2606
- private _rawSourceList;
2607
- private _cameraModes;
3053
+ declare class SourceList extends LitUploaderBlock {
3054
+ private _controller?;
3055
+ private _sources;
2608
3056
  /**
2609
3057
  * CSS-only attribute
2610
3058
  */
2611
3059
  wrap: boolean;
2612
3060
  initCallback(): void;
2613
3061
  protected updated(changedProperties: PropertyValues<this>): void;
2614
- private _updateSources;
2615
- private _sources;
2616
3062
  render(): lit_html.TemplateResult<1>;
2617
3063
  }
2618
3064
  declare global {
@@ -2667,7 +3113,9 @@ declare class UploadCtxProvider extends LitUploaderBlock {
2667
3113
  }
2668
3114
  interface UploadCtxProvider extends LitUploaderBlock {
2669
3115
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
3116
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
2670
3117
  removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
3118
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
2671
3119
  }
2672
3120
  declare global {
2673
3121
  interface HTMLElementTagNameMap {
@@ -2675,47 +3123,80 @@ declare global {
2675
3123
  }
2676
3124
  }
2677
3125
 
2678
- declare class UrlSource extends LitUploaderBlock {
3126
+ declare class SimpleBtn extends LitUploaderBlock {
3127
+ static styleAttrs: string[];
2679
3128
  couldBeCtxOwner: boolean;
2680
- activityType: ActivityType;
2681
- private _formState;
3129
+ dropzone: boolean;
3130
+ private _buttonTextKey;
3131
+ private readonly _handleClick;
2682
3132
  initCallback(): void;
2683
- private _inputRef;
2684
- private _handleInput;
2685
- private _handleUpload;
2686
3133
  render(): lit_html.TemplateResult<1>;
2687
3134
  }
2688
3135
  declare global {
2689
3136
  interface HTMLElementTagNameMap {
2690
- 'uc-url-source': UrlSource;
3137
+ 'uc-simple-btn': SimpleBtn;
2691
3138
  }
2692
3139
  }
2693
3140
 
2694
- declare class SimpleBtn extends LitUploaderBlock {
2695
- static styleAttrs: string[];
2696
- couldBeCtxOwner: boolean;
2697
- dropzone: boolean;
2698
- private _buttonTextKey;
2699
- private readonly _handleClick;
3141
+ declare class PluginActivityHost extends LitActivityBlock {
3142
+ registration: Owned<PluginActivityRegistration>;
3143
+ private _dispose?;
3144
+ private _containerRef;
3145
+ initCallback(): void;
3146
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
3147
+ private _ensureRegistered;
3148
+ private _renderActivity;
3149
+ private _disposeActivity;
3150
+ disconnectedCallback(): void;
3151
+ render(): lit_html.TemplateResult<1>;
3152
+ }
3153
+ declare class PluginActivityRenderer extends LitBlock {
3154
+ mode: 'modal' | 'inline';
3155
+ private _activities;
3156
+ private _unsubscribePlugins?;
2700
3157
  initCallback(): void;
3158
+ private _syncActivities;
3159
+ disconnectedCallback(): void;
2701
3160
  render(): lit_html.TemplateResult<1>;
2702
3161
  }
2703
3162
  declare global {
2704
3163
  interface HTMLElementTagNameMap {
2705
- 'uc-simple-btn': SimpleBtn;
3164
+ 'uc-plugin-activity-host': PluginActivityHost;
3165
+ 'uc-plugin-activity-renderer': PluginActivityRenderer;
3166
+ }
3167
+ }
3168
+
3169
+ declare class UrlSource extends LitUploaderBlock {
3170
+ private _url;
3171
+ private _handleInput;
3172
+ private _handleUpload;
3173
+ render(): lit_html.TemplateResult<1>;
3174
+ }
3175
+ declare global {
3176
+ interface HTMLElementTagNameMap {
3177
+ 'uc-url-source': UrlSource;
2706
3178
  }
2707
3179
  }
2708
3180
 
2709
3181
  declare class FileUploaderRegular extends LitSolutionBlock {
3182
+ static lazyPlugins: LazyPluginEntry[];
2710
3183
  attributesMeta: {
2711
3184
  headless?: boolean;
3185
+ 'smart-button'?: boolean;
2712
3186
  'ctx-name': string;
2713
3187
  };
2714
3188
  static styleAttrs: string[];
2715
3189
  headless: boolean;
2716
- smart: boolean;
3190
+ smartButton: boolean;
2717
3191
  constructor();
2718
3192
  initCallback(): void;
3193
+ /**
3194
+ * Exposes whether SmartBtn is active for non-Lit classes that can't use context
3195
+ */
3196
+ get isSmartBtnActive(): boolean;
3197
+ private _renderSmartButton;
3198
+ private _renderStaticButton;
3199
+ private _renderButton;
2719
3200
  render(): lit_html.TemplateResult<1>;
2720
3201
  }
2721
3202
  declare global {
@@ -2725,6 +3206,7 @@ declare global {
2725
3206
  }
2726
3207
 
2727
3208
  declare class FileUploaderInline extends LitSolutionBlock {
3209
+ static lazyPlugins: LazyPluginEntry[];
2728
3210
  attributesMeta: {
2729
3211
  'ctx-name': string;
2730
3212
  };
@@ -2745,6 +3227,7 @@ declare global {
2745
3227
  }
2746
3228
 
2747
3229
  declare class FileUploaderMinimal extends LitSolutionBlock {
3230
+ static lazyPlugins: LazyPluginEntry[];
2748
3231
  attributesMeta: {
2749
3232
  'ctx-name': string;
2750
3233
  };
@@ -2768,4 +3251,4 @@ declare global {
2768
3251
  }
2769
3252
  }
2770
3253
 
2771
- 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, 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, toKebabCase };
3254
+ 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, 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, toKebabCase };