@uploadcare/file-uploader 1.25.0-alpha.9 → 1.26.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 (72) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +3 -3
  4. package/dist/index.d.ts +2206 -1890
  5. package/dist/index.js +5 -5
  6. package/dist/index.layered.css +3 -3
  7. package/dist/index.ssr.js +4 -21
  8. package/dist/locales/file-uploader/ar.js +2 -2
  9. package/dist/locales/file-uploader/az.js +2 -2
  10. package/dist/locales/file-uploader/ca.js +2 -2
  11. package/dist/locales/file-uploader/cs.js +2 -2
  12. package/dist/locales/file-uploader/da.js +2 -2
  13. package/dist/locales/file-uploader/de.js +2 -2
  14. package/dist/locales/file-uploader/el.js +2 -2
  15. package/dist/locales/file-uploader/en.js +2 -2
  16. package/dist/locales/file-uploader/es.js +2 -2
  17. package/dist/locales/file-uploader/et.js +2 -2
  18. package/dist/locales/file-uploader/fi.js +2 -2
  19. package/dist/locales/file-uploader/fr.js +2 -2
  20. package/dist/locales/file-uploader/he.js +2 -2
  21. package/dist/locales/file-uploader/hy.js +2 -2
  22. package/dist/locales/file-uploader/is.js +2 -2
  23. package/dist/locales/file-uploader/it.js +2 -2
  24. package/dist/locales/file-uploader/ja.js +2 -2
  25. package/dist/locales/file-uploader/ka.js +2 -2
  26. package/dist/locales/file-uploader/kk.js +2 -2
  27. package/dist/locales/file-uploader/ko.js +2 -2
  28. package/dist/locales/file-uploader/lv.js +2 -2
  29. package/dist/locales/file-uploader/nb.js +2 -2
  30. package/dist/locales/file-uploader/nl.js +2 -2
  31. package/dist/locales/file-uploader/pl.js +2 -2
  32. package/dist/locales/file-uploader/pt.js +2 -2
  33. package/dist/locales/file-uploader/ro.js +2 -2
  34. package/dist/locales/file-uploader/ru.js +2 -2
  35. package/dist/locales/file-uploader/sk.js +2 -2
  36. package/dist/locales/file-uploader/sr.js +2 -2
  37. package/dist/locales/file-uploader/sv.js +2 -2
  38. package/dist/locales/file-uploader/tr.js +2 -2
  39. package/dist/locales/file-uploader/uk.js +2 -2
  40. package/dist/locales/file-uploader/vi.js +2 -2
  41. package/dist/locales/file-uploader/zh-TW.js +2 -2
  42. package/dist/locales/file-uploader/zh.js +2 -2
  43. package/package.json +13 -6
  44. package/web/file-uploader.iife.min.d.ts +2448 -2002
  45. package/web/file-uploader.iife.min.js +4 -4
  46. package/web/file-uploader.iife.min.js.LEGAL.txt +2 -2
  47. package/web/file-uploader.min.d.ts +2448 -2002
  48. package/web/file-uploader.min.js +4 -4
  49. package/web/file-uploader.min.js.LEGAL.txt +2 -2
  50. package/web/uc-basic.layered.min.css +3 -3
  51. package/web/uc-basic.min.css +3 -3
  52. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  53. package/web/uc-cloud-image-editor.min.css +3 -3
  54. package/web/uc-cloud-image-editor.min.d.ts +1421 -372
  55. package/web/uc-cloud-image-editor.min.js +4 -4
  56. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  57. package/web/uc-file-uploader-inline.min.css +3 -3
  58. package/web/uc-file-uploader-inline.min.d.ts +2448 -2002
  59. package/web/uc-file-uploader-inline.min.js +4 -4
  60. package/web/uc-file-uploader-inline.min.js.LEGAL.txt +2 -2
  61. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  62. package/web/uc-file-uploader-minimal.min.css +3 -3
  63. package/web/uc-file-uploader-minimal.min.d.ts +2448 -2002
  64. package/web/uc-file-uploader-minimal.min.js +4 -4
  65. package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +2 -2
  66. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  67. package/web/uc-file-uploader-regular.min.css +3 -3
  68. package/web/uc-file-uploader-regular.min.d.ts +2448 -2002
  69. package/web/uc-file-uploader-regular.min.js +4 -4
  70. package/web/uc-file-uploader-regular.min.js.LEGAL.txt +2 -2
  71. package/web/uc-img.min.d.ts +5 -0
  72. package/web/uc-img.min.js +4 -4
package/dist/index.d.ts CHANGED
@@ -1,23 +1,24 @@
1
- import { LitElement, PropertyValues, nothing, TemplateResult } from 'lit';
1
+ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
2
2
  export { loadFileUploaderFrom } from './abstract/loadFileUploaderFrom.js';
3
+ import _default from './locales/file-uploader/en.js';
3
4
  import * as lit_html from 'lit-html';
4
5
  import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
5
- import { TelemetryRequest } from '@uploadcare/quality-insights';
6
6
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
7
- import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions, Queue } from '@uploadcare/upload-client';
7
+ import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
8
8
  export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
9
9
  import { Ref } from 'lit/directives/ref.js';
10
+ import { TelemetryRequest } from '@uploadcare/quality-insights';
10
11
  export { PACKAGE_NAME, PACKAGE_VERSION } from './env.js';
11
12
 
12
- type Subscription = {
13
- remove: () => void;
14
- };
15
- declare class PubSub<T extends Record<string, unknown> = Record<string, unknown>> {
13
+ type Unsubscriber = () => void;
14
+ declare class PubSub<T extends Record<string, unknown>> {
16
15
  private static _contexts;
17
16
  private _store;
17
+ private _ctxId;
18
18
  private constructor();
19
+ get id(): string;
19
20
  pub<K extends keyof T>(key: K, value: T[K]): void;
20
- sub<K extends keyof T>(key: K, callback: (value: T[K]) => void, init?: boolean): Subscription;
21
+ sub<K extends keyof T>(key: K, callback: (value: T[K]) => void, init?: boolean): Unsubscriber;
21
22
  read<K extends keyof T>(key: K): T[K];
22
23
  add<K extends keyof T>(key: K, value: T[K], rewrite?: boolean): void;
23
24
  has(key: keyof T): boolean;
@@ -47,6 +48,7 @@ declare class SymbioteComponent<TState extends Record<string, unknown> = Record<
47
48
  [K in keyof T]: K extends keyof TState ? TState[K] : never;
48
49
  }>(obj: T, rewrite?: boolean): void;
49
50
  initCallback(): void;
51
+ sharedCtx: PubSub<TState>;
50
52
  ctxName: string;
51
53
  ctxOwner: boolean;
52
54
  }
