@uploadcare/file-uploader 1.26.3 → 1.27.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/CloudImageEditorActivity-7EK7P3UP.js +1 -0
  2. package/dist/CloudImageEditorActivity-HGSS7NV2.css +8 -0
  3. package/dist/CloudImageEditorActivity-HGSS7NV2.layered.css +7 -0
  4. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  5. package/dist/chunk-5OA6ZVWQ.js +7 -0
  6. package/dist/chunk-BDD5ZPFI.js +7 -0
  7. package/dist/chunk-GCTQN3DZ.js +7 -0
  8. package/dist/chunk-LNXFGGSC.js +7 -0
  9. package/dist/chunk-NJ77GRVX.js +8 -0
  10. package/dist/chunk-TVCYFFRR.js +7 -0
  11. package/dist/cloud-image-editor-PX6YZMOH.css +6 -0
  12. package/dist/cloud-image-editor-PX6YZMOH.layered.css +7 -0
  13. package/dist/cloud-image-editor-Q5333S7T.js +1 -0
  14. package/dist/cloudImageEditorPlugin-BE5HU2W4.js +8 -0
  15. package/dist/cloudImageEditorPlugin-WZCVZALK.css +6 -0
  16. package/dist/cloudImageEditorPlugin-WZCVZALK.layered.css +7 -0
  17. package/dist/core.css +6 -0
  18. package/dist/core.d.ts +3168 -0
  19. package/dist/core.js +8 -0
  20. package/dist/core.layered.css +7 -0
  21. package/dist/env.js +3 -3
  22. package/dist/index.css +3 -3
  23. package/dist/index.d.ts +433 -106
  24. package/dist/index.js +5 -5
  25. package/dist/index.layered.css +3 -3
  26. package/dist/index.ssr.js +96 -6
  27. package/dist/locales/file-uploader/ar.js +2 -2
  28. package/dist/locales/file-uploader/az.js +2 -2
  29. package/dist/locales/file-uploader/ca.js +2 -2
  30. package/dist/locales/file-uploader/cs.js +2 -2
  31. package/dist/locales/file-uploader/da.js +2 -2
  32. package/dist/locales/file-uploader/de.js +2 -2
  33. package/dist/locales/file-uploader/el.js +2 -2
  34. package/dist/locales/file-uploader/en.js +2 -2
  35. package/dist/locales/file-uploader/es.js +2 -2
  36. package/dist/locales/file-uploader/et.js +2 -2
  37. package/dist/locales/file-uploader/fi.js +2 -2
  38. package/dist/locales/file-uploader/fr.js +2 -2
  39. package/dist/locales/file-uploader/he.js +2 -2
  40. package/dist/locales/file-uploader/hy.js +2 -2
  41. package/dist/locales/file-uploader/is.js +2 -2
  42. package/dist/locales/file-uploader/it.js +2 -2
  43. package/dist/locales/file-uploader/ja.js +2 -2
  44. package/dist/locales/file-uploader/ka.js +2 -2
  45. package/dist/locales/file-uploader/kk.js +2 -2
  46. package/dist/locales/file-uploader/ko.js +2 -2
  47. package/dist/locales/file-uploader/lv.js +2 -2
  48. package/dist/locales/file-uploader/nb.js +2 -2
  49. package/dist/locales/file-uploader/nl.js +2 -2
  50. package/dist/locales/file-uploader/pl.js +2 -2
  51. package/dist/locales/file-uploader/pt.js +2 -2
  52. package/dist/locales/file-uploader/ro.js +2 -2
  53. package/dist/locales/file-uploader/ru.js +2 -2
  54. package/dist/locales/file-uploader/sk.js +2 -2
  55. package/dist/locales/file-uploader/sr.js +2 -2
  56. package/dist/locales/file-uploader/sv.js +2 -2
  57. package/dist/locales/file-uploader/tr.js +2 -2
  58. package/dist/locales/file-uploader/uk.js +2 -2
  59. package/dist/locales/file-uploader/vi.js +2 -2
  60. package/dist/locales/file-uploader/zh-TW.js +2 -2
  61. package/dist/locales/file-uploader/zh.js +2 -2
  62. package/package.json +11 -1
  63. package/web/file-uploader.iife.min.d.ts +433 -106
  64. package/web/file-uploader.iife.min.js +4 -4
  65. package/web/file-uploader.min.d.ts +433 -106
  66. package/web/file-uploader.min.js +4 -4
  67. package/web/uc-basic.layered.min.css +3 -3
  68. package/web/uc-basic.min.css +3 -3
  69. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  70. package/web/uc-cloud-image-editor.min.css +3 -3
  71. package/web/uc-cloud-image-editor.min.d.ts +518 -191
  72. package/web/uc-cloud-image-editor.min.js +4 -4
  73. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  74. package/web/uc-file-uploader-inline.min.css +3 -3
  75. package/web/uc-file-uploader-inline.min.d.ts +433 -106
  76. package/web/uc-file-uploader-inline.min.js +4 -4
  77. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  78. package/web/uc-file-uploader-minimal.min.css +3 -3
  79. package/web/uc-file-uploader-minimal.min.d.ts +433 -106
  80. package/web/uc-file-uploader-minimal.min.js +4 -4
  81. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  82. package/web/uc-file-uploader-regular.min.css +3 -3
  83. package/web/uc-file-uploader-regular.min.d.ts +433 -106
  84. package/web/uc-file-uploader-regular.min.js +4 -4
  85. package/web/uc-img.min.js +4 -4
package/dist/core.d.ts ADDED
@@ -0,0 +1,3168 @@
1
+ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
2
+ import * as lit_html from 'lit-html';
3
+ import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
4
+ import * as _uploadcare_upload_client from '@uploadcare/upload-client';
5
+ import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
6
+ export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
7
+ import { Ref } from 'lit/directives/ref.js';
8
+ import { TelemetryRequest } from '@uploadcare/quality-insights';
9
+
10
+ type Unsubscriber = () => void;
11
+ declare class PubSub<T extends Record<string, unknown>> {
12
+ private static _contexts;
13
+ private _store;
14
+ private _ctxId;
15
+ private constructor();
16
+ get id(): string;
17
+ pub<K extends keyof T>(key: K, value: T[K]): void;
18
+ sub<K extends keyof T>(key: K, callback: (value: T[K]) => void, init?: boolean): Unsubscriber;
19
+ read<K extends keyof T>(key: K): T[K];
20
+ add<K extends keyof T>(key: K, value: T[K], rewrite?: boolean): void;
21
+ has(key: keyof T): boolean;
22
+ get store(): T;
23
+ static registerCtx<T extends Record<string, unknown>>(initialValue: T, ctxId: string): PubSub<T>;
24
+ static deleteCtx(ctxId: string): void;
25
+ static getCtx<T extends Record<string, unknown> = Record<string, unknown>>(ctxId: string): PubSub<T> | null;
26
+ static hasCtx(ctxId: string): boolean;
27
+ }
28
+
29
+ type Constructor<T = unknown> = new (...args: any[]) => T;
30
+
31
+ type SymbioteStateBag<T extends Record<string, unknown>> = T;
32
+ /**
33
+ * Interface for components using SymbioteMixin
34
+ */
35
+ declare class SymbioteComponent<TState extends Record<string, unknown> = Record<string, unknown>> {
36
+ $: SymbioteStateBag<TState>;
37
+ sub<TKey extends keyof TState>(key: TKey, callback: (value: TState[TKey]) => void, init?: boolean): () => void;
38
+ pub<TKey extends keyof TState>(key: TKey, value: TState[TKey]): void;
39
+ set$<T extends {
40
+ [K in keyof T]: K extends keyof TState ? TState[K] : never;
41
+ }>(obj: T): void;
42
+ has<TKey extends keyof TState>(key: TKey): boolean;
43
+ add<TKey extends keyof TState>(key: TKey, val: TState[TKey], rewrite?: boolean): void;
44
+ add$<T extends {
45
+ [K in keyof T]: K extends keyof TState ? TState[K] : never;
46
+ }>(obj: T, rewrite?: boolean): void;
47
+ initCallback(): void;
48
+ sharedCtx: PubSub<TState>;
49
+ ctxName: string;
50
+ ctxOwner: boolean;
51
+ }
52
+
53
+ declare const BaseComponent_base: typeof LitElement & Constructor<{
54
+ willYield: boolean;
55
+ yield(slot: string, defaultContent?: unknown): unknown;
56
+ }> & Constructor<{
57
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
58
+ }> & Constructor<SymbioteComponent<Record<string, unknown>>> & Constructor<LitElement> & {
59
+ reg(tagName: string): void;
60
+ };
61
+ declare class BaseComponent extends BaseComponent_base {
62
+ }
63
+
64
+ type Uid = string & {
65
+ __uid: true;
66
+ };
67
+
68
+ declare class UID {
69
+ static generateFastUid(): Uid;
70
+ static generateRandomUUID(): string;
71
+ }
72
+
73
+ declare function defineComponents(blockExports: Record<string, any>): void;
74
+
75
+ declare const UC_WINDOW_KEY = "UC";
76
+ type IndexModule = Record<string, any>;
77
+ declare global {
78
+ interface Window {
79
+ [UC_WINDOW_KEY]?: IndexModule;
80
+ }
81
+ }
82
+ /**
83
+ * @param url File Uploader pack url
84
+ * @param [register] Register connected package, if it not registered yet
85
+ */
86
+ declare function loadFileUploaderFrom(url: string, register?: boolean): Promise<IndexModule | null>;
87
+
88
+ declare const _default: {
89
+ 'locale-id': string;
90
+ 'social-source-lang': string;
91
+ 'upload-file': string;
92
+ 'upload-files': string;
93
+ 'choose-file': string;
94
+ 'choose-files': string;
95
+ 'drop-files-here': string;
96
+ 'select-file-source': string;
97
+ selected: string;
98
+ upload: string;
99
+ 'add-more': string;
100
+ cancel: string;
101
+ 'start-from-cancel': string;
102
+ clear: string;
103
+ 'camera-shot': string;
104
+ 'upload-url': string;
105
+ 'upload-url-placeholder': string;
106
+ 'edit-image': string;
107
+ 'edit-detail': string;
108
+ back: string;
109
+ done: string;
110
+ ok: string;
111
+ 'remove-from-list': string;
112
+ no: string;
113
+ yes: string;
114
+ 'confirm-your-action': string;
115
+ 'are-you-sure': string;
116
+ 'selected-count': string;
117
+ 'select-all': string;
118
+ 'deselect-all': string;
119
+ 'upload-error': string;
120
+ 'validation-error': string;
121
+ 'no-files': string;
122
+ browse: string;
123
+ 'not-uploaded-yet': string;
124
+ file__one: string;
125
+ file__other: string;
126
+ error__one: string;
127
+ error__other: string;
128
+ 'header-uploading': string;
129
+ 'header-failed': string;
130
+ 'header-succeed': string;
131
+ 'header-total': string;
132
+ 'src-type-local': string;
133
+ 'src-type-from-url': string;
134
+ 'src-type-camera': string;
135
+ 'src-type-mobile-video-camera': string;
136
+ 'src-type-mobile-photo-camera': string;
137
+ 'src-type-draw': string;
138
+ 'src-type-facebook': string;
139
+ 'src-type-dropbox': string;
140
+ 'src-type-gdrive': string;
141
+ 'src-type-ngdrive': string;
142
+ 'src-type-gphotos': string;
143
+ 'src-type-flickr': string;
144
+ 'src-type-vk': string;
145
+ 'src-type-evernote': string;
146
+ 'src-type-box': string;
147
+ 'src-type-onedrive': string;
148
+ 'src-type-huddle': string;
149
+ 'src-type-other': string;
150
+ 'caption-from-url': string;
151
+ 'caption-camera': string;
152
+ 'caption-draw': string;
153
+ 'caption-edit-file': string;
154
+ 'file-no-name': string;
155
+ 'toggle-fullscreen': string;
156
+ 'toggle-guides': string;
157
+ rotate: string;
158
+ 'flip-vertical': string;
159
+ 'flip-horizontal': string;
160
+ apply: string;
161
+ brightness: string;
162
+ contrast: string;
163
+ saturation: string;
164
+ exposure: string;
165
+ gamma: string;
166
+ vibrance: string;
167
+ warmth: string;
168
+ enhance: string;
169
+ original: string;
170
+ resize: string;
171
+ crop: string;
172
+ 'select-color': string;
173
+ text: string;
174
+ draw: string;
175
+ 'cancel-edit': string;
176
+ 'tab-view': string;
177
+ 'tab-details': string;
178
+ 'file-name': string;
179
+ 'file-size': string;
180
+ 'cdn-url': string;
181
+ 'file-size-unknown': string;
182
+ 'camera-permissions-denied': string;
183
+ 'camera-permissions-prompt': string;
184
+ 'camera-permissions-request': string;
185
+ 'files-count-limit-error-title': string;
186
+ 'files-count-limit-error-too-few': string;
187
+ 'files-count-limit-error-too-many': string;
188
+ 'files-max-size-limit-error': string;
189
+ 'has-validation-errors': string;
190
+ 'images-only-accepted': string;
191
+ 'file-type-not-allowed': string;
192
+ 'some-files-were-not-uploaded': string;
193
+ 'file-item-edit-button': string;
194
+ 'file-item-remove-button': string;
195
+ 'a11y-editor-tab-filters': string;
196
+ 'a11y-editor-tab-tuning': string;
197
+ 'a11y-editor-tab-crop': string;
198
+ 'a11y-activity-header-button-close': string;
199
+ flip: string;
200
+ mirror: string;
201
+ 'a11y-cloud-editor-apply-filter': string;
202
+ 'a11y-cloud-editor-apply-crop': string;
203
+ 'a11y-cloud-editor-apply-tuning': string;
204
+ 'a11y-cloud-editor-apply-aspect-ratio': string;
205
+ finished: string;
206
+ failed: string;
207
+ uploading: string;
208
+ idle: string;
209
+ 'a11y-file-item-status': string;
210
+ 'waiting-for': string;
211
+ 'queued-uploading': string;
212
+ 'queued-validation': string;
213
+ validation: string;
214
+ 'crop-to-shape': string;
215
+ custom: string;
216
+ 'freeform-crop': string;
217
+ };
218
+
219
+ type LocaleDefinition = typeof _default;
220
+ type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
221
+ declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
222
+
223
+ declare class A11y implements ISharedInstance {
224
+ private _destroyKeyUX;
225
+ private readonly _scopedWindow;
226
+ constructor();
227
+ registerBlock(scope: LitBlock): void;
228
+ destroy(): void;
229
+ }
230
+
231
+ declare class LocaleManager extends SharedInstance {
232
+ private _localeName;
233
+ constructor(sharedInstancesBag: SharedInstancesBag);
234
+ private _applyOverrides;
235
+ private _applyPluginLocales;
236
+ }
237
+
238
+ /**
239
+ * Custom configuration options registration system for plugins
240
+ */
241
+ type CustomConfigDefinition<T = unknown> = {
242
+ /**
243
+ * Config option name (will be used as property and optionally as attribute)
244
+ */
245
+ name: string;
246
+ /**
247
+ * Default value for the config option
248
+ */
249
+ defaultValue: T;
250
+ /**
251
+ * Whether this config can be set via HTML attribute
252
+ * @default true
253
+ */
254
+ attribute?: boolean;
255
+ /**
256
+ * Convert attribute string to config value
257
+ * Only used if attribute is true
258
+ */
259
+ fromAttribute?: (value: string | null) => T;
260
+ /**
261
+ * Convert config value to attribute string
262
+ * Only used if attribute is true
263
+ */
264
+ toAttribute?: (value: T) => string | null;
265
+ /**
266
+ * Normalize/validate the config value
267
+ */
268
+ normalize?: (value: unknown) => T;
269
+ };
270
+ /**
271
+ * Registry for custom config options defined by plugins
272
+ * This is managed by the PluginManager as a shared instance property
273
+ */
274
+ declare class CustomConfigRegistry {
275
+ private _definitions;
276
+ register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
277
+ unregister(name: string): void;
278
+ unregisterByPlugin(pluginId: string): void;
279
+ get(name: string): CustomConfigDefinition<any> | undefined;
280
+ getAll(): Map<string, CustomConfigDefinition<any>>;
281
+ }
282
+ /**
283
+ * Interface for TypeScript module augmentation
284
+ * Plugins should extend this interface to add their custom config types
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * declare module '@uploadcare/file-uploader' {
289
+ * interface CustomConfig {
290
+ * 'my-custom-option': string;
291
+ * }
292
+ * }
293
+ * ```
294
+ */
295
+ interface CustomConfig {
296
+ }
297
+
298
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
299
+
300
+ declare class TypedData<T extends Record<string, unknown>> {
301
+ private _ctxId;
302
+ private _data;
303
+ constructor(initialValue: T);
304
+ get uid(): Uid;
305
+ setValue<K extends keyof T>(prop: K, value: T[K]): void;
306
+ setMultipleValues(updObj: Partial<T>): void;
307
+ getValue<K extends keyof T>(prop: K): T[K];
308
+ subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
309
+ destroy(): void;
310
+ }
311
+
312
+ interface UploadEntryData extends Record<string, unknown> {
313
+ file: File | null;
314
+ externalUrl: string | null;
315
+ fileName: string | null;
316
+ fileSize: number | null;
317
+ lastModified: number;
318
+ uploadProgress: number;
319
+ uuid: string | null;
320
+ isImage: boolean;
321
+ mimeType: string | null;
322
+ ctxName: string | null;
323
+ cdnUrl: string | null;
324
+ cdnUrlModifiers: string | null;
325
+ fileInfo: UploadcareFile | null;
326
+ isUploading: boolean;
327
+ abortController: AbortController | null;
328
+ thumbUrl: string | null;
329
+ silent: boolean;
330
+ source: string | null;
331
+ fullPath: string | null;
332
+ metadata: Metadata | null;
333
+ errors: OutputErrorFile[];
334
+ uploadError: Error | null;
335
+ isRemoved: boolean;
336
+ isQueuedForUploading: boolean;
337
+ isValidationPending: boolean;
338
+ isQueuedForValidation: boolean;
339
+ }
340
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
341
+ type UploadEntryKeys = keyof UploadEntryData;
342
+
343
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
344
+ signal?: AbortSignal;
345
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
346
+ type FileValidatorDescriptor = {
347
+ runOn: 'add' | 'upload' | 'change';
348
+ validator: FuncFileValidator;
349
+ };
350
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
351
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
352
+ declare class ValidationManager extends SharedInstance {
353
+ private get _uploadCollection();
354
+ private _commonFileValidators;
355
+ private _commonCollectionValidators;
356
+ private _queue;
357
+ private _runQueueDebounced;
358
+ private _isDestroyed;
359
+ private _entryValidationState;
360
+ constructor(sharedInstancesBag: SharedInstancesBag);
361
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
362
+ runCollectionValidators(): void;
363
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
364
+ private _runFileValidatorsForEntry;
365
+ private _addCustomTypeToValidationError;
366
+ private _getEntryValidationState;
367
+ private _getValidatorDescriptors;
368
+ private _getValidatorDescriptorsForEntry;
369
+ destroy(): void;
370
+ }
371
+
372
+ type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
373
+ type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
374
+ type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
375
+ type TypedCollectionOptions<T extends Record<string, unknown>> = {
376
+ initialValue: T;
377
+ watchList?: (keyof T)[];
378
+ handler?: TypedCollectionObserverHandler<T>;
379
+ };
380
+ declare class TypedCollection<T extends Record<string, unknown>> {
381
+ private static readonly _destroyDelayMs;
382
+ private _ctxId;
383
+ private _data;
384
+ private _watchList;
385
+ private _subsMap;
386
+ private _propertyObservers;
387
+ private _collectionObservers;
388
+ private _items;
389
+ private _removed;
390
+ private _added;
391
+ private _markedToDestroy;
392
+ private _observeTimeout?;
393
+ private _notifyTimeout?;
394
+ private _destroyTimeout?;
395
+ private _notifyObservers;
396
+ private _initialValue;
397
+ constructor(options: TypedCollectionOptions<T>);
398
+ private _notify;
399
+ private _scheduleDestroyMarkedItems;
400
+ observeCollection(handler: TypedCollectionObserverHandler<T>): () => void;
401
+ unobserveCollection(handler: TypedCollectionObserverHandler<T>): void;
402
+ add(init: Partial<T>): Uid;
403
+ hasItem(id: Uid): boolean;
404
+ read(id: Uid): TypedData<T> | null;
405
+ readProp<K extends keyof T>(id: Uid, propName: K): T[K];
406
+ publishProp<K extends keyof T>(id: Uid, propName: K, value: T[K]): void;
407
+ remove(id: Uid): void;
408
+ clearAll(): void;
409
+ observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
410
+ unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
411
+ findItems(checkFn: (item: TypedData<T>) => boolean): Uid[];
412
+ items(): Uid[];
413
+ get size(): number;
414
+ destroy(): void;
415
+ }
416
+
417
+ declare const CameraSourceTypes: Readonly<{
418
+ PHOTO: "photo";
419
+ VIDEO: "video";
420
+ }>;
421
+ type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
422
+
423
+ type ApiAddFileCommonOptions = {
424
+ silent?: boolean;
425
+ fileName?: string;
426
+ source?: string;
427
+ };
428
+ declare class UploaderPublicApi extends SharedInstance {
429
+ private _l10n;
430
+ get _uploadCollection(): TypedCollection<UploadEntryData>;
431
+ get cfg(): Readonly<ConfigType>;
432
+ get l10n(): (str: string, variables?: Record<string, string | number>) => string;
433
+ /**
434
+ * TODO: Probably we should not allow user to override `source` property
435
+ */
436
+ addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
437
+ addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
438
+ addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
439
+ addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
440
+ fullPath?: string;
441
+ }) => OutputFileEntry<"idle">;
442
+ removeFileByInternalId: (internalId: string) => void;
443
+ removeAllFiles(): void;
444
+ uploadAll: () => void;
445
+ openSystemDialog: (options?: {
446
+ captureCamera?: boolean;
447
+ modeCamera?: ModeCameraType;
448
+ }) => void;
449
+ getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
450
+ getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
451
+ initFlow: (force?: boolean) => void;
452
+ doneFlow: () => void;
453
+ setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
454
+ getCurrentActivity: () => ActivityType;
455
+ setModalState: (opened: boolean) => void;
456
+ private get _sourceList();
457
+ }
458
+
459
+ declare const ExternalUploadSource: Readonly<{
460
+ readonly FACEBOOK: "facebook";
461
+ readonly DROPBOX: "dropbox";
462
+ readonly GDRIVE: "gdrive";
463
+ readonly GPHOTOS: "gphotos";
464
+ readonly FLICKR: "flickr";
465
+ readonly VK: "vk";
466
+ readonly EVERNOTE: "evernote";
467
+ readonly BOX: "box";
468
+ readonly ONEDRIVE: "onedrive";
469
+ readonly HUDDLE: "huddle";
470
+ }>;
471
+ declare const UploadSource: Readonly<{
472
+ readonly FACEBOOK: "facebook";
473
+ readonly DROPBOX: "dropbox";
474
+ readonly GDRIVE: "gdrive";
475
+ readonly GPHOTOS: "gphotos";
476
+ readonly FLICKR: "flickr";
477
+ readonly VK: "vk";
478
+ readonly EVERNOTE: "evernote";
479
+ readonly BOX: "box";
480
+ readonly ONEDRIVE: "onedrive";
481
+ readonly HUDDLE: "huddle";
482
+ readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
483
+ readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
484
+ readonly LOCAL: "local";
485
+ readonly DROP_AREA: "drop-area";
486
+ readonly CAMERA: "camera";
487
+ readonly EXTERNAL: "external";
488
+ readonly API: "js-api";
489
+ readonly URL: "url";
490
+ readonly DRAW: "draw";
491
+ }>;
492
+ type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
493
+
494
+ declare class LitUploaderBlock extends LitActivityBlock {
495
+ static extSrcList: Readonly<typeof ExternalUploadSource>;
496
+ static sourceTypes: Readonly<typeof UploadSource>;
497
+ protected couldBeCtxOwner: boolean;
498
+ private _isCtxOwner;
499
+ private _unobserveCollection?;
500
+ private _unobserveCollectionProperties?;
501
+ init$: {
502
+ '*commonProgress': number;
503
+ '*uploadList': never[];
504
+ '*uploadQueue': _uploadcare_upload_client.Queue;
505
+ '*collectionErrors': OutputErrorCollection[];
506
+ '*collectionState': OutputCollectionState | null;
507
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
508
+ '*uploadTrigger': Set<string>;
509
+ '*currentActivity': null;
510
+ '*currentActivityParams': {};
511
+ '*history': never[];
512
+ '*historyBack': null;
513
+ '*closeModal': () => void;
514
+ };
515
+ private get _hasCtxOwner();
516
+ initCallback(): void;
517
+ getAPI(): UploaderPublicApi;
518
+ get validationManager(): ValidationManager;
519
+ get api(): UploaderPublicApi;
520
+ get uploadCollection(): TypedCollection<UploadEntryData>;
521
+ get secureUploadsManager(): SecureUploadsManager;
522
+ disconnectedCallback(): void;
523
+ connectedCallback(): void;
524
+ private _initCtxOwner;
525
+ private _observeUploadCollection;
526
+ private _unobserveUploadCollection;
527
+ private _createGroup;
528
+ private _flushOutputItems;
529
+ private _handleCollectionUpdate;
530
+ private _handleCollectionPropertiesUpdate;
531
+ private _flushCommonUploadProgress;
532
+ private _openCloudImageEditor;
533
+ private _setInitialCrop;
534
+ protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
535
+ protected getUploadClientOptions(): Promise<FileFromOptions>;
536
+ getOutputData(): OutputFileEntry[];
537
+ }
538
+
539
+ /**
540
+ * Mapping of loading resources per operation
541
+ */
542
+ type LoadingOperations = Map<string, Map<string, boolean>>;
543
+ /**
544
+ * Image size
545
+ */
546
+ interface ImageSize {
547
+ width: number;
548
+ height: number;
549
+ }
550
+ interface Transformations {
551
+ enhance?: number;
552
+ brightness?: number;
553
+ exposure?: number;
554
+ gamma?: number;
555
+ contrast?: number;
556
+ saturation?: number;
557
+ vibrance?: number;
558
+ warmth?: number;
559
+ rotate?: number;
560
+ mirror?: boolean;
561
+ flip?: boolean;
562
+ filter?: {
563
+ name: string;
564
+ amount: number;
565
+ };
566
+ crop?: {
567
+ dimensions: [number, number];
568
+ coords: [number, number];
569
+ };
570
+ }
571
+ interface ApplyResult {
572
+ originalUrl: string;
573
+ cdnUrlModifiers: string;
574
+ cdnUrl: string;
575
+ transformations: Transformations;
576
+ }
577
+ type ChangeResult = ApplyResult;
578
+ interface CropAspectRatio {
579
+ type: 'aspect-ratio';
580
+ width: number;
581
+ height: number;
582
+ id: string;
583
+ hasFreeform?: boolean;
584
+ }
585
+ type CropPresetList = CropAspectRatio[];
586
+
587
+ declare function initState(fnCtx: CloudImageEditorBlock): {
588
+ '*originalUrl': null;
589
+ '*loadingOperations': LoadingOperations;
590
+ '*faderEl': null;
591
+ '*cropperEl': null;
592
+ '*imgEl': null;
593
+ '*imgContainerEl': null;
594
+ '*networkProblems': boolean;
595
+ '*imageSize': null;
596
+ '*editorTransformations': {};
597
+ '*cropPresetList': never[];
598
+ '*currentAspectRatio': null;
599
+ '*tabList': readonly ["crop", "tuning", "filters"];
600
+ '*tabId': "crop";
601
+ '*on.retryNetwork': () => void;
602
+ '*on.apply': (transformations: Transformations) => void;
603
+ '*on.cancel': () => void;
604
+ };
605
+
606
+ type PresenceToggleStyle = {
607
+ transition?: string;
608
+ visible?: string;
609
+ hidden?: string;
610
+ };
611
+ declare class PresenceToggle extends LitBlock {
612
+ private _visible;
613
+ private _styles;
614
+ private _visibleStyle;
615
+ private _hiddenStyle;
616
+ private _externalTransitions;
617
+ private _initialRenderComplete;
618
+ set visible(value: boolean);
619
+ get visible(): boolean;
620
+ set styles(styles: PresenceToggleStyle);
621
+ get styles(): PresenceToggleStyle;
622
+ private _handleVisible;
623
+ private _dispatchInitialRenderEvent;
624
+ initCallback(): void;
625
+ }
626
+ declare global {
627
+ interface HTMLElementTagNameMap {
628
+ 'uc-presence-toggle': PresenceToggle;
629
+ }
630
+ }
631
+
632
+ declare class LineLoaderUi extends LitBlock {
633
+ active: boolean;
634
+ private readonly _lineRef;
635
+ private _isAnimating;
636
+ private readonly _handleTransitionEndRight;
637
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
638
+ protected updated(changedProperties: PropertyValues<this>): void;
639
+ private _start;
640
+ private _stop;
641
+ private _resetLine;
642
+ render(): lit_html.TemplateResult<1>;
643
+ }
644
+ declare global {
645
+ interface HTMLElementTagNameMap {
646
+ 'uc-line-loader-ui': LineLoaderUi;
647
+ }
648
+ }
649
+
650
+ declare class Icon extends LitBlock {
651
+ name: string;
652
+ private _resolvedHref;
653
+ private _pluginSvg;
654
+ private _iconHrefResolver;
655
+ private _unsubscribePlugins?;
656
+ initCallback(): void;
657
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
658
+ private _updateResolvedHref;
659
+ render(): lit_html.TemplateResult<1>;
660
+ disconnectedCallback(): void;
661
+ }
662
+ declare global {
663
+ interface HTMLElementTagNameMap {
664
+ 'uc-icon': Icon;
665
+ }
666
+ }
667
+
668
+ type AriaRole = 'alert' | 'alertdialog' | 'button' | 'checkbox' | 'dialog' | 'gridcell' | 'link' | 'log' | 'marquee' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option' | 'progressbar' | 'radio' | 'scrollbar' | 'searchbox' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'tabpanel' | 'textbox' | 'timer' | 'tooltip' | 'treeitem' | 'combobox' | 'grid' | 'listbox' | 'menu' | 'menubar' | 'radiogroup' | 'tablist' | 'tree' | 'treegrid' | 'application' | 'article' | 'cell' | 'columnheader' | 'definition' | 'directory' | 'document' | 'feed' | 'figure' | 'group' | 'heading' | 'img' | 'list' | 'listitem' | 'math' | 'none' | 'note' | 'presentation' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'separator' | 'table' | 'term' | 'text' | 'toolbar' | 'banner' | 'complementary' | 'contentinfo' | 'form' | 'main' | 'navigation' | 'region' | 'search' | 'doc-abstract' | 'doc-acknowledgments' | 'doc-afterword' | 'doc-appendix' | 'doc-backlink' | 'doc-biblioentry' | 'doc-bibliography' | 'doc-biblioref' | 'doc-chapter' | 'doc-colophon' | 'doc-conclusion' | 'doc-cover' | 'doc-credit' | 'doc-credits' | 'doc-dedication' | 'doc-endnote' | 'doc-endnotes' | 'doc-epigraph' | 'doc-epilogue' | 'doc-errata' | 'doc-example' | 'doc-footnote' | 'doc-foreword' | 'doc-glossary' | 'doc-glossref' | 'doc-index' | 'doc-introduction' | 'doc-noteref' | 'doc-notice' | 'doc-pagebreak' | 'doc-pagelist' | 'doc-part' | 'doc-preface' | 'doc-prologue' | 'doc-pullquote' | 'doc-qna' | 'doc-subtitle' | 'doc-tip' | 'doc-toc';
669
+
670
+ type Theme = string | null;
671
+ declare class BtnUi extends LitBlock {
672
+ text: string;
673
+ icon: string;
674
+ reverse: boolean;
675
+ theme: Theme;
676
+ ariaRole: AriaRole | undefined;
677
+ ariaControls: string;
678
+ titleProp: string;
679
+ /**
680
+ * CSS-only attribute
681
+ */
682
+ active: boolean;
683
+ protected firstUpdated(changed: PropertyValues<this>): void;
684
+ protected updated(changed: PropertyValues<this>): void;
685
+ private _applyReverse;
686
+ private _applyThemeClass;
687
+ private get _iconClassMap();
688
+ private get _computedIconHidden();
689
+ private get _computedIconSingle();
690
+ render(): lit_html.TemplateResult<1>;
691
+ }
692
+ declare global {
693
+ interface HTMLElementTagNameMap {
694
+ 'uc-btn-ui': BtnUi;
695
+ }
696
+ }
697
+
698
+ declare class CropFrame extends LitBlock {
699
+ private _backdropMask?;
700
+ private _backdropMaskInner?;
701
+ private readonly _backdropMaskId;
702
+ private _frameThumbs?;
703
+ private _frameGuides?;
704
+ private _draggingThumb?;
705
+ private _hoverThumb?;
706
+ private _dragStartPoint?;
707
+ private _dragStartCrop?;
708
+ private _frameImage?;
709
+ private _guidesHidden;
710
+ private _draggingValue;
711
+ private readonly _svgRef;
712
+ private _svgReady;
713
+ private _pendingMaskHref;
714
+ private get _svgElement();
715
+ private get _dragging();
716
+ private set _dragging(value);
717
+ private _applyGuidesDragState;
718
+ private _shouldThumbBeDisabled;
719
+ private _createBackdrop;
720
+ /**
721
+ * @private Super Tricky workaround for the chromium bug See
722
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=330815
723
+ */
724
+ private _resizeBackdrop;
725
+ private _updateBackdrop;
726
+ private _updateFrame;
727
+ private _createThumb;
728
+ private _createThumbs;
729
+ private _createGuides;
730
+ private _createFrame;
731
+ private _handlePointerDown;
732
+ private readonly _handlePointerUp;
733
+ private readonly _handlePointerMove;
734
+ private _calcCropBox;
735
+ private readonly _handleSvgPointerMove;
736
+ private _updateCursor;
737
+ private _createMask;
738
+ private _updateMask;
739
+ private _render;
740
+ toggleThumbs(visible: boolean): void;
741
+ initCallback(): void;
742
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
743
+ private _initializeSvg;
744
+ disconnectedCallback(): void;
745
+ render(): TemplateResult;
746
+ }
747
+ declare global {
748
+ interface HTMLElementTagNameMap {
749
+ 'uc-crop-frame': CropFrame;
750
+ }
751
+ }
752
+
753
+ type Operations = {
754
+ flip: boolean;
755
+ mirror: boolean;
756
+ rotate: number;
757
+ };
758
+ declare class EditorImageCropper extends LitBlock {
759
+ ctxOwner: boolean;
760
+ private _commitDebounced;
761
+ private _handleResizeThrottled;
762
+ private _imageSize;
763
+ private _canvas?;
764
+ private _ctx;
765
+ private _isActive;
766
+ private _observer?;
767
+ private _image;
768
+ private _cancelPreload?;
769
+ private readonly _canvasRef;
770
+ private readonly _frameRef;
771
+ constructor();
772
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
773
+ private _syncTransformations;
774
+ private _initCanvas;
775
+ private _alignImage;
776
+ private _alignCrop;
777
+ private _drawImage;
778
+ private _draw;
779
+ private _animateIn;
780
+ private _getCropDimensions;
781
+ private _getCropTransformation;
782
+ private _commit;
783
+ setValue<K extends keyof Operations>(operation: K, value: Operations[K]): void;
784
+ getValue<K extends keyof Operations>(operation: K): Operations[K];
785
+ activate(imageSize: ImageSize, { fromViewer }?: {
786
+ fromViewer?: boolean;
787
+ }): Promise<void>;
788
+ deactivate({ reset }?: {
789
+ reset?: boolean;
790
+ }): void;
791
+ private _transitionToCrop;
792
+ private _transitionToImage;
793
+ private _reset;
794
+ private _waitForImage;
795
+ private _handleImageLoading;
796
+ initCallback(): void;
797
+ disconnectedCallback(): void;
798
+ render(): TemplateResult;
799
+ }
800
+ declare global {
801
+ interface HTMLElementTagNameMap {
802
+ 'uc-editor-image-cropper': EditorImageCropper;
803
+ }
804
+ }
805
+
806
+ declare const TabId: Readonly<{
807
+ readonly CROP: "crop";
808
+ readonly TUNING: "tuning";
809
+ readonly FILTERS: "filters";
810
+ }>;
811
+ type TabIdValue$1 = (typeof TabId)[keyof typeof TabId];
812
+ declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
813
+ type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
814
+ declare const ALL_FILTERS: readonly ["adaris", "briaril", "calarel", "carris", "cynarel", "cyren", "elmet", "elonni", "enzana", "erydark", "fenralan", "ferand", "galen", "gavin", "gethriel", "iorill", "iothari", "iselva", "jadis", "lavra", "misiara", "namala", "nerion", "nethari", "pamaya", "sarnar", "sedis", "sewen", "sorahel", "sorlen", "tarian", "thellassan", "varriel", "varven", "vevera", "virkas", "yedis", "yllara", "zatvel", "zevcen"];
815
+ type FilterId = (typeof ALL_FILTERS)[number];
816
+ declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
817
+ type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
818
+ /** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
819
+ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
820
+ brightness: {
821
+ zero: number;
822
+ range: readonly [-100, 100];
823
+ keypointsNumber: number;
824
+ };
825
+ exposure: {
826
+ zero: number;
827
+ range: readonly [-500, 500];
828
+ keypointsNumber: number;
829
+ };
830
+ gamma: {
831
+ zero: number;
832
+ range: readonly [0, 1000];
833
+ keypointsNumber: number;
834
+ };
835
+ contrast: {
836
+ zero: number;
837
+ range: readonly [-100, 500];
838
+ keypointsNumber: number;
839
+ };
840
+ saturation: {
841
+ zero: number;
842
+ range: readonly [-100, 500];
843
+ keypointsNumber: number;
844
+ };
845
+ vibrance: {
846
+ zero: number;
847
+ range: readonly [-100, 500];
848
+ keypointsNumber: number;
849
+ };
850
+ warmth: {
851
+ zero: number;
852
+ range: readonly [-100, 100];
853
+ keypointsNumber: number;
854
+ };
855
+ enhance: {
856
+ zero: number;
857
+ range: readonly [0, 100];
858
+ keypointsNumber: number;
859
+ };
860
+ filter: {
861
+ zero: number;
862
+ range: readonly [0, 100];
863
+ keypointsNumber: number;
864
+ };
865
+ }>;
866
+
867
+ type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
868
+ declare class EditorImageFader extends LitBlock {
869
+ private _isActive;
870
+ private _hidden;
871
+ private _operation;
872
+ private _filter;
873
+ private _value?;
874
+ private _transformations;
875
+ private _keypoints;
876
+ private _previewImage?;
877
+ private _cancelLastImages?;
878
+ private _cancelBatchPreload?;
879
+ private _url?;
880
+ private _fromViewer?;
881
+ private _raf;
882
+ private _addKeypointDebounced;
883
+ private readonly _previewHostRef;
884
+ private readonly _layersHostRef;
885
+ constructor();
886
+ private _handleImageLoading;
887
+ private _flush;
888
+ private _imageSrc;
889
+ private _constructKeypoint;
890
+ /**
891
+ * Check if current operation and filter equals passed ones
892
+ */
893
+ private _isSame;
894
+ set(value: string | number): void;
895
+ private _update;
896
+ private _createPreviewImage;
897
+ private _initNodes;
898
+ setTransformations(transformations: Transformations): Promise<void>;
899
+ preload({ url, filter, operation, value, }: {
900
+ url: string;
901
+ filter?: string;
902
+ operation?: OperationKey;
903
+ value?: number;
904
+ }): Promise<void>;
905
+ private _setOriginalSrc;
906
+ activate({ url, operation, value, filter, fromViewer, }: {
907
+ url: string;
908
+ operation?: OperationKey;
909
+ value?: number;
910
+ filter?: string;
911
+ fromViewer?: boolean;
912
+ }): Promise<void>;
913
+ deactivate({ hide }?: {
914
+ hide?: boolean;
915
+ }): void;
916
+ private _ensurePreviewAttached;
917
+ private _clearLayersHost;
918
+ render(): TemplateResult;
919
+ }
920
+ declare global {
921
+ interface HTMLElementTagNameMap {
922
+ 'uc-editor-image-fader': EditorImageFader;
923
+ }
924
+ }
925
+
926
+ declare class EditorButtonControl extends LitBlock {
927
+ active: boolean;
928
+ title: string;
929
+ protected icon: string;
930
+ protected titleProp: string;
931
+ protected get buttonClasses(): Record<string, boolean>;
932
+ private _updateHostStateClasses;
933
+ protected onClick(_event: MouseEvent): void;
934
+ connectedCallback(): void;
935
+ protected updated(changedProperties: PropertyValues<this>): void;
936
+ render(): lit_html.TemplateResult<1>;
937
+ }
938
+
939
+ declare class EditorFreeformButtonControl extends EditorButtonControl {
940
+ initCallback(): void;
941
+ onClick(): void;
942
+ private _computeTitle;
943
+ render(): lit_html.TemplateResult<1>;
944
+ }
945
+ declare class EditorAspectRatioButtonControl extends EditorButtonControl {
946
+ private _aspectRatio;
947
+ get aspectRatio(): CropAspectRatio | null;
948
+ set aspectRatio(value: CropAspectRatio | null);
949
+ initCallback(): void;
950
+ protected onClick(): void;
951
+ private _updateAspectRatioPresentation;
952
+ private _renderIcon;
953
+ render(): lit_html.TemplateResult<1>;
954
+ }
955
+ declare global {
956
+ interface HTMLElementTagNameMap {
957
+ 'uc-editor-freeform-button-control': EditorFreeformButtonControl;
958
+ 'uc-editor-aspect-ratio-button-control': EditorAspectRatioButtonControl;
959
+ }
960
+ }
961
+
962
+ declare class EditorCropButtonControl extends EditorButtonControl {
963
+ operation: CropOperation | undefined;
964
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
965
+ protected onClick(e: MouseEvent): void;
966
+ }
967
+ declare global {
968
+ interface HTMLElementTagNameMap {
969
+ 'uc-editor-crop-button-control': EditorCropButtonControl;
970
+ }
971
+ }
972
+
973
+ declare class EditorFilterControl extends EditorButtonControl {
974
+ private _operation;
975
+ private _filter;
976
+ private _originalUrl;
977
+ private _observer?;
978
+ private _cancelPreload?;
979
+ private _lastPreviewRequestId;
980
+ private _previewVisibilityCheckRaf?;
981
+ private _previewVisibilityCheckTimeout?;
982
+ private _previewImage;
983
+ private _previewLoaded;
984
+ isOriginal: boolean;
985
+ private _iconSize;
986
+ get filter(): string;
987
+ set filter(value: string);
988
+ onClick(e: MouseEvent): void;
989
+ private _previewSrc;
990
+ private _observerCallback;
991
+ initCallback(): void;
992
+ disconnectedCallback(): void;
993
+ protected updated(changedProperties: PropertyValues<this>): void;
994
+ private _updateFilterLabels;
995
+ private _loadPreview;
996
+ private _schedulePreviewVisibilityCheck;
997
+ private _clearPreviewVisibilityChecks;
998
+ private get _shouldShowPreview();
999
+ render(): lit_html.TemplateResult<1>;
1000
+ }
1001
+ declare global {
1002
+ interface HTMLElementTagNameMap {
1003
+ 'uc-editor-filter-control': EditorFilterControl;
1004
+ }
1005
+ }
1006
+
1007
+ declare class EditorOperationControl extends EditorButtonControl {
1008
+ private _operation;
1009
+ get operation(): ColorOperation | '';
1010
+ set operation(value: ColorOperation | '');
1011
+ private _updateOperationMetadata;
1012
+ initCallback(): void;
1013
+ protected onClick(e: MouseEvent): void;
1014
+ }
1015
+ declare global {
1016
+ interface HTMLElementTagNameMap {
1017
+ 'uc-editor-operation-control': EditorOperationControl;
1018
+ }
1019
+ }
1020
+
1021
+ declare class EditorScroller extends LitBlock {
1022
+ /**
1023
+ * CSS-only attribute
1024
+ */
1025
+ hiddenScrollbar: boolean;
1026
+ private readonly _handleWheel;
1027
+ connectedCallback(): void;
1028
+ disconnectedCallback(): void;
1029
+ }
1030
+ declare global {
1031
+ interface HTMLElementTagNameMap {
1032
+ 'uc-editor-scroller': EditorScroller;
1033
+ }
1034
+ }
1035
+
1036
+ declare class SliderUi extends LitBlock {
1037
+ private _observer?;
1038
+ private _thumbSize;
1039
+ private _zeroDotEl?;
1040
+ private _stepsCount?;
1041
+ private readonly _inputRef;
1042
+ private readonly _thumbRef;
1043
+ private readonly _stepsRef;
1044
+ disabled: boolean;
1045
+ min: number;
1046
+ max: number;
1047
+ defaultValue: number;
1048
+ zero: number;
1049
+ private _currentValue;
1050
+ constructor();
1051
+ private _emitSliderEvent;
1052
+ private readonly _handleSliderInput;
1053
+ private readonly _handleSliderChange;
1054
+ private readonly _handleInputFocus;
1055
+ private readonly _handleInputBlur;
1056
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
1057
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
1058
+ private _updateValue;
1059
+ private _updateZeroDot;
1060
+ private _updateSteps;
1061
+ disconnectedCallback(): void;
1062
+ private _setCurrentValue;
1063
+ private _syncInputValue;
1064
+ private _extractEventValue;
1065
+ render(): lit_html.TemplateResult<1>;
1066
+ }
1067
+ declare global {
1068
+ interface HTMLElementTagNameMap {
1069
+ 'uc-slider-ui': SliderUi;
1070
+ }
1071
+ }
1072
+
1073
+ type SliderOperation = ColorOperation | 'filter';
1074
+ type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
1075
+ declare const FAKE_ORIGINAL_FILTER = "original";
1076
+ declare class EditorSlider extends LitBlock {
1077
+ state: {
1078
+ operation: SliderOperation;
1079
+ filter: SliderFilter | undefined;
1080
+ originalUrl: string;
1081
+ disabled: boolean;
1082
+ min: number;
1083
+ max: number;
1084
+ value: number;
1085
+ defaultValue: number;
1086
+ zero: number;
1087
+ };
1088
+ private _handleInput;
1089
+ setOperation(operation: SliderOperation, filter?: SliderFilter): void;
1090
+ private _initializeValues;
1091
+ apply(): void;
1092
+ cancel(): void;
1093
+ initCallback(): void;
1094
+ protected updated(changedProperties: PropertyValues<this>): void;
1095
+ render(): lit_html.TemplateResult<1>;
1096
+ }
1097
+ declare global {
1098
+ interface HTMLElementTagNameMap {
1099
+ 'uc-editor-slider': EditorSlider;
1100
+ }
1101
+ }
1102
+
1103
+ type TabIdValue = (typeof TabId)[keyof typeof TabId];
1104
+ declare class EditorToolbar extends LitBlock {
1105
+ private _showLoader;
1106
+ showMainToolbar: boolean;
1107
+ showSubToolbar: boolean;
1108
+ private _showTabToggles;
1109
+ tabList: readonly TabIdValue[];
1110
+ activeTab: TabIdValue;
1111
+ private _useSliderPanel;
1112
+ private _tooltipVisible;
1113
+ private _operationTooltip;
1114
+ private _tabIndicatorOffset;
1115
+ private _tabIndicatorWidth;
1116
+ private readonly _sliderRef;
1117
+ private readonly _tabIndicatorRef;
1118
+ protected readonly tabToggleRefs: Record<TabIdValue, Ref<HTMLElement>>;
1119
+ private readonly _handleWindowResize;
1120
+ private _cropPresets;
1121
+ private _cancelPreload?;
1122
+ private readonly _debouncedShowLoader;
1123
+ private readonly _updateInfoTooltip;
1124
+ private readonly _subTopToolbarStyles;
1125
+ private readonly _subBottomToolbarStyles;
1126
+ private readonly _tabToggleStyles;
1127
+ private readonly _tabTogglesStyles;
1128
+ init$: Record<string, unknown>;
1129
+ private _onSliderClose;
1130
+ private _activateTab;
1131
+ private _applyTabState;
1132
+ private _syncTabIndicator;
1133
+ private get _hasAspectRatioPicker();
1134
+ private _renderControlsByTab;
1135
+ private _renderCropTabControls;
1136
+ private _renderFilterTabControls;
1137
+ private _renderTuningTabControls;
1138
+ private _renderControlGroup;
1139
+ private _renderFreeformControl;
1140
+ private _renderAspectRatioControl;
1141
+ private _renderCropOperationControl;
1142
+ private _renderFilterControl;
1143
+ private _renderOperationControl;
1144
+ private _renderAspectRatioList;
1145
+ private _preloadEditedImage;
1146
+ initCallback(): void;
1147
+ connectedCallback(): void;
1148
+ firstUpdated(changedProperties: PropertyValues<this>): void;
1149
+ protected updated(changedProperties: PropertyValues<this>): void;
1150
+ disconnectedCallback(): void;
1151
+ private _assignSharedElements;
1152
+ private readonly _handleCancel;
1153
+ private readonly _handleApply;
1154
+ private readonly _handleApplySlider;
1155
+ private readonly _handleCancelSlider;
1156
+ private readonly _handleTabClick;
1157
+ private _renderTabToggle;
1158
+ private _renderTabContent;
1159
+ render(): TemplateResult<1>;
1160
+ }
1161
+ declare global {
1162
+ interface HTMLElementTagNameMap {
1163
+ 'uc-editor-toolbar': EditorToolbar;
1164
+ }
1165
+ }
1166
+
1167
+ declare class CloudImageEditorBlock extends LitBlock {
1168
+ attributesMeta: ({
1169
+ uuid: string;
1170
+ } | {
1171
+ 'cdn-url': string;
1172
+ }) & Partial<{
1173
+ tabs: string;
1174
+ 'crop-preset': string;
1175
+ }> & {
1176
+ 'ctx-name': string;
1177
+ };
1178
+ ctxOwner: boolean;
1179
+ static styleAttrs: string[];
1180
+ private _statusMessage;
1181
+ private _imageSrc;
1182
+ private _fileType;
1183
+ private _showLoader;
1184
+ uuid: string | null;
1185
+ cdnUrl: string | null;
1186
+ cropPreset: string;
1187
+ tabs: string | null;
1188
+ private _hasNetworkProblems;
1189
+ private _isInitialized;
1190
+ private _pendingInitUpdate;
1191
+ private readonly _debouncedShowLoader;
1192
+ private readonly _imgRef;
1193
+ private readonly _cropperRef;
1194
+ private readonly _faderRef;
1195
+ private readonly _imgContainerRef;
1196
+ private readonly _handleImageLoad;
1197
+ private readonly _handleImageError;
1198
+ private readonly _handleRetryNetwork;
1199
+ private _scheduleInitialization;
1200
+ init$: ReturnType<typeof initState>;
1201
+ initCallback(): void;
1202
+ private _assignSharedElements;
1203
+ private _attachImageListeners;
1204
+ private _detachImageListeners;
1205
+ private get _imageClassName();
1206
+ /**
1207
+ * To proper work, we need non-zero size the element. So, we'll wait for it.
1208
+ */
1209
+ private _waitForSize;
1210
+ firstUpdated(changedProperties: PropertyValues<this>): void;
1211
+ disconnectedCallback(): void;
1212
+ render(): lit_html.TemplateResult<1>;
1213
+ protected updated(changedProperties: PropertyValues<this>): void;
1214
+ private _syncTabListFromProp;
1215
+ private _syncCropPresetState;
1216
+ updateImage(): Promise<void>;
1217
+ initEditor(): Promise<void>;
1218
+ }
1219
+ declare global {
1220
+ interface HTMLElementTagNameMap {
1221
+ 'uc-cloud-image-editor-block': CloudImageEditorBlock;
1222
+ }
1223
+ }
1224
+
1225
+ declare class CloudImageEditor extends CloudImageEditorBlock {
1226
+ static styleAttrs: string[];
1227
+ constructor();
1228
+ initCallback(): void;
1229
+ }
1230
+ declare global {
1231
+ interface HTMLElementTagNameMap {
1232
+ 'uc-cloud-image-editor': CloudImageEditor;
1233
+ }
1234
+ }
1235
+
1236
+ type ActivityParams$1 = {
1237
+ internalId: string;
1238
+ };
1239
+ declare class CloudImageEditorActivity extends LitUploaderBlock {
1240
+ private _entry?;
1241
+ private _editorConfig;
1242
+ get activityParams(): ActivityParams$1;
1243
+ initCallback(): void;
1244
+ disconnectedCallback(): void;
1245
+ private _handleApply;
1246
+ private _handleCancel;
1247
+ handleChange(event: CustomEvent<ChangeResult>): void;
1248
+ private _mountEditor;
1249
+ private _unmountEditor;
1250
+ render(): lit_html.TemplateResult<1> | typeof nothing;
1251
+ private _createEditorConfig;
1252
+ }
1253
+ declare global {
1254
+ interface HTMLElementTagNameMap {
1255
+ 'uc-cloud-image-editor-activity': CloudImageEditorActivity;
1256
+ }
1257
+ }
1258
+
1259
+ declare class ActivityHeader extends LitActivityBlock {
1260
+ }
1261
+ declare global {
1262
+ interface HTMLElementTagNameMap {
1263
+ 'uc-activity-header': ActivityHeader;
1264
+ }
1265
+ }
1266
+
1267
+ declare class Spinner extends LitBlock {
1268
+ render(): lit_html.TemplateResult<1>;
1269
+ }
1270
+ declare global {
1271
+ interface HTMLElementTagNameMap {
1272
+ 'uc-spinner': Spinner;
1273
+ }
1274
+ }
1275
+
1276
+ type ActivityParams = {
1277
+ externalSourceType: string;
1278
+ };
1279
+ declare class ExternalSource extends LitUploaderBlock {
1280
+ couldBeCtxOwner: boolean;
1281
+ activityType: "external";
1282
+ private _messageBridge?;
1283
+ private _iframeRef;
1284
+ private _latestSelectionSummary;
1285
+ private _selectedList;
1286
+ private _isSelectionReady;
1287
+ private _isDoneBtnEnabled;
1288
+ private _couldSelectAll;
1289
+ private _couldDeselectAll;
1290
+ private _showSelectionStatus;
1291
+ private _showDoneBtn;
1292
+ private _doneBtnTextClass;
1293
+ private _toolbarVisible;
1294
+ private get _counterText();
1295
+ get activityParams(): ActivityParams;
1296
+ initCallback(): void;
1297
+ private _extractUrlFromSelectedFile;
1298
+ private _handleToolbarStateChange;
1299
+ private _handleSelectedFilesChange;
1300
+ private _handleIframeLoad;
1301
+ private _applyTheme;
1302
+ private _applyEmbedCss;
1303
+ private _setupL10n;
1304
+ private _remoteUrl;
1305
+ private _handleDone;
1306
+ private _handleCancel;
1307
+ private _handleSelectAll;
1308
+ private _handleDeselectAll;
1309
+ private _setSelectionSummary;
1310
+ private _mountIframe;
1311
+ private _unmountIframe;
1312
+ private _resetSelectionStatus;
1313
+ disconnectedCallback(): void;
1314
+ render(): lit_html.TemplateResult<1>;
1315
+ }
1316
+ declare global {
1317
+ interface HTMLElementTagNameMap {
1318
+ 'uc-external-source': ExternalSource;
1319
+ }
1320
+ }
1321
+
1322
+ declare const ACTIVITY_TYPES: Readonly<{
1323
+ START_FROM: "start-from";
1324
+ CAMERA: "camera";
1325
+ DRAW: "draw";
1326
+ UPLOAD_LIST: "upload-list";
1327
+ URL: "url";
1328
+ CLOUD_IMG_EDIT: "cloud-image-edit";
1329
+ EXTERNAL: "external";
1330
+ }>;
1331
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1332
+ type ActivityType = RegisteredActivityType | null;
1333
+
1334
+ declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1335
+ interface CustomActivities {
1336
+ }
1337
+ type ActivityParamsMap = {
1338
+ 'cloud-image-edit': ActivityParams$1;
1339
+ external: ActivityParams;
1340
+ } & {
1341
+ [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1342
+ };
1343
+ declare class LitActivityBlock extends LitBlock {
1344
+ protected historyTracked: boolean;
1345
+ private [ACTIVE_PROP]?;
1346
+ init$: {
1347
+ '*currentActivity': null;
1348
+ '*currentActivityParams': {};
1349
+ '*history': never[];
1350
+ '*historyBack': null;
1351
+ '*closeModal': () => void;
1352
+ };
1353
+ private _debouncedHistoryFlush;
1354
+ private _deactivate;
1355
+ private _activate;
1356
+ initCallback(): void;
1357
+ private _historyFlush;
1358
+ protected _isActivityRegistered(): boolean;
1359
+ private static _activityCallbacks;
1360
+ static activities: Readonly<{
1361
+ START_FROM: 'start-from';
1362
+ CAMERA: 'camera';
1363
+ DRAW: 'draw';
1364
+ UPLOAD_LIST: 'upload-list';
1365
+ URL: 'url';
1366
+ CLOUD_IMG_EDIT: 'cloud-image-edit';
1367
+ EXTERNAL: 'external';
1368
+ }>;
1369
+ protected get isActivityActive(): boolean;
1370
+ get couldOpenActivity(): boolean;
1371
+ /** TODO: remove name argument */
1372
+ protected registerActivity(_name: string, options?: {
1373
+ onActivate?: () => void;
1374
+ onDeactivate?: () => void;
1375
+ }): void;
1376
+ private _unregisterActivity;
1377
+ disconnectedCallback(): void;
1378
+ get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1379
+ get initActivity(): RegisteredActivityType | null;
1380
+ get doneActivity(): RegisteredActivityType | null;
1381
+ historyBack(): void;
1382
+ }
1383
+
1384
+ declare const InternalEventType: Readonly<{
1385
+ readonly INIT_SOLUTION: "init-solution";
1386
+ readonly CHANGE_CONFIG: "change-config";
1387
+ readonly ACTION_EVENT: "action-event";
1388
+ readonly ERROR_EVENT: "error-event";
1389
+ }>;
1390
+ declare const EventType: Readonly<{
1391
+ readonly FILE_ADDED: "file-added";
1392
+ readonly FILE_REMOVED: "file-removed";
1393
+ readonly FILE_UPLOAD_START: "file-upload-start";
1394
+ readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
1395
+ readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
1396
+ readonly FILE_UPLOAD_FAILED: "file-upload-failed";
1397
+ readonly FILE_URL_CHANGED: "file-url-changed";
1398
+ readonly MODAL_OPEN: "modal-open";
1399
+ readonly MODAL_CLOSE: "modal-close";
1400
+ readonly DONE_CLICK: "done-click";
1401
+ readonly UPLOAD_CLICK: "upload-click";
1402
+ readonly ACTIVITY_CHANGE: "activity-change";
1403
+ readonly COMMON_UPLOAD_START: "common-upload-start";
1404
+ readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
1405
+ readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
1406
+ readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
1407
+ readonly CHANGE: "change";
1408
+ readonly GROUP_CREATED: "group-created";
1409
+ }>;
1410
+ type EventKey = (typeof EventType)[keyof typeof EventType];
1411
+ type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
1412
+ type EventPayload = {
1413
+ [EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
1414
+ [EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
1415
+ [EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
1416
+ [EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
1417
+ [EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
1418
+ [EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
1419
+ [EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
1420
+ [EventType.MODAL_OPEN]: {
1421
+ modalId: ModalId;
1422
+ };
1423
+ [EventType.MODAL_CLOSE]: {
1424
+ modalId: ModalId;
1425
+ hasActiveModals: boolean;
1426
+ };
1427
+ [EventType.ACTIVITY_CHANGE]: {
1428
+ activity: ActivityType;
1429
+ };
1430
+ [EventType.UPLOAD_CLICK]: undefined;
1431
+ [EventType.DONE_CLICK]: OutputCollectionState;
1432
+ [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
1433
+ [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
1434
+ [EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
1435
+ [EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
1436
+ [EventType.CHANGE]: OutputCollectionState;
1437
+ [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
1438
+ };
1439
+ declare class EventEmitter extends SharedInstance {
1440
+ private _timeoutStore;
1441
+ private _targets;
1442
+ bindTarget(target: LitBlock): () => void;
1443
+ private _dispatch;
1444
+ emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
1445
+ debounce?: TDebounce;
1446
+ }): void;
1447
+ destroy(): void;
1448
+ }
1449
+
1450
+ type EventMap = {
1451
+ [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
1452
+ };
1453
+
1454
+ type SelectOption = {
1455
+ text: string;
1456
+ value: string;
1457
+ };
1458
+ declare class Select extends LitBlock {
1459
+ value: string;
1460
+ disabled: boolean;
1461
+ options: SelectOption[];
1462
+ render(): lit_html.TemplateResult<1>;
1463
+ private _handleChange;
1464
+ }
1465
+ declare global {
1466
+ interface HTMLElementTagNameMap {
1467
+ 'uc-select': Select;
1468
+ }
1469
+ }
1470
+
1471
+ type CameraMode = 'photo' | 'video';
1472
+ declare class CameraSource extends LitUploaderBlock {
1473
+ couldBeCtxOwner: boolean;
1474
+ activityType: "camera";
1475
+ private _unsubPermissions;
1476
+ private _capturing;
1477
+ private _chunks;
1478
+ private _mediaRecorder;
1479
+ private _stream;
1480
+ private _selectedAudioId;
1481
+ private _selectedCameraId;
1482
+ private _activeTab;
1483
+ private _options;
1484
+ private _canvas;
1485
+ private _ctx;
1486
+ private _cameraDevices;
1487
+ private _audioDevices;
1488
+ private _permissionResponses;
1489
+ private _permissionCleanupFns;
1490
+ private _currentVideoSource;
1491
+ private readonly _handlePreviewPlay;
1492
+ private readonly _handlePreviewPause;
1493
+ private _timerRef;
1494
+ private _lineRef;
1495
+ private _videoRef;
1496
+ private _switcherRef;
1497
+ private _startTime;
1498
+ private _elapsedTime;
1499
+ private _videoTransformCss;
1500
+ private _videoHidden;
1501
+ private _messageHidden;
1502
+ private _requestBtnHidden;
1503
+ private _cameraSelectOptions;
1504
+ private _cameraSelectHidden;
1505
+ private _l10nMessage;
1506
+ private _timerHidden;
1507
+ private _cameraHidden;
1508
+ private _cameraActionsHidden;
1509
+ private _audioSelectOptions;
1510
+ private _audioSelectHidden;
1511
+ private _audioSelectDisabled;
1512
+ private _audioToggleMicrophoneHidden;
1513
+ private _tabCameraHidden;
1514
+ private _tabVideoHidden;
1515
+ private _currentIcon;
1516
+ private _currentTimelineIcon;
1517
+ private _toggleMicrophoneIcon;
1518
+ private _mutableClassButton;
1519
+ private _chooseActionWithCamera;
1520
+ private _handleCameraSelectChange;
1521
+ private _handleAudioSelectChange;
1522
+ private _handleRequestPermissions;
1523
+ private _handleStartCamera;
1524
+ private _handleToggleRecording;
1525
+ private _handleToggleAudio;
1526
+ private _handleRetake;
1527
+ private _handleAccept;
1528
+ private _handleClickTab;
1529
+ private _updateTimer;
1530
+ private _startTimer;
1531
+ private _stopTimer;
1532
+ private _startTimeline;
1533
+ private _stopTimeline;
1534
+ private _animationFrameId;
1535
+ private _startRecording;
1536
+ private _stopRecording;
1537
+ /** This method is used to toggle recording pause/resume */
1538
+ private _toggleRecording;
1539
+ private _toggleEnableAudio;
1540
+ /**
1541
+ * Previewing the video that was recorded on the camera
1542
+ */
1543
+ private _previewVideo;
1544
+ private _attachPreviewListeners;
1545
+ private _detachPreviewListeners;
1546
+ private _setVideoSource;
1547
+ /**
1548
+ * Do not bind srcObject directly in the template, because it stops video pausing on shot.
1549
+ * I really don'y know why but that's how it is. Assigning srcObject manually fixes the issue.
1550
+ */
1551
+ private _applyVideoSource;
1552
+ private _retake;
1553
+ private _accept;
1554
+ private _handlePhoto;
1555
+ private _handleVideo;
1556
+ private _setCameraState;
1557
+ private _shot;
1558
+ private _handleActiveTab;
1559
+ private _createFile;
1560
+ private _guessExtensionByMime;
1561
+ /**
1562
+ * The send file to the server
1563
+ */
1564
+ private _toSend;
1565
+ private get _cameraModes();
1566
+ private _setPermissionsState;
1567
+ private _makeStreamInactive;
1568
+ private _stopCapture;
1569
+ private _capture;
1570
+ private _handlePermissionsChange;
1571
+ private _permissionAccess;
1572
+ private _teardownPermissionListeners;
1573
+ private _requestDeviceAccess;
1574
+ private _getDevices;
1575
+ private _onActivate;
1576
+ private _onDeactivate;
1577
+ private _handleCameraModes;
1578
+ initCallback(): void;
1579
+ firstUpdated(changedProperties: PropertyValues<this>): void;
1580
+ updated(changedProperties: PropertyValues<this>): void;
1581
+ private _destroy;
1582
+ disconnectedCallback(): void;
1583
+ render(): lit_html.TemplateResult<1>;
1584
+ }
1585
+ declare global {
1586
+ interface HTMLElementTagNameMap {
1587
+ 'uc-camera-source': CameraSource;
1588
+ }
1589
+ }
1590
+
1591
+ /**
1592
+ * Config keys that can't be passed as attribute (because they are object or function)
1593
+ */
1594
+ declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
1595
+ declare class Config extends LitBlock {
1596
+ attributesMeta: Partial<ConfigPlainType> & {
1597
+ 'ctx-name': string;
1598
+ };
1599
+ init$: LitBlock["init$"] & ConfigType;
1600
+ private _computationControllers;
1601
+ private _pluginChangeUnsubscribe?;
1602
+ private _mutationObserver?;
1603
+ /**
1604
+ * Mapping of attribute names to custom config keys for plugin-registered configs.
1605
+ * Updated dynamically when plugins are registered or changed.
1606
+ * Similar to builtinAttrKeyMapping but for custom configs.
1607
+ */
1608
+ private _customAttrKeyMapping;
1609
+ /** Set of all custom config names registered by plugins */
1610
+ private _customConfigKeys;
1611
+ /**
1612
+ * Map of custom config subscriptions (config name -> unsubscribe function)
1613
+ * Used to track and clean up subscriptions when plugins change
1614
+ */
1615
+ private _customConfigSubscriptions;
1616
+ /**
1617
+ * Check if a key is a custom config (registered by plugins)
1618
+ */
1619
+ private _isCustomConfig;
1620
+ /**
1621
+ * Get the custom config definition for a key
1622
+ */
1623
+ private _getCustomConfigDefinition;
1624
+ /**
1625
+ * Get attribute names for a config key (kebab-case and lowercase)
1626
+ */
1627
+ private _getAttributeNames;
1628
+ private _flushValueToAttribute;
1629
+ private _flushValueToState;
1630
+ private _setValue;
1631
+ private _getValue;
1632
+ private _assertSameValueDifferentReference;
1633
+ private _processCustomConfigs;
1634
+ private _setupCustomConfigs;
1635
+ private _setupMutationObserver;
1636
+ initCallback(): void;
1637
+ attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
1638
+ disconnectedCallback(): void;
1639
+ static get observedAttributes(): string[];
1640
+ }
1641
+ interface Config extends ConfigType, CustomConfig {
1642
+ }
1643
+ declare global {
1644
+ interface HTMLElementTagNameMap {
1645
+ 'uc-config': Config;
1646
+ }
1647
+ }
1648
+
1649
+ declare class FileItemConfig extends LitUploaderBlock {
1650
+ private _entrySubs;
1651
+ protected entry: UploadEntryTypedData | null;
1652
+ protected withEntry<A extends unknown[], R>(fn: (entry: UploadEntryTypedData, ...args: A) => R): (...args: A) => R | undefined;
1653
+ protected subEntry<K extends UploadEntryKeys>(prop: K, handler: (value: UploadEntryData[K]) => void): void;
1654
+ protected reset(): void;
1655
+ disconnectedCallback(): void;
1656
+ }
1657
+
1658
+ declare class Thumb extends FileItemConfig {
1659
+ badgeIcon: string;
1660
+ uid: Uid;
1661
+ private _thumbUrl;
1662
+ private _renderedGridOnce;
1663
+ private _thumbRect;
1664
+ private _isIntersecting;
1665
+ private _firstViewMode;
1666
+ private _observer?;
1667
+ private _pendingThumbUpdate?;
1668
+ private _calculateThumbSize;
1669
+ private _generateThumbnail;
1670
+ private _debouncedGenerateThumb;
1671
+ private _decodeImage;
1672
+ private _cancelPendingThumbUpdate;
1673
+ private _scheduleThumbUpdate;
1674
+ private _requestThumbGeneration;
1675
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
1676
+ protected updated(changedProperties: PropertyValues<this>): void;
1677
+ private _observerCallback;
1678
+ protected reset(): void;
1679
+ private _bindToEntry;
1680
+ initCallback(): void;
1681
+ connectedCallback(): void;
1682
+ disconnectedCallback(): void;
1683
+ render(): lit_html.TemplateResult<1>;
1684
+ }
1685
+ declare global {
1686
+ interface HTMLElementTagNameMap {
1687
+ 'uc-thumb': Thumb;
1688
+ }
1689
+ }
1690
+
1691
+ declare class ProgressBar extends LitBlock {
1692
+ hasFileName: boolean;
1693
+ value: number;
1694
+ visible: boolean;
1695
+ private _progressValue;
1696
+ private readonly _fakeProgressLineRef;
1697
+ private readonly _handleFakeProgressAnimation;
1698
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
1699
+ protected updated(changedProperties: PropertyValues<this>): void;
1700
+ disconnectedCallback(): void;
1701
+ private _normalizeProgressValue;
1702
+ private _updateProgressValueStyle;
1703
+ render(): lit_html.TemplateResult<1>;
1704
+ }
1705
+ declare global {
1706
+ interface HTMLElementTagNameMap {
1707
+ 'uc-progress-bar': ProgressBar;
1708
+ }
1709
+ }
1710
+
1711
+ declare class FileItem extends FileItemConfig {
1712
+ protected couldBeCtxOwner: boolean;
1713
+ private _pauseRender;
1714
+ uid: Uid;
1715
+ private _itemName;
1716
+ private _errorText;
1717
+ private _hint;
1718
+ private _progressValue;
1719
+ private _progressVisible;
1720
+ private _badgeIcon;
1721
+ private _isFinished;
1722
+ private _isFailed;
1723
+ private _isUploading;
1724
+ private _isFocused;
1725
+ private _showFileNames;
1726
+ private _ariaLabelStatusFile;
1727
+ private _pluginFileActions;
1728
+ private _renderedOnce;
1729
+ private _observer?;
1730
+ private _unsubscribePlugins?;
1731
+ private _handleRemove;
1732
+ private _handleUploadClick;
1733
+ private _calculateState;
1734
+ private _debouncedCalculateState;
1735
+ private _updateHintAndProgress;
1736
+ private _handleState;
1737
+ protected reset(): void;
1738
+ private _observerCallback;
1739
+ private _handleEntryId;
1740
+ private _updateShowFileNames;
1741
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
1742
+ private _updatePluginFileActions;
1743
+ private _handlePluginFileAction;
1744
+ initCallback(): void;
1745
+ connectedCallback(): void;
1746
+ disconnectedCallback(): void;
1747
+ private _upload;
1748
+ static activeInstances: Set<FileItem>;
1749
+ protected shouldUpdate(changedProperties: PropertyValues<this>): boolean;
1750
+ render(): lit_html.TemplateResult<1>;
1751
+ }
1752
+ declare global {
1753
+ interface HTMLElementTagNameMap {
1754
+ 'uc-file-item': FileItem;
1755
+ }
1756
+ }
1757
+
1758
+ declare class DropArea extends LitUploaderBlock {
1759
+ static styleAttrs: string[];
1760
+ /**
1761
+ * CSS-only attribute
1762
+ */
1763
+ single: boolean;
1764
+ /**
1765
+ * CSS-only attribute
1766
+ */
1767
+ ghost: boolean;
1768
+ disabled: boolean;
1769
+ clickable: boolean;
1770
+ withIcon: boolean;
1771
+ fullscreen: boolean;
1772
+ initflow: boolean;
1773
+ text?: string;
1774
+ private _isEnabled;
1775
+ private _isVisible;
1776
+ private get _localizedText();
1777
+ private _destroyDropzone;
1778
+ private _destroyContentWrapperDropzone;
1779
+ private _contentWrapperRef;
1780
+ private readonly _handleAreaInteraction;
1781
+ private _sourceListAllowsLocal;
1782
+ private _clickableListenersAttached;
1783
+ isActive(): boolean;
1784
+ initCallback(): void;
1785
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
1786
+ protected updated(changedProperties: PropertyValues<this>): void;
1787
+ /** Ignore drop events if there are other visible drop areas on the page. */
1788
+ private _shouldIgnore;
1789
+ private _couldHandleFiles;
1790
+ private _updateIsEnabled;
1791
+ private _updateVisibility;
1792
+ private _updateDragStateAttribute;
1793
+ private _setupContentWrapperDropzone;
1794
+ private _updateClickableListeners;
1795
+ disconnectedCallback(): void;
1796
+ render(): lit_html.TemplateResult<1>;
1797
+ }
1798
+ declare global {
1799
+ interface HTMLElementTagNameMap {
1800
+ 'uc-drop-area': DropArea;
1801
+ }
1802
+ }
1803
+
1804
+ type FilesViewMode = 'grid' | 'list';
1805
+ declare class UploadList extends LitUploaderBlock {
1806
+ couldBeCtxOwner: boolean;
1807
+ protected historyTracked: boolean;
1808
+ activityType: "upload-list";
1809
+ private _doneBtnVisible;
1810
+ private _doneBtnEnabled;
1811
+ private _uploadBtnVisible;
1812
+ private _addMoreBtnVisible;
1813
+ private _addMoreBtnEnabled;
1814
+ private _commonErrorMessage;
1815
+ private _hasFiles;
1816
+ private _latestSummary;
1817
+ private get _headerText();
1818
+ private _handleAdd;
1819
+ private _handleUpload;
1820
+ private _handleDone;
1821
+ private _handleCancel;
1822
+ private _throttledHandleCollectionUpdate;
1823
+ private _updateUploadsState;
1824
+ private _getHeaderText;
1825
+ get couldOpenActivity(): boolean;
1826
+ initCallback(): void;
1827
+ disconnectedCallback(): void;
1828
+ render(): lit_html.TemplateResult<1>;
1829
+ }
1830
+ declare global {
1831
+ interface HTMLElementTagNameMap {
1832
+ 'uc-upload-list': UploadList;
1833
+ }
1834
+ }
1835
+
1836
+ type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
1837
+ type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
1838
+ type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
1839
+ uuid: string;
1840
+ cdnUrlModifiers: string;
1841
+ fileName: string;
1842
+ }) => Promise<string> | string;
1843
+ type SecureUploadsSignatureAndExpire = {
1844
+ secureSignature: string;
1845
+ secureExpire: string;
1846
+ };
1847
+ type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatureAndExpire | null>;
1848
+ type IconHrefResolver = (iconName: string) => string;
1849
+ type FileValidators = FileValidator[];
1850
+ type CollectionValidators = FuncCollectionValidator[];
1851
+ type ConfigType = {
1852
+ /**
1853
+ * Your project’s Public Key.
1854
+ */
1855
+ pubkey: string;
1856
+ /**
1857
+ * Allow multiple file uploads.
1858
+ */
1859
+ multiple: boolean;
1860
+ /**
1861
+ * Minimum number of files to upload.
1862
+ */
1863
+ multipleMin: number;
1864
+ /**
1865
+ * Maximum number of files to upload.
1866
+ */
1867
+ multipleMax: number;
1868
+ /**
1869
+ * Require user confirmation before uploading.
1870
+ */
1871
+ confirmUpload: boolean;
1872
+ /**
1873
+ * Allow only image files.
1874
+ */
1875
+ imgOnly: boolean;
1876
+ /**
1877
+ * Native file input accept attribute value. Also affects client validation settings.
1878
+ */
1879
+ accept: string;
1880
+ /**
1881
+ * Preferred types for external sources.
1882
+ * See [here](https://uploadcare.com/docs/file-uploader/options/#external-sources-preferred-types)
1883
+ */
1884
+ externalSourcesPreferredTypes: string;
1885
+ /**
1886
+ * Provide custom CSS to the social sources iframe
1887
+ */
1888
+ externalSourcesEmbedCss: string;
1889
+ /**
1890
+ * Store uploaded files.
1891
+ */
1892
+ store: boolean | 'auto';
1893
+ /**
1894
+ * Mirror the camera view.
1895
+ */
1896
+ cameraMirror: boolean;
1897
+ /**
1898
+ * Default camera capture mode.
1899
+ */
1900
+ cameraCapture: 'user' | 'environment' | '';
1901
+ /**
1902
+ * List of sources for file uploads.
1903
+ */
1904
+ sourceList: string;
1905
+ /**
1906
+ * Top-level origin for the uploader.
1907
+ * This is used for Google Drive Picker if there is no access to the origin due to the cross-origin policy.
1908
+ */
1909
+ topLevelOrigin: string;
1910
+ /**
1911
+ * Maximum size of local files in bytes.
1912
+ */
1913
+ maxLocalFileSizeBytes: number;
1914
+ /**
1915
+ * Thumbnail size.
1916
+ */
1917
+ thumbSize: number;
1918
+ /**
1919
+ * Show the upload list even if it is empty.
1920
+ */
1921
+ showEmptyList: boolean;
1922
+ /**
1923
+ * Use local image editor.
1924
+ */
1925
+ useLocalImageEditor: boolean;
1926
+ /**
1927
+ * Enable cloud image editing.
1928
+ */
1929
+ useCloudImageEditor: boolean;
1930
+ /**
1931
+ * Tabs to show in the cloud image editor.
1932
+ *
1933
+ * @default 'crop, tuning, filters'
1934
+ */
1935
+ cloudImageEditorTabs: string;
1936
+ /**
1937
+ * Remove copyright information.
1938
+ */
1939
+ removeCopyright: boolean;
1940
+ /**
1941
+ * Defines the crop behavior. When uploading images, your users can select a crop area with a defined aspect ratio.
1942
+ */
1943
+ cropPreset: string;
1944
+ /**
1945
+ * Image shrink options.
1946
+ */
1947
+ imageShrink: string;
1948
+ /**
1949
+ * Lock scroll when modal is open.
1950
+ */
1951
+ modalScrollLock: boolean;
1952
+ /**
1953
+ * Show strokes on modal backdrop.
1954
+ */
1955
+ modalBackdropStrokes: boolean;
1956
+ /**
1957
+ * Wrap the source list.
1958
+ */
1959
+ sourceListWrap: boolean;
1960
+ /**
1961
+ * Key to revoke Custom OAuth access. See [OAuth docs](https://uploadcare.com/docs/upload-sources/#oauth) for details.
1962
+ */
1963
+ remoteTabSessionKey: string;
1964
+ /**
1965
+ * Set custom CNAME.
1966
+ */
1967
+ cdnCname: string;
1968
+ /**
1969
+ * Set CNAME base domain for prefixed CDN URLs.
1970
+ */
1971
+ cdnCnamePrefixed: string;
1972
+ /**
1973
+ * Set a custom upload URL.
1974
+ */
1975
+ baseUrl: string;
1976
+ /**
1977
+ * Set a custom social sources URL.
1978
+ */
1979
+ socialBaseUrl: string;
1980
+ /**
1981
+ * Secure signature for uploads.
1982
+ */
1983
+ secureSignature: string;
1984
+ /**
1985
+ * Expiry time for secure uploads.
1986
+ */
1987
+ secureExpire: string;
1988
+ /**
1989
+ * Proxy URL for secure delivery.
1990
+ */
1991
+ secureDeliveryProxy: string;
1992
+ /**
1993
+ * Maximum number of retry attempts for throttled requests.
1994
+ */
1995
+ retryThrottledRequestMaxTimes: number;
1996
+ /**
1997
+ * Maximum number of retry attempts for network errors.
1998
+ */
1999
+ retryNetworkErrorMaxTimes: number;
2000
+ /**
2001
+ * Minimum file size for multipart uploads.
2002
+ */
2003
+ multipartMinFileSize: number;
2004
+ /**
2005
+ * Chunk size for multipart uploads.
2006
+ */
2007
+ multipartChunkSize: number;
2008
+ /**
2009
+ * Maximum number of concurrent requests.
2010
+ */
2011
+ maxConcurrentRequests: number;
2012
+ /**
2013
+ * Maximum number of concurrent multipart requests.
2014
+ */
2015
+ multipartMaxConcurrentRequests: number;
2016
+ /**
2017
+ * Maximum number of attempts for multipart uploads.
2018
+ */
2019
+ multipartMaxAttempts: number;
2020
+ /**
2021
+ * Check for URL duplicates.
2022
+ */
2023
+ checkForUrlDuplicates: boolean;
2024
+ /**
2025
+ * Save URL for recurrent uploads.
2026
+ */
2027
+ saveUrlForRecurrentUploads: boolean;
2028
+ /**
2029
+ * Group output files.
2030
+ */
2031
+ groupOutput: boolean;
2032
+ /**
2033
+ * User agent integration string.
2034
+ */
2035
+ userAgentIntegration: string;
2036
+ /**
2037
+ * Enable debug mode.
2038
+ */
2039
+ debug: boolean;
2040
+ /**
2041
+ * Locale name for the uploader.
2042
+ */
2043
+ localeName: string;
2044
+ /**
2045
+ * Expiry threshold for secure uploads.
2046
+ */
2047
+ secureUploadsExpireThreshold: number;
2048
+ /**
2049
+ * Array of plugins to register with the uploader instance.
2050
+ */
2051
+ plugins: UploaderPlugin[];
2052
+ /**
2053
+ * Metadata for the file.
2054
+ */
2055
+ metadata: Metadata | MetadataCallback | null;
2056
+ /**
2057
+ * Override locale definitions.
2058
+ */
2059
+ localeDefinitionOverride: LocaleDefinitionOverride | null;
2060
+ /**
2061
+ * Resolver for secure uploads signature.
2062
+ */
2063
+ secureUploadsSignatureResolver: SecureUploadsSignatureResolver | null;
2064
+ /**
2065
+ * Resolver for secure delivery proxy URL.
2066
+ */
2067
+ secureDeliveryProxyUrlResolver: SecureDeliveryProxyUrlResolver | null;
2068
+ /**
2069
+ * Resolver for icon href.
2070
+ */
2071
+ iconHrefResolver: IconHrefResolver | null;
2072
+ /**
2073
+ * Validators for individual files.
2074
+ */
2075
+ fileValidators: FileValidators;
2076
+ /**
2077
+ * Validators for file collections.
2078
+ */
2079
+ collectionValidators: CollectionValidators;
2080
+ /**
2081
+ * Timeout for async validation functions, in milliseconds.
2082
+ */
2083
+ validationTimeout: number;
2084
+ /**
2085
+ * The number of files to validate concurrently.
2086
+ */
2087
+ validationConcurrency: number;
2088
+ /**
2089
+ * The camera modes to enable in the camera modal,
2090
+ * it is possible to select photo or video capture.
2091
+ * The first mode is the default mode.
2092
+ * @default 'photo,video'
2093
+ */
2094
+ cameraModes: string;
2095
+ /**
2096
+ * The default tab to open in the camera modal,
2097
+ * it is possible to select video or photo capture
2098
+ * @default 'null'
2099
+ * @deprecated - use `cameraModes` instead
2100
+ */
2101
+ defaultCameraMode: CameraMode | null;
2102
+ /**
2103
+ * Enable audio recording.
2104
+ * @default true
2105
+ */
2106
+ enableAudioRecording: boolean;
2107
+ /**
2108
+ * Enable video recording.
2109
+ * @deprecated - use `cameraModes` instead
2110
+ * @default null
2111
+ */
2112
+ enableVideoRecording: boolean | null;
2113
+ /**
2114
+ * The maximum duration of the video recording in seconds
2115
+ * @default null
2116
+ */
2117
+ maxVideoRecordingDuration: number | null;
2118
+ /**
2119
+ * A dictionary object that can contain
2120
+ * the following properties from MediaRecorderOptions
2121
+ */
2122
+ mediaRecorderOptions: MediaRecorderOptions | null;
2123
+ filesViewMode: FilesViewMode;
2124
+ gridShowFileNames: boolean;
2125
+ cloudImageEditorAutoOpen: boolean;
2126
+ qualityInsights: boolean;
2127
+ cloudImageEditorMaskHref: string | null;
2128
+ /**
2129
+ * Adds data-testid attributes to the each block. Needed for testing purposes.
2130
+ * @default false
2131
+ */
2132
+ testMode: boolean;
2133
+ };
2134
+ type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
2135
+ type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
2136
+ type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKeys<ConfigPlainType>;
2137
+ type KebabCase$1<S extends string> = S extends `${infer C}${infer T}` ? T extends Uncapitalize<T> ? `${Uncapitalize<C>}${KebabCase$1<T>}` : `${Uncapitalize<C>}-${KebabCase$1<T>}` : S;
2138
+ type KebabCaseKeys<T extends Record<string, unknown>> = {
2139
+ [Key in keyof T as KebabCase$1<Key & string>]: T[Key];
2140
+ };
2141
+ type LowerCase<S extends string> = Lowercase<S>;
2142
+ type LowerCaseKeys<T extends Record<string, unknown>> = {
2143
+ [Key in keyof T as Lowercase<Key & string>]: T[Key];
2144
+ };
2145
+ type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
2146
+ type OutputCustomErrorType = 'CUSTOM_ERROR';
2147
+ type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
2148
+ type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
2149
+ type OutputFileErrorPayload = {
2150
+ entry: OutputFileEntry;
2151
+ };
2152
+ type OutputErrorTypePayload = {
2153
+ NOT_AN_IMAGE: OutputFileErrorPayload;
2154
+ FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
2155
+ FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
2156
+ SOME_FILES_HAS_ERRORS: {
2157
+ [k: string]: never;
2158
+ };
2159
+ TOO_MANY_FILES: {
2160
+ min: number;
2161
+ max: number;
2162
+ total: number;
2163
+ };
2164
+ TOO_FEW_FILES: {
2165
+ min: number;
2166
+ max: number;
2167
+ total: number;
2168
+ };
2169
+ UPLOAD_ERROR: OutputFileErrorPayload & {
2170
+ error: UploadError;
2171
+ };
2172
+ NETWORK_ERROR: OutputFileErrorPayload & {
2173
+ error: NetworkError;
2174
+ };
2175
+ UNKNOWN_ERROR: OutputFileErrorPayload & {
2176
+ error?: Error;
2177
+ };
2178
+ CUSTOM_ERROR: Record<string, unknown>;
2179
+ };
2180
+ type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType ? {
2181
+ type?: T;
2182
+ message: string;
2183
+ payload?: OutputErrorTypePayload[T];
2184
+ } : T extends keyof OutputErrorTypePayload ? {
2185
+ type: T;
2186
+ message: string;
2187
+ payload?: OutputErrorTypePayload[T];
2188
+ } : never;
2189
+ type OutputErrorFile = OutputError<OutputFileErrorType>;
2190
+ type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
2191
+ type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
2192
+ status: TStatus;
2193
+ internalId: string;
2194
+ name: string;
2195
+ size: number;
2196
+ isImage: boolean;
2197
+ mimeType: string;
2198
+ metadata: Metadata | null;
2199
+ file: File | Blob | null;
2200
+ externalUrl: string | null;
2201
+ uploadProgress: number;
2202
+ fullPath: string | null;
2203
+ source: SourceTypes | null;
2204
+ isValidationPending: boolean;
2205
+ } & ({
2206
+ status: 'success';
2207
+ fileInfo: UploadcareFile;
2208
+ uuid: string;
2209
+ cdnUrl: string;
2210
+ cdnUrlModifiers: string;
2211
+ isUploading: false;
2212
+ isSuccess: true;
2213
+ isFailed: false;
2214
+ isRemoved: false;
2215
+ errors: [];
2216
+ } | {
2217
+ status: 'failed';
2218
+ fileInfo: UploadcareFile | null;
2219
+ uuid: string | null;
2220
+ cdnUrl: string | null;
2221
+ cdnUrlModifiers: string | null;
2222
+ isUploading: false;
2223
+ isSuccess: false;
2224
+ isFailed: true;
2225
+ isRemoved: false;
2226
+ errors: OutputError<OutputFileErrorType>[];
2227
+ } | {
2228
+ status: 'uploading';
2229
+ fileInfo: null;
2230
+ uuid: null;
2231
+ cdnUrl: null;
2232
+ cdnUrlModifiers: null;
2233
+ isUploading: true;
2234
+ isSuccess: false;
2235
+ isFailed: false;
2236
+ isRemoved: false;
2237
+ errors: [];
2238
+ } | {
2239
+ status: 'removed';
2240
+ fileInfo: UploadcareFile | null;
2241
+ uuid: string | null;
2242
+ cdnUrl: string | null;
2243
+ cdnUrlModifiers: string | null;
2244
+ isUploading: false;
2245
+ isSuccess: false;
2246
+ isFailed: false;
2247
+ isRemoved: true;
2248
+ errors: OutputError<OutputFileErrorType>[];
2249
+ } | {
2250
+ status: 'idle';
2251
+ fileInfo: null;
2252
+ uuid: null;
2253
+ cdnUrl: null;
2254
+ cdnUrlModifiers: null;
2255
+ isUploading: false;
2256
+ isSuccess: false;
2257
+ isFailed: false;
2258
+ isRemoved: false;
2259
+ errors: [];
2260
+ });
2261
+ type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
2262
+ type GroupFlag = 'has-group' | 'maybe-has-group';
2263
+ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'> = {
2264
+ status: TStatus;
2265
+ totalCount: number;
2266
+ successCount: number;
2267
+ failedCount: number;
2268
+ uploadingCount: number;
2269
+ progress: number;
2270
+ successEntries: OutputFileEntry<'success'>[];
2271
+ failedEntries: OutputFileEntry<'failed'>[];
2272
+ uploadingEntries: OutputFileEntry<'uploading'>[];
2273
+ idleEntries: OutputFileEntry<'idle'>[];
2274
+ } & (TGroupFlag extends 'has-group' ? {
2275
+ group: UploadcareGroup;
2276
+ } : TGroupFlag extends 'maybe-has-group' ? {
2277
+ group: UploadcareGroup | null;
2278
+ } : never) & ({
2279
+ status: 'idle';
2280
+ isFailed: false;
2281
+ isUploading: false;
2282
+ isSuccess: false;
2283
+ errors: [];
2284
+ allEntries: OutputFileEntry<'idle' | 'success'>[];
2285
+ } | {
2286
+ status: 'uploading';
2287
+ isFailed: false;
2288
+ isUploading: true;
2289
+ isSuccess: false;
2290
+ errors: [];
2291
+ allEntries: OutputFileEntry[];
2292
+ } | {
2293
+ status: 'success';
2294
+ isFailed: false;
2295
+ isUploading: false;
2296
+ isSuccess: true;
2297
+ errors: [];
2298
+ allEntries: OutputFileEntry<'success'>[];
2299
+ } | {
2300
+ status: 'failed';
2301
+ isFailed: true;
2302
+ isUploading: false;
2303
+ isSuccess: false;
2304
+ errors: OutputError<OutputCollectionErrorType>[];
2305
+ allEntries: OutputFileEntry[];
2306
+ });
2307
+
2308
+ declare class SecureUploadsManager extends SharedInstance {
2309
+ private _secureToken;
2310
+ getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
2311
+ destroy(): void;
2312
+ }
2313
+
2314
+ type CommonEventType = InternalEventKey | EventKey;
2315
+ type TelemetryState = TelemetryRequest & {
2316
+ eventTimestamp: number;
2317
+ location: string;
2318
+ };
2319
+ type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
2320
+ modalId?: string;
2321
+ eventType?: CommonEventType;
2322
+ };
2323
+ declare class TelemetryManager extends SharedInstance {
2324
+ private readonly _sessionId;
2325
+ private readonly _telemetryInstance;
2326
+ private _config;
2327
+ private _initialized;
2328
+ private _lastPayload;
2329
+ private readonly _queue;
2330
+ private _isEnabled;
2331
+ constructor(sharedInstancesBag: SharedInstancesBag);
2332
+ private _init;
2333
+ private _setConfig;
2334
+ private _formattingPayload;
2335
+ private _excludedEvents;
2336
+ sendEvent(body: TelemetryEventBody): void;
2337
+ sendEventError(error: unknown, context?: string): void;
2338
+ /**
2339
+ * Method to send telemetry event for Cloud Image Editor.
2340
+ */
2341
+ sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
2342
+ /**
2343
+ * Deeply compares two objects and returns true if they are equal, false otherwise.
2344
+ */
2345
+ private _checkObj;
2346
+ private get _timestamp();
2347
+ private get _solution();
2348
+ private get _activity();
2349
+ private get _location();
2350
+ }
2351
+
2352
+ interface ISharedInstance {
2353
+ destroy?(): void;
2354
+ }
2355
+ declare class SharedInstance {
2356
+ protected _ctx: PubSub<SharedState>;
2357
+ protected _sharedInstancesBag: SharedInstancesBag;
2358
+ private _subscriptions;
2359
+ private _cfgProxy;
2360
+ protected _debugPrint: (...args: unknown[]) => void;
2361
+ constructor(sharedInstancesBag: SharedInstancesBag);
2362
+ protected addSub(unsub: () => void): void;
2363
+ protected get _cfg(): Readonly<ConfigType>;
2364
+ destroy(): void;
2365
+ }
2366
+ declare const instanceKeyMap: {
2367
+ modalManager: "*modalManager";
2368
+ pluginManager: "*pluginManager";
2369
+ telemetryManager: "*telemetryManager";
2370
+ localeManager: "*localeManager";
2371
+ a11y: "*a11y";
2372
+ blocksRegistry: "*blocksRegistry";
2373
+ eventEmitter: "*eventEmitter";
2374
+ uploadCollection: "*uploadCollection";
2375
+ secureUploadsManager: "*secureUploadsManager";
2376
+ api: "*publicApi";
2377
+ validationManager: "*validationManager";
2378
+ };
2379
+ type InstanceTypeMap = {
2380
+ [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
2381
+ };
2382
+ type InstanceName = keyof typeof instanceKeyMap;
2383
+ type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
2384
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2385
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2386
+ readonly ctx: PubSub<SharedState>;
2387
+ readonly modalManager: ModalManager | null;
2388
+ readonly pluginManager: PluginManager;
2389
+ readonly telemetryManager: TelemetryManager;
2390
+ readonly localeManager: LocaleManager;
2391
+ readonly a11y: A11y;
2392
+ readonly blocksRegistry: Set<LitBlock>;
2393
+ readonly eventEmitter: EventEmitter;
2394
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2395
+ readonly secureUploadsManager: SecureUploadsManager;
2396
+ readonly api: UploaderPublicApi;
2397
+ readonly validationManager: ValidationManager;
2398
+ when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
2399
+ };
2400
+
2401
+ type PluginVersion = string;
2402
+ type PluginIconRegistration = {
2403
+ name: string;
2404
+ svg: string;
2405
+ };
2406
+ type PluginI18nRegistration = Record<string, Record<string, string>>;
2407
+ type PluginSourceRegistration = {
2408
+ id: string;
2409
+ label: string;
2410
+ icon?: string;
2411
+ onSelect: () => Promise<void> | void;
2412
+ };
2413
+ type PluginRenderDispose = () => void;
2414
+ type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
2415
+ type PluginActivityRegistration = {
2416
+ id: string;
2417
+ render: PluginRender;
2418
+ };
2419
+ type PluginFileActionRegistration = {
2420
+ id: string;
2421
+ icon: string;
2422
+ shouldRender: (fileEntry: OutputFileEntry) => boolean;
2423
+ onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
2424
+ };
2425
+ type PluginRegistryApi = {
2426
+ registerSource: (source: PluginSourceRegistration) => PluginSourceRegistration;
2427
+ registerActivity: (activity: PluginActivityRegistration) => PluginActivityRegistration;
2428
+ registerFileAction: (fileAction: PluginFileActionRegistration) => PluginFileActionRegistration;
2429
+ registerIcon: (icon: PluginIconRegistration) => PluginIconRegistration;
2430
+ registerI18n: (i18n: PluginI18nRegistration) => PluginI18nRegistration;
2431
+ registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
2432
+ };
2433
+ /**
2434
+ * API for managing plugin config subscriptions
2435
+ */
2436
+ type PluginConfigApi = {
2437
+ /**
2438
+ * Get the current value of a config option.
2439
+ *
2440
+ * @param configName - The name of the config to get
2441
+ * @returns The current config value
2442
+ *
2443
+ * @example
2444
+ * ```typescript
2445
+ * const theme = pluginApi.config.get('my-theme');
2446
+ * console.log('Current theme:', theme);
2447
+ * ```
2448
+ */
2449
+ get: <T = unknown>(configName: keyof (ConfigType & CustomConfig)) => T;
2450
+ /**
2451
+ * Subscribe to changes in a custom config value.
2452
+ * The callback will be called immediately with the current value,
2453
+ * and then whenever the value changes.
2454
+ *
2455
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
2456
+ *
2457
+ * @param configName - The name of the custom config to subscribe to
2458
+ * @param callback - Function to call with the new value
2459
+ * @returns Unsubscribe function
2460
+ *
2461
+ * @example
2462
+ * ```typescript
2463
+ * pluginApi.config.subscribe('my-option', (value) => {
2464
+ * console.log('Config changed:', value);
2465
+ * });
2466
+ * // Cleanup happens automatically on plugin disposal
2467
+ * ```
2468
+ */
2469
+ subscribe: <T = unknown>(configName: keyof (ConfigType & CustomConfig), callback: (value: T) => void) => () => void;
2470
+ };
2471
+ /**
2472
+ * API for managing plugin activity interactions
2473
+ */
2474
+ type PluginActivityApi = {
2475
+ /**
2476
+ * Get the current activity parameters.
2477
+ *
2478
+ * @returns The current activity parameters object
2479
+ *
2480
+ * @example
2481
+ * ```typescript
2482
+ * const params = pluginApi.activity.getParams();
2483
+ * console.log('Current params:', params);
2484
+ * ```
2485
+ */
2486
+ getParams: () => Record<string, unknown>;
2487
+ /**
2488
+ * Subscribe to changes in activity parameters.
2489
+ * The callback will be called immediately with the current params,
2490
+ * and then whenever the params change.
2491
+ *
2492
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
2493
+ *
2494
+ * @param callback - Function to call with the new params
2495
+ * @returns Unsubscribe function
2496
+ *
2497
+ * @example
2498
+ * ```typescript
2499
+ * pluginApi.activity.subscribeToParams((params) => {
2500
+ * console.log('Activity params changed:', params);
2501
+ * });
2502
+ * // Cleanup happens automatically on plugin disposal
2503
+ * ```
2504
+ */
2505
+ subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
2506
+ };
2507
+ type PluginApi = {
2508
+ registry: PluginRegistryApi;
2509
+ config: PluginConfigApi;
2510
+ activity: PluginActivityApi;
2511
+ };
2512
+ type PluginUploaderApi = UploaderPublicApi;
2513
+ type PluginExports = {
2514
+ dispose?: () => void;
2515
+ };
2516
+ type PluginSetupResult = PluginExports | void | Promise<PluginExports | void>;
2517
+ type PluginSetupParams = {
2518
+ pluginApi: PluginApi;
2519
+ uploaderApi: PluginUploaderApi;
2520
+ };
2521
+ type UploaderPlugin = {
2522
+ id: string;
2523
+ version: PluginVersion;
2524
+ setup: (params: PluginSetupParams) => PluginSetupResult;
2525
+ };
2526
+ type Owned<T> = T & {
2527
+ pluginId: string;
2528
+ };
2529
+ type PluginRegistrySnapshot = {
2530
+ sources: Owned<PluginSourceRegistration>[];
2531
+ activities: Owned<PluginActivityRegistration>[];
2532
+ fileActions: Owned<PluginFileActionRegistration>[];
2533
+ icons: Owned<PluginIconRegistration>[];
2534
+ i18n: Owned<PluginI18nRegistration>[];
2535
+ };
2536
+
2537
+ declare class PluginManager extends SharedInstance {
2538
+ private _plugins;
2539
+ private _sources;
2540
+ private _activities;
2541
+ private _fileActions;
2542
+ private _icons;
2543
+ private _i18n;
2544
+ private _subscribers;
2545
+ private _pluginsUpdate;
2546
+ readonly configRegistry: CustomConfigRegistry;
2547
+ constructor(sharedInstancesBag: SharedInstancesBag);
2548
+ onPluginsChange(callback: () => void): () => void;
2549
+ private _syncPlugins;
2550
+ private _registerPlugin;
2551
+ private _unregisterPlugin;
2552
+ snapshot(): PluginRegistrySnapshot;
2553
+ destroy(): void;
2554
+ private _register;
2555
+ private _purgeRegistrations;
2556
+ private _notifySubscribers;
2557
+ }
2558
+
2559
+ type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
2560
+ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2561
+
2562
+ declare class LitSolutionBlock extends LitBlock {
2563
+ static styleAttrs: string[];
2564
+ init$: {
2565
+ '*solution': string | null;
2566
+ '*commonProgress': number;
2567
+ '*uploadList': never[];
2568
+ '*uploadQueue': _uploadcare_upload_client.Queue;
2569
+ '*collectionErrors': OutputErrorCollection[];
2570
+ '*collectionState': OutputCollectionState | null;
2571
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
2572
+ '*uploadTrigger': Set<string>;
2573
+ '*currentActivity': null;
2574
+ '*currentActivityParams': {};
2575
+ '*history': never[];
2576
+ '*historyBack': null;
2577
+ '*closeModal': () => void;
2578
+ };
2579
+ initCallback(): void;
2580
+ render(): lit_html.TemplateResult<1>;
2581
+ }
2582
+
2583
+ type CssPropValue = string | number | undefined | null;
2584
+ declare const ImgConfig_base: typeof LitElement & Constructor<LitElement> & {
2585
+ reg(tagName: string): void;
2586
+ } & Constructor<{
2587
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
2588
+ }>;
2589
+ declare class ImgConfig extends ImgConfig_base {
2590
+ private _state;
2591
+ private _subscribers;
2592
+ private _isnObserver;
2593
+ private _observed;
2594
+ createRenderRoot(): HTMLElement | ShadowRoot;
2595
+ constructor();
2596
+ protected $$(key: string): unknown;
2597
+ protected set$$(kvObj: Record<string, CssPropValue>): void;
2598
+ protected sub$$<T = unknown>(key: string, kbFn: (val: T) => void): void;
2599
+ private _notify;
2600
+ protected analyticsParams(): string;
2601
+ protected initAttributes(el: HTMLElement): void;
2602
+ protected initIntersection(el: HTMLElement, cbkFn: () => void): void;
2603
+ connectedCallback(): void;
2604
+ private _initCssProperties;
2605
+ disconnectedCallback(): void;
2606
+ static get observedAttributes(): string[];
2607
+ attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
2608
+ }
2609
+
2610
+ declare class ImgBase extends ImgConfig {
2611
+ private _img;
2612
+ private _imgPreview;
2613
+ private _fmtAbs;
2614
+ private _validateSize;
2615
+ private _getCdnModifiers;
2616
+ private _getTypedCssValue;
2617
+ private _getUrlBase;
2618
+ private _proxyUrl;
2619
+ protected _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
2620
+ private _setupEventProxy;
2621
+ protected get img(): HTMLImageElement;
2622
+ private get _currentImg();
2623
+ private get _hasPreviewImage();
2624
+ private get _bgSelector();
2625
+ private get _breakpoints();
2626
+ private get _hasFormatJPG();
2627
+ private _renderBg;
2628
+ private _getSrcset;
2629
+ private _getSrc;
2630
+ private get _srcUrlPreview();
2631
+ private _renderBackground;
2632
+ private _appendURL;
2633
+ private _setupConfigForImage;
2634
+ private _loaderImage;
2635
+ private _renderImage;
2636
+ protected init(): void;
2637
+ }
2638
+
2639
+ declare class Img extends ImgBase {
2640
+ attributesMeta: {
2641
+ src: string;
2642
+ } | {
2643
+ uuid: string;
2644
+ };
2645
+ connectedCallback(): void;
2646
+ }
2647
+ declare global {
2648
+ interface HTMLElementTagNameMap {
2649
+ 'uc-img': Img;
2650
+ }
2651
+ }
2652
+
2653
+ declare class FormInput extends LitUploaderBlock {
2654
+ attributesMeta: {
2655
+ 'ctx-name': string;
2656
+ name?: string;
2657
+ };
2658
+ private _validationInputElement;
2659
+ private _dynamicInputsContainer;
2660
+ nameAttrValue?: string;
2661
+ private get _inputName();
2662
+ private _createValidationInput;
2663
+ initCallback(): void;
2664
+ }
2665
+ declare global {
2666
+ interface HTMLElementTagNameMap {
2667
+ 'uc-form-input': FormInput;
2668
+ }
2669
+ }
2670
+
2671
+ declare class Copyright extends LitBlock {
2672
+ initCallback(): void;
2673
+ render(): lit_html.TemplateResult<1>;
2674
+ }
2675
+ declare global {
2676
+ interface HTMLElementTagNameMap {
2677
+ 'uc-copyright': Copyright;
2678
+ }
2679
+ }
2680
+
2681
+ declare class ProgressBarCommon extends LitUploaderBlock {
2682
+ private _unobserveCollectionCb?;
2683
+ private _visible;
2684
+ private _value;
2685
+ constructor();
2686
+ initCallback(): void;
2687
+ protected updated(changedProperties: PropertyValues<this>): void;
2688
+ disconnectedCallback(): void;
2689
+ render(): lit_html.TemplateResult<1>;
2690
+ }
2691
+ declare global {
2692
+ interface HTMLElementTagNameMap {
2693
+ 'uc-progress-bar-common': ProgressBarCommon;
2694
+ }
2695
+ }
2696
+
2697
+ type SourceButtonConfig = {
2698
+ id: string;
2699
+ label: string;
2700
+ icon?: string;
2701
+ onClick: () => void | Promise<void>;
2702
+ };
2703
+ declare class SourceBtn extends LitUploaderBlock {
2704
+ couldBeCtxOwner: boolean;
2705
+ source?: SourceButtonConfig;
2706
+ private _iconName;
2707
+ private _srcTypeKey;
2708
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2709
+ private _applySource;
2710
+ activate(): void;
2711
+ render(): lit_html.TemplateResult<1>;
2712
+ }
2713
+ declare global {
2714
+ interface HTMLElementTagNameMap {
2715
+ 'uc-source-btn': SourceBtn;
2716
+ }
2717
+ }
2718
+
2719
+ declare class SourceList extends LitUploaderBlock {
2720
+ private _rawSourceList;
2721
+ private _cameraModes;
2722
+ private _unsubscribePlugins?;
2723
+ private _sources;
2724
+ /**
2725
+ * CSS-only attribute
2726
+ */
2727
+ wrap: boolean;
2728
+ initCallback(): void;
2729
+ protected updated(changedProperties: PropertyValues<this>): void;
2730
+ private _updateSources;
2731
+ private _expandSource;
2732
+ private _makeBuiltInSourceConfig;
2733
+ private _makePluginSourceConfig;
2734
+ private _openActivity;
2735
+ render(): lit_html.TemplateResult<1>;
2736
+ disconnectedCallback(): void;
2737
+ }
2738
+ declare global {
2739
+ interface HTMLElementTagNameMap {
2740
+ 'uc-source-list': SourceList;
2741
+ }
2742
+ }
2743
+
2744
+ declare class StartFrom extends LitActivityBlock {
2745
+ protected historyTracked: boolean;
2746
+ activityType: ActivityType;
2747
+ initCallback(): void;
2748
+ render(): lit_html.TemplateResult<1>;
2749
+ }
2750
+ declare global {
2751
+ interface HTMLElementTagNameMap {
2752
+ 'uc-start-from': StartFrom;
2753
+ }
2754
+ }
2755
+
2756
+ type EventListenerMap = {
2757
+ [K in (typeof EventType)[keyof typeof EventType]]: (e: CustomEvent<EventPayload[K]>) => void;
2758
+ };
2759
+ declare class UploadCtxProvider extends LitUploaderBlock {
2760
+ attributesMeta: {
2761
+ 'ctx-name': string;
2762
+ };
2763
+ static styleAttrs: string[];
2764
+ static EventType: Readonly<{
2765
+ readonly FILE_ADDED: "file-added";
2766
+ readonly FILE_REMOVED: "file-removed";
2767
+ readonly FILE_UPLOAD_START: "file-upload-start";
2768
+ readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
2769
+ readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
2770
+ readonly FILE_UPLOAD_FAILED: "file-upload-failed";
2771
+ readonly FILE_URL_CHANGED: "file-url-changed";
2772
+ readonly MODAL_OPEN: "modal-open";
2773
+ readonly MODAL_CLOSE: "modal-close";
2774
+ readonly DONE_CLICK: "done-click";
2775
+ readonly UPLOAD_CLICK: "upload-click";
2776
+ readonly ACTIVITY_CHANGE: "activity-change";
2777
+ readonly COMMON_UPLOAD_START: "common-upload-start";
2778
+ readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
2779
+ readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
2780
+ readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
2781
+ readonly CHANGE: "change";
2782
+ readonly GROUP_CREATED: "group-created";
2783
+ }>;
2784
+ private _unbindEventEmitter;
2785
+ initCallback(): void;
2786
+ disconnectedCallback(): void;
2787
+ }
2788
+ interface UploadCtxProvider extends LitUploaderBlock {
2789
+ addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
2790
+ removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
2791
+ }
2792
+ declare global {
2793
+ interface HTMLElementTagNameMap {
2794
+ 'uc-upload-ctx-provider': UploadCtxProvider;
2795
+ }
2796
+ }
2797
+
2798
+ declare class UrlSource extends LitUploaderBlock {
2799
+ private _formState;
2800
+ private _inputRef;
2801
+ private _handleInput;
2802
+ private _handleUpload;
2803
+ firstUpdated(): void;
2804
+ render(): lit_html.TemplateResult<1>;
2805
+ }
2806
+ declare global {
2807
+ interface HTMLElementTagNameMap {
2808
+ 'uc-url-source': UrlSource;
2809
+ }
2810
+ }
2811
+
2812
+ declare class SimpleBtn extends LitUploaderBlock {
2813
+ static styleAttrs: string[];
2814
+ couldBeCtxOwner: boolean;
2815
+ dropzone: boolean;
2816
+ private _buttonTextKey;
2817
+ private readonly _handleClick;
2818
+ initCallback(): void;
2819
+ render(): lit_html.TemplateResult<1>;
2820
+ }
2821
+ declare global {
2822
+ interface HTMLElementTagNameMap {
2823
+ 'uc-simple-btn': SimpleBtn;
2824
+ }
2825
+ }
2826
+
2827
+ declare class PluginActivityHost extends LitActivityBlock {
2828
+ registration: Owned<PluginActivityRegistration>;
2829
+ activityType: ActivityType;
2830
+ private _dispose?;
2831
+ private _containerRef;
2832
+ initCallback(): void;
2833
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2834
+ private _ensureRegistered;
2835
+ private _renderActivity;
2836
+ private _disposeActivity;
2837
+ disconnectedCallback(): void;
2838
+ render(): lit_html.TemplateResult<1>;
2839
+ }
2840
+ declare class PluginActivityRenderer extends LitBlock {
2841
+ mode: 'modal' | 'inline';
2842
+ private _activities;
2843
+ private _unsubscribePlugins?;
2844
+ initCallback(): void;
2845
+ private _syncActivities;
2846
+ disconnectedCallback(): void;
2847
+ render(): lit_html.TemplateResult<1>;
2848
+ }
2849
+ declare global {
2850
+ interface HTMLElementTagNameMap {
2851
+ 'uc-plugin-activity-host': PluginActivityHost;
2852
+ 'uc-plugin-activity-renderer': PluginActivityRenderer;
2853
+ }
2854
+ }
2855
+
2856
+ declare class FileUploaderRegular extends LitSolutionBlock {
2857
+ attributesMeta: {
2858
+ headless?: boolean;
2859
+ 'ctx-name': string;
2860
+ };
2861
+ static styleAttrs: string[];
2862
+ headless: boolean;
2863
+ constructor();
2864
+ initCallback(): void;
2865
+ render(): lit_html.TemplateResult<1>;
2866
+ }
2867
+ declare global {
2868
+ interface HTMLElementTagNameMap {
2869
+ 'uc-file-uploader-regular': FileUploaderRegular;
2870
+ }
2871
+ }
2872
+
2873
+ declare class FileUploaderInline extends LitSolutionBlock {
2874
+ attributesMeta: {
2875
+ 'ctx-name': string;
2876
+ };
2877
+ static styleAttrs: string[];
2878
+ private _couldCancel;
2879
+ constructor();
2880
+ private _handleCancel;
2881
+ private get _couldHistoryBack();
2882
+ private get _couldShowList();
2883
+ private _getInitActivity;
2884
+ initCallback(): void;
2885
+ render(): lit_html.TemplateResult<1>;
2886
+ }
2887
+ declare global {
2888
+ interface HTMLElementTagNameMap {
2889
+ 'uc-file-uploader-inline': FileUploaderInline;
2890
+ }
2891
+ }
2892
+
2893
+ declare class FileUploaderMinimal extends LitSolutionBlock {
2894
+ attributesMeta: {
2895
+ 'ctx-name': string;
2896
+ };
2897
+ static styleAttrs: string[];
2898
+ private _singleUpload;
2899
+ private _isHiddenStartFrom;
2900
+ private _classUploadList;
2901
+ private _classStartFrom;
2902
+ private _getInitActivity;
2903
+ constructor();
2904
+ private _handleModalOpen;
2905
+ private _handleModalClose;
2906
+ initCallback(): void;
2907
+ disconnectedCallback(): void;
2908
+ render(): lit_html.TemplateResult<1>;
2909
+ }
2910
+ declare global {
2911
+ interface HTMLElementTagNameMap {
2912
+ 'uc-file-uploader-minimal': FileUploaderMinimal;
2913
+ }
2914
+ }
2915
+
2916
+ declare const PACKAGE_NAME = "blocks";
2917
+ declare const PACKAGE_VERSION: string;
2918
+
2919
+ type SharedConfigState = {
2920
+ [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2921
+ };
2922
+ type BlocksRegistry = Set<LitBlock>;
2923
+ type ActivityBlockCtxState = {
2924
+ '*currentActivity': RegisteredActivityType | null;
2925
+ '*currentActivityParams': Record<string, unknown>;
2926
+ '*history': (RegisteredActivityType | null)[];
2927
+ '*historyBack': (() => void) | null;
2928
+ '*closeModal': () => void;
2929
+ };
2930
+ type UploaderBlockCtxState = ActivityBlockCtxState & {
2931
+ '*commonProgress': number;
2932
+ '*uploadList': {
2933
+ uid: Uid;
2934
+ }[];
2935
+ '*uploadQueue': Queue;
2936
+ '*collectionErrors': OutputErrorCollection[];
2937
+ '*collectionState': OutputCollectionState | null;
2938
+ '*groupInfo': UploadcareGroup | null;
2939
+ '*uploadTrigger': Set<Uid>;
2940
+ };
2941
+ type SolutionBlockCtxState = UploaderBlockCtxState & {
2942
+ '*solution': string | null;
2943
+ };
2944
+ type CloudImageEditorState = {
2945
+ '*originalUrl': string | null;
2946
+ '*loadingOperations': LoadingOperations;
2947
+ '*faderEl': EditorImageFader | null;
2948
+ '*cropperEl': EditorImageCropper | null;
2949
+ '*imgEl': HTMLImageElement | null;
2950
+ '*imgContainerEl': HTMLElement | null;
2951
+ '*networkProblems': boolean;
2952
+ '*imageSize': {
2953
+ width: number;
2954
+ height: number;
2955
+ } | null;
2956
+ '*editorTransformations': Transformations;
2957
+ '*cropPresetList': CropPresetList;
2958
+ '*currentAspectRatio': CropAspectRatio | null;
2959
+ '*tabList': readonly TabIdValue$1[];
2960
+ '*tabId': TabIdValue$1;
2961
+ '*on.retryNetwork': () => void;
2962
+ '*on.apply': (transformations: Transformations) => void;
2963
+ '*on.cancel': () => void;
2964
+ };
2965
+ type EditorImageCropperState = {
2966
+ '*padding': number;
2967
+ '*operations': {
2968
+ rotate: number;
2969
+ mirror: boolean;
2970
+ flip: boolean;
2971
+ };
2972
+ '*imageBox': {
2973
+ x: number;
2974
+ y: number;
2975
+ width: number;
2976
+ height: number;
2977
+ };
2978
+ '*cropBox': {
2979
+ x: number;
2980
+ y: number;
2981
+ width: number;
2982
+ height: number;
2983
+ };
2984
+ };
2985
+ type EditorToolbarState = {
2986
+ '*showListAspectRatio': boolean;
2987
+ '*sliderEl': EditorSlider | null;
2988
+ '*showSlider': boolean;
2989
+ '*currentFilter': string;
2990
+ '*currentOperation': string | null;
2991
+ '*operationTooltip': string | null;
2992
+ };
2993
+ type SharedContextInstances = Map<string, ISharedInstance>;
2994
+ type DynamicBlockState = {
2995
+ '*sharedContextInstances': SharedContextInstances;
2996
+ '*blocksRegistry': BlocksRegistry;
2997
+ '*eventEmitter': EventEmitter;
2998
+ '*localeManager': LocaleManager;
2999
+ '*telemetryManager': TelemetryManager;
3000
+ '*a11y': A11y;
3001
+ '*modalManager': ModalManager | null;
3002
+ '*pluginManager': PluginManager;
3003
+ };
3004
+ type DynamicUploaderBlockState = {
3005
+ '*uploadCollection': TypedCollection<UploadEntryData>;
3006
+ '*publicApi': UploaderPublicApi;
3007
+ '*validationManager': ValidationManager;
3008
+ '*secureUploadsManager': SecureUploadsManager;
3009
+ };
3010
+ type LocaleState = {
3011
+ [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
3012
+ };
3013
+ type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
3014
+
3015
+ declare const LitBlockBase: typeof LitElement & Constructor<{
3016
+ willYield: boolean;
3017
+ yield(slot: string, defaultContent?: unknown): unknown;
3018
+ }> & Constructor<{
3019
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
3020
+ }> & Constructor<SymbioteComponent<SharedState>> & Constructor<LitElement> & {
3021
+ reg(tagName: string): void;
3022
+ };
3023
+ declare class LitBlock extends LitBlockBase {
3024
+ private _cfgProxy;
3025
+ static styleAttrs: string[];
3026
+ activityType: ActivityType;
3027
+ init$: {};
3028
+ constructor();
3029
+ l10n: (str: string, variables?: Record<string, string | number>) => string;
3030
+ debugPrint: (...args: unknown[]) => void;
3031
+ protected _sharedInstancesBag: {
3032
+ readonly ctx: PubSub<SharedState>;
3033
+ readonly modalManager: ModalManager | null;
3034
+ readonly pluginManager: PluginManager;
3035
+ readonly telemetryManager: TelemetryManager;
3036
+ readonly localeManager: LocaleManager;
3037
+ readonly a11y: A11y;
3038
+ readonly blocksRegistry: Set<LitBlock>;
3039
+ readonly eventEmitter: EventEmitter;
3040
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
3041
+ readonly secureUploadsManager: SecureUploadsManager;
3042
+ readonly api: UploaderPublicApi;
3043
+ readonly validationManager: ValidationManager;
3044
+ when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
3045
+ modalManager: ModalManager | null;
3046
+ pluginManager: PluginManager;
3047
+ telemetryManager: TelemetryManager;
3048
+ localeManager: LocaleManager;
3049
+ a11y: A11y;
3050
+ blocksRegistry: BlocksRegistry;
3051
+ eventEmitter: EventEmitter;
3052
+ uploadCollection: TypedCollection<UploadEntryData>;
3053
+ secureUploadsManager: SecureUploadsManager;
3054
+ api: UploaderPublicApi;
3055
+ validationManager: ValidationManager;
3056
+ }[TName]>) => void): () => void;
3057
+ };
3058
+ emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
3059
+ hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
3060
+ connectedCallback(): void;
3061
+ initCallback(): void;
3062
+ get testId(): string;
3063
+ get modalManager(): ModalManager | null;
3064
+ get telemetryManager(): TelemetryManager;
3065
+ get localeManager(): LocaleManager;
3066
+ get a11y(): A11y;
3067
+ get blocksRegistry(): Set<LitBlock>;
3068
+ get eventEmitter(): EventEmitter;
3069
+ disconnectedCallback(): void;
3070
+ /**
3071
+ * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
3072
+ */
3073
+ private destroyCtxCallback;
3074
+ private _getSharedContextInstances;
3075
+ protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
3076
+ private _destroySharedContextInstances;
3077
+ protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
3078
+ protected proxyUrl(url: string): Promise<string>;
3079
+ get cfg(): ConfigType;
3080
+ subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void): () => void;
3081
+ }
3082
+
3083
+ declare class Modal extends LitBlock {
3084
+ static styleAttrs: string[];
3085
+ private _mouseDownTarget;
3086
+ /** WARNING: Do not rename/change this, it's used in dashboard */
3087
+ protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
3088
+ /**
3089
+ * CSS-only attribute
3090
+ */
3091
+ strokes: boolean;
3092
+ /**
3093
+ * CSS-only attribute
3094
+ */
3095
+ blockBodyScrolling: boolean;
3096
+ /** WARNING: Do not rename/change this, it's used in dashboard */
3097
+ protected closeDialog: () => void;
3098
+ private _handleDialogClose;
3099
+ private _handleDialogMouseDown;
3100
+ private _handleDialogMouseUp;
3101
+ show(): void;
3102
+ hide(): void;
3103
+ private _handleModalOpen;
3104
+ private _handleModalClose;
3105
+ private _handleModalCloseAll;
3106
+ initCallback(): void;
3107
+ disconnectedCallback(): void;
3108
+ private _handleDialogRef;
3109
+ render(): lit_html.TemplateResult<1>;
3110
+ }
3111
+ declare global {
3112
+ interface HTMLElementTagNameMap {
3113
+ 'uc-modal': Modal;
3114
+ }
3115
+ }
3116
+
3117
+ declare const ModalEvents: Readonly<{
3118
+ readonly ADD: "modal:add";
3119
+ readonly DELETE: "modal:delete";
3120
+ readonly OPEN: "modal:open";
3121
+ readonly CLOSE: "modal:close";
3122
+ readonly CLOSE_ALL: "modal:closeAll";
3123
+ readonly DESTROY: "modal:destroy";
3124
+ }>;
3125
+ type ModalId = ActivityType;
3126
+ type ModalCb = (data: {
3127
+ id: ModalId;
3128
+ modal: Modal;
3129
+ }) => void;
3130
+ type ModalEventType = (typeof ModalEvents)[keyof typeof ModalEvents];
3131
+ declare class ModalManager extends SharedInstance {
3132
+ private _modals;
3133
+ private _activeModals;
3134
+ private _subscribers;
3135
+ /**
3136
+ * Register a modal with the manager
3137
+ * @param id Unique identifier for the modal
3138
+ * @param modal Modal component instance
3139
+ */
3140
+ registerModal(id: ModalId, modal: Modal): void;
3141
+ /** Remove a modal by ID. */
3142
+ deleteModal(id: ModalId): boolean;
3143
+ /** Open a modal by its ID. */
3144
+ open(id: ModalId): boolean;
3145
+ /** Close a specific modal by ID. */
3146
+ close(id: ModalId): boolean;
3147
+ /** Toggle a modal - open if closed, close if open. */
3148
+ toggle(id: ModalId): boolean;
3149
+ /** True if there are any active modals. */
3150
+ get hasActiveModals(): boolean;
3151
+ /** Close the most recently opened modal and return to the previous one. */
3152
+ back(): boolean;
3153
+ /** Close all open modals. */
3154
+ closeAll(): number;
3155
+ /**
3156
+ * Subscribe to modal events
3157
+ * @returns Unsubscribe function
3158
+ */
3159
+ subscribe(event: ModalEventType, callback: ModalCb): () => void;
3160
+ /** Unsubscribe from modal events */
3161
+ unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
3162
+ /** Notify all subscribers of a modal event. */
3163
+ private _notify;
3164
+ /** Destroy the modal manager, clean up resources */
3165
+ destroy(): void;
3166
+ }
3167
+
3168
+ export { LitActivityBlock as ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, CameraSource, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, type CustomActivities, type CustomConfig, type CustomConfigDefinition, PubSub as Data, DropArea, 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, 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, PluginActivityHost, PluginActivityRenderer, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, 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 };