@@ -73,11 +75,11 @@ declare class UID {
73
75
 
74
76
  declare function defineComponents(blockExports: Record<string, any>): void;
75
77
 
76
- type LocaleDefinition = Record<string, string>;
78
+ type LocaleDefinition = typeof _default;
77
79
  type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
78
80
  declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
79
81
 
80
- declare class A11y {
82
+ declare class A11y implements ISharedInstance {
81
83
  private _destroyKeyUX;
82
84
  private readonly _scopedWindow;
83
85
  constructor();
@@ -85,18 +87,11 @@ declare class A11y {
85
87
  destroy(): void;
86
88
  }
87
89
 
88
- declare class LocaleManager {
89
- private _blockInstance;
90
+ declare class LocaleManager extends SharedInstance {
90
91
  private _localeName;
91
- constructor(blockInstance: LitBlock);
92
+ constructor(sharedInstancesBag: SharedInstancesBag);
92
93
  }
93
94
 
94
- type EventMap = {
95
- [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
96
- };
97
-
98
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(uploaderBlock: LitUploaderBlock): OutputCollectionState<TCollectionStatus, TGroupFlag>;
99
-
100
95
  declare class TypedData<T extends Record<string, unknown>> {
101
96
  private _ctxId;
102
97
  private _data;
@@ -105,10 +100,63 @@ declare class TypedData<T extends Record<string, unknown>> {
105
100
  setValue<K extends keyof T>(prop: K, value: T[K]): void;
106
101
  setMultipleValues(updObj: Partial<T>): void;
107
102
  getValue<K extends keyof T>(prop: K): T[K];
108
- subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Subscription;
103
+ subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
104
+ destroy(): void;
105
+ }
106
+
107
+ type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
108
+ type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
109
+ type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
110
+ type TypedCollectionOptions<T extends Record<string, unknown>> = {
111
+ initialValue: T;
112
+ watchList?: (keyof T)[];
113
+ handler?: TypedCollectionObserverHandler<T>;
114
+ };
115
+ declare class TypedCollection<T extends Record<string, unknown>> {
116
+ private static readonly _destroyDelayMs;
117
+ private _ctxId;
118
+ private _data;
119
+ private _watchList;
120
+ private _subsMap;
121
+ private _propertyObservers;
122
+ private _collectionObservers;
123
+ private _items;
124
+ private _removed;
125
+ private _added;
126
+ private _markedToDestroy;
127
+ private _observeTimeout?;
128
+ private _notifyTimeout?;
129
+ private _destroyTimeout?;
130
+ private _notifyObservers;
131
+ private _initialValue;
132
+ constructor(options: TypedCollectionOptions<T>);
133
+ private _notify;
134
+ private _scheduleDestroyMarkedItems;
135
+ observeCollection(handler: TypedCollectionObserverHandler<T>): () => void;
136
+ unobserveCollection(handler: TypedCollectionObserverHandler<T>): void;
137
+ add(init: Partial<T>): Uid;
138
+ hasItem(id: Uid): boolean;
139
+ read(id: Uid): TypedData<T> | null;
140
+ readProp<K extends keyof T>(id: Uid, propName: K): T[K];
141
+ publishProp<K extends keyof T>(id: Uid, propName: K, value: T[K]): void;
142
+ remove(id: Uid): void;
143
+ clearAll(): void;
144
+ observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
145
+ unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
146
+ findItems(checkFn: (item: TypedData<T>) => boolean): Uid[];
147
+ items(): Uid[];
148
+ get size(): number;
109
149
  destroy(): void;
110
150
  }
111
151
 
152
+ declare const CameraSourceTypes: Readonly<{
153
+ PHOTO: "photo";
154
+ VIDEO: "video";
155
+ }>;
156
+ type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
157
+
158
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
159
+
112
160
  interface UploadEntryData extends Record<string, unknown> {
113
161
  file: File | null;
114
162
  externalUrl: string | null;
@@ -140,198 +188,40 @@ interface UploadEntryData extends Record<string, unknown> {
140
188
  type UploadEntryTypedData = TypedData<UploadEntryData>;
141
189
  type UploadEntryKeys = keyof UploadEntryData;
142
190
 
143
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
144
- signal?: AbortSignal;
145
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
146
- type FileValidatorDescriptor = {
147
- runOn: 'add' | 'upload' | 'change';
148
- validator: FuncFileValidator;
191
+ type ApiAddFileCommonOptions = {
192
+ silent?: boolean;
193
+ fileName?: string;
194
+ source?: string;
149
195
  };
150
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
151
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
152
- declare class ValidationManager {
153
- private _blockInstance;
154
- private _uploadCollection;
155
- private _commonFileValidators;
156
- private _commonCollectionValidators;
157
- private _queue;
158
- private _runQueueDebounced;
159
- private _entryValidationState;
160
- constructor(blockInstance: LitUploaderBlock);
161
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
162
- runCollectionValidators(): void;
163
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
164
- private _runFileValidatorsForEntry;
165
- private _addCustomTypeToValidationError;
166
- private _getEntryValidationState;
167
- private _getValidatorDescriptors;
168
- private _getValidatorDescriptorsForEntry;
169
- }
170
-
171
- type CameraMode = 'photo' | 'video';
172
- declare class CameraSource extends LitUploaderBlock {
173
- couldBeCtxOwner: boolean;
174
- activityType: "camera";
175
- private _unsubPermissions;
176
- private _capturing;
177
- private _chunks;
178
- private _mediaRecorder;
179
- private _stream;
180
- private _selectedAudioId;
181
- private _selectedCameraId;
182
- private _activeTab;
183
- private _options;
184
- private _canvas;
185
- private _ctx;
186
- private _cameraDevices;
187
- private _audioDevices;
188
- private _permissionResponses;
189
- private _permissionCleanupFns;
190
- private _currentVideoSource;
191
- private readonly _handlePreviewPlay;
192
- private readonly _handlePreviewPause;
193
- private _timerRef;
194
- private _lineRef;
195
- private _videoRef;
196
- private _switcherRef;
197
- private _startTime;
198
- private _elapsedTime;
199
- private _videoTransformCss;
200
- private _videoHidden;
201
- private _messageHidden;
202
- private _requestBtnHidden;
203
- private _cameraSelectOptions;
204
- private _cameraSelectHidden;
205
- private _l10nMessage;
206
- private _timerHidden;
207
- private _cameraHidden;
208
- private _cameraActionsHidden;
209
- private _audioSelectOptions;
210
- private _audioSelectHidden;
211
- private _audioSelectDisabled;
212
- private _audioToggleMicrophoneHidden;
213
- private _tabCameraHidden;
214
- private _tabVideoHidden;
215
- private _currentIcon;
216
- private _currentTimelineIcon;
217
- private _toggleMicrophoneIcon;
218
- private _mutableClassButton;
219
- private _chooseActionWithCamera;
220
- private _handleCameraSelectChange;
221
- private _handleAudioSelectChange;
222
- private _handleRequestPermissions;
223
- private _handleStartCamera;
224
- private _handleToggleRecording;
225
- private _handleToggleAudio;
226
- private _handleRetake;
227
- private _handleAccept;
228
- private _handleClickTab;
229
- private _updateTimer;
230
- private _startTimer;
231
- private _stopTimer;
232
- private _startTimeline;
233
- private _stopTimeline;
234
- private _animationFrameId;
235
- private _startRecording;
236
- private _stopRecording;
237
- /** This method is used to toggle recording pause/resume */
238
- private _toggleRecording;
239
- private _toggleEnableAudio;
240
- /**
241
- * Previewing the video that was recorded on the camera
242
- */
243
- private _previewVideo;
244
- private _attachPreviewListeners;
245
- private _detachPreviewListeners;
246
- private _setVideoSource;
247
- /**
248
- * Do not bind srcObject directly in the template, because it stops video pausing on shot.
249
- * I really don'y know why but that's how it is. Assigning srcObject manually fixes the issue.
250
- */
251
- private _applyVideoSource;
252
- private _retake;
253
- private _accept;
254
- private _handlePhoto;
255
- private _handleVideo;
256
- private _setCameraState;
257
- private _shot;
258
- private _handleActiveTab;
259
- private _createFile;
260
- private _guessExtensionByMime;
196
+ declare class UploaderPublicApi extends SharedInstance {
197
+ private _l10n;
198
+ get _uploadCollection(): TypedCollection<UploadEntryData>;
199
+ get cfg(): Readonly<ConfigType>;
200
+ get l10n(): (str: string, variables?: Record<string, string | number>) => string;
261
201
  /**
262
- * The send file to the server
202
+ * TODO: Probably we should not allow user to override `source` property
263
203
  */
264
- private _toSend;
265
- private get _cameraModes();
266
- private _setPermissionsState;
267
- private _makeStreamInactive;
268
- private _stopCapture;
269
- private _capture;
270
- private _handlePermissionsChange;
271
- private _permissionAccess;
272
- private _teardownPermissionListeners;
273
- private _requestDeviceAccess;
274
- private _getDevices;
275
- private _onActivate;
276
- private _onDeactivate;
277
- private _handleCameraModes;
278
- initCallback(): void;
279
- firstUpdated(changedProperties: PropertyValues<this>): void;
280
- updated(changedProperties: PropertyValues<this>): void;
281
- private _destroy;
282
- disconnectedCallback(): void;
283
- render(): lit_html.TemplateResult<1>;
284
- }
285
-
286
- /**
287
- * Config keys that can't be passed as attribute (because they are object or function)
288
- */
289
- declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
290
- /** Mapping of attribute names to state */
291
- declare const attrStateMapping: Record<string, string>;
292
- declare class Config extends LitBlock {
293
- attributesMeta: Partial<ConfigPlainType> & {
294
- 'ctx-name': string;
295
- };
296
- init$: LitBlock["init$"] & ConfigType;
297
- private _computationControllers;
298
- private _flushValueToAttribute;
299
- private _flushValueToState;
300
- private _setValue;
301
- private _getValue;
302
- private _assertSameValueDifferentReference;
303
- initCallback(): void;
304
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
305
- static get observedAttributes(): string[];
306
- }
307
- interface Config extends ConfigType {
308
- }
309
-
310
- type FilesViewMode = 'grid' | 'list';
311
- declare class UploadList extends LitUploaderBlock {
312
- couldBeCtxOwner: boolean;
313
- protected historyTracked: boolean;
314
- activityType: "upload-list";
315
- private _doneBtnVisible;
316
- private _doneBtnEnabled;
317
- private _uploadBtnVisible;
318
- private _addMoreBtnVisible;
319
- private _addMoreBtnEnabled;
320
- private _commonErrorMessage;
321
- private _hasFiles;
322
- private _latestSummary;
323
- private get _headerText();
324
- private _handleAdd;
325
- private _handleUpload;
326
- private _handleDone;
327
- private _handleCancel;
328
- private _throttledHandleCollectionUpdate;
329
- private _updateUploadsState;
330
- private _getHeaderText;
331
- get couldOpenActivity(): boolean;
332
- initCallback(): void;
333
- disconnectedCallback(): void;
334
- render(): lit_html.TemplateResult<1>;
204
+ addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
205
+ addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
206
+ addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
207
+ addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
208
+ fullPath?: string;
209
+ }) => OutputFileEntry<"idle">;
210
+ removeFileByInternalId: (internalId: string) => void;
211
+ removeAllFiles(): void;
212
+ uploadAll: () => void;
213
+ openSystemDialog: (options?: {
214
+ captureCamera?: boolean;
215
+ modeCamera?: ModeCameraType;
216
+ }) => void;
217
+ getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
218
+ getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
219
+ initFlow: (force?: boolean) => void;
220
+ doneFlow: () => void;
221
+ setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
222
+ getCurrentActivity: () => ActivityType;
223
+ setModalState: (opened: boolean) => void;
224
+ private get _sourceList();
335
225
  }
336
226
 
337
227
  declare const ExternalUploadSource: Readonly<{
@@ -369,662 +259,744 @@ declare const UploadSource: Readonly<{
369
259
  }>;
370
260
  type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
371
261
 
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;
262
+ declare class LitUploaderBlock extends LitActivityBlock {
263
+ static extSrcList: Readonly<typeof ExternalUploadSource>;
264
+ static sourceTypes: Readonly<typeof UploadSource>;
265
+ protected couldBeCtxOwner: boolean;
266
+ private _isCtxOwner;
267
+ private _unobserveCollection?;
268
+ private _unobserveCollectionProperties?;
269
+ init$: {
270
+ '*commonProgress': number;
271
+ '*uploadList': never[];
272
+ '*uploadQueue': _uploadcare_upload_client.Queue;
273
+ '*collectionErrors': OutputErrorCollection[];
274
+ '*collectionState': OutputCollectionState | null;
275
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
276
+ '*uploadTrigger': Set<string>;
277
+ '*currentActivity': null;
278
+ '*currentActivityParams': {};
279
+ '*history': never[];
280
+ '*historyBack': null;
281
+ '*closeModal': () => void;
282
+ };
283
+ private get _hasCtxOwner();
284
+ initCallback(): void;
285
+ getAPI(): UploaderPublicApi;
286
+ get validationManager(): ValidationManager;
287
+ get api(): UploaderPublicApi;
288
+ get uploadCollection(): TypedCollection<UploadEntryData>;
289
+ get secureUploadsManager(): SecureUploadsManager;
290
+ disconnectedCallback(): void;
291
+ connectedCallback(): void;
292
+ private _initCtxOwner;
293
+ private _observeUploadCollection;
294
+ private _unobserveUploadCollection;
295
+ private _createGroup;
296
+ private _flushOutputItems;
297
+ private _handleCollectionUpdate;
298
+ private _handleCollectionPropertiesUpdate;
299
+ private _flushCommonUploadProgress;
300
+ private _openCloudImageEditor;
301
+ private _setInitialCrop;
302
+ protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
303
+ protected getUploadClientOptions(): Promise<FileFromOptions>;
304
+ getOutputData(): OutputFileEntry[];
415
305
  }
416
306
 
417
- declare const CameraSourceTypes: Readonly<{
418
- PHOTO: "photo";
419
- VIDEO: "video";
420
- }>;
421
- type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
307
+ /**
308
+ * Mapping of loading resources per operation
309
+ */
310
+ type LoadingOperations = Map<string, Map<string, boolean>>;
311
+ /**
312
+ * Image size
313
+ */
314
+ interface ImageSize {
315
+ width: number;
316
+ height: number;
317
+ }
318
+ interface Transformations {
319
+ enhance?: number;
320
+ brightness?: number;
321
+ exposure?: number;
322
+ gamma?: number;
323
+ contrast?: number;
324
+ saturation?: number;
325
+ vibrance?: number;
326
+ warmth?: number;
327
+ rotate?: number;
328
+ mirror?: boolean;
329
+ flip?: boolean;
330
+ filter?: {
331
+ name: string;
332
+ amount: number;
333
+ };
334
+ crop?: {
335
+ dimensions: [number, number];
336
+ coords: [number, number];
337
+ };
338
+ }
339
+ interface ApplyResult {
340
+ originalUrl: string;
341
+ cdnUrlModifiers: string;
342
+ cdnUrl: string;
343
+ transformations: Transformations;
344
+ }
345
+ type ChangeResult = ApplyResult;
346
+ interface CropAspectRatio {
347
+ type: 'aspect-ratio';
348
+ width: number;
349
+ height: number;
350
+ id: string;
351
+ hasFreeform?: boolean;
352
+ }
353
+ type CropPresetList = CropAspectRatio[];
422
354
 
423
- type ApiAddFileCommonOptions = {
424
- silent?: boolean;
425
- fileName?: string;
426
- source?: string;
355
+ declare function initState(fnCtx: CloudImageEditorBlock): {
356
+ '*originalUrl': null;
357
+ '*loadingOperations': LoadingOperations;
358
+ '*faderEl': null;
359
+ '*cropperEl': null;
360
+ '*imgEl': null;
361
+ '*imgContainerEl': null;
362
+ '*networkProblems': boolean;
363
+ '*imageSize': null;
364
+ '*editorTransformations': {};
365
+ '*cropPresetList': never[];
366
+ '*currentAspectRatio': null;
367
+ '*tabList': readonly ["crop", "tuning", "filters"];
368
+ '*tabId': "crop";
369
+ '*on.retryNetwork': () => void;
370
+ '*on.apply': (transformations: Transformations) => void;
371
+ '*on.cancel': () => void;
427
372
  };
428
- declare class UploaderPublicApi {
429
- private _ctx;
430
- constructor(ctx: LitUploaderBlock);
431
- get _uploadCollection(): TypedCollection<UploadEntryData>;
432
- get cfg(): ConfigType;
433
- get l10n(): (str: string, variables?: Record<string, string | number>) => string;
434
- /**
435
- * TODO: Probably we should not allow user to override `source` property
436
- */
437
- addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
438
- addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
439
- addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
440
- addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
441
- fullPath?: string;
442
- }) => OutputFileEntry<"idle">;
443
- removeFileByInternalId: (internalId: string) => void;
444
- removeAllFiles(): void;
445
- uploadAll: () => void;
446
- openSystemDialog: (options?: {
447
- captureCamera?: boolean;
448
- modeCamera?: ModeCameraType;
449
- }) => void;
450
- getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
451
- getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
452
- initFlow: (force?: boolean) => void;
453
- doneFlow: () => void;
454
- setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
455
- getCurrentActivity: () => ActivityType;
456
- setModalState: (opened: boolean) => void;
457
- private get _sourceList();
458
- }
459
373
 
460
- type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
461
- type LocaleDefinitionOverride = Record<string, LocaleDefinition>;
462
- type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
463
- uuid: string;
464
- cdnUrlModifiers: string;
465
- fileName: string;
466
- }) => Promise<string> | string;
467
- type SecureUploadsSignatureAndExpire = {
468
- secureSignature: string;
469
- secureExpire: string;
374
+ type PresenceToggleStyle = {
375
+ transition?: string;
376
+ visible?: string;
377
+ hidden?: string;
470
378
  };
471
- type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatureAndExpire | null>;
472
- type IconHrefResolver = (iconName: string) => string;
473
- type FileValidators = FileValidator[];
474
- type CollectionValidators = FuncCollectionValidator[];
475
- type ConfigType = {
476
- /**
477
- * Your project’s Public Key.
478
- */
479
- pubkey: string;
480
- /**
481
- * Allow multiple file uploads.
482
- */
483
- multiple: boolean;
484
- /**
485
- * Minimum number of files to upload.
486
- */
487
- multipleMin: number;
488
- /**
489
- * Maximum number of files to upload.
490
- */
491
- multipleMax: number;
492
- /**
493
- * Require user confirmation before uploading.
494
- */
495
- confirmUpload: boolean;
496
- /**
497
- * Allow only image files.
498
- */
499
- imgOnly: boolean;
500
- /**
501
- * Native file input accept attribute value. Also affects client validation settings.
502
- */
503
- accept: string;
504
- /**
505
- * Preferred types for external sources.
506
- * See [here](https://uploadcare.com/docs/file-uploader/options/#external-sources-preferred-types)
507
- */
508
- externalSourcesPreferredTypes: string;
509
- /**
510
- * Provide custom CSS to the social sources iframe
511
- */
512
- externalSourcesEmbedCss: string;
379
+ declare class PresenceToggle extends LitBlock {
380
+ private _visible;
381
+ private _styles;
382
+ private _visibleStyle;
383
+ private _hiddenStyle;
384
+ private _externalTransitions;
385
+ private _initialRenderComplete;
386
+ set visible(value: boolean);
387
+ get visible(): boolean;
388
+ set styles(styles: PresenceToggleStyle);
389
+ get styles(): PresenceToggleStyle;
390
+ private _handleVisible;
391
+ private _dispatchInitialRenderEvent;
392
+ initCallback(): void;
393
+ }
394
+ declare global {
395
+ interface HTMLElementTagNameMap {
396
+ 'uc-presence-toggle': PresenceToggle;
397
+ }
398
+ }
399
+
400
+ declare class LineLoaderUi extends LitBlock {
401
+ active: boolean;
402
+ private readonly _lineRef;
403
+ private _isAnimating;
404
+ private readonly _handleTransitionEndRight;
405
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
406
+ protected updated(changedProperties: PropertyValues<this>): void;
407
+ private _start;
408
+ private _stop;
409
+ private _resetLine;
410
+ render(): lit_html.TemplateResult<1>;
411
+ }
412
+ declare global {
413
+ interface HTMLElementTagNameMap {
414
+ 'uc-line-loader-ui': LineLoaderUi;
415
+ }
416
+ }
417
+
418
+ declare class Icon extends LitBlock {
419
+ name: string;
420
+ private _resolvedHref;
421
+ private _iconHrefResolver;
422
+ initCallback(): void;
423
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
424
+ private _updateResolvedHref;
425
+ render(): lit_html.TemplateResult<1>;
426
+ }
427
+ declare global {
428
+ interface HTMLElementTagNameMap {
429
+ 'uc-icon': Icon;
430
+ }
431
+ }
432
+
433
+ 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';
434
+
435
+ type Theme = string | null;
436
+ declare class BtnUi extends LitBlock {
437
+ text: string;
438
+ icon: string;
439
+ reverse: boolean;
440
+ theme: Theme;
441
+ ariaRole: AriaRole | undefined;
442
+ ariaControls: string;
443
+ titleProp: string;
513
444
  /**
514
- * Store uploaded files.
445
+ * CSS-only attribute
515
446
  */
516
- store: boolean | 'auto';
447
+ active: boolean;
448
+ protected firstUpdated(changed: PropertyValues<this>): void;
449
+ protected updated(changed: PropertyValues<this>): void;
450
+ private _applyReverse;
451
+ private _applyThemeClass;
452
+ private get _iconClassMap();
453
+ private get _computedIconHidden();
454
+ private get _computedIconSingle();
455
+ render(): lit_html.TemplateResult<1>;
456
+ }
457
+ declare global {
458
+ interface HTMLElementTagNameMap {
459
+ 'uc-btn-ui': BtnUi;
460
+ }
461
+ }
462
+
463
+ declare class CropFrame extends LitBlock {
464
+ private _backdropMask?;
465
+ private _backdropMaskInner?;
466
+ private readonly _backdropMaskId;
467
+ private _frameThumbs?;
468
+ private _frameGuides?;
469
+ private _draggingThumb?;
470
+ private _hoverThumb?;
471
+ private _dragStartPoint?;
472
+ private _dragStartCrop?;
473
+ private _frameImage?;
474
+ private _guidesHidden;
475
+ private _draggingValue;
476
+ private readonly _svgRef;
477
+ private _svgReady;
478
+ private _pendingMaskHref;
479
+ private get _svgElement();
480
+ private get _dragging();
481
+ private set _dragging(value);
482
+ private _applyGuidesDragState;
483
+ private _shouldThumbBeDisabled;
484
+ private _createBackdrop;
517
485
  /**
518
- * Mirror the camera view.
486
+ * @private Super Tricky workaround for the chromium bug See
487
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=330815
519
488
  */
520
- cameraMirror: boolean;
489
+ private _resizeBackdrop;
490
+ private _updateBackdrop;
491
+ private _updateFrame;
492
+ private _createThumb;
493
+ private _createThumbs;
494
+ private _createGuides;
495
+ private _createFrame;
496
+ private _handlePointerDown;
497
+ private readonly _handlePointerUp;
498
+ private readonly _handlePointerMove;
499
+ private _calcCropBox;
500
+ private readonly _handleSvgPointerMove;
501
+ private _updateCursor;
502
+ private _createMask;
503
+ private _updateMask;
504
+ private _render;
505
+ toggleThumbs(visible: boolean): void;
506
+ initCallback(): void;
507
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
508
+ private _initializeSvg;
509
+ disconnectedCallback(): void;
510
+ render(): TemplateResult;
511
+ }
512
+ declare global {
513
+ interface HTMLElementTagNameMap {
514
+ 'uc-crop-frame': CropFrame;
515
+ }
516
+ }
517
+
518
+ type Operations = {
519
+ flip: boolean;
520
+ mirror: boolean;
521
+ rotate: number;
522
+ };
523
+ declare class EditorImageCropper extends LitBlock {
524
+ ctxOwner: boolean;
525
+ private _commitDebounced;
526
+ private _handleResizeThrottled;
527
+ private _imageSize;
528
+ private _canvas?;
529
+ private _ctx;
530
+ private _isActive;
531
+ private _observer?;
532
+ private _image;
533
+ private _cancelPreload?;
534
+ private readonly _canvasRef;
535
+ private readonly _frameRef;
536
+ constructor();
537
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
538
+ private _syncTransformations;
539
+ private _initCanvas;
540
+ private _alignImage;
541
+ private _alignCrop;
542
+ private _drawImage;
543
+ private _draw;
544
+ private _animateIn;
545
+ private _getCropDimensions;
546
+ private _getCropTransformation;
547
+ private _commit;
548
+ setValue<K extends keyof Operations>(operation: K, value: Operations[K]): void;
549
+ getValue<K extends keyof Operations>(operation: K): Operations[K];
550
+ activate(imageSize: ImageSize, { fromViewer }?: {
551
+ fromViewer?: boolean;
552
+ }): Promise<void>;
553
+ deactivate({ reset }?: {
554
+ reset?: boolean;
555
+ }): void;
556
+ private _transitionToCrop;
557
+ private _transitionToImage;
558
+ private _reset;
559
+ private _waitForImage;
560
+ private _handleImageLoading;
561
+ initCallback(): void;
562
+ disconnectedCallback(): void;
563
+ render(): TemplateResult;
564
+ }
565
+ declare global {
566
+ interface HTMLElementTagNameMap {
567
+ 'uc-editor-image-cropper': EditorImageCropper;
568
+ }
569
+ }
570
+
571
+ declare const TabId: Readonly<{
572
+ readonly CROP: "crop";
573
+ readonly TUNING: "tuning";
574
+ readonly FILTERS: "filters";
575
+ }>;
576
+ type TabIdValue$1 = (typeof TabId)[keyof typeof TabId];
577
+ declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
578
+ type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
579
+ 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"];
580
+ type FilterId = (typeof ALL_FILTERS)[number];
581
+ declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
582
+ type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
583
+ /** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
584
+ declare const COLOR_OPERATIONS_CONFIG: Readonly<{
585
+ brightness: {
586
+ zero: number;
587
+ range: readonly [-100, 100];
588
+ keypointsNumber: number;
589
+ };
590
+ exposure: {
591
+ zero: number;
592
+ range: readonly [-500, 500];
593
+ keypointsNumber: number;
594
+ };
595
+ gamma: {
596
+ zero: number;
597
+ range: readonly [0, 1000];
598
+ keypointsNumber: number;
599
+ };
600
+ contrast: {
601
+ zero: number;
602
+ range: readonly [-100, 500];
603
+ keypointsNumber: number;
604
+ };
605
+ saturation: {
606
+ zero: number;
607
+ range: readonly [-100, 500];
608
+ keypointsNumber: number;
609
+ };
610
+ vibrance: {
611
+ zero: number;
612
+ range: readonly [-100, 500];
613
+ keypointsNumber: number;
614
+ };
615
+ warmth: {
616
+ zero: number;
617
+ range: readonly [-100, 100];
618
+ keypointsNumber: number;
619
+ };
620
+ enhance: {
621
+ zero: number;
622
+ range: readonly [0, 100];
623
+ keypointsNumber: number;
624
+ };
625
+ filter: {
626
+ zero: number;
627
+ range: readonly [0, 100];
628
+ keypointsNumber: number;
629
+ };
630
+ }>;
631
+
632
+ type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
633
+ declare class EditorImageFader extends LitBlock {
634
+ private _isActive;
635
+ private _hidden;
636
+ private _operation;
637
+ private _filter;
638
+ private _value?;
639
+ private _transformations;
640
+ private _keypoints;
641
+ private _previewImage?;
642
+ private _cancelLastImages?;
643
+ private _cancelBatchPreload?;
644
+ private _url?;
645
+ private _fromViewer?;
646
+ private _raf;
647
+ private _addKeypointDebounced;
648
+ private readonly _previewHostRef;
649
+ private readonly _layersHostRef;
650
+ constructor();
651
+ private _handleImageLoading;
652
+ private _flush;
653
+ private _imageSrc;
654
+ private _constructKeypoint;
521
655
  /**
522
- * Default camera capture mode.
656
+ * Check if current operation and filter equals passed ones
523
657
  */
524
- cameraCapture: 'user' | 'environment' | '';
525
- /**
526
- * List of sources for file uploads.
527
- */
528
- sourceList: string;
529
- /**
530
- * Top-level origin for the uploader.
531
- * This is used for Google Drive Picker if there is no access to the origin due to the cross-origin policy.
532
- */
533
- topLevelOrigin: string;
534
- /**
535
- * Maximum size of local files in bytes.
536
- */
537
- maxLocalFileSizeBytes: number;
538
- /**
539
- * Thumbnail size.
540
- */
541
- thumbSize: number;
542
- /**
543
- * Show the upload list even if it is empty.
544
- */
545
- showEmptyList: boolean;
546
- /**
547
- * Use local image editor.
548
- */
549
- useLocalImageEditor: boolean;
550
- /**
551
- * Enable cloud image editing.
552
- */
553
- useCloudImageEditor: boolean;
554
- /**
555
- * Tabs to show in the cloud image editor.
556
- *
557
- * @default 'crop, tuning, filters'
558
- */
559
- cloudImageEditorTabs: string;
560
- /**
561
- * Remove copyright information.
562
- */
563
- removeCopyright: boolean;
564
- /**
565
- * Defines the crop behavior. When uploading images, your users can select a crop area with a defined aspect ratio.
566
- */
567
- cropPreset: string;
568
- /**
569
- * Image shrink options.
570
- */
571
- imageShrink: string;
572
- /**
573
- * Lock scroll when modal is open.
574
- */
575
- modalScrollLock: boolean;
576
- /**
577
- * Show strokes on modal backdrop.
578
- */
579
- modalBackdropStrokes: boolean;
580
- /**
581
- * Wrap the source list.
582
- */
583
- sourceListWrap: boolean;
584
- /**
585
- * Key to revoke Custom OAuth access. See [OAuth docs](https://uploadcare.com/docs/upload-sources/#oauth) for details.
586
- */
587
- remoteTabSessionKey: string;
588
- /**
589
- * Set custom CNAME.
590
- */
591
- cdnCname: string;
592
- /**
593
- * Set CNAME base domain for prefixed CDN URLs.
594
- */
595
- cdnCnamePrefixed: string;
596
- /**
597
- * Set a custom upload URL.
598
- */
599
- baseUrl: string;
600
- /**
601
- * Set a custom social sources URL.
602
- */
603
- socialBaseUrl: string;
604
- /**
605
- * Secure signature for uploads.
606
- */
607
- secureSignature: string;
608
- /**
609
- * Expiry time for secure uploads.
610
- */
611
- secureExpire: string;
612
- /**
613
- * Proxy URL for secure delivery.
614
- */
615
- secureDeliveryProxy: string;
616
- /**
617
- * Maximum number of retry attempts for throttled requests.
618
- */
619
- retryThrottledRequestMaxTimes: number;
620
- /**
621
- * Maximum number of retry attempts for network errors.
622
- */
623
- retryNetworkErrorMaxTimes: number;
624
- /**
625
- * Minimum file size for multipart uploads.
626
- */
627
- multipartMinFileSize: number;
628
- /**
629
- * Chunk size for multipart uploads.
630
- */
631
- multipartChunkSize: number;
632
- /**
633
- * Maximum number of concurrent requests.
634
- */
635
- maxConcurrentRequests: number;
636
- /**
637
- * Maximum number of concurrent multipart requests.
638
- */
639
- multipartMaxConcurrentRequests: number;
640
- /**
641
- * Maximum number of attempts for multipart uploads.
642
- */
643
- multipartMaxAttempts: number;
644
- /**
645
- * Check for URL duplicates.
646
- */
647
- checkForUrlDuplicates: boolean;
648
- /**
649
- * Save URL for recurrent uploads.
650
- */
651
- saveUrlForRecurrentUploads: boolean;
652
- /**
653
- * Group output files.
654
- */
655
- groupOutput: boolean;
656
- /**
657
- * User agent integration string.
658
- */
659
- userAgentIntegration: string;
660
- /**
661
- * Enable debug mode.
662
- */
663
- debug: boolean;
664
- /**
665
- * Locale name for the uploader.
666
- */
667
- localeName: string;
668
- /**
669
- * Expiry threshold for secure uploads.
670
- */
671
- secureUploadsExpireThreshold: number;
672
- /**
673
- * Metadata for the file.
674
- */
675
- metadata: Metadata | MetadataCallback | null;
676
- /**
677
- * Override locale definitions.
678
- */
679
- localeDefinitionOverride: LocaleDefinitionOverride | null;
680
- /**
681
- * Resolver for secure uploads signature.
682
- */
683
- secureUploadsSignatureResolver: SecureUploadsSignatureResolver | null;
684
- /**
685
- * Resolver for secure delivery proxy URL.
686
- */
687
- secureDeliveryProxyUrlResolver: SecureDeliveryProxyUrlResolver | null;
688
- /**
689
- * Resolver for icon href.
690
- */
691
- iconHrefResolver: IconHrefResolver | null;
692
- /**
693
- * Validators for individual files.
694
- */
695
- fileValidators: FileValidators;
696
- /**
697
- * Validators for file collections.
698
- */
699
- collectionValidators: CollectionValidators;
700
- /**
701
- * Timeout for async validation functions, in milliseconds.
702
- */
703
- validationTimeout: number;
704
- /**
705
- * The number of files to validate concurrently.
706
- */
707
- validationConcurrency: number;
708
- /**
709
- * The camera modes to enable in the camera modal,
710
- * it is possible to select photo or video capture.
711
- * The first mode is the default mode.
712
- * @default 'photo,video'
713
- */
714
- cameraModes: string;
715
- /**
716
- * The default tab to open in the camera modal,
717
- * it is possible to select video or photo capture
718
- * @default 'null'
719
- * @deprecated - use `cameraModes` instead
720
- */
721
- defaultCameraMode: CameraMode | null;
722
- /**
723
- * Enable audio recording.
724
- * @default true
725
- */
726
- enableAudioRecording: boolean;
727
- /**
728
- * Enable video recording.
729
- * @deprecated - use `cameraModes` instead
730
- * @default null
731
- */
732
- enableVideoRecording: boolean | null;
733
- /**
734
- * The maximum duration of the video recording in seconds
735
- * @default null
736
- */
737
- maxVideoRecordingDuration: number | null;
738
- /**
739
- * A dictionary object that can contain
740
- * the following properties from MediaRecorderOptions
741
- */
742
- mediaRecorderOptions: MediaRecorderOptions | null;
743
- filesViewMode: FilesViewMode;
744
- gridShowFileNames: boolean;
745
- cloudImageEditorAutoOpen: boolean;
746
- qualityInsights: boolean;
747
- cloudImageEditorMaskHref: string | null;
658
+ private _isSame;
659
+ set(value: string | number): void;
660
+ private _update;
661
+ private _createPreviewImage;
662
+ private _initNodes;
663
+ setTransformations(transformations: Transformations): Promise<void>;
664
+ preload({ url, filter, operation, value, }: {
665
+ url: string;
666
+ filter?: string;
667
+ operation?: OperationKey;
668
+ value?: number;
669
+ }): Promise<void>;
670
+ private _setOriginalSrc;
671
+ activate({ url, operation, value, filter, fromViewer, }: {
672
+ url: string;
673
+ operation?: OperationKey;
674
+ value?: number;
675
+ filter?: string;
676
+ fromViewer?: boolean;
677
+ }): Promise<void>;
678
+ deactivate({ hide }?: {
679
+ hide?: boolean;
680
+ }): void;
681
+ private _ensurePreviewAttached;
682
+ private _clearLayersHost;
683
+ render(): TemplateResult;
684
+ }
685
+ declare global {
686
+ interface HTMLElementTagNameMap {
687
+ 'uc-editor-image-fader': EditorImageFader;
688
+ }
689
+ }
690
+
691
+ declare class EditorButtonControl extends LitBlock {
692
+ active: boolean;
693
+ title: string;
694
+ protected icon: string;
695
+ protected titleProp: string;
696
+ protected get buttonClasses(): Record<string, boolean>;
697
+ private _updateHostStateClasses;
698
+ protected onClick(_event: MouseEvent): void;
699
+ connectedCallback(): void;
700
+ protected updated(changedProperties: PropertyValues<this>): void;
701
+ render(): lit_html.TemplateResult<1>;
702
+ }
703
+
704
+ declare class EditorFreeformButtonControl extends EditorButtonControl {
705
+ initCallback(): void;
706
+ onClick(): void;
707
+ private _computeTitle;
708
+ render(): lit_html.TemplateResult<1>;
709
+ }
710
+ declare class EditorAspectRatioButtonControl extends EditorButtonControl {
711
+ private _aspectRatio;
712
+ get aspectRatio(): CropAspectRatio | null;
713
+ set aspectRatio(value: CropAspectRatio | null);
714
+ initCallback(): void;
715
+ protected onClick(): void;
716
+ private _updateAspectRatioPresentation;
717
+ private _renderIcon;
718
+ render(): lit_html.TemplateResult<1>;
719
+ }
720
+ declare global {
721
+ interface HTMLElementTagNameMap {
722
+ 'uc-editor-freeform-button-control': EditorFreeformButtonControl;
723
+ 'uc-editor-aspect-ratio-button-control': EditorAspectRatioButtonControl;
724
+ }
725
+ }
726
+
727
+ declare class EditorCropButtonControl extends EditorButtonControl {
728
+ operation: CropOperation | undefined;
729
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
730
+ protected onClick(e: MouseEvent): void;
731
+ }
732
+ declare global {
733
+ interface HTMLElementTagNameMap {
734
+ 'uc-editor-crop-button-control': EditorCropButtonControl;
735
+ }
736
+ }
737
+
738
+ declare class EditorFilterControl extends EditorButtonControl {
739
+ private _operation;
740
+ private _filter;
741
+ private _originalUrl;
742
+ private _observer?;
743
+ private _cancelPreload?;
744
+ private _lastPreviewRequestId;
745
+ private _previewVisibilityCheckRaf?;
746
+ private _previewVisibilityCheckTimeout?;
747
+ private _previewImage;
748
+ private _previewLoaded;
749
+ isOriginal: boolean;
750
+ private _iconSize;
751
+ get filter(): string;
752
+ set filter(value: string);
753
+ onClick(e: MouseEvent): void;
754
+ private _previewSrc;
755
+ private _observerCallback;
756
+ initCallback(): void;
757
+ disconnectedCallback(): void;
758
+ protected updated(changedProperties: PropertyValues<this>): void;
759
+ private _updateFilterLabels;
760
+ private _loadPreview;
761
+ private _schedulePreviewVisibilityCheck;
762
+ private _clearPreviewVisibilityChecks;
763
+ private get _shouldShowPreview();
764
+ render(): lit_html.TemplateResult<1>;
765
+ }
766
+ declare global {
767
+ interface HTMLElementTagNameMap {
768
+ 'uc-editor-filter-control': EditorFilterControl;
769
+ }
770
+ }
771
+
772
+ declare class EditorOperationControl extends EditorButtonControl {
773
+ private _operation;
774
+ get operation(): ColorOperation | '';
775
+ set operation(value: ColorOperation | '');
776
+ private _updateOperationMetadata;
777
+ initCallback(): void;
778
+ protected onClick(e: MouseEvent): void;
779
+ }
780
+ declare global {
781
+ interface HTMLElementTagNameMap {
782
+ 'uc-editor-operation-control': EditorOperationControl;
783
+ }
784
+ }
785
+
786
+ declare class EditorScroller extends LitBlock {
748
787
  /**
749
- * Adds data-testid attributes to the each block. Needed for testing purposes.
750
- * @default false
788
+ * CSS-only attribute
751
789
  */
752
- testMode: boolean;
753
- };
754
- type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
755
- type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
756
- type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKeys<ConfigPlainType>;
757
- 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;
758
- type KebabCaseKeys<T extends Record<string, unknown>> = {
759
- [Key in keyof T as KebabCase$1<Key & string>]: T[Key];
760
- };
761
- type LowerCase<S extends string> = Lowercase<S>;
762
- type LowerCaseKeys<T extends Record<string, unknown>> = {
763
- [Key in keyof T as Lowercase<Key & string>]: T[Key];
764
- };
765
- type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
766
- type OutputCustomErrorType = 'CUSTOM_ERROR';
767
- type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
768
- type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
769
- type OutputFileErrorPayload = {
770
- entry: OutputFileEntry;
771
- };
772
- type OutputErrorTypePayload = {
773
- NOT_AN_IMAGE: OutputFileErrorPayload;
774
- FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
775
- FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
776
- SOME_FILES_HAS_ERRORS: {
777
- [k: string]: never;
778
- };
779
- TOO_MANY_FILES: {
780
- min: number;
781
- max: number;
782
- total: number;
783
- };
784
- TOO_FEW_FILES: {
790
+ hiddenScrollbar: boolean;
791
+ private readonly _handleWheel;
792
+ connectedCallback(): void;
793
+ disconnectedCallback(): void;
794
+ }
795
+ declare global {
796
+ interface HTMLElementTagNameMap {
797
+ 'uc-editor-scroller': EditorScroller;
798
+ }
799
+ }
800
+
801
+ declare class SliderUi extends LitBlock {
802
+ private _observer?;
803
+ private _thumbSize;
804
+ private _zeroDotEl?;
805
+ private _stepsCount?;
806
+ private readonly _inputRef;
807
+ private readonly _thumbRef;
808
+ private readonly _stepsRef;
809
+ disabled: boolean;
810
+ min: number;
811
+ max: number;
812
+ defaultValue: number;
813
+ zero: number;
814
+ private _currentValue;
815
+ constructor();
816
+ private _emitSliderEvent;
817
+ private readonly _handleSliderInput;
818
+ private readonly _handleSliderChange;
819
+ private readonly _handleInputFocus;
820
+ private readonly _handleInputBlur;
821
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
822
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
823
+ private _updateValue;
824
+ private _updateZeroDot;
825
+ private _updateSteps;
826
+ disconnectedCallback(): void;
827
+ private _setCurrentValue;
828
+ private _syncInputValue;
829
+ private _extractEventValue;
830
+ render(): lit_html.TemplateResult<1>;
831
+ }
832
+ declare global {
833
+ interface HTMLElementTagNameMap {
834
+ 'uc-slider-ui': SliderUi;
835
+ }
836
+ }
837
+
838
+ type SliderOperation = ColorOperation | 'filter';
839
+ type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
840
+ declare const FAKE_ORIGINAL_FILTER = "original";
841
+ declare class EditorSlider extends LitBlock {
842
+ state: {
843
+ operation: SliderOperation;
844
+ filter: SliderFilter | undefined;
845
+ originalUrl: string;
846
+ disabled: boolean;
785
847
  min: number;
786
- max: number;
787
- total: number;
788
- };
789
- UPLOAD_ERROR: OutputFileErrorPayload & {
790
- error: UploadError;
791
- };
792
- NETWORK_ERROR: OutputFileErrorPayload & {
793
- error: NetworkError;
794
- };
795
- UNKNOWN_ERROR: OutputFileErrorPayload & {
796
- error?: Error;
848
+ max: number;
849
+ value: number;
850
+ defaultValue: number;
851
+ zero: number;
797
852
  };
798
- CUSTOM_ERROR: Record<string, unknown>;
799
- };
800
- type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType ? {
801
- type?: T;
802
- message: string;
803
- payload?: OutputErrorTypePayload[T];
804
- } : T extends keyof OutputErrorTypePayload ? {
805
- type: T;
806
- message: string;
807
- payload?: OutputErrorTypePayload[T];
808
- } : never;
809
- type OutputErrorFile = OutputError<OutputFileErrorType>;
810
- type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
811
- type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
812
- status: TStatus;
813
- internalId: string;
814
- name: string;
815
- size: number;
816
- isImage: boolean;
817
- mimeType: string;
818
- metadata: Metadata | null;
819
- file: File | Blob | null;
820
- externalUrl: string | null;
821
- uploadProgress: number;
822
- fullPath: string | null;
823
- source: SourceTypes | null;
824
- isValidationPending: boolean;
825
- } & ({
826
- status: 'success';
827
- fileInfo: UploadcareFile;
828
- uuid: string;
829
- cdnUrl: string;
830
- cdnUrlModifiers: string;
831
- isUploading: false;
832
- isSuccess: true;
833
- isFailed: false;
834
- isRemoved: false;
835
- errors: [];
836
- } | {
837
- status: 'failed';
838
- fileInfo: UploadcareFile | null;
839
- uuid: string | null;
840
- cdnUrl: string | null;
841
- cdnUrlModifiers: string | null;
842
- isUploading: false;
843
- isSuccess: false;
844
- isFailed: true;
845
- isRemoved: false;
846
- errors: OutputError<OutputFileErrorType>[];
847
- } | {
848
- status: 'uploading';
849
- fileInfo: null;
850
- uuid: null;
851
- cdnUrl: null;
852
- cdnUrlModifiers: null;
853
- isUploading: true;
854
- isSuccess: false;
855
- isFailed: false;
856
- isRemoved: false;
857
- errors: [];
858
- } | {
859
- status: 'removed';
860
- fileInfo: UploadcareFile | null;
861
- uuid: string | null;
862
- cdnUrl: string | null;
863
- cdnUrlModifiers: string | null;
864
- isUploading: false;
865
- isSuccess: false;
866
- isFailed: false;
867
- isRemoved: true;
868
- errors: OutputError<OutputFileErrorType>[];
869
- } | {
870
- status: 'idle';
871
- fileInfo: null;
872
- uuid: null;
873
- cdnUrl: null;
874
- cdnUrlModifiers: null;
875
- isUploading: false;
876
- isSuccess: false;
877
- isFailed: false;
878
- isRemoved: false;
879
- errors: [];
880
- });
881
- type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
882
- type GroupFlag = 'has-group' | 'maybe-has-group';
883
- type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'> = {
884
- status: TStatus;
885
- totalCount: number;
886
- successCount: number;
887
- failedCount: number;
888
- uploadingCount: number;
889
- progress: number;
890
- successEntries: OutputFileEntry<'success'>[];
891
- failedEntries: OutputFileEntry<'failed'>[];
892
- uploadingEntries: OutputFileEntry<'uploading'>[];
893
- idleEntries: OutputFileEntry<'idle'>[];
894
- } & (TGroupFlag extends 'has-group' ? {
895
- group: UploadcareGroup;
896
- } : TGroupFlag extends 'maybe-has-group' ? {
897
- group: UploadcareGroup | null;
898
- } : never) & ({
899
- status: 'idle';
900
- isFailed: false;
901
- isUploading: false;
902
- isSuccess: false;
903
- errors: [];
904
- allEntries: OutputFileEntry<'idle' | 'success'>[];
905
- } | {
906
- status: 'uploading';
907
- isFailed: false;
908
- isUploading: true;
909
- isSuccess: false;
910
- errors: [];
911
- allEntries: OutputFileEntry[];
912
- } | {
913
- status: 'success';
914
- isFailed: false;
915
- isUploading: false;
916
- isSuccess: true;
917
- errors: [];
918
- allEntries: OutputFileEntry<'success'>[];
919
- } | {
920
- status: 'failed';
921
- isFailed: true;
922
- isUploading: false;
923
- isSuccess: false;
924
- errors: OutputError<OutputCollectionErrorType>[];
925
- allEntries: OutputFileEntry[];
926
- });
853
+ private _handleInput;
854
+ setOperation(operation: SliderOperation, filter?: SliderFilter): void;
855
+ private _initializeValues;
856
+ apply(): void;
857
+ cancel(): void;
858
+ initCallback(): void;
859
+ protected updated(changedProperties: PropertyValues<this>): void;
860
+ render(): lit_html.TemplateResult<1>;
861
+ }
862
+ declare global {
863
+ interface HTMLElementTagNameMap {
864
+ 'uc-editor-slider': EditorSlider;
865
+ }
866
+ }
927
867
 
928
- declare class SecureUploadsManager {
929
- private readonly _block;
930
- private _secureToken;
931
- constructor(block: LitUploaderBlock);
932
- private _debugPrint;
933
- getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
868
+ type TabIdValue = (typeof TabId)[keyof typeof TabId];
869
+ declare class EditorToolbar extends LitBlock {
870
+ private _showLoader;
871
+ showMainToolbar: boolean;
872
+ showSubToolbar: boolean;
873
+ private _showTabToggles;
874
+ tabList: readonly TabIdValue[];
875
+ activeTab: TabIdValue;
876
+ private _useSliderPanel;
877
+ private _tooltipVisible;
878
+ private _operationTooltip;
879
+ private _tabIndicatorOffset;
880
+ private _tabIndicatorWidth;
881
+ private readonly _sliderRef;
882
+ private readonly _tabIndicatorRef;
883
+ protected readonly tabToggleRefs: Record<TabIdValue, Ref<HTMLElement>>;
884
+ private readonly _handleWindowResize;
885
+ private _cropPresets;
886
+ private _cancelPreload?;
887
+ private readonly _debouncedShowLoader;
888
+ private readonly _updateInfoTooltip;
889
+ private readonly _subTopToolbarStyles;
890
+ private readonly _subBottomToolbarStyles;
891
+ private readonly _tabToggleStyles;
892
+ private readonly _tabTogglesStyles;
893
+ init$: Record<string, unknown>;
894
+ private _onSliderClose;
895
+ private _activateTab;
896
+ private _applyTabState;
897
+ private _syncTabIndicator;
898
+ private get _hasAspectRatioPicker();
899
+ private _renderControlsByTab;
900
+ private _renderCropTabControls;
901
+ private _renderFilterTabControls;
902
+ private _renderTuningTabControls;
903
+ private _renderControlGroup;
904
+ private _renderFreeformControl;
905
+ private _renderAspectRatioControl;
906
+ private _renderCropOperationControl;
907
+ private _renderFilterControl;
908
+ private _renderOperationControl;
909
+ private _renderAspectRatioList;
910
+ private _preloadEditedImage;
911
+ initCallback(): void;
912
+ connectedCallback(): void;
913
+ firstUpdated(changedProperties: PropertyValues<this>): void;
914
+ protected updated(changedProperties: PropertyValues<this>): void;
915
+ disconnectedCallback(): void;
916
+ private _assignSharedElements;
917
+ private readonly _handleCancel;
918
+ private readonly _handleApply;
919
+ private readonly _handleApplySlider;
920
+ private readonly _handleCancelSlider;
921
+ private readonly _handleTabClick;
922
+ private _renderTabToggle;
923
+ private _renderTabContent;
924
+ render(): TemplateResult<1>;
925
+ }
926
+ declare global {
927
+ interface HTMLElementTagNameMap {
928
+ 'uc-editor-toolbar': EditorToolbar;
929
+ }
934
930
  }
935
931
 
936
- declare class LitUploaderBlock extends LitActivityBlock {
937
- static extSrcList: Readonly<typeof ExternalUploadSource>;
938
- static sourceTypes: Readonly<typeof UploadSource>;
939
- protected couldBeCtxOwner: boolean;
940
- private _isCtxOwner;
941
- private _unobserveCollection?;
942
- private _unobserveCollectionProperties?;
943
- init$: {
944
- '*commonProgress': number;
945
- '*uploadList': never[];
946
- '*uploadQueue': _uploadcare_upload_client.Queue;
947
- '*collectionErrors': OutputErrorCollection[];
948
- '*collectionState': OutputCollectionState | null;
949
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
950
- '*uploadTrigger': Set<string>;
951
- '*currentActivity': null;
952
- '*currentActivityParams': {};
953
- '*history': never[];
954
- '*historyBack': null;
955
- '*closeModal': () => void;
932
+ declare class CloudImageEditorBlock extends LitBlock {
933
+ attributesMeta: ({
934
+ uuid: string;
935
+ } | {
936
+ 'cdn-url': string;
937
+ }) & Partial<{
938
+ tabs: string;
939
+ 'crop-preset': string;
940
+ }> & {
941
+ 'ctx-name': string;
956
942
  };
957
- private get _hasCtxOwner();
943
+ ctxOwner: boolean;
944
+ static styleAttrs: string[];
945
+ private _statusMessage;
946
+ private _imageSrc;
947
+ private _fileType;
948
+ private _showLoader;
949
+ uuid: string | null;
950
+ cdnUrl: string | null;
951
+ cropPreset: string;
952
+ tabs: string | null;
953
+ private _hasNetworkProblems;
954
+ private _isInitialized;
955
+ private _pendingInitUpdate;
956
+ private readonly _debouncedShowLoader;
957
+ private readonly _imgRef;
958
+ private readonly _cropperRef;
959
+ private readonly _faderRef;
960
+ private readonly _imgContainerRef;
961
+ private readonly _handleImageLoad;
962
+ private readonly _handleImageError;
963
+ private readonly _handleRetryNetwork;
964
+ private _scheduleInitialization;
965
+ init$: ReturnType<typeof initState>;
958
966
  initCallback(): void;
959
- protected get validationManager(): ValidationManager;
960
- get api(): UploaderPublicApi;
961
- getAPI(): UploaderPublicApi;
962
- get uploadCollection(): TypedCollection<UploadEntryData>;
963
- get secureUploadsManager(): SecureUploadsManager;
967
+ private _assignSharedElements;
968
+ private _attachImageListeners;
969
+ private _detachImageListeners;
970
+ private get _imageClassName();
971
+ /**
972
+ * To proper work, we need non-zero size the element. So, we'll wait for it.
973
+ */
974
+ private _waitForSize;
975
+ firstUpdated(changedProperties: PropertyValues<this>): void;
964
976
  disconnectedCallback(): void;
965
- connectedCallback(): void;
966
- private _initCtxOwner;
967
- private _observeUploadCollection;
968
- private _unobserveUploadCollection;
969
- private _createGroup;
970
- private _flushOutputItems;
971
- private _handleCollectionUpdate;
972
- private _handleCollectionPropertiesUpdate;
973
- private _flushCommonUploadProgress;
974
- private _openCloudImageEditor;
975
- private _setInitialCrop;
976
- protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
977
- protected getUploadClientOptions(): Promise<FileFromOptions>;
978
- getOutputData(): OutputFileEntry[];
979
- }
980
-
981
- /**
982
- * Mapping of loading resources per operation
983
- */
984
- type LoadingOperations = Map<string, Map<string, boolean>>;
985
- /**
986
- * Image size
987
- */
988
- interface ImageSize {
989
- width: number;
990
- height: number;
977
+ render(): lit_html.TemplateResult<1>;
978
+ protected updated(changedProperties: PropertyValues<this>): void;
979
+ private _syncTabListFromProp;
980
+ private _syncCropPresetState;
981
+ updateImage(): Promise<void>;
982
+ initEditor(): Promise<void>;
991
983
  }
992
- interface Transformations {
993
- enhance?: number;
994
- brightness?: number;
995
- exposure?: number;
996
- gamma?: number;
997
- contrast?: number;
998
- saturation?: number;
999
- vibrance?: number;
1000
- warmth?: number;
1001
- rotate?: number;
1002
- mirror?: boolean;
1003
- flip?: boolean;
1004
- filter?: {
1005
- name: string;
1006
- amount: number;
1007
- };
1008
- crop?: {
1009
- dimensions: [number, number];
1010
- coords: [number, number];
1011
- };
984
+ declare global {
985
+ interface HTMLElementTagNameMap {
986
+ 'uc-cloud-image-editor-block': CloudImageEditorBlock;
987
+ }
1012
988
  }
1013
- interface ApplyResult {
1014
- originalUrl: string;
1015
- cdnUrlModifiers: string;
1016
- cdnUrl: string;
1017
- transformations: Transformations;
989
+
990
+ declare class CloudImageEditor extends CloudImageEditorBlock {
991
+ static styleAttrs: string[];
992
+ constructor();
993
+ initCallback(): void;
1018
994
  }
1019
- type ChangeResult = ApplyResult;
1020
- interface CropAspectRatio {
1021
- type: 'aspect-ratio';
1022
- width: number;
1023
- height: number;
1024
- id: string;
1025
- hasFreeform?: boolean;
995
+ declare global {
996
+ interface HTMLElementTagNameMap {
997
+ 'uc-cloud-image-editor': CloudImageEditor;
998
+ }
1026
999
  }
1027
- type CropPresetList = CropAspectRatio[];
1028
1000
 
1029
1001
  type ActivityParams$1 = {
1030
1002
  internalId: string;
@@ -1044,6 +1016,28 @@ declare class CloudImageEditorActivity extends LitUploaderBlock {
1044
1016
  render(): lit_html.TemplateResult<1> | typeof nothing;
1045
1017
  private _createEditorConfig;
1046
1018
  }
1019
+ declare global {
1020
+ interface HTMLElementTagNameMap {
1021
+ 'uc-cloud-image-editor-activity': CloudImageEditorActivity;
1022
+ }
1023
+ }
1024
+
1025
+ declare class ActivityHeader extends LitActivityBlock {
1026
+ }
1027
+ declare global {
1028
+ interface HTMLElementTagNameMap {
1029
+ 'uc-activity-header': ActivityHeader;
1030
+ }
1031
+ }
1032
+
1033
+ declare class Spinner extends LitBlock {
1034
+ render(): lit_html.TemplateResult<1>;
1035
+ }
1036
+ declare global {
1037
+ interface HTMLElementTagNameMap {
1038
+ 'uc-spinner': Spinner;
1039
+ }
1040
+ }
1047
1041
 
1048
1042
  type ActivityParams = {
1049
1043
  externalSourceType: string;
@@ -1085,6 +1079,23 @@ declare class ExternalSource extends LitUploaderBlock {
1085
1079
  disconnectedCallback(): void;
1086
1080
  render(): lit_html.TemplateResult<1>;
1087
1081
  }
1082
+ declare global {
1083
+ interface HTMLElementTagNameMap {
1084
+ 'uc-external-source': ExternalSource;
1085
+ }
1086
+ }
1087
+
1088
+ declare const ACTIVITY_TYPES: Readonly<{
1089
+ START_FROM: "start-from";
1090
+ CAMERA: "camera";
1091
+ DRAW: "draw";
1092
+ UPLOAD_LIST: "upload-list";
1093
+ URL: "url";
1094
+ CLOUD_IMG_EDIT: "cloud-image-edit";
1095
+ EXTERNAL: "external";
1096
+ }>;
1097
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1098
+ type ActivityType = RegisteredActivityType | (string & {}) | null;
1088
1099
 
1089
1100
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1090
1101
  type ActivityParamsMap = {
@@ -1131,8 +1142,6 @@ declare class LitActivityBlock extends LitBlock {
1131
1142
  get doneActivity(): string | null;
1132
1143
  historyBack(): void;
1133
1144
  }
1134
- type RegisteredActivityType = (typeof LitActivityBlock)['activities'][keyof (typeof LitActivityBlock)['activities']];
1135
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1136
1145
 
1137
1146
  declare const InternalEventType: Readonly<{
1138
1147
  readonly INIT_SOLUTION: "init-solution";
@@ -1180,7 +1189,7 @@ type EventPayload = {
1180
1189
  [EventType.ACTIVITY_CHANGE]: {
1181
1190
  activity: ActivityType;
1182
1191
  };
1183
- [EventType.UPLOAD_CLICK]: void;
1192
+ [EventType.UPLOAD_CLICK]: undefined;
1184
1193
  [EventType.DONE_CLICK]: OutputCollectionState;
1185
1194
  [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
1186
1195
  [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
@@ -1189,1111 +1198,1425 @@ type EventPayload = {
1189
1198
  [EventType.CHANGE]: OutputCollectionState;
1190
1199
  [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
1191
1200
  };
1192
- declare class EventEmitter {
1201
+ declare class EventEmitter extends SharedInstance {
1193
1202
  private _timeoutStore;
1194
1203
  private _targets;
1195
- private _debugPrint;
1196
- constructor(debugPrint: (...args: unknown[]) => void);
1197
1204
  bindTarget(target: LitBlock): () => void;
1198
1205
  private _dispatch;
1199
1206
  emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
1200
1207
  debounce?: TDebounce;
1201
1208
  }): void;
1209
+ destroy(): void;
1210
+ }
1211
+
1212
+ type EventMap = {
1213
+ [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
1214
+ };
1215
+
1216
+ type SelectOption = {
1217
+ text: string;
1218
+ value: string;
1219
+ };
1220
+ declare class Select extends LitBlock {
1221
+ value: string;
1222
+ disabled: boolean;
1223
+ options: SelectOption[];
1224
+ render(): lit_html.TemplateResult<1>;
1225
+ private _handleChange;
1226
+ }
1227
+ declare global {
1228
+ interface HTMLElementTagNameMap {
1229
+ 'uc-select': Select;
1230
+ }
1231
+ }
1232
+
1233
+ type CameraMode = 'photo' | 'video';
1234
+ declare class CameraSource extends LitUploaderBlock {
1235
+ couldBeCtxOwner: boolean;
1236
+ activityType: "camera";
1237
+ private _unsubPermissions;
1238
+ private _capturing;
1239
+ private _chunks;
1240
+ private _mediaRecorder;
1241
+ private _stream;
1242
+ private _selectedAudioId;
1243
+ private _selectedCameraId;
1244
+ private _activeTab;
1245
+ private _options;
1246
+ private _canvas;
1247
+ private _ctx;
1248
+ private _cameraDevices;
1249
+ private _audioDevices;
1250
+ private _permissionResponses;
1251
+ private _permissionCleanupFns;
1252
+ private _currentVideoSource;
1253
+ private readonly _handlePreviewPlay;
1254
+ private readonly _handlePreviewPause;
1255
+ private _timerRef;
1256
+ private _lineRef;
1257
+ private _videoRef;
1258
+ private _switcherRef;
1259
+ private _startTime;
1260
+ private _elapsedTime;
1261
+ private _videoTransformCss;
1262
+ private _videoHidden;
1263
+ private _messageHidden;
1264
+ private _requestBtnHidden;
1265
+ private _cameraSelectOptions;
1266
+ private _cameraSelectHidden;
1267
+ private _l10nMessage;
1268
+ private _timerHidden;
1269
+ private _cameraHidden;
1270
+ private _cameraActionsHidden;
1271
+ private _audioSelectOptions;
1272
+ private _audioSelectHidden;
1273
+ private _audioSelectDisabled;
1274
+ private _audioToggleMicrophoneHidden;
1275
+ private _tabCameraHidden;
1276
+ private _tabVideoHidden;
1277
+ private _currentIcon;
1278
+ private _currentTimelineIcon;
1279
+ private _toggleMicrophoneIcon;
1280
+ private _mutableClassButton;
1281
+ private _chooseActionWithCamera;
1282
+ private _handleCameraSelectChange;
1283
+ private _handleAudioSelectChange;
1284
+ private _handleRequestPermissions;
1285
+ private _handleStartCamera;
1286
+ private _handleToggleRecording;
1287
+ private _handleToggleAudio;
1288
+ private _handleRetake;
1289
+ private _handleAccept;
1290
+ private _handleClickTab;
1291
+ private _updateTimer;
1292
+ private _startTimer;
1293
+ private _stopTimer;
1294
+ private _startTimeline;
1295
+ private _stopTimeline;
1296
+ private _animationFrameId;
1297
+ private _startRecording;
1298
+ private _stopRecording;
1299
+ /** This method is used to toggle recording pause/resume */
1300
+ private _toggleRecording;
1301
+ private _toggleEnableAudio;
1302
+ /**
1303
+ * Previewing the video that was recorded on the camera
1304
+ */
1305
+ private _previewVideo;
1306
+ private _attachPreviewListeners;
1307
+ private _detachPreviewListeners;
1308
+ private _setVideoSource;
1309
+ /**
1310
+ * Do not bind srcObject directly in the template, because it stops video pausing on shot.
1311
+ * I really don'y know why but that's how it is. Assigning srcObject manually fixes the issue.
1312
+ */
1313
+ private _applyVideoSource;
1314
+ private _retake;
1315
+ private _accept;
1316
+ private _handlePhoto;
1317
+ private _handleVideo;
1318
+ private _setCameraState;
1319
+ private _shot;
1320
+ private _handleActiveTab;
1321
+ private _createFile;
1322
+ private _guessExtensionByMime;
1323
+ /**
1324
+ * The send file to the server
1325
+ */
1326
+ private _toSend;
1327
+ private get _cameraModes();
1328
+ private _setPermissionsState;
1329
+ private _makeStreamInactive;
1330
+ private _stopCapture;
1331
+ private _capture;
1332
+ private _handlePermissionsChange;
1333
+ private _permissionAccess;
1334
+ private _teardownPermissionListeners;
1335
+ private _requestDeviceAccess;
1336
+ private _getDevices;
1337
+ private _onActivate;
1338
+ private _onDeactivate;
1339
+ private _handleCameraModes;
1340
+ initCallback(): void;
1341
+ firstUpdated(changedProperties: PropertyValues<this>): void;
1342
+ updated(changedProperties: PropertyValues<this>): void;
1343
+ private _destroy;
1344
+ disconnectedCallback(): void;
1345
+ render(): lit_html.TemplateResult<1>;
1346
+ }
1347
+ declare global {
1348
+ interface HTMLElementTagNameMap {
1349
+ 'uc-camera-source': CameraSource;
1350
+ }
1351
+ }
1352
+
1353
+ /**
1354
+ * Config keys that can't be passed as attribute (because they are object or function)
1355
+ */
1356
+ declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
1357
+ /** Mapping of attribute names to state */
1358
+ declare const attrStateMapping: Record<string, string>;
1359
+ declare class Config extends LitBlock {
1360
+ attributesMeta: Partial<ConfigPlainType> & {
1361
+ 'ctx-name': string;
1362
+ };
1363
+ init$: LitBlock["init$"] & ConfigType;
1364
+ private _computationControllers;
1365
+ private _flushValueToAttribute;
1366
+ private _flushValueToState;
1367
+ private _setValue;
1368
+ private _getValue;
1369
+ private _assertSameValueDifferentReference;
1370
+ initCallback(): void;
1371
+ attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
1372
+ static get observedAttributes(): string[];
1373
+ }
1374
+ interface Config extends ConfigType {
1375
+ }
1376
+ declare global {
1377
+ interface HTMLElementTagNameMap {
1378
+ 'uc-config': Config;
1379
+ }
1202
1380
  }
1203
1381
 
1204
- type CommonEventType = InternalEventKey | EventKey;
1205
- type TelemetryState = TelemetryRequest & {
1206
- eventTimestamp: number;
1207
- location: string;
1208
- };
1209
- type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
1210
- modalId?: string;
1211
- eventType?: CommonEventType;
1212
- };
1213
- interface ITelemetryManager {
1214
- sendEvent(body: TelemetryEventBody): void;
1215
- sendEventError(error: unknown, context?: string): void;
1216
- sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
1382
+ declare class FileItemConfig extends LitUploaderBlock {
1383
+ private _entrySubs;
1384
+ protected entry: UploadEntryTypedData | null;
1385
+ protected withEntry<A extends unknown[], R>(fn: (entry: UploadEntryTypedData, ...args: A) => R): (...args: A) => R | undefined;
1386
+ protected subEntry<K extends UploadEntryKeys>(prop: K, handler: (value: UploadEntryData[K]) => void): void;
1387
+ protected reset(): void;
1388
+ disconnectedCallback(): void;
1217
1389
  }
1218
1390
 
1219
- declare const TabId: Readonly<{
1220
- readonly CROP: "crop";
1221
- readonly TUNING: "tuning";
1222
- readonly FILTERS: "filters";
1223
- }>;
1224
- type TabIdValue$1 = (typeof TabId)[keyof typeof TabId];
1225
- declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
1226
- type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
1227
- 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"];
1228
- type FilterId = (typeof ALL_FILTERS)[number];
1229
- declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
1230
- type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
1231
- /** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
1232
- declare const COLOR_OPERATIONS_CONFIG: Readonly<{
1233
- brightness: {
1234
- zero: number;
1235
- range: readonly [-100, 100];
1236
- keypointsNumber: number;
1237
- };
1238
- exposure: {
1239
- zero: number;
1240
- range: readonly [-500, 500];
1241
- keypointsNumber: number;
1242
- };
1243
- gamma: {
1244
- zero: number;
1245
- range: readonly [0, 1000];
1246
- keypointsNumber: number;
1247
- };
1248
- contrast: {
1249
- zero: number;
1250
- range: readonly [-100, 500];
1251
- keypointsNumber: number;
1252
- };
1253
- saturation: {
1254
- zero: number;
1255
- range: readonly [-100, 500];
1256
- keypointsNumber: number;
1257
- };
1258
- vibrance: {
1259
- zero: number;
1260
- range: readonly [-100, 500];
1261
- keypointsNumber: number;
1262
- };
1263
- warmth: {
1264
- zero: number;
1265
- range: readonly [-100, 100];
1266
- keypointsNumber: number;
1267
- };
1268
- enhance: {
1269
- zero: number;
1270
- range: readonly [0, 100];
1271
- keypointsNumber: number;
1272
- };
1273
- filter: {
1274
- zero: number;
1275
- range: readonly [0, 100];
1276
- keypointsNumber: number;
1277
- };
1278
- }>;
1391
+ declare class Thumb extends FileItemConfig {
1392
+ badgeIcon: string;
1393
+ uid: Uid;
1394
+ private _thumbUrl;
1395
+ private _renderedGridOnce;
1396
+ private _thumbRect;
1397
+ private _isIntersecting;
1398
+ private _firstViewMode;
1399
+ private _observer?;
1400
+ private _pendingThumbUpdate?;
1401
+ private _calculateThumbSize;
1402
+ private _generateThumbnail;
1403
+ private _debouncedGenerateThumb;
1404
+ private _decodeImage;
1405
+ private _cancelPendingThumbUpdate;
1406
+ private _scheduleThumbUpdate;
1407
+ private _requestThumbGeneration;
1408
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
1409
+ protected updated(changedProperties: PropertyValues<this>): void;
1410
+ private _observerCallback;
1411
+ protected reset(): void;
1412
+ private _bindToEntry;
1413
+ initCallback(): void;
1414
+ connectedCallback(): void;
1415
+ disconnectedCallback(): void;
1416
+ render(): lit_html.TemplateResult<1>;
1417
+ }
1418
+ declare global {
1419
+ interface HTMLElementTagNameMap {
1420
+ 'uc-thumb': Thumb;
1421
+ }
1422
+ }
1279
1423
 
1280
- type SharedConfigState = {
1281
- [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
1282
- };
1283
- type BlocksRegistry = Set<LitBlock>;
1284
- type ActivityBlockCtxState = {
1285
- '*currentActivity': string | null;
1286
- '*currentActivityParams': Record<string, unknown>;
1287
- '*history': (string | null)[];
1288
- '*historyBack': (() => void) | null;
1289
- '*closeModal': () => void;
1290
- };
1291
- type UploaderBlockCtxState = ActivityBlockCtxState & {
1292
- '*commonProgress': number;
1293
- '*uploadList': {
1294
- uid: Uid;
1295
- }[];
1296
- '*uploadQueue': Queue;
1297
- '*collectionErrors': OutputErrorCollection[];
1298
- '*collectionState': OutputCollectionState | null;
1299
- '*groupInfo': UploadcareGroup | null;
1300
- '*uploadTrigger': Set<Uid>;
1301
- };
1302
- type SolutionBlockCtxState = UploaderBlockCtxState & {
1303
- '*solution': string | null;
1304
- };
1305
- type CloudImageEditorState = {
1306
- '*originalUrl': string | null;
1307
- '*loadingOperations': LoadingOperations;
1308
- '*faderEl': EditorImageFader | null;
1309
- '*cropperEl': EditorImageCropper | null;
1310
- '*imgEl': HTMLImageElement | null;
1311
- '*imgContainerEl': HTMLElement | null;
1312
- '*networkProblems': boolean;
1313
- '*imageSize': {
1314
- width: number;
1315
- height: number;
1316
- } | null;
1317
- '*editorTransformations': Transformations;
1318
- '*cropPresetList': CropPresetList;
1319
- '*currentAspectRatio': CropAspectRatio | null;
1320
- '*tabList': readonly TabIdValue$1[];
1321
- '*tabId': TabIdValue$1;
1322
- '*on.retryNetwork': () => void;
1323
- '*on.apply': (transformations: Transformations) => void;
1324
- '*on.cancel': () => void;
1325
- };
1326
- type EditorImageCropperState = {
1327
- '*padding': number;
1328
- '*operations': {
1329
- rotate: number;
1330
- mirror: boolean;
1331
- flip: boolean;
1332
- };
1333
- '*imageBox': {
1334
- x: number;
1335
- y: number;
1336
- width: number;
1337
- height: number;
1338
- };
1339
- '*cropBox': {
1340
- x: number;
1341
- y: number;
1342
- width: number;
1343
- height: number;
1344
- };
1345
- };
1346
- type EditorToolbarState = {
1347
- '*showListAspectRatio': boolean;
1348
- '*sliderEl': EditorSlider | null;
1349
- '*showSlider': boolean;
1350
- '*currentFilter': string;
1351
- '*currentOperation': string | null;
1352
- '*operationTooltip': string | null;
1353
- };
1354
- type DynamicBlockState = {
1355
- '*blocksRegistry': BlocksRegistry;
1356
- '*eventEmitter': EventEmitter;
1357
- '*localeManager': LocaleManager;
1358
- '*telemetryManager': ITelemetryManager;
1359
- '*a11y': A11y;
1360
- '*modalManager': ModalManager | null;
1361
- };
1362
- type DynamicUploaderBlockState = {
1363
- '*uploadCollection': TypedCollection<UploadEntryData>;
1364
- '*publicApi': UploaderPublicApi;
1365
- '*validationManager': ValidationManager;
1366
- '*secureUploadsManager': SecureUploadsManager;
1367
- };
1368
- type LocaleState = {
1369
- [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
1370
- };
1371
- type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
1424
+ declare class ProgressBar extends LitBlock {
1425
+ hasFileName: boolean;
1426
+ value: number;
1427
+ visible: boolean;
1428
+ private _progressValue;
1429
+ private readonly _fakeProgressLineRef;
1430
+ private readonly _handleFakeProgressAnimation;
1431
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
1432
+ protected updated(changedProperties: PropertyValues<this>): void;
1433
+ disconnectedCallback(): void;
1434
+ private _normalizeProgressValue;
1435
+ private _updateProgressValueStyle;
1436
+ render(): lit_html.TemplateResult<1>;
1437
+ }
1438
+ declare global {
1439
+ interface HTMLElementTagNameMap {
1440
+ 'uc-progress-bar': ProgressBar;
1441
+ }
1442
+ }
1372
1443
 
1373
- declare const LitBlockBase: typeof LitElement & Constructor<{
1374
- willYield: boolean;
1375
- yield(slot: string, defaultContent?: unknown): unknown;
1376
- }> & Constructor<{
1377
- getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
1378
- }> & Constructor<SymbioteComponent<SharedState>> & Constructor<LitElement> & {
1379
- reg(tagName: string): void;
1380
- };
1381
- declare class LitBlock extends LitBlockBase {
1382
- private _cfgProxy;
1383
- private _sharedContextInstances;
1384
- static styleAttrs: string[];
1385
- activityType: ActivityType;
1386
- init$: {};
1387
- constructor();
1388
- l10n(str: string, variables?: Record<string, string | number>): string;
1389
- private _pluralize;
1390
- emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
1391
- hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
1444
+ declare class FileItem extends FileItemConfig {
1445
+ protected couldBeCtxOwner: boolean;
1446
+ private _pauseRender;
1447
+ uid: Uid;
1448
+ private _itemName;
1449
+ private _errorText;
1450
+ private _hint;
1451
+ private _progressValue;
1452
+ private _progressVisible;
1453
+ private _badgeIcon;
1454
+ private _isFinished;
1455
+ private _isFailed;
1456
+ private _isUploading;
1457
+ private _isFocused;
1458
+ private _isEditable;
1459
+ private _showFileNames;
1460
+ private _ariaLabelStatusFile;
1461
+ private _renderedOnce;
1462
+ private _observer?;
1463
+ private _handleEdit;
1464
+ private _handleRemove;
1465
+ private _handleUploadClick;
1466
+ private _calculateState;
1467
+ private _debouncedCalculateState;
1468
+ private _updateHintAndProgress;
1469
+ private _handleState;
1470
+ protected reset(): void;
1471
+ private _observerCallback;
1472
+ private _handleEntryId;
1473
+ private _updateShowFileNames;
1474
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
1475
+ initCallback(): void;
1392
1476
  connectedCallback(): void;
1477
+ disconnectedCallback(): void;
1478
+ private _upload;
1479
+ static activeInstances: Set<FileItem>;
1480
+ protected shouldUpdate(changedProperties: PropertyValues<this>): boolean;
1481
+ render(): lit_html.TemplateResult<1>;
1482
+ }
1483
+ declare global {
1484
+ interface HTMLElementTagNameMap {
1485
+ 'uc-file-item': FileItem;
1486
+ }
1487
+ }
1488
+
1489
+ declare class DropArea extends LitUploaderBlock {
1490
+ static styleAttrs: string[];
1491
+ /**
1492
+ * CSS-only attribute
1493
+ */
1494
+ single: boolean;
1495
+ /**
1496
+ * CSS-only attribute
1497
+ */
1498
+ ghost: boolean;
1499
+ disabled: boolean;
1500
+ clickable: boolean;
1501
+ withIcon: boolean;
1502
+ fullscreen: boolean;
1503
+ initflow: boolean;
1504
+ text?: string;
1505
+ private _isEnabled;
1506
+ private _isVisible;
1507
+ private get _localizedText();
1508
+ private _destroyDropzone;
1509
+ private _destroyContentWrapperDropzone;
1510
+ private _contentWrapperRef;
1511
+ private readonly _handleAreaInteraction;
1512
+ private _sourceListAllowsLocal;
1513
+ private _clickableListenersAttached;
1514
+ isActive(): boolean;
1515
+ initCallback(): void;
1516
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
1517
+ protected updated(changedProperties: PropertyValues<this>): void;
1518
+ /** Ignore drop events if there are other visible drop areas on the page. */
1519
+ private _shouldIgnore;
1520
+ private _couldHandleFiles;
1521
+ private _updateIsEnabled;
1522
+ private _updateVisibility;
1523
+ private _updateDragStateAttribute;
1524
+ private _updateClickableListeners;
1525
+ disconnectedCallback(): void;
1526
+ render(): lit_html.TemplateResult<1>;
1527
+ }
1528
+ declare global {
1529
+ interface HTMLElementTagNameMap {
1530
+ 'uc-drop-area': DropArea;
1531
+ }
1532
+ }
1533
+
1534
+ type FilesViewMode = 'grid' | 'list';
1535
+ declare class UploadList extends LitUploaderBlock {
1536
+ couldBeCtxOwner: boolean;
1537
+ protected historyTracked: boolean;
1538
+ activityType: "upload-list";
1539
+ private _doneBtnVisible;
1540
+ private _doneBtnEnabled;
1541
+ private _uploadBtnVisible;
1542
+ private _addMoreBtnVisible;
1543
+ private _addMoreBtnEnabled;
1544
+ private _commonErrorMessage;
1545
+ private _hasFiles;
1546
+ private _latestSummary;
1547
+ private get _headerText();
1548
+ private _handleAdd;
1549
+ private _handleUpload;
1550
+ private _handleDone;
1551
+ private _handleCancel;
1552
+ private _throttledHandleCollectionUpdate;
1553
+ private _updateUploadsState;
1554
+ private _getHeaderText;
1555
+ get couldOpenActivity(): boolean;
1393
1556
  initCallback(): void;
1394
- get testId(): string;
1395
- get modalManager(): ModalManager | null;
1396
- get telemetryManager(): ITelemetryManager;
1397
- get localeManager(): LocaleManager;
1398
- get a11y(): A11y;
1399
- get blocksRegistry(): Set<LitBlock>;
1400
- get eventEmitter(): EventEmitter;
1401
1557
  disconnectedCallback(): void;
1558
+ render(): lit_html.TemplateResult<1>;
1559
+ }
1560
+ declare global {
1561
+ interface HTMLElementTagNameMap {
1562
+ 'uc-upload-list': UploadList;
1563
+ }
1564
+ }
1565
+
1566
+ type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
1567
+ type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
1568
+ type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
1569
+ uuid: string;
1570
+ cdnUrlModifiers: string;
1571
+ fileName: string;
1572
+ }) => Promise<string> | string;
1573
+ type SecureUploadsSignatureAndExpire = {
1574
+ secureSignature: string;
1575
+ secureExpire: string;
1576
+ };
1577
+ type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatureAndExpire | null>;
1578
+ type IconHrefResolver = (iconName: string) => string;
1579
+ type FileValidators = FileValidator[];
1580
+ type CollectionValidators = FuncCollectionValidator[];
1581
+ type ConfigType = {
1582
+ /**
1583
+ * Your project’s Public Key.
1584
+ */
1585
+ pubkey: string;
1586
+ /**
1587
+ * Allow multiple file uploads.
1588
+ */
1589
+ multiple: boolean;
1590
+ /**
1591
+ * Minimum number of files to upload.
1592
+ */
1593
+ multipleMin: number;
1594
+ /**
1595
+ * Maximum number of files to upload.
1596
+ */
1597
+ multipleMax: number;
1598
+ /**
1599
+ * Require user confirmation before uploading.
1600
+ */
1601
+ confirmUpload: boolean;
1602
+ /**
1603
+ * Allow only image files.
1604
+ */
1605
+ imgOnly: boolean;
1606
+ /**
1607
+ * Native file input accept attribute value. Also affects client validation settings.
1608
+ */
1609
+ accept: string;
1610
+ /**
1611
+ * Preferred types for external sources.
1612
+ * See [here](https://uploadcare.com/docs/file-uploader/options/#external-sources-preferred-types)
1613
+ */
1614
+ externalSourcesPreferredTypes: string;
1615
+ /**
1616
+ * Provide custom CSS to the social sources iframe
1617
+ */
1618
+ externalSourcesEmbedCss: string;
1619
+ /**
1620
+ * Store uploaded files.
1621
+ */
1622
+ store: boolean | 'auto';
1623
+ /**
1624
+ * Mirror the camera view.
1625
+ */
1626
+ cameraMirror: boolean;
1627
+ /**
1628
+ * Default camera capture mode.
1629
+ */
1630
+ cameraCapture: 'user' | 'environment' | '';
1631
+ /**
1632
+ * List of sources for file uploads.
1633
+ */
1634
+ sourceList: string;
1635
+ /**
1636
+ * Top-level origin for the uploader.
1637
+ * This is used for Google Drive Picker if there is no access to the origin due to the cross-origin policy.
1638
+ */
1639
+ topLevelOrigin: string;
1640
+ /**
1641
+ * Maximum size of local files in bytes.
1642
+ */
1643
+ maxLocalFileSizeBytes: number;
1644
+ /**
1645
+ * Thumbnail size.
1646
+ */
1647
+ thumbSize: number;
1648
+ /**
1649
+ * Show the upload list even if it is empty.
1650
+ */
1651
+ showEmptyList: boolean;
1652
+ /**
1653
+ * Use local image editor.
1654
+ */
1655
+ useLocalImageEditor: boolean;
1656
+ /**
1657
+ * Enable cloud image editing.
1658
+ */
1659
+ useCloudImageEditor: boolean;
1660
+ /**
1661
+ * Tabs to show in the cloud image editor.
1662
+ *
1663
+ * @default 'crop, tuning, filters'
1664
+ */
1665
+ cloudImageEditorTabs: string;
1666
+ /**
1667
+ * Remove copyright information.
1668
+ */
1669
+ removeCopyright: boolean;
1670
+ /**
1671
+ * Defines the crop behavior. When uploading images, your users can select a crop area with a defined aspect ratio.
1672
+ */
1673
+ cropPreset: string;
1674
+ /**
1675
+ * Image shrink options.
1676
+ */
1677
+ imageShrink: string;
1678
+ /**
1679
+ * Lock scroll when modal is open.
1680
+ */
1681
+ modalScrollLock: boolean;
1682
+ /**
1683
+ * Show strokes on modal backdrop.
1684
+ */
1685
+ modalBackdropStrokes: boolean;
1686
+ /**
1687
+ * Wrap the source list.
1688
+ */
1689
+ sourceListWrap: boolean;
1690
+ /**
1691
+ * Key to revoke Custom OAuth access. See [OAuth docs](https://uploadcare.com/docs/upload-sources/#oauth) for details.
1692
+ */
1693
+ remoteTabSessionKey: string;
1694
+ /**
1695
+ * Set custom CNAME.
1696
+ */
1697
+ cdnCname: string;
1698
+ /**
1699
+ * Set CNAME base domain for prefixed CDN URLs.
1700
+ */
1701
+ cdnCnamePrefixed: string;
1702
+ /**
1703
+ * Set a custom upload URL.
1704
+ */
1705
+ baseUrl: string;
1706
+ /**
1707
+ * Set a custom social sources URL.
1708
+ */
1709
+ socialBaseUrl: string;
1710
+ /**
1711
+ * Secure signature for uploads.
1712
+ */
1713
+ secureSignature: string;
1714
+ /**
1715
+ * Expiry time for secure uploads.
1716
+ */
1717
+ secureExpire: string;
1718
+ /**
1719
+ * Proxy URL for secure delivery.
1720
+ */
1721
+ secureDeliveryProxy: string;
1722
+ /**
1723
+ * Maximum number of retry attempts for throttled requests.
1724
+ */
1725
+ retryThrottledRequestMaxTimes: number;
1726
+ /**
1727
+ * Maximum number of retry attempts for network errors.
1728
+ */
1729
+ retryNetworkErrorMaxTimes: number;
1730
+ /**
1731
+ * Minimum file size for multipart uploads.
1732
+ */
1733
+ multipartMinFileSize: number;
1734
+ /**
1735
+ * Chunk size for multipart uploads.
1736
+ */
1737
+ multipartChunkSize: number;
1738
+ /**
1739
+ * Maximum number of concurrent requests.
1740
+ */
1741
+ maxConcurrentRequests: number;
1402
1742
  /**
1403
- * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
1743
+ * Maximum number of concurrent multipart requests.
1404
1744
  */
1405
- protected destroyCtxCallback(): void;
1745
+ multipartMaxConcurrentRequests: number;
1406
1746
  /**
1407
- * Adds a shared context instance if it does not exist yet.
1408
- * @param key The shared state key.
1409
- * @param resolver The resolver function that creates the instance.
1410
- * @param persist Whether to persist the instance in the context if the creator block is removed. It's usually needed for those instances that depends on the current block. Defaults to false.
1747
+ * Maximum number of attempts for multipart uploads.
1411
1748
  */
1412
- protected addSharedContextInstance<TKey extends keyof SharedState>(key: TKey, resolver: () => SharedState[TKey], { persist }?: {
1413
- persist?: boolean | undefined;
1414
- }): void;
1415
- private _destroySharedContextInstances;
1416
- protected getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
1417
- protected proxyUrl(url: string): Promise<string>;
1418
- get cfg(): ConfigType;
1419
- subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void): () => void;
1420
- debugPrint(...args: unknown[]): void;
1421
- }
1422
-
1423
- declare class Modal extends LitBlock {
1424
- static styleAttrs: string[];
1425
- private _mouseDownTarget;
1426
- /** WARNING: Do not rename/change this, it's used in dashboard */
1427
- protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
1428
- /** WARNING: Do not rename/change this, it's used in dashboard */
1429
- protected closeDialog: () => void;
1430
- private _handleDialogClose;
1431
- private _handleDialogMouseDown;
1432
- private _handleDialogMouseUp;
1433
- show(): void;
1434
- hide(): void;
1435
- private _handleModalOpen;
1436
- private _handleModalClose;
1437
- private _handleModalCloseAll;
1438
- initCallback(): void;
1439
- disconnectedCallback(): void;
1440
- private _handleDialogRef;
1441
- render(): lit_html.TemplateResult<1>;
1442
- }
1443
-
1444
- declare const ModalEvents: Readonly<{
1445
- readonly ADD: "modal:add";
1446
- readonly DELETE: "modal:delete";
1447
- readonly OPEN: "modal:open";
1448
- readonly CLOSE: "modal:close";
1449
- readonly CLOSE_ALL: "modal:closeAll";
1450
- readonly DESTROY: "modal:destroy";
1451
- }>;
1452
- type ModalId = ActivityType;
1453
- type ModalCb = (data: {
1454
- id: ModalId;
1455
- modal: Modal;
1456
- }) => void;
1457
- type ModalEventType = (typeof ModalEvents)[keyof typeof ModalEvents];
1458
- declare class ModalManager {
1459
- private _modals;
1460
- private _activeModals;
1461
- private _subscribers;
1462
- private _block;
1463
- constructor(block: LitBlock);
1464
- private _debugPrint;
1749
+ multipartMaxAttempts: number;
1465
1750
  /**
1466
- * Register a modal with the manager
1467
- * @param id Unique identifier for the modal
1468
- * @param modal Modal component instance
1751
+ * Check for URL duplicates.
1469
1752
  */
1470
- registerModal(id: ModalId, modal: Modal): void;
1471
- /** Remove a modal by ID. */
1472
- deleteModal(id: ModalId): boolean;
1473
- /** Open a modal by its ID. */
1474
- open(id: ModalId): boolean;
1475
- /** Close a specific modal by ID. */
1476
- close(id: ModalId): boolean;
1477
- /** Toggle a modal - open if closed, close if open. */
1478
- toggle(id: ModalId): boolean;
1479
- /** True if there are any active modals. */
1480
- get hasActiveModals(): boolean;
1481
- /** Close the most recently opened modal and return to the previous one. */
1482
- back(): boolean;
1483
- /** Close all open modals. */
1484
- closeAll(): number;
1753
+ checkForUrlDuplicates: boolean;
1485
1754
  /**
1486
- * Subscribe to modal events
1487
- * @returns Unsubscribe function
1755
+ * Save URL for recurrent uploads.
1488
1756
  */
1489
- subscribe(event: ModalEventType, callback: ModalCb): () => void;
1490
- /** Unsubscribe from modal events */
1491
- unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
1492
- /** Notify all subscribers of a modal event. */
1493
- private _notify;
1494
- /** Destroy the modal manager, clean up resources */
1495
- destroy(): void;
1496
- }
1497
-
1498
- type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
1499
- declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
1500
-
1501
- declare class Icon extends LitBlock {
1502
- name: string;
1503
- private _resolvedHref;
1504
- private _iconHrefResolver;
1505
- initCallback(): void;
1506
- protected willUpdate(changedProperties: PropertyValues<this>): void;
1507
- private _updateResolvedHref;
1508
- render(): lit_html.TemplateResult<1>;
1509
- }
1510
-
1511
- type CssPropValue = string | number | undefined | null;
1512
- declare const ImgConfig_base: typeof LitElement & Constructor<LitElement> & {
1513
- reg(tagName: string): void;
1514
- } & Constructor<{
1515
- getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
1516
- }>;
1517
- declare class ImgConfig extends ImgConfig_base {
1518
- private _state;
1519
- private _subscribers;
1520
- private _isnObserver;
1521
- private _observed;
1522
- createRenderRoot(): HTMLElement | ShadowRoot;
1523
- constructor();
1524
- protected $$(key: string): unknown;
1525
- protected set$$(kvObj: Record<string, CssPropValue>): void;
1526
- protected sub$$<T = unknown>(key: string, kbFn: (val: T) => void): void;
1527
- private _notify;
1528
- protected analyticsParams(): string;
1529
- protected initAttributes(el: HTMLElement): void;
1530
- protected initIntersection(el: HTMLElement, cbkFn: () => void): void;
1531
- connectedCallback(): void;
1532
- private _initCssProperties;
1533
- disconnectedCallback(): void;
1534
- static get observedAttributes(): string[];
1535
- attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
1536
- }
1537
-
1538
- declare class ImgBase extends ImgConfig {
1539
- private _img;
1540
- private _imgPreview;
1541
- private _fmtAbs;
1542
- private _validateSize;
1543
- private _getCdnModifiers;
1544
- private _getTypedCssValue;
1545
- private _getUrlBase;
1546
- private _proxyUrl;
1547
- protected _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
1548
- private _setupEventProxy;
1549
- protected get img(): HTMLImageElement;
1550
- private get _currentImg();
1551
- private get _hasPreviewImage();
1552
- private get _bgSelector();
1553
- private get _breakpoints();
1554
- private get _hasFormatJPG();
1555
- private _renderBg;
1556
- private _getSrcset;
1557
- private _getSrc;
1558
- private get _srcUrlPreview();
1559
- private _renderBackground;
1560
- private _appendURL;
1561
- private _setupConfigForImage;
1562
- private _loaderImage;
1563
- private _renderImage;
1564
- protected init(): void;
1565
- }
1566
-
1567
- declare class Img extends ImgBase {
1568
- attributesMeta: {
1569
- src: string;
1570
- } | {
1571
- uuid: string;
1757
+ saveUrlForRecurrentUploads: boolean;
1758
+ /**
1759
+ * Group output files.
1760
+ */
1761
+ groupOutput: boolean;
1762
+ /**
1763
+ * User agent integration string.
1764
+ */
1765
+ userAgentIntegration: string;
1766
+ /**
1767
+ * Enable debug mode.
1768
+ */
1769
+ debug: boolean;
1770
+ /**
1771
+ * Locale name for the uploader.
1772
+ */
1773
+ localeName: string;
1774
+ /**
1775
+ * Expiry threshold for secure uploads.
1776
+ */
1777
+ secureUploadsExpireThreshold: number;
1778
+ /**
1779
+ * Metadata for the file.
1780
+ */
1781
+ metadata: Metadata | MetadataCallback | null;
1782
+ /**
1783
+ * Override locale definitions.
1784
+ */
1785
+ localeDefinitionOverride: LocaleDefinitionOverride | null;
1786
+ /**
1787
+ * Resolver for secure uploads signature.
1788
+ */
1789
+ secureUploadsSignatureResolver: SecureUploadsSignatureResolver | null;
1790
+ /**
1791
+ * Resolver for secure delivery proxy URL.
1792
+ */
1793
+ secureDeliveryProxyUrlResolver: SecureDeliveryProxyUrlResolver | null;
1794
+ /**
1795
+ * Resolver for icon href.
1796
+ */
1797
+ iconHrefResolver: IconHrefResolver | null;
1798
+ /**
1799
+ * Validators for individual files.
1800
+ */
1801
+ fileValidators: FileValidators;
1802
+ /**
1803
+ * Validators for file collections.
1804
+ */
1805
+ collectionValidators: CollectionValidators;
1806
+ /**
1807
+ * Timeout for async validation functions, in milliseconds.
1808
+ */
1809
+ validationTimeout: number;
1810
+ /**
1811
+ * The number of files to validate concurrently.
1812
+ */
1813
+ validationConcurrency: number;
1814
+ /**
1815
+ * The camera modes to enable in the camera modal,
1816
+ * it is possible to select photo or video capture.
1817
+ * The first mode is the default mode.
1818
+ * @default 'photo,video'
1819
+ */
1820
+ cameraModes: string;
1821
+ /**
1822
+ * The default tab to open in the camera modal,
1823
+ * it is possible to select video or photo capture
1824
+ * @default 'null'
1825
+ * @deprecated - use `cameraModes` instead
1826
+ */
1827
+ defaultCameraMode: CameraMode | null;
1828
+ /**
1829
+ * Enable audio recording.
1830
+ * @default true
1831
+ */
1832
+ enableAudioRecording: boolean;
1833
+ /**
1834
+ * Enable video recording.
1835
+ * @deprecated - use `cameraModes` instead
1836
+ * @default null
1837
+ */
1838
+ enableVideoRecording: boolean | null;
1839
+ /**
1840
+ * The maximum duration of the video recording in seconds
1841
+ * @default null
1842
+ */
1843
+ maxVideoRecordingDuration: number | null;
1844
+ /**
1845
+ * A dictionary object that can contain
1846
+ * the following properties from MediaRecorderOptions
1847
+ */
1848
+ mediaRecorderOptions: MediaRecorderOptions | null;
1849
+ filesViewMode: FilesViewMode;
1850
+ gridShowFileNames: boolean;
1851
+ cloudImageEditorAutoOpen: boolean;
1852
+ qualityInsights: boolean;
1853
+ cloudImageEditorMaskHref: string | null;
1854
+ /**
1855
+ * Adds data-testid attributes to the each block. Needed for testing purposes.
1856
+ * @default false
1857
+ */
1858
+ testMode: boolean;
1859
+ };
1860
+ type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
1861
+ type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
1862
+ type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKeys<ConfigPlainType>;
1863
+ 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;
1864
+ type KebabCaseKeys<T extends Record<string, unknown>> = {
1865
+ [Key in keyof T as KebabCase$1<Key & string>]: T[Key];
1866
+ };
1867
+ type LowerCase<S extends string> = Lowercase<S>;
1868
+ type LowerCaseKeys<T extends Record<string, unknown>> = {
1869
+ [Key in keyof T as Lowercase<Key & string>]: T[Key];
1870
+ };
1871
+ type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
1872
+ type OutputCustomErrorType = 'CUSTOM_ERROR';
1873
+ type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
1874
+ type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
1875
+ type OutputFileErrorPayload = {
1876
+ entry: OutputFileEntry;
1877
+ };
1878
+ type OutputErrorTypePayload = {
1879
+ NOT_AN_IMAGE: OutputFileErrorPayload;
1880
+ FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
1881
+ FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
1882
+ SOME_FILES_HAS_ERRORS: {
1883
+ [k: string]: never;
1572
1884
  };
1573
- connectedCallback(): void;
1574
- }
1575
-
1576
- declare class FormInput extends LitUploaderBlock {
1577
- propertiesMeta: {
1578
- 'ctx-name': string;
1885
+ TOO_MANY_FILES: {
1886
+ min: number;
1887
+ max: number;
1888
+ total: number;
1579
1889
  };
1580
- private _validationInputElement;
1581
- private _dynamicInputsContainer;
1582
- private _createValidationInput;
1583
- initCallback(): void;
1584
- }
1585
-
1586
- declare class Copyright extends LitBlock {
1587
- initCallback(): void;
1588
- render(): lit_html.TemplateResult<1>;
1589
- }
1590
-
1591
- declare class ProgressBar extends LitBlock {
1592
- value: number;
1593
- visible: boolean;
1594
- private _progressValue;
1595
- private readonly _fakeProgressLineRef;
1596
- private readonly _handleFakeProgressAnimation;
1597
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
1598
- protected updated(changedProperties: PropertyValues<this>): void;
1599
- disconnectedCallback(): void;
1600
- private _normalizeProgressValue;
1601
- private _updateProgressValueStyle;
1602
- render(): lit_html.TemplateResult<1>;
1603
- }
1604
-
1605
- declare class ProgressBarCommon extends LitUploaderBlock {
1606
- private _unobserveCollectionCb?;
1607
- private _visible;
1608
- private _value;
1609
- constructor();
1610
- initCallback(): void;
1611
- protected updated(changedProperties: PropertyValues<this>): void;
1612
- disconnectedCallback(): void;
1613
- render(): lit_html.TemplateResult<1>;
1614
- }
1615
-
1616
- type SelectOption = {
1617
- text: string;
1618
- value: string;
1890
+ TOO_FEW_FILES: {
1891
+ min: number;
1892
+ max: number;
1893
+ total: number;
1894
+ };
1895
+ UPLOAD_ERROR: OutputFileErrorPayload & {
1896
+ error: UploadError;
1897
+ };
1898
+ NETWORK_ERROR: OutputFileErrorPayload & {
1899
+ error: NetworkError;
1900
+ };
1901
+ UNKNOWN_ERROR: OutputFileErrorPayload & {
1902
+ error?: Error;
1903
+ };
1904
+ CUSTOM_ERROR: Record<string, unknown>;
1619
1905
  };
1620
- declare class Select extends LitBlock {
1621
- value: string;
1622
- disabled: boolean;
1623
- options: SelectOption[];
1624
- render(): lit_html.TemplateResult<1>;
1625
- private _handleChange;
1626
- }
1627
-
1628
- declare class SourceBtn extends LitUploaderBlock {
1629
- couldBeCtxOwner: boolean;
1630
- private _registeredTypes;
1631
- type?: string;
1632
- private _iconName;
1633
- private _srcTypeKey;
1634
- private _initTypes;
1635
- initCallback(): void;
1636
- private _registerType;
1637
- activate(): void;
1638
- private _applyType;
1639
- protected willUpdate(changedProperties: PropertyValues<this>): void;
1640
- render(): lit_html.TemplateResult<1>;
1641
- }
1642
-
1643
- declare class SourceList extends LitBlock {
1644
- private _rawSourceList;
1645
- private _cameraModes;
1646
- initCallback(): void;
1647
- protected updated(changedProperties: PropertyValues<this>): void;
1648
- private _updateSources;
1649
- private _sources;
1650
- render(): lit_html.TemplateResult<1>;
1651
- }
1652
-
1653
- declare class Spinner extends LitBlock {
1654
- render(): lit_html.TemplateResult<1>;
1655
- }
1656
-
1657
- declare class FileItemConfig extends LitUploaderBlock {
1658
- private _entrySubs;
1659
- protected entry: UploadEntryTypedData | null;
1660
- protected withEntry<A extends unknown[], R>(fn: (entry: UploadEntryTypedData, ...args: A) => R): (...args: A) => R | undefined;
1661
- protected subEntry<K extends UploadEntryKeys>(prop: K, handler: (value: UploadEntryData[K]) => void): void;
1662
- protected reset(): void;
1663
- disconnectedCallback(): void;
1664
- }
1665
-
1666
- declare class Thumb extends FileItemConfig {
1667
- badgeIcon: string;
1668
- uid: Uid;
1669
- private _thumbUrl;
1670
- private _renderedGridOnce;
1671
- private _thumbRect;
1672
- private _isIntersecting;
1673
- private _firstViewMode;
1674
- private _observer?;
1675
- private _pendingThumbUpdate?;
1676
- private _calculateThumbSize;
1677
- private _generateThumbnail;
1678
- private _debouncedGenerateThumb;
1679
- private _decodeImage;
1680
- private _cancelPendingThumbUpdate;
1681
- private _scheduleThumbUpdate;
1682
- private _requestThumbGeneration;
1683
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
1684
- protected updated(changedProperties: PropertyValues<this>): void;
1685
- private _observerCallback;
1686
- protected reset(): void;
1687
- private _bindToEntry;
1688
- initCallback(): void;
1689
- connectedCallback(): void;
1690
- disconnectedCallback(): void;
1691
- render(): lit_html.TemplateResult<1>;
1692
- }
1693
-
1694
- declare class ActivityHeader extends LitActivityBlock {
1695
- }
1906
+ type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType ? {
1907
+ type?: T;
1908
+ message: string;
1909
+ payload?: OutputErrorTypePayload[T];
1910
+ } : T extends keyof OutputErrorTypePayload ? {
1911
+ type: T;
1912
+ message: string;
1913
+ payload?: OutputErrorTypePayload[T];
1914
+ } : never;
1915
+ type OutputErrorFile = OutputError<OutputFileErrorType>;
1916
+ type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
1917
+ type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
1918
+ status: TStatus;
1919
+ internalId: string;
1920
+ name: string;
1921
+ size: number;
1922
+ isImage: boolean;
1923
+ mimeType: string;
1924
+ metadata: Metadata | null;
1925
+ file: File | Blob | null;
1926
+ externalUrl: string | null;
1927
+ uploadProgress: number;
1928
+ fullPath: string | null;
1929
+ source: SourceTypes | null;
1930
+ isValidationPending: boolean;
1931
+ } & ({
1932
+ status: 'success';
1933
+ fileInfo: UploadcareFile;
1934
+ uuid: string;
1935
+ cdnUrl: string;
1936
+ cdnUrlModifiers: string;
1937
+ isUploading: false;
1938
+ isSuccess: true;
1939
+ isFailed: false;
1940
+ isRemoved: false;
1941
+ errors: [];
1942
+ } | {
1943
+ status: 'failed';
1944
+ fileInfo: UploadcareFile | null;
1945
+ uuid: string | null;
1946
+ cdnUrl: string | null;
1947
+ cdnUrlModifiers: string | null;
1948
+ isUploading: false;
1949
+ isSuccess: false;
1950
+ isFailed: true;
1951
+ isRemoved: false;
1952
+ errors: OutputError<OutputFileErrorType>[];
1953
+ } | {
1954
+ status: 'uploading';
1955
+ fileInfo: null;
1956
+ uuid: null;
1957
+ cdnUrl: null;
1958
+ cdnUrlModifiers: null;
1959
+ isUploading: true;
1960
+ isSuccess: false;
1961
+ isFailed: false;
1962
+ isRemoved: false;
1963
+ errors: [];
1964
+ } | {
1965
+ status: 'removed';
1966
+ fileInfo: UploadcareFile | null;
1967
+ uuid: string | null;
1968
+ cdnUrl: string | null;
1969
+ cdnUrlModifiers: string | null;
1970
+ isUploading: false;
1971
+ isSuccess: false;
1972
+ isFailed: false;
1973
+ isRemoved: true;
1974
+ errors: OutputError<OutputFileErrorType>[];
1975
+ } | {
1976
+ status: 'idle';
1977
+ fileInfo: null;
1978
+ uuid: null;
1979
+ cdnUrl: null;
1980
+ cdnUrlModifiers: null;
1981
+ isUploading: false;
1982
+ isSuccess: false;
1983
+ isFailed: false;
1984
+ isRemoved: false;
1985
+ errors: [];
1986
+ });
1987
+ type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
1988
+ type GroupFlag = 'has-group' | 'maybe-has-group';
1989
+ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'> = {
1990
+ status: TStatus;
1991
+ totalCount: number;
1992
+ successCount: number;
1993
+ failedCount: number;
1994
+ uploadingCount: number;
1995
+ progress: number;
1996
+ successEntries: OutputFileEntry<'success'>[];
1997
+ failedEntries: OutputFileEntry<'failed'>[];
1998
+ uploadingEntries: OutputFileEntry<'uploading'>[];
1999
+ idleEntries: OutputFileEntry<'idle'>[];
2000
+ } & (TGroupFlag extends 'has-group' ? {
2001
+ group: UploadcareGroup;
2002
+ } : TGroupFlag extends 'maybe-has-group' ? {
2003
+ group: UploadcareGroup | null;
2004
+ } : never) & ({
2005
+ status: 'idle';
2006
+ isFailed: false;
2007
+ isUploading: false;
2008
+ isSuccess: false;
2009
+ errors: [];
2010
+ allEntries: OutputFileEntry<'idle' | 'success'>[];
2011
+ } | {
2012
+ status: 'uploading';
2013
+ isFailed: false;
2014
+ isUploading: true;
2015
+ isSuccess: false;
2016
+ errors: [];
2017
+ allEntries: OutputFileEntry[];
2018
+ } | {
2019
+ status: 'success';
2020
+ isFailed: false;
2021
+ isUploading: false;
2022
+ isSuccess: true;
2023
+ errors: [];
2024
+ allEntries: OutputFileEntry<'success'>[];
2025
+ } | {
2026
+ status: 'failed';
2027
+ isFailed: true;
2028
+ isUploading: false;
2029
+ isSuccess: false;
2030
+ errors: OutputError<OutputCollectionErrorType>[];
2031
+ allEntries: OutputFileEntry[];
2032
+ });
1696
2033
 
1697
- declare class StartFrom extends LitActivityBlock {
1698
- protected historyTracked: boolean;
1699
- activityType: ActivityType;
1700
- initCallback(): void;
1701
- render(): lit_html.TemplateResult<1>;
2034
+ declare class SecureUploadsManager extends SharedInstance {
2035
+ private _secureToken;
2036
+ getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
2037
+ destroy(): void;
1702
2038
  }
1703
2039
 
1704
- type EventListenerMap = {
1705
- [K in (typeof EventType)[keyof typeof EventType]]: (e: CustomEvent<EventPayload[K]>) => void;
2040
+ type CommonEventType = InternalEventKey | EventKey;
2041
+ type TelemetryState = TelemetryRequest & {
2042
+ eventTimestamp: number;
2043
+ location: string;
1706
2044
  };
1707
- declare class UploadCtxProvider extends LitUploaderBlock {
1708
- propertiesMeta: {
1709
- 'ctx-name': string;
1710
- };
1711
- static styleAttrs: string[];
1712
- static EventType: Readonly<{
1713
- readonly FILE_ADDED: "file-added";
1714
- readonly FILE_REMOVED: "file-removed";
1715
- readonly FILE_UPLOAD_START: "file-upload-start";
1716
- readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
1717
- readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
1718
- readonly FILE_UPLOAD_FAILED: "file-upload-failed";
1719
- readonly FILE_URL_CHANGED: "file-url-changed";
1720
- readonly MODAL_OPEN: "modal-open";
1721
- readonly MODAL_CLOSE: "modal-close";
1722
- readonly DONE_CLICK: "done-click";
1723
- readonly UPLOAD_CLICK: "upload-click";
1724
- readonly ACTIVITY_CHANGE: "activity-change";
1725
- readonly COMMON_UPLOAD_START: "common-upload-start";
1726
- readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
1727
- readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
1728
- readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
1729
- readonly CHANGE: "change";
1730
- readonly GROUP_CREATED: "group-created";
1731
- }>;
1732
- private _unbindEventEmitter;
1733
- initCallback(): void;
1734
- disconnectedCallback(): void;
1735
- }
1736
- interface UploadCtxProvider extends LitUploaderBlock {
1737
- addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
1738
- removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
1739
- }
1740
-
1741
- declare class UrlSource extends LitUploaderBlock {
1742
- couldBeCtxOwner: boolean;
1743
- activityType: ActivityType;
1744
- private _formState;
1745
- initCallback(): void;
1746
- private _inputRef;
1747
- private _handleInput;
1748
- private _handleUpload;
1749
- render(): lit_html.TemplateResult<1>;
1750
- }
1751
-
1752
- declare function initState(fnCtx: CloudImageEditorBlock): {
1753
- '*originalUrl': null;
1754
- '*loadingOperations': LoadingOperations;
1755
- '*faderEl': null;
1756
- '*cropperEl': null;
1757
- '*imgEl': null;
1758
- '*imgContainerEl': null;
1759
- '*networkProblems': boolean;
1760
- '*imageSize': null;
1761
- '*editorTransformations': {};
1762
- '*cropPresetList': never[];
1763
- '*currentAspectRatio': null;
1764
- '*tabList': readonly ["crop", "tuning", "filters"];
1765
- '*tabId': "crop";
1766
- '*on.retryNetwork': () => void;
1767
- '*on.apply': (transformations: Transformations) => void;
1768
- '*on.cancel': () => void;
2045
+ type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
2046
+ modalId?: string;
2047
+ eventType?: CommonEventType;
1769
2048
  };
1770
-
1771
- declare class CloudImageEditorBlock extends LitBlock {
1772
- attributesMeta: ({
1773
- uuid: string;
1774
- } | {
1775
- 'cdn-url': string;
1776
- }) & Partial<{
1777
- tabs: string;
1778
- 'crop-preset': string;
1779
- }> & {
1780
- 'ctx-name': string;
1781
- };
1782
- ctxOwner: boolean;
1783
- static styleAttrs: string[];
1784
- private _statusMessage;
1785
- private _imageSrc;
1786
- private _fileType;
1787
- private _showLoader;
1788
- uuid: string | null;
1789
- cdnUrl: string | null;
1790
- cropPreset: string;
1791
- tabs: string | null;
1792
- private _hasNetworkProblems;
1793
- private _isInitialized;
1794
- private _pendingInitUpdate;
1795
- private readonly _debouncedShowLoader;
1796
- private readonly _imgRef;
1797
- private readonly _cropperRef;
1798
- private readonly _faderRef;
1799
- private readonly _imgContainerRef;
1800
- private readonly _handleImageLoad;
1801
- private readonly _handleImageError;
1802
- private readonly _handleRetryNetwork;
1803
- private _scheduleInitialization;
1804
- init$: ReturnType<typeof initState>;
1805
- initCallback(): void;
1806
- private _assignSharedElements;
1807
- private _attachImageListeners;
1808
- private _detachImageListeners;
1809
- private get _imageClassName();
2049
+ declare class TelemetryManager extends SharedInstance {
2050
+ private readonly _sessionId;
2051
+ private readonly _telemetryInstance;
2052
+ private _config;
2053
+ private _initialized;
2054
+ private _lastPayload;
2055
+ private readonly _queue;
2056
+ private _isEnabled;
2057
+ constructor(sharedInstancesBag: SharedInstancesBag);
2058
+ private _init;
2059
+ private _setConfig;
2060
+ private _formattingPayload;
2061
+ private _excludedEvents;
2062
+ sendEvent(body: TelemetryEventBody): void;
2063
+ sendEventError(error: unknown, context?: string): void;
1810
2064
  /**
1811
- * To proper work, we need non-zero size the element. So, we'll wait for it.
2065
+ * Method to send telemetry event for Cloud Image Editor.
1812
2066
  */
1813
- private _waitForSize;
1814
- firstUpdated(changedProperties: PropertyValues<this>): void;
1815
- disconnectedCallback(): void;
1816
- render(): lit_html.TemplateResult<1>;
1817
- protected updated(changedProperties: PropertyValues<this>): void;
1818
- private _syncTabListFromProp;
1819
- private _syncCropPresetState;
1820
- updateImage(): Promise<void>;
1821
- initEditor(): Promise<void>;
1822
- }
1823
-
1824
- declare class CropFrame extends LitBlock {
1825
- private _backdropMask?;
1826
- private _backdropMaskInner?;
1827
- private readonly _backdropMaskId;
1828
- private _frameThumbs?;
1829
- private _frameGuides?;
1830
- private _draggingThumb?;
1831
- private _hoverThumb?;
1832
- private _dragStartPoint?;
1833
- private _dragStartCrop?;
1834
- private _frameImage?;
1835
- private _guidesHidden;
1836
- private _draggingValue;
1837
- private readonly _svgRef;
1838
- private _svgReady;
1839
- private _pendingMaskHref;
1840
- private get _svgElement();
1841
- private get _dragging();
1842
- private set _dragging(value);
1843
- private _applyGuidesDragState;
1844
- private _shouldThumbBeDisabled;
1845
- private _createBackdrop;
2067
+ sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
1846
2068
  /**
1847
- * @private Super Tricky workaround for the chromium bug See
1848
- * https://bugs.chromium.org/p/chromium/issues/detail?id=330815
2069
+ * Deeply compares two objects and returns true if they are equal, false otherwise.
1849
2070
  */
1850
- private _resizeBackdrop;
1851
- private _updateBackdrop;
1852
- private _updateFrame;
1853
- private _createThumb;
1854
- private _createThumbs;
1855
- private _createGuides;
1856
- private _createFrame;
1857
- private _handlePointerDown;
1858
- private readonly _handlePointerUp;
1859
- private readonly _handlePointerMove;
1860
- private _calcCropBox;
1861
- private readonly _handleSvgPointerMove;
1862
- private _updateCursor;
1863
- private _createMask;
1864
- private _updateMask;
1865
- private _render;
1866
- toggleThumbs(visible: boolean): void;
1867
- initCallback(): void;
1868
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
1869
- private _initializeSvg;
1870
- disconnectedCallback(): void;
1871
- render(): TemplateResult;
1872
- }
1873
-
1874
- declare class EditorButtonControl extends LitBlock {
1875
- active: boolean;
1876
- title: string;
1877
- protected icon: string;
1878
- protected titleProp: string;
1879
- protected get buttonClasses(): Record<string, boolean>;
1880
- private _updateHostStateClasses;
1881
- protected onClick(_event: MouseEvent): void;
1882
- connectedCallback(): void;
1883
- protected updated(changedProperties: PropertyValues<this>): void;
1884
- render(): lit_html.TemplateResult<1>;
2071
+ private _checkObj;
2072
+ private get _timestamp();
2073
+ private get _solution();
2074
+ private get _activity();
2075
+ private get _location();
1885
2076
  }
1886
2077
 
1887
- declare class EditorFreeformButtonControl extends EditorButtonControl {
1888
- initCallback(): void;
1889
- onClick(): void;
1890
- private _computeTitle;
1891
- render(): lit_html.TemplateResult<1>;
1892
- }
1893
- declare class EditorAspectRatioButtonControl extends EditorButtonControl {
1894
- private _aspectRatio;
1895
- get aspectRatio(): CropAspectRatio | null;
1896
- set aspectRatio(value: CropAspectRatio | null);
1897
- initCallback(): void;
1898
- protected onClick(): void;
1899
- private _updateAspectRatioPresentation;
1900
- private _renderIcon;
1901
- render(): lit_html.TemplateResult<1>;
1902
- }
2078
+ type SharedConfigState = {
2079
+ [K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
2080
+ };
2081
+ type BlocksRegistry = Set<LitBlock>;
2082
+ type ActivityBlockCtxState = {
2083
+ '*currentActivity': string | null;
2084
+ '*currentActivityParams': Record<string, unknown>;
2085
+ '*history': (string | null)[];
2086
+ '*historyBack': (() => void) | null;
2087
+ '*closeModal': () => void;
2088
+ };
2089
+ type UploaderBlockCtxState = ActivityBlockCtxState & {
2090
+ '*commonProgress': number;
2091
+ '*uploadList': {
2092
+ uid: Uid;
2093
+ }[];
2094
+ '*uploadQueue': Queue;
2095
+ '*collectionErrors': OutputErrorCollection[];
2096
+ '*collectionState': OutputCollectionState | null;
2097
+ '*groupInfo': UploadcareGroup | null;
2098
+ '*uploadTrigger': Set<Uid>;
2099
+ };
2100
+ type SolutionBlockCtxState = UploaderBlockCtxState & {
2101
+ '*solution': string | null;
2102
+ };
2103
+ type CloudImageEditorState = {
2104
+ '*originalUrl': string | null;
2105
+ '*loadingOperations': LoadingOperations;
2106
+ '*faderEl': EditorImageFader | null;
2107
+ '*cropperEl': EditorImageCropper | null;
2108
+ '*imgEl': HTMLImageElement | null;
2109
+ '*imgContainerEl': HTMLElement | null;
2110
+ '*networkProblems': boolean;
2111
+ '*imageSize': {
2112
+ width: number;
2113
+ height: number;
2114
+ } | null;
2115
+ '*editorTransformations': Transformations;
2116
+ '*cropPresetList': CropPresetList;
2117
+ '*currentAspectRatio': CropAspectRatio | null;
2118
+ '*tabList': readonly TabIdValue$1[];
2119
+ '*tabId': TabIdValue$1;
2120
+ '*on.retryNetwork': () => void;
2121
+ '*on.apply': (transformations: Transformations) => void;
2122
+ '*on.cancel': () => void;
2123
+ };
2124
+ type EditorImageCropperState = {
2125
+ '*padding': number;
2126
+ '*operations': {
2127
+ rotate: number;
2128
+ mirror: boolean;
2129
+ flip: boolean;
2130
+ };
2131
+ '*imageBox': {
2132
+ x: number;
2133
+ y: number;
2134
+ width: number;
2135
+ height: number;
2136
+ };
2137
+ '*cropBox': {
2138
+ x: number;
2139
+ y: number;
2140
+ width: number;
2141
+ height: number;
2142
+ };
2143
+ };
2144
+ type EditorToolbarState = {
2145
+ '*showListAspectRatio': boolean;
2146
+ '*sliderEl': EditorSlider | null;
2147
+ '*showSlider': boolean;
2148
+ '*currentFilter': string;
2149
+ '*currentOperation': string | null;
2150
+ '*operationTooltip': string | null;
2151
+ };
2152
+ type DynamicBlockState = {
2153
+ '*blocksRegistry': BlocksRegistry;
2154
+ '*eventEmitter': EventEmitter;
2155
+ '*localeManager': LocaleManager;
2156
+ '*telemetryManager': TelemetryManager;
2157
+ '*a11y': A11y;
2158
+ '*modalManager': ModalManager | null;
2159
+ };
2160
+ type DynamicUploaderBlockState = {
2161
+ '*uploadCollection': TypedCollection<UploadEntryData>;
2162
+ '*publicApi': UploaderPublicApi;
2163
+ '*validationManager': ValidationManager;
2164
+ '*secureUploadsManager': SecureUploadsManager;
2165
+ };
2166
+ type LocaleState = {
2167
+ [K in keyof LocaleDefinition as `*l10n/${K}`]: string;
2168
+ };
2169
+ type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
1903
2170
 
1904
- declare class EditorCropButtonControl extends EditorButtonControl {
1905
- operation: CropOperation | undefined;
1906
- protected willUpdate(changedProperties: PropertyValues<this>): void;
1907
- protected onClick(e: MouseEvent): void;
2171
+ interface ISharedInstance {
2172
+ destroy?(): void;
1908
2173
  }
1909
-
1910
- declare class EditorFilterControl extends EditorButtonControl {
1911
- private _operation;
1912
- private _filter;
1913
- private _originalUrl;
1914
- private _observer?;
1915
- private _cancelPreload?;
1916
- private _lastPreviewRequestId;
1917
- private _previewVisibilityCheckRaf?;
1918
- private _previewVisibilityCheckTimeout?;
1919
- private _previewImage;
1920
- private _previewLoaded;
1921
- isOriginal: boolean;
1922
- private _iconSize;
1923
- get filter(): string;
1924
- set filter(value: string);
1925
- onClick(e: MouseEvent): void;
1926
- private _previewSrc;
1927
- private _observerCallback;
1928
- initCallback(): void;
1929
- disconnectedCallback(): void;
1930
- protected updated(changedProperties: PropertyValues<this>): void;
1931
- private _updateFilterLabels;
1932
- private _loadPreview;
1933
- private _schedulePreviewVisibilityCheck;
1934
- private _clearPreviewVisibilityChecks;
1935
- private get _shouldShowPreview();
1936
- render(): lit_html.TemplateResult<1>;
2174
+ declare class SharedInstance {
2175
+ protected _ctx: PubSub<SharedState>;
2176
+ protected _sharedInstancesBag: SharedInstancesBag;
2177
+ private _subscriptions;
2178
+ private _cfgProxy;
2179
+ protected _debugPrint: (...args: unknown[]) => void;
2180
+ constructor(sharedInstancesBag: SharedInstancesBag);
2181
+ protected addSub(unsub: () => void): void;
2182
+ protected get _cfg(): Readonly<ConfigType>;
2183
+ destroy(): void;
1937
2184
  }
2185
+ type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2186
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2187
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2188
+ readonly ctx: PubSub<SharedState>;
2189
+ readonly modalManager: ModalManager | null;
2190
+ readonly telemetryManager: TelemetryManager;
2191
+ readonly localeManager: LocaleManager;
2192
+ readonly a11y: A11y;
2193
+ readonly blocksRegistry: Set<LitBlock>;
2194
+ readonly eventEmitter: EventEmitter;
2195
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2196
+ readonly secureUploadsManager: SecureUploadsManager;
2197
+ readonly api: UploaderPublicApi;
2198
+ readonly validationManager: ValidationManager;
2199
+ };
1938
2200
 
1939
- type Operations = {
1940
- flip: boolean;
1941
- mirror: boolean;
1942
- rotate: number;
2201
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2202
+ signal?: AbortSignal;
2203
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2204
+ type FileValidatorDescriptor = {
2205
+ runOn: 'add' | 'upload' | 'change';
2206
+ validator: FuncFileValidator;
1943
2207
  };
1944
- declare class EditorImageCropper extends LitBlock {
1945
- ctxOwner: boolean;
1946
- private _commitDebounced;
1947
- private _handleResizeThrottled;
1948
- private _imageSize;
1949
- private _canvas?;
1950
- private _ctx;
1951
- private _isActive;
1952
- private _observer?;
1953
- private _image;
1954
- private _cancelPreload?;
1955
- private readonly _canvasRef;
1956
- private readonly _frameRef;
1957
- constructor();
1958
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
1959
- private _syncTransformations;
1960
- private _initCanvas;
1961
- private _alignImage;
1962
- private _alignCrop;
1963
- private _drawImage;
1964
- private _draw;
1965
- private _animateIn;
1966
- private _getCropDimensions;
1967
- private _getCropTransformation;
1968
- private _commit;
1969
- setValue<K extends keyof Operations>(operation: K, value: Operations[K]): void;
1970
- getValue<K extends keyof Operations>(operation: K): Operations[K];
1971
- activate(imageSize: ImageSize, { fromViewer }?: {
1972
- fromViewer?: boolean;
1973
- }): Promise<void>;
1974
- deactivate({ reset }?: {
1975
- reset?: boolean;
1976
- }): void;
1977
- private _transitionToCrop;
1978
- private _transitionToImage;
1979
- private _reset;
1980
- private _waitForImage;
1981
- private _handleImageLoading;
1982
- initCallback(): void;
1983
- disconnectedCallback(): void;
1984
- render(): TemplateResult;
2208
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2209
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2210
+ declare class ValidationManager extends SharedInstance {
2211
+ private get _uploadCollection();
2212
+ private _commonFileValidators;
2213
+ private _commonCollectionValidators;
2214
+ private _queue;
2215
+ private _runQueueDebounced;
2216
+ private _isDestroyed;
2217
+ private _entryValidationState;
2218
+ constructor(sharedInstancesBag: SharedInstancesBag);
2219
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2220
+ runCollectionValidators(): void;
2221
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2222
+ private _runFileValidatorsForEntry;
2223
+ private _addCustomTypeToValidationError;
2224
+ private _getEntryValidationState;
2225
+ private _getValidatorDescriptors;
2226
+ private _getValidatorDescriptorsForEntry;
2227
+ destroy(): void;
1985
2228
  }
1986
2229
 
1987
- type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
1988
- declare class EditorImageFader extends LitBlock {
1989
- private _isActive;
1990
- private _hidden;
1991
- private _operation;
1992
- private _filter;
1993
- private _value?;
1994
- private _transformations;
1995
- private _keypoints;
1996
- private _previewImage?;
1997
- private _cancelLastImages?;
1998
- private _cancelBatchPreload?;
1999
- private _url?;
2000
- private _fromViewer?;
2001
- private _raf;
2002
- private _addKeypointDebounced;
2003
- private readonly _previewHostRef;
2004
- private readonly _layersHostRef;
2230
+ declare const LitBlockBase: typeof LitElement & Constructor<{
2231
+ willYield: boolean;
2232
+ yield(slot: string, defaultContent?: unknown): unknown;
2233
+ }> & Constructor<{
2234
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
2235
+ }> & Constructor<SymbioteComponent<SharedState>> & Constructor<LitElement> & {
2236
+ reg(tagName: string): void;
2237
+ };
2238
+ declare class LitBlock extends LitBlockBase {
2239
+ private _cfgProxy;
2240
+ protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2241
+ static styleAttrs: string[];
2242
+ activityType: ActivityType;
2243
+ init$: {};
2005
2244
  constructor();
2006
- private _handleImageLoading;
2007
- private _flush;
2008
- private _imageSrc;
2009
- private _constructKeypoint;
2010
- /**
2011
- * Check if current operation and filter equals passed ones
2012
- */
2013
- private _isSame;
2014
- set(value: string | number): void;
2015
- private _update;
2016
- private _createPreviewImage;
2017
- private _initNodes;
2018
- setTransformations(transformations: Transformations): Promise<void>;
2019
- preload({ url, filter, operation, value, }: {
2020
- url: string;
2021
- filter?: string;
2022
- operation?: OperationKey;
2023
- value?: number;
2024
- }): Promise<void>;
2025
- private _setOriginalSrc;
2026
- activate({ url, operation, value, filter, fromViewer, }: {
2027
- url: string;
2028
- operation?: OperationKey;
2029
- value?: number;
2030
- filter?: string;
2031
- fromViewer?: boolean;
2032
- }): Promise<void>;
2033
- deactivate({ hide }?: {
2034
- hide?: boolean;
2035
- }): void;
2036
- private _ensurePreviewAttached;
2037
- private _clearLayersHost;
2038
- render(): TemplateResult;
2245
+ l10n: (str: string, variables?: Record<string, string | number>) => string;
2246
+ debugPrint: (...args: unknown[]) => void;
2247
+ protected _sharedInstancesBag: {
2248
+ readonly ctx: PubSub<SharedState>;
2249
+ readonly modalManager: ModalManager | null;
2250
+ readonly telemetryManager: TelemetryManager;
2251
+ readonly localeManager: LocaleManager;
2252
+ readonly a11y: A11y;
2253
+ readonly blocksRegistry: Set<LitBlock>;
2254
+ readonly eventEmitter: EventEmitter;
2255
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
2256
+ readonly secureUploadsManager: SecureUploadsManager;
2257
+ readonly api: UploaderPublicApi;
2258
+ readonly validationManager: ValidationManager;
2259
+ };
2260
+ emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2261
+ hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
2262
+ connectedCallback(): void;
2263
+ initCallback(): void;
2264
+ get testId(): string;
2265
+ get modalManager(): ModalManager | null;
2266
+ get telemetryManager(): TelemetryManager;
2267
+ get localeManager(): LocaleManager;
2268
+ get a11y(): A11y;
2269
+ get blocksRegistry(): Set<LitBlock>;
2270
+ get eventEmitter(): EventEmitter;
2271
+ disconnectedCallback(): void;
2272
+ /**
2273
+ * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2274
+ */
2275
+ private destroyCtxCallback;
2276
+ /**
2277
+ * Adds a shared context instance if it does not exist yet.
2278
+ * @param key The shared state key.
2279
+ * @param resolver The resolver function that creates the instance.
2280
+ */
2281
+ protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2282
+ private _destroySharedContextInstances;
2283
+ protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
2284
+ protected proxyUrl(url: string): Promise<string>;
2285
+ get cfg(): ConfigType;
2286
+ subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void): () => void;
2039
2287
  }
2040
2288
 
2041
- declare class EditorOperationControl extends EditorButtonControl {
2042
- private _operation;
2043
- get operation(): ColorOperation | '';
2044
- set operation(value: ColorOperation | '');
2045
- private _updateOperationMetadata;
2289
+ declare class Modal extends LitBlock {
2290
+ static styleAttrs: string[];
2291
+ private _mouseDownTarget;
2292
+ /** WARNING: Do not rename/change this, it's used in dashboard */
2293
+ protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
2294
+ /**
2295
+ * CSS-only attribute
2296
+ */
2297
+ strokes: boolean;
2298
+ /**
2299
+ * CSS-only attribute
2300
+ */
2301
+ blockBodyScrolling: boolean;
2302
+ /** WARNING: Do not rename/change this, it's used in dashboard */
2303
+ protected closeDialog: () => void;
2304
+ private _handleDialogClose;
2305
+ private _handleDialogMouseDown;
2306
+ private _handleDialogMouseUp;
2307
+ show(): void;
2308
+ hide(): void;
2309
+ private _handleModalOpen;
2310
+ private _handleModalClose;
2311
+ private _handleModalCloseAll;
2046
2312
  initCallback(): void;
2047
- protected onClick(e: MouseEvent): void;
2313
+ disconnectedCallback(): void;
2314
+ private _handleDialogRef;
2315
+ render(): lit_html.TemplateResult<1>;
2316
+ }
2317
+ declare global {
2318
+ interface HTMLElementTagNameMap {
2319
+ 'uc-modal': Modal;
2320
+ }
2048
2321
  }
2049
2322
 
2050
- declare class EditorScroller extends LitBlock {
2051
- private readonly _handleWheel;
2052
- connectedCallback(): void;
2053
- disconnectedCallback(): void;
2323
+ declare const ModalEvents: Readonly<{
2324
+ readonly ADD: "modal:add";
2325
+ readonly DELETE: "modal:delete";
2326
+ readonly OPEN: "modal:open";
2327
+ readonly CLOSE: "modal:close";
2328
+ readonly CLOSE_ALL: "modal:closeAll";
2329
+ readonly DESTROY: "modal:destroy";
2330
+ }>;
2331
+ type ModalId = ActivityType;
2332
+ type ModalCb = (data: {
2333
+ id: ModalId;
2334
+ modal: Modal;
2335
+ }) => void;
2336
+ type ModalEventType = (typeof ModalEvents)[keyof typeof ModalEvents];
2337
+ declare class ModalManager extends SharedInstance {
2338
+ private _modals;
2339
+ private _activeModals;
2340
+ private _subscribers;
2341
+ /**
2342
+ * Register a modal with the manager
2343
+ * @param id Unique identifier for the modal
2344
+ * @param modal Modal component instance
2345
+ */
2346
+ registerModal(id: ModalId, modal: Modal): void;
2347
+ /** Remove a modal by ID. */
2348
+ deleteModal(id: ModalId): boolean;
2349
+ /** Open a modal by its ID. */
2350
+ open(id: ModalId): boolean;
2351
+ /** Close a specific modal by ID. */
2352
+ close(id: ModalId): boolean;
2353
+ /** Toggle a modal - open if closed, close if open. */
2354
+ toggle(id: ModalId): boolean;
2355
+ /** True if there are any active modals. */
2356
+ get hasActiveModals(): boolean;
2357
+ /** Close the most recently opened modal and return to the previous one. */
2358
+ back(): boolean;
2359
+ /** Close all open modals. */
2360
+ closeAll(): number;
2361
+ /**
2362
+ * Subscribe to modal events
2363
+ * @returns Unsubscribe function
2364
+ */
2365
+ subscribe(event: ModalEventType, callback: ModalCb): () => void;
2366
+ /** Unsubscribe from modal events */
2367
+ unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
2368
+ /** Notify all subscribers of a modal event. */
2369
+ private _notify;
2370
+ /** Destroy the modal manager, clean up resources */
2371
+ destroy(): void;
2054
2372
  }
2055
2373
 
2056
- type SliderOperation = ColorOperation | 'filter';
2057
- type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
2058
- declare const FAKE_ORIGINAL_FILTER = "original";
2059
- declare class EditorSlider extends LitBlock {
2060
- state: {
2061
- operation: SliderOperation;
2062
- filter: SliderFilter | undefined;
2063
- originalUrl: string;
2064
- disabled: boolean;
2065
- min: number;
2066
- max: number;
2067
- value: number;
2068
- defaultValue: number;
2069
- zero: number;
2374
+ type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
2375
+ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2376
+
2377
+ declare class LitSolutionBlock extends LitBlock {
2378
+ static styleAttrs: string[];
2379
+ init$: {
2380
+ '*solution': string | null;
2381
+ '*commonProgress': number;
2382
+ '*uploadList': never[];
2383
+ '*uploadQueue': _uploadcare_upload_client.Queue;
2384
+ '*collectionErrors': OutputErrorCollection[];
2385
+ '*collectionState': OutputCollectionState | null;
2386
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
2387
+ '*uploadTrigger': Set<string>;
2388
+ '*currentActivity': null;
2389
+ '*currentActivityParams': {};
2390
+ '*history': never[];
2391
+ '*historyBack': null;
2392
+ '*closeModal': () => void;
2070
2393
  };
2071
- private _handleInput;
2072
- setOperation(operation: SliderOperation, filter?: SliderFilter): void;
2073
- private _initializeValues;
2074
- apply(): void;
2075
- cancel(): void;
2076
2394
  initCallback(): void;
2077
- protected updated(changedProperties: PropertyValues<this>): void;
2078
2395
  render(): lit_html.TemplateResult<1>;
2079
2396
  }
2080
2397
 
2081
- type TabIdValue = (typeof TabId)[keyof typeof TabId];
2082
- declare class EditorToolbar extends LitBlock {
2083
- private _showLoader;
2084
- showMainToolbar: boolean;
2085
- showSubToolbar: boolean;
2086
- private _showTabToggles;
2087
- tabList: readonly TabIdValue[];
2088
- activeTab: TabIdValue;
2089
- private _useSliderPanel;
2090
- private _tooltipVisible;
2091
- private _operationTooltip;
2092
- private _tabIndicatorOffset;
2093
- private _tabIndicatorWidth;
2094
- private readonly _sliderRef;
2095
- private readonly _tabIndicatorRef;
2096
- protected readonly tabToggleRefs: Record<TabIdValue, Ref<HTMLElement>>;
2097
- private readonly _handleWindowResize;
2098
- private _cropPresets;
2099
- private _cancelPreload?;
2100
- private readonly _debouncedShowLoader;
2101
- private readonly _updateInfoTooltip;
2102
- private readonly _subTopToolbarStyles;
2103
- private readonly _subBottomToolbarStyles;
2104
- private readonly _tabContentStyles;
2105
- private readonly _tabToggleStyles;
2106
- private readonly _tabTogglesStyles;
2107
- init$: Record<string, unknown>;
2108
- private _onSliderClose;
2109
- private _activateTab;
2110
- private _applyTabState;
2111
- private _syncTabIndicator;
2112
- private get _hasAspectRatioPicker();
2113
- private _renderControlsByTab;
2114
- private _renderCropTabControls;
2115
- private _renderFilterTabControls;
2116
- private _renderTuningTabControls;
2117
- private _renderControlGroup;
2118
- private _renderFreeformControl;
2119
- private _renderAspectRatioControl;
2120
- private _renderCropOperationControl;
2121
- private _renderFilterControl;
2122
- private _renderOperationControl;
2123
- private _renderAspectRatioList;
2124
- private _preloadEditedImage;
2125
- initCallback(): void;
2398
+ type CssPropValue = string | number | undefined | null;
2399
+ declare const ImgConfig_base: typeof LitElement & Constructor<LitElement> & {
2400
+ reg(tagName: string): void;
2401
+ } & Constructor<{
2402
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
2403
+ }>;
2404
+ declare class ImgConfig extends ImgConfig_base {
2405
+ private _state;
2406
+ private _subscribers;
2407
+ private _isnObserver;
2408
+ private _observed;
2409
+ createRenderRoot(): HTMLElement | ShadowRoot;
2410
+ constructor();
2411
+ protected $$(key: string): unknown;
2412
+ protected set$$(kvObj: Record<string, CssPropValue>): void;
2413
+ protected sub$$<T = unknown>(key: string, kbFn: (val: T) => void): void;
2414
+ private _notify;
2415
+ protected analyticsParams(): string;
2416
+ protected initAttributes(el: HTMLElement): void;
2417
+ protected initIntersection(el: HTMLElement, cbkFn: () => void): void;
2126
2418
  connectedCallback(): void;
2127
- firstUpdated(changedProperties: PropertyValues<this>): void;
2128
- protected updated(changedProperties: PropertyValues<this>): void;
2419
+ private _initCssProperties;
2129
2420
  disconnectedCallback(): void;
2130
- private _assignSharedElements;
2131
- private readonly _handleCancel;
2132
- private readonly _handleApply;
2133
- private readonly _handleApplySlider;
2134
- private readonly _handleCancelSlider;
2135
- private readonly _handleTabClick;
2136
- private _renderTabToggle;
2137
- private _renderTabContent;
2138
- render(): TemplateResult<1>;
2421
+ static get observedAttributes(): string[];
2422
+ attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
2423
+ }
2424
+
2425
+ declare class ImgBase extends ImgConfig {
2426
+ private _img;
2427
+ private _imgPreview;
2428
+ private _fmtAbs;
2429
+ private _validateSize;
2430
+ private _getCdnModifiers;
2431
+ private _getTypedCssValue;
2432
+ private _getUrlBase;
2433
+ private _proxyUrl;
2434
+ protected _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
2435
+ private _setupEventProxy;
2436
+ protected get img(): HTMLImageElement;
2437
+ private get _currentImg();
2438
+ private get _hasPreviewImage();
2439
+ private get _bgSelector();
2440
+ private get _breakpoints();
2441
+ private get _hasFormatJPG();
2442
+ private _renderBg;
2443
+ private _getSrcset;
2444
+ private _getSrc;
2445
+ private get _srcUrlPreview();
2446
+ private _renderBackground;
2447
+ private _appendURL;
2448
+ private _setupConfigForImage;
2449
+ private _loaderImage;
2450
+ private _renderImage;
2451
+ protected init(): void;
2452
+ }
2453
+
2454
+ declare class Img extends ImgBase {
2455
+ attributesMeta: {
2456
+ src: string;
2457
+ } | {
2458
+ uuid: string;
2459
+ };
2460
+ connectedCallback(): void;
2461
+ }
2462
+ declare global {
2463
+ interface HTMLElementTagNameMap {
2464
+ 'uc-img': Img;
2465
+ }
2139
2466
  }
2140
2467
 
2141
- type Theme = string | null;
2142
- declare class BtnUi extends LitBlock {
2143
- text: string;
2144
- icon: string;
2145
- reverse: boolean;
2146
- theme: Theme;
2147
- ariaRole: string;
2148
- ariaControls: string;
2149
- titleProp: string;
2150
- protected firstUpdated(changed: PropertyValues<this>): void;
2151
- protected updated(changed: PropertyValues<this>): void;
2152
- private _applyReverse;
2153
- private _applyThemeClass;
2154
- private get _iconClassMap();
2155
- private get _computedIconHidden();
2156
- private get _computedIconSingle();
2157
- render(): lit_html.TemplateResult<1>;
2468
+ declare class FormInput extends LitUploaderBlock {
2469
+ attributesMeta: {
2470
+ 'ctx-name': string;
2471
+ name?: string;
2472
+ };
2473
+ private _validationInputElement;
2474
+ private _dynamicInputsContainer;
2475
+ nameAttrValue?: string;
2476
+ private get _inputName();
2477
+ private _createValidationInput;
2478
+ initCallback(): void;
2479
+ }
2480
+ declare global {
2481
+ interface HTMLElementTagNameMap {
2482
+ 'uc-form-input': FormInput;
2483
+ }
2158
2484
  }
2159
2485
 
2160
- declare class LineLoaderUi extends LitBlock {
2161
- active: boolean;
2162
- private readonly _lineRef;
2163
- private _isAnimating;
2164
- private readonly _handleTransitionEndRight;
2165
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
2166
- protected updated(changedProperties: PropertyValues<this>): void;
2167
- private _start;
2168
- private _stop;
2169
- private _resetLine;
2486
+ declare class Copyright extends LitBlock {
2487
+ initCallback(): void;
2170
2488
  render(): lit_html.TemplateResult<1>;
2171
2489
  }
2490
+ declare global {
2491
+ interface HTMLElementTagNameMap {
2492
+ 'uc-copyright': Copyright;
2493
+ }
2494
+ }
2172
2495
 
2173
- type PresenceToggleStyle = {
2174
- transition?: string;
2175
- visible?: string;
2176
- hidden?: string;
2177
- };
2178
- declare class PresenceToggle extends LitBlock {
2496
+ declare class ProgressBarCommon extends LitUploaderBlock {
2497
+ private _unobserveCollectionCb?;
2179
2498
  private _visible;
2180
- private _styles;
2181
- private _visibleStyle;
2182
- private _hiddenStyle;
2183
- private _externalTransitions;
2184
- private _initialRenderComplete;
2185
- set visible(value: boolean);
2186
- get visible(): boolean;
2187
- set styles(styles: PresenceToggleStyle);
2188
- get styles(): PresenceToggleStyle;
2189
- private _handleVisible;
2190
- private _dispatchInitialRenderEvent;
2499
+ private _value;
2500
+ constructor();
2191
2501
  initCallback(): void;
2502
+ protected updated(changedProperties: PropertyValues<this>): void;
2503
+ disconnectedCallback(): void;
2504
+ render(): lit_html.TemplateResult<1>;
2505
+ }
2506
+ declare global {
2507
+ interface HTMLElementTagNameMap {
2508
+ 'uc-progress-bar-common': ProgressBarCommon;
2509
+ }
2192
2510
  }
2193
2511
 
2194
- declare class SliderUi extends LitBlock {
2195
- private _observer?;
2196
- private _thumbSize;
2197
- private _zeroDotEl?;
2198
- private _stepsCount?;
2199
- private readonly _inputRef;
2200
- private readonly _thumbRef;
2201
- private readonly _stepsRef;
2202
- disabled: boolean;
2203
- min: number;
2204
- max: number;
2205
- defaultValue: number;
2206
- zero: number;
2207
- private _currentValue;
2208
- constructor();
2209
- private _emitSliderEvent;
2210
- private readonly _handleSliderInput;
2211
- private readonly _handleSliderChange;
2212
- private readonly _handleInputFocus;
2213
- private readonly _handleInputBlur;
2214
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
2512
+ declare class SourceBtn extends LitUploaderBlock {
2513
+ couldBeCtxOwner: boolean;
2514
+ private _registeredTypes;
2515
+ type?: string;
2516
+ private _iconName;
2517
+ private _srcTypeKey;
2518
+ private _initTypes;
2519
+ initCallback(): void;
2520
+ private _registerType;
2521
+ activate(): void;
2522
+ private _applyType;
2215
2523
  protected willUpdate(changedProperties: PropertyValues<this>): void;
2216
- private _updateValue;
2217
- private _updateZeroDot;
2218
- private _updateSteps;
2219
- disconnectedCallback(): void;
2220
- private _setCurrentValue;
2221
- private _syncInputValue;
2222
- private _extractEventValue;
2223
2524
  render(): lit_html.TemplateResult<1>;
2224
2525
  }
2526
+ declare global {
2527
+ interface HTMLElementTagNameMap {
2528
+ 'uc-source-btn': SourceBtn;
2529
+ }
2530
+ }
2225
2531
 
2226
- declare class DropArea extends LitUploaderBlock {
2227
- static styleAttrs: string[];
2228
- disabled: boolean;
2229
- clickable: boolean;
2230
- withIcon: boolean;
2231
- fullscreen: boolean;
2232
- initflow: boolean;
2233
- text?: string;
2234
- private _isEnabled;
2235
- private _isVisible;
2236
- private get _localizedText();
2237
- private _destroyDropzone;
2238
- private _destroyContentWrapperDropzone;
2239
- private _contentWrapperRef;
2240
- private readonly _handleAreaInteraction;
2241
- private _sourceListAllowsLocal;
2242
- private _clickableListenersAttached;
2243
- isActive(): boolean;
2532
+ declare class SourceList extends LitBlock {
2533
+ private _rawSourceList;
2534
+ private _cameraModes;
2535
+ /**
2536
+ * CSS-only attribute
2537
+ */
2538
+ wrap: boolean;
2244
2539
  initCallback(): void;
2245
- protected willUpdate(changedProperties: PropertyValues<this>): void;
2246
2540
  protected updated(changedProperties: PropertyValues<this>): void;
2247
- /** Ignore drop events if there are other visible drop areas on the page. */
2248
- private _shouldIgnore;
2249
- private _couldHandleFiles;
2250
- private _updateIsEnabled;
2251
- private _updateVisibility;
2252
- private _updateDragStateAttribute;
2253
- private _updateClickableListeners;
2254
- disconnectedCallback(): void;
2541
+ private _updateSources;
2542
+ private _sources;
2255
2543
  render(): lit_html.TemplateResult<1>;
2256
2544
  }
2545
+ declare global {
2546
+ interface HTMLElementTagNameMap {
2547
+ 'uc-source-list': SourceList;
2548
+ }
2549
+ }
2257
2550
 
2258
- declare class FileItem extends FileItemConfig {
2259
- protected couldBeCtxOwner: boolean;
2260
- private _pauseRender;
2261
- uid: Uid;
2262
- private _itemName;
2263
- private _errorText;
2264
- private _hint;
2265
- private _progressValue;
2266
- private _progressVisible;
2267
- private _badgeIcon;
2268
- private _isFinished;
2269
- private _isFailed;
2270
- private _isUploading;
2271
- private _isFocused;
2272
- private _isEditable;
2273
- private _showFileNames;
2274
- private _ariaLabelStatusFile;
2275
- private _renderedOnce;
2276
- private _observer?;
2277
- private _handleEdit;
2278
- private _handleRemove;
2279
- private _handleUploadClick;
2280
- private _calculateState;
2281
- private _debouncedCalculateState;
2282
- private _updateHintAndProgress;
2283
- private _handleState;
2284
- protected reset(): void;
2285
- private _observerCallback;
2286
- private _handleEntryId;
2287
- private _updateShowFileNames;
2288
- protected willUpdate(changedProperties: PropertyValues<this>): void;
2551
+ declare class StartFrom extends LitActivityBlock {
2552
+ protected historyTracked: boolean;
2553
+ activityType: ActivityType;
2554
+ initCallback(): void;
2555
+ render(): lit_html.TemplateResult<1>;
2556
+ }
2557
+ declare global {
2558
+ interface HTMLElementTagNameMap {
2559
+ 'uc-start-from': StartFrom;
2560
+ }
2561
+ }
2562
+
2563
+ type EventListenerMap = {
2564
+ [K in (typeof EventType)[keyof typeof EventType]]: (e: CustomEvent<EventPayload[K]>) => void;
2565
+ };
2566
+ declare class UploadCtxProvider extends LitUploaderBlock {
2567
+ attributesMeta: {
2568
+ 'ctx-name': string;
2569
+ };
2570
+ static styleAttrs: string[];
2571
+ static EventType: Readonly<{
2572
+ readonly FILE_ADDED: "file-added";
2573
+ readonly FILE_REMOVED: "file-removed";
2574
+ readonly FILE_UPLOAD_START: "file-upload-start";
2575
+ readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
2576
+ readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
2577
+ readonly FILE_UPLOAD_FAILED: "file-upload-failed";
2578
+ readonly FILE_URL_CHANGED: "file-url-changed";
2579
+ readonly MODAL_OPEN: "modal-open";
2580
+ readonly MODAL_CLOSE: "modal-close";
2581
+ readonly DONE_CLICK: "done-click";
2582
+ readonly UPLOAD_CLICK: "upload-click";
2583
+ readonly ACTIVITY_CHANGE: "activity-change";
2584
+ readonly COMMON_UPLOAD_START: "common-upload-start";
2585
+ readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
2586
+ readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
2587
+ readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
2588
+ readonly CHANGE: "change";
2589
+ readonly GROUP_CREATED: "group-created";
2590
+ }>;
2591
+ private _unbindEventEmitter;
2289
2592
  initCallback(): void;
2290
- connectedCallback(): void;
2291
2593
  disconnectedCallback(): void;
2292
- private _upload;
2293
- static activeInstances: Set<FileItem>;
2294
- protected shouldUpdate(changedProperties: PropertyValues<this>): boolean;
2594
+ }
2595
+ interface UploadCtxProvider extends LitUploaderBlock {
2596
+ addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
2597
+ removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
2598
+ }
2599
+ declare global {
2600
+ interface HTMLElementTagNameMap {
2601
+ 'uc-upload-ctx-provider': UploadCtxProvider;
2602
+ }
2603
+ }
2604
+
2605
+ declare class UrlSource extends LitUploaderBlock {
2606
+ couldBeCtxOwner: boolean;
2607
+ activityType: ActivityType;
2608
+ private _formState;
2609
+ initCallback(): void;
2610
+ private _inputRef;
2611
+ private _handleInput;
2612
+ private _handleUpload;
2295
2613
  render(): lit_html.TemplateResult<1>;
2296
2614
  }
2615
+ declare global {
2616
+ interface HTMLElementTagNameMap {
2617
+ 'uc-url-source': UrlSource;
2618
+ }
2619
+ }
2297
2620
 
2298
2621
  declare class SimpleBtn extends LitUploaderBlock {
2299
2622
  static styleAttrs: string[];
@@ -2304,26 +2627,10 @@ declare class SimpleBtn extends LitUploaderBlock {
2304
2627
  initCallback(): void;
2305
2628
  render(): lit_html.TemplateResult<1>;
2306
2629
  }
2307
-
2308
- declare class LitSolutionBlock extends LitBlock {
2309
- static styleAttrs: string[];
2310
- init$: {
2311
- '*solution': string | null;
2312
- '*commonProgress': number;
2313
- '*uploadList': never[];
2314
- '*uploadQueue': _uploadcare_upload_client.Queue;
2315
- '*collectionErrors': OutputErrorCollection[];
2316
- '*collectionState': OutputCollectionState | null;
2317
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
2318
- '*uploadTrigger': Set<string>;
2319
- '*currentActivity': null;
2320
- '*currentActivityParams': {};
2321
- '*history': never[];
2322
- '*historyBack': null;
2323
- '*closeModal': () => void;
2324
- };
2325
- initCallback(): void;
2326
- render(): lit_html.TemplateResult<1>;
2630
+ declare global {
2631
+ interface HTMLElementTagNameMap {
2632
+ 'uc-simple-btn': SimpleBtn;
2633
+ }
2327
2634
  }
2328
2635
 
2329
2636
  declare class FileUploaderRegular extends LitSolutionBlock {
@@ -2337,15 +2644,14 @@ declare class FileUploaderRegular extends LitSolutionBlock {
2337
2644
  initCallback(): void;
2338
2645
  render(): lit_html.TemplateResult<1>;
2339
2646
  }
2340
-
2341
- declare class CloudImageEditor extends CloudImageEditorBlock {
2342
- static styleAttrs: string[];
2343
- constructor();
2344
- initCallback(): void;
2647
+ declare global {
2648
+ interface HTMLElementTagNameMap {
2649
+ 'uc-file-uploader-regular': FileUploaderRegular;
2650
+ }
2345
2651
  }
2346
2652
 
2347
2653
  declare class FileUploaderInline extends LitSolutionBlock {
2348
- propertiesMeta: {
2654
+ attributesMeta: {
2349
2655
  'ctx-name': string;
2350
2656
  };
2351
2657
  static styleAttrs: string[];
@@ -2358,9 +2664,14 @@ declare class FileUploaderInline extends LitSolutionBlock {
2358
2664
  initCallback(): void;
2359
2665
  render(): lit_html.TemplateResult<1>;
2360
2666
  }
2667
+ declare global {
2668
+ interface HTMLElementTagNameMap {
2669
+ 'uc-file-uploader-inline': FileUploaderInline;
2670
+ }
2671
+ }
2361
2672
 
2362
2673
  declare class FileUploaderMinimal extends LitSolutionBlock {
2363
- propertiesMeta: {
2674
+ attributesMeta: {
2364
2675
  'ctx-name': string;
2365
2676
  };
2366
2677
  static styleAttrs: string[];
@@ -2376,5 +2687,10 @@ declare class FileUploaderMinimal extends LitSolutionBlock {
2376
2687
  disconnectedCallback(): void;
2377
2688
  render(): lit_html.TemplateResult<1>;
2378
2689
  }
2690
+ declare global {
2691
+ interface HTMLElementTagNameMap {
2692
+ 'uc-file-uploader-minimal': FileUploaderMinimal;
2693
+ }
2694
+ }
2379
2695
 
2380
2696
  export { LitActivityBlock as ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, PubSub as Data, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };