@uploadcare/file-uploader 1.25.0 → 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 (75) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +4 -75
  2. package/dist/env.js +4 -33
  3. package/dist/index.css +5 -2660
  4. package/dist/index.d.ts +2326 -1670
  5. package/dist/index.js +6 -12012
  6. package/dist/index.layered.css +4 -2716
  7. package/dist/index.ssr.js +532 -768
  8. package/dist/locales/file-uploader/ar.js +4 -165
  9. package/dist/locales/file-uploader/az.js +4 -157
  10. package/dist/locales/file-uploader/ca.js +4 -159
  11. package/dist/locales/file-uploader/cs.js +4 -161
  12. package/dist/locales/file-uploader/da.js +4 -157
  13. package/dist/locales/file-uploader/de.js +4 -157
  14. package/dist/locales/file-uploader/el.js +4 -157
  15. package/dist/locales/file-uploader/en.js +4 -157
  16. package/dist/locales/file-uploader/es.js +4 -159
  17. package/dist/locales/file-uploader/et.js +4 -157
  18. package/dist/locales/file-uploader/fi.js +4 -157
  19. package/dist/locales/file-uploader/fr.js +4 -159
  20. package/dist/locales/file-uploader/he.js +4 -159
  21. package/dist/locales/file-uploader/hy.js +4 -157
  22. package/dist/locales/file-uploader/is.js +4 -157
  23. package/dist/locales/file-uploader/it.js +4 -159
  24. package/dist/locales/file-uploader/ja.js +4 -157
  25. package/dist/locales/file-uploader/ka.js +4 -157
  26. package/dist/locales/file-uploader/kk.js +4 -157
  27. package/dist/locales/file-uploader/ko.js +4 -157
  28. package/dist/locales/file-uploader/lv.js +4 -159
  29. package/dist/locales/file-uploader/nb.js +4 -157
  30. package/dist/locales/file-uploader/nl.js +4 -157
  31. package/dist/locales/file-uploader/pl.js +4 -161
  32. package/dist/locales/file-uploader/pt.js +4 -159
  33. package/dist/locales/file-uploader/ro.js +4 -159
  34. package/dist/locales/file-uploader/ru.js +4 -161
  35. package/dist/locales/file-uploader/sk.js +4 -161
  36. package/dist/locales/file-uploader/sr.js +4 -159
  37. package/dist/locales/file-uploader/sv.js +4 -157
  38. package/dist/locales/file-uploader/tr.js +4 -157
  39. package/dist/locales/file-uploader/uk.js +4 -161
  40. package/dist/locales/file-uploader/vi.js +4 -157
  41. package/dist/locales/file-uploader/zh-TW.js +4 -157
  42. package/dist/locales/file-uploader/zh.js +4 -157
  43. package/package.json +44 -32
  44. package/types/jsx.d.ts +75 -48
  45. package/web/file-uploader.iife.min.d.ts +2619 -1833
  46. package/web/file-uploader.iife.min.js +6 -27
  47. package/web/file-uploader.iife.min.js.LEGAL.txt +71 -0
  48. package/web/file-uploader.min.d.ts +2619 -1833
  49. package/web/file-uploader.min.js +5 -26
  50. package/web/file-uploader.min.js.LEGAL.txt +71 -0
  51. package/web/uc-basic.layered.min.css +4 -23
  52. package/web/uc-basic.min.css +4 -23
  53. package/web/uc-cloud-image-editor.layered.min.css +4 -23
  54. package/web/uc-cloud-image-editor.min.css +4 -23
  55. package/web/uc-cloud-image-editor.min.d.ts +1835 -580
  56. package/web/uc-cloud-image-editor.min.js +5 -26
  57. package/web/uc-cloud-image-editor.min.js.LEGAL.txt +70 -0
  58. package/web/uc-file-uploader-inline.layered.min.css +4 -23
  59. package/web/uc-file-uploader-inline.min.css +4 -23
  60. package/web/uc-file-uploader-inline.min.d.ts +2619 -1833
  61. package/web/uc-file-uploader-inline.min.js +5 -26
  62. package/web/uc-file-uploader-inline.min.js.LEGAL.txt +71 -0
  63. package/web/uc-file-uploader-minimal.layered.min.css +4 -23
  64. package/web/uc-file-uploader-minimal.min.css +4 -23
  65. package/web/uc-file-uploader-minimal.min.d.ts +2619 -1833
  66. package/web/uc-file-uploader-minimal.min.js +5 -26
  67. package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +71 -0
  68. package/web/uc-file-uploader-regular.layered.min.css +4 -23
  69. package/web/uc-file-uploader-regular.min.css +4 -23
  70. package/web/uc-file-uploader-regular.min.d.ts +2619 -1833
  71. package/web/uc-file-uploader-regular.min.js +5 -26
  72. package/web/uc-file-uploader-regular.min.js.LEGAL.txt +71 -0
  73. package/web/uc-img.min.d.ts +60 -100
  74. package/web/uc-img.min.js +5 -25
  75. package/web/uc-img.min.js.LEGAL.txt +24 -0
package/dist/index.d.ts CHANGED
@@ -1,700 +1,1633 @@
1
- import { BaseComponent } from '@symbiotejs/symbiote';
2
- export { BaseComponent, Data, UID } from '@symbiotejs/symbiote';
1
+ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
2
+ export { loadFileUploaderFrom } from './abstract/loadFileUploaderFrom.js';
3
+ import _default from './locales/file-uploader/en.js';
4
+ import * as lit_html from 'lit-html';
5
+ import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
3
6
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
4
- import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions } from '@uploadcare/upload-client';
7
+ import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
5
8
  export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
6
- export { loadFileUploaderFrom } from './abstract/loadFileUploaderFrom.js';
9
+ import { Ref } from 'lit/directives/ref.js';
7
10
  import { TelemetryRequest } from '@uploadcare/quality-insights';
8
11
  export { PACKAGE_NAME, PACKAGE_VERSION } from './env.js';
9
12
 
10
- declare class A11y {
13
+ type Unsubscriber = () => void;
14
+ declare class PubSub<T extends Record<string, unknown>> {
15
+ private static _contexts;
16
+ private _store;
17
+ private _ctxId;
18
+ private constructor();
19
+ get id(): string;
20
+ pub<K extends keyof T>(key: K, value: T[K]): void;
21
+ sub<K extends keyof T>(key: K, callback: (value: T[K]) => void, init?: boolean): Unsubscriber;
22
+ read<K extends keyof T>(key: K): T[K];
23
+ add<K extends keyof T>(key: K, value: T[K], rewrite?: boolean): void;
24
+ has(key: keyof T): boolean;
25
+ get store(): T;
26
+ static registerCtx<T extends Record<string, unknown>>(initialValue: T, ctxId: string): PubSub<T>;
27
+ static deleteCtx(ctxId: string): void;
28
+ static getCtx<T extends Record<string, unknown> = Record<string, unknown>>(ctxId: string): PubSub<T> | null;
29
+ static hasCtx(ctxId: string): boolean;
30
+ }
31
+
32
+ type Constructor<T = unknown> = new (...args: any[]) => T;
33
+
34
+ type SymbioteStateBag<T extends Record<string, unknown>> = T;
35
+ /**
36
+ * Interface for components using SymbioteMixin
37
+ */
38
+ declare class SymbioteComponent<TState extends Record<string, unknown> = Record<string, unknown>> {
39
+ $: SymbioteStateBag<TState>;
40
+ sub<TKey extends keyof TState>(key: TKey, callback: (value: TState[TKey]) => void, init?: boolean): () => void;
41
+ pub<TKey extends keyof TState>(key: TKey, value: TState[TKey]): void;
42
+ set$<T extends {
43
+ [K in keyof T]: K extends keyof TState ? TState[K] : never;
44
+ }>(obj: T): void;
45
+ has<TKey extends keyof TState>(key: TKey): boolean;
46
+ add<TKey extends keyof TState>(key: TKey, val: TState[TKey], rewrite?: boolean): void;
47
+ add$<T extends {
48
+ [K in keyof T]: K extends keyof TState ? TState[K] : never;
49
+ }>(obj: T, rewrite?: boolean): void;
50
+ initCallback(): void;
51
+ sharedCtx: PubSub<TState>;
52
+ ctxName: string;
53
+ ctxOwner: boolean;
54
+ }
55
+
56
+ declare const BaseComponent_base: typeof LitElement & Constructor<{
57
+ willYield: boolean;
58
+ yield(slot: string, defaultContent?: unknown): unknown;
59
+ }> & Constructor<{
60
+ getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
61
+ }> & Constructor<SymbioteComponent<Record<string, unknown>>> & Constructor<LitElement> & {
62
+ reg(tagName: string): void;
63
+ };
64
+ declare class BaseComponent extends BaseComponent_base {
65
+ }
66
+
67
+ type Uid = string & {
68
+ __uid: true;
69
+ };
70
+
71
+ declare class UID {
72
+ static generateFastUid(): Uid;
73
+ static generateRandomUUID(): string;
74
+ }
75
+
76
+ declare function defineComponents(blockExports: Record<string, any>): void;
77
+
78
+ type LocaleDefinition = typeof _default;
79
+ type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
80
+ declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
81
+
82
+ declare class A11y implements ISharedInstance {
11
83
  private _destroyKeyUX;
12
84
  private readonly _scopedWindow;
13
85
  constructor();
14
- registerBlock(scope: Block): void;
86
+ registerBlock(scope: LitBlock): void;
15
87
  destroy(): void;
16
88
  }
17
89
 
18
- type LocaleChangeCallback = () => void;
19
- declare class LocaleManager {
20
- private _blockInstance;
90
+ declare class LocaleManager extends SharedInstance {
21
91
  private _localeName;
22
- private _callbacks;
23
- private _boundBlocks;
24
- constructor(blockInstance: Block);
25
- onLocaleChange(callback: LocaleChangeCallback): () => void;
26
- bindL10n(block: Block, key: string, resolver: LocaleChangeCallback): void;
27
- destroyL10nBindings(block: Block): void;
92
+ constructor(sharedInstancesBag: SharedInstancesBag);
93
+ }
94
+
95
+ declare class TypedData<T extends Record<string, unknown>> {
96
+ private _ctxId;
97
+ private _data;
98
+ constructor(initialValue: T);
99
+ get uid(): Uid;
100
+ setValue<K extends keyof T>(prop: K, value: T[K]): void;
101
+ setMultipleValues(updObj: Partial<T>): void;
102
+ getValue<K extends keyof T>(prop: K): T[K];
103
+ subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
28
104
  destroy(): void;
29
105
  }
30
106
 
31
- declare class Modal extends Block {
32
- static styleAttrs: string[];
33
- static StateConsumerScope: string;
34
- private _mouseDownTarget;
35
- handleModalOpen: ModalCb;
36
- handleModalClose: ModalCb;
37
- handleModalCloseAll: ModalCb;
38
- constructor();
39
- _handleBackdropClick: () => void;
40
- _closeDialog: () => void;
41
- _handleDialogClose: () => void;
42
- _handleDialogMouseDown: (e: MouseEvent) => void;
43
- _handleDialogMouseUp: (e: MouseEvent) => void;
44
- show(): void;
45
- hide(): void;
46
- private _handleModalOpen;
47
- private _handleModalClose;
48
- private _handleModalCloseAll;
49
- initCallback(): void;
50
- destroyCallback(): void;
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;
149
+ destroy(): void;
51
150
  }
52
151
 
53
- declare const ModalEvents: Readonly<{
54
- readonly ADD: "modal:add";
55
- readonly DELETE: "modal:delete";
56
- readonly OPEN: "modal:open";
57
- readonly CLOSE: "modal:close";
58
- readonly CLOSE_ALL: "modal:closeAll";
59
- readonly DESTROY: "modal:destroy";
152
+ declare const CameraSourceTypes: Readonly<{
153
+ PHOTO: "photo";
154
+ VIDEO: "video";
60
155
  }>;
61
- type ModalId = ActivityType;
62
- type ModalCb = (data: {
63
- id: ModalId;
64
- modal: Modal;
65
- }) => void;
66
- type ModalEventType = (typeof ModalEvents)[keyof typeof ModalEvents];
67
- declare class ModalManager {
68
- private _modals;
69
- private _activeModals;
70
- private _subscribers;
71
- private _block;
72
- constructor(block: Block);
73
- private _debugPrint;
74
- /**
75
- * Register a modal with the manager
76
- * @param id Unique identifier for the modal
77
- * @param modal Modal component instance
78
- */
79
- registerModal(id: ModalId, modal: Modal): void;
80
- /** Remove a modal by ID. */
81
- deleteModal(id: ModalId): boolean;
82
- /** Open a modal by its ID. */
83
- open(id: ModalId): boolean;
84
- /** Close a specific modal by ID. */
85
- close(id: ModalId): boolean;
86
- /** Toggle a modal - open if closed, close if open. */
87
- toggle(id: ModalId): boolean;
88
- /** True if there are any active modals. */
89
- get hasActiveModals(): boolean;
90
- /** Close the most recently opened modal and return to the previous one. */
91
- back(): boolean;
92
- /** Close all open modals. */
93
- closeAll(): number;
94
- /**
95
- * Subscribe to modal events
96
- * @returns Unsubscribe function
97
- */
98
- subscribe(event: ModalEventType, callback: ModalCb): () => void;
99
- /** Unsubscribe from modal events */
100
- unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
101
- /** Notify all subscribers of a modal event. */
102
- private _notify;
103
- /** Destroy the modal manager, clean up resources */
104
- destroy(): void;
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
+
160
+ interface UploadEntryData extends Record<string, unknown> {
161
+ file: File | null;
162
+ externalUrl: string | null;
163
+ fileName: string | null;
164
+ fileSize: number | null;
165
+ lastModified: number;
166
+ uploadProgress: number;
167
+ uuid: string | null;
168
+ isImage: boolean;
169
+ mimeType: string | null;
170
+ ctxName: string | null;
171
+ cdnUrl: string | null;
172
+ cdnUrlModifiers: string | null;
173
+ fileInfo: UploadcareFile | null;
174
+ isUploading: boolean;
175
+ abortController: AbortController | null;
176
+ thumbUrl: string | null;
177
+ silent: boolean;
178
+ source: string | null;
179
+ fullPath: string | null;
180
+ metadata: Metadata | null;
181
+ errors: OutputErrorFile[];
182
+ uploadError: Error | null;
183
+ isRemoved: boolean;
184
+ isQueuedForUploading: boolean;
185
+ isValidationPending: boolean;
186
+ isQueuedForValidation: boolean;
105
187
  }
188
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
189
+ type UploadEntryKeys = keyof UploadEntryData;
106
190
 
107
- type CommonEventType = InternalEventKey | EventKey;
108
- type TelemetryState = TelemetryRequest & {
109
- eventTimestamp: number;
110
- location: string;
111
- };
112
- type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
113
- modalId?: string;
114
- eventType?: CommonEventType;
191
+ type ApiAddFileCommonOptions = {
192
+ silent?: boolean;
193
+ fileName?: string;
194
+ source?: string;
115
195
  };
116
- declare class TelemetryManager {
117
- private readonly _sessionId;
118
- private readonly _telemetryInstance;
119
- private readonly _block;
120
- private _config;
121
- private _initialized;
122
- private _lastPayload;
123
- private readonly _queue;
124
- constructor(block: Block);
125
- private _init;
126
- private _setConfig;
127
- private _formattingPayload;
128
- private _excludedEvents;
129
- sendEvent(body: TelemetryEventBody): void;
130
- sendEventError(error: unknown, context?: string): void;
131
- /**
132
- * Method to send telemetry event for Cloud Image Editor.
133
- */
134
- sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
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;
135
201
  /**
136
- * Deeply compares two objects and returns true if they are equal, false otherwise.
202
+ * TODO: Probably we should not allow user to override `source` property
137
203
  */
138
- private _checkObj;
139
- private get _timestamp();
140
- private get _solution();
141
- private get _activity();
142
- private get _location();
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();
143
225
  }
144
226
 
145
- declare class Block extends BaseComponent<any> {
146
- private __cfgProxy?;
147
- protected l10nProcessorSubs: Map<string, Set<{
148
- remove: () => void;
149
- }>>;
150
- static StateConsumerScope: string | null;
151
- static styleAttrs: string[];
152
- protected requireCtxName: boolean;
153
- activityType: ActivityType;
154
- init$: {};
155
- l10n(str: string, variables?: Record<string, string | number>): string;
156
- private pluralize;
157
- protected bindL10n(key: string, resolver: () => void): void;
158
- constructor();
159
- emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
160
- hasBlockInCtx(callback: (block: Block) => boolean): boolean;
161
- setOrAddState(prop: string, newVal: any): void;
162
- connectedCallback(): void;
163
- disconnectedCallback(): void;
164
- initCallback(): void;
165
- get testId(): string;
166
- get modalManager(): ModalManager | undefined;
167
- get telemetryManager(): TelemetryManager | {
168
- sendEvent: () => void;
169
- sendEventCloudImageEditor: () => void;
170
- sendEventError: () => void;
227
+ declare const ExternalUploadSource: Readonly<{
228
+ readonly FACEBOOK: "facebook";
229
+ readonly DROPBOX: "dropbox";
230
+ readonly GDRIVE: "gdrive";
231
+ readonly GPHOTOS: "gphotos";
232
+ readonly FLICKR: "flickr";
233
+ readonly VK: "vk";
234
+ readonly EVERNOTE: "evernote";
235
+ readonly BOX: "box";
236
+ readonly ONEDRIVE: "onedrive";
237
+ readonly HUDDLE: "huddle";
238
+ }>;
239
+ declare const UploadSource: Readonly<{
240
+ readonly FACEBOOK: "facebook";
241
+ readonly DROPBOX: "dropbox";
242
+ readonly GDRIVE: "gdrive";
243
+ readonly GPHOTOS: "gphotos";
244
+ readonly FLICKR: "flickr";
245
+ readonly VK: "vk";
246
+ readonly EVERNOTE: "evernote";
247
+ readonly BOX: "box";
248
+ readonly ONEDRIVE: "onedrive";
249
+ readonly HUDDLE: "huddle";
250
+ readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
251
+ readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
252
+ readonly LOCAL: "local";
253
+ readonly DROP_AREA: "drop-area";
254
+ readonly CAMERA: "camera";
255
+ readonly EXTERNAL: "external";
256
+ readonly API: "js-api";
257
+ readonly URL: "url";
258
+ readonly DRAW: "draw";
259
+ }>;
260
+ type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
261
+
262
+ declare class LitUploaderBlock extends LitActivityBlock {
263
+ static extSrcList: Readonly<typeof ExternalUploadSource>;
264
+ static sourceTypes: Readonly<typeof UploadSource>;
265
+ protected couldBeCtxOwner: boolean;
266
+ private _isCtxOwner;
267
+ private _unobserveCollection?;
268
+ private _unobserveCollectionProperties?;
269
+ init$: {
270
+ '*commonProgress': number;
271
+ '*uploadList': never[];
272
+ '*uploadQueue': _uploadcare_upload_client.Queue;
273
+ '*collectionErrors': OutputErrorCollection[];
274
+ '*collectionState': OutputCollectionState | null;
275
+ '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
276
+ '*uploadTrigger': Set<string>;
277
+ '*currentActivity': null;
278
+ '*currentActivityParams': {};
279
+ '*history': never[];
280
+ '*historyBack': null;
281
+ '*closeModal': () => void;
171
282
  };
172
- protected get localeManager(): LocaleManager | null;
173
- protected get a11y(): A11y | null;
174
- protected get blocksRegistry(): Set<Block>;
175
- destroyCallback(): void;
176
- /**
177
- * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
178
- */
179
- protected destroyCtxCallback(): void;
180
- protected proxyUrl(url: string): Promise<string>;
181
- get cfg(): ConfigType;
182
- subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void): void;
183
- debugPrint(...args: unknown[]): void;
184
- static reg(name?: string): void;
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[];
185
305
  }
186
306
 
187
- declare const InternalEventType: Readonly<{
188
- readonly INIT_SOLUTION: "init-solution";
189
- readonly CHANGE_CONFIG: "change-config";
190
- readonly ACTION_EVENT: "action-event";
191
- readonly ERROR_EVENT: "error-event";
192
- }>;
193
- declare const EventType: Readonly<{
194
- readonly FILE_ADDED: "file-added";
195
- readonly FILE_REMOVED: "file-removed";
196
- readonly FILE_UPLOAD_START: "file-upload-start";
197
- readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
198
- readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
199
- readonly FILE_UPLOAD_FAILED: "file-upload-failed";
200
- readonly FILE_URL_CHANGED: "file-url-changed";
201
- readonly MODAL_OPEN: "modal-open";
202
- readonly MODAL_CLOSE: "modal-close";
203
- readonly DONE_CLICK: "done-click";
204
- readonly UPLOAD_CLICK: "upload-click";
205
- readonly ACTIVITY_CHANGE: "activity-change";
206
- readonly COMMON_UPLOAD_START: "common-upload-start";
207
- readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
208
- readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
209
- readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
210
- readonly CHANGE: "change";
211
- readonly GROUP_CREATED: "group-created";
212
- }>;
213
- type EventKey = (typeof EventType)[keyof typeof EventType];
214
- type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
215
- type EventPayload = {
216
- [EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
217
- [EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
218
- [EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
219
- [EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
220
- [EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
221
- [EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
222
- [EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
223
- [EventType.MODAL_OPEN]: {
224
- modalId: ModalId;
225
- };
226
- [EventType.MODAL_CLOSE]: {
227
- modalId: ModalId;
228
- hasActiveModals: boolean;
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;
229
333
  };
230
- [EventType.ACTIVITY_CHANGE]: {
231
- activity: ActivityType;
334
+ crop?: {
335
+ dimensions: [number, number];
336
+ coords: [number, number];
232
337
  };
233
- [EventType.UPLOAD_CLICK]: void;
234
- [EventType.DONE_CLICK]: OutputCollectionState;
235
- [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
236
- [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
237
- [EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
238
- [EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
239
- [EventType.CHANGE]: OutputCollectionState;
240
- [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
241
- };
242
- declare class EventEmitter {
243
- private _timeoutStore;
244
- private _targets;
245
- private _debugPrint;
246
- constructor(debugPrint: (...args: unknown[]) => void);
247
- bindTarget(target: Block): void;
248
- unbindTarget(target: Block): void;
249
- private _dispatch;
250
- emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
251
- debounce?: TDebounce;
252
- }): void;
253
338
  }
254
-
255
- type EventMap = {
256
- [T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
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[];
354
+
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;
257
372
  };
258
373
 
259
- type LocaleDefinition = Record<string, string>;
260
- type LocaleDefinitionResolver = () => Promise<LocaleDefinition>;
261
- declare const defineLocale: (localeName: string, definitionOrResolver: LocaleDefinition | LocaleDefinitionResolver) => void;
262
-
263
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(uploaderBlock: UploaderBlock): OutputCollectionState<TCollectionStatus, TGroupFlag>;
264
-
265
- type TypedSchema = Record<string, {
266
- type: unknown;
267
- value: unknown;
268
- nullable?: boolean;
269
- }>;
270
- type Constructor<T = any> = new (...args: any[]) => T;
271
- type ExtractType<T, V> = T extends StringConstructor ? string : T extends BooleanConstructor ? boolean : T extends NumberConstructor ? number : T extends ArrayConstructor ? V : T extends Constructor ? InstanceType<T> : T;
272
- type ExtractDataFromSchema<T extends TypedSchema> = {
273
- [K in keyof T]: ExtractType<T[K]['type'], T[K]['value']> | (T[K]['nullable'] extends true ? null : never);
374
+ type PresenceToggleStyle = {
375
+ transition?: string;
376
+ visible?: string;
377
+ hidden?: string;
274
378
  };
275
- type ExtractKeysFromSchema<T extends TypedSchema> = Extract<keyof T, string>;
276
- declare class TypedData<T extends TypedSchema> {
277
- private __typedSchema;
278
- private __ctxId;
279
- private __schema;
280
- private __data;
281
- constructor(typedSchema: T, ctxName?: string);
282
- get uid(): string;
283
- setValue<K extends ExtractKeysFromSchema<T>>(prop: K, value: ExtractDataFromSchema<T>[K]): void;
284
- setMultipleValues(updObj: Partial<ExtractDataFromSchema<T>>): void;
285
- getValue<K extends ExtractKeysFromSchema<T>>(prop: K): ExtractDataFromSchema<T>[K];
286
- subscribe<K extends ExtractKeysFromSchema<T>>(prop: K, handler: (newVal: ExtractDataFromSchema<T>[K]) => void): {
287
- remove: () => void;
288
- callback: Function;
289
- };
290
- remove(): void;
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
+ }
291
398
  }
292
399
 
293
- declare const uploadEntrySchema: Readonly<{
294
- file: Readonly<{
295
- type: {
296
- new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
297
- prototype: File;
298
- };
299
- value: null;
300
- nullable: true;
301
- }>;
302
- externalUrl: Readonly<{
303
- type: StringConstructor;
304
- value: null;
305
- nullable: true;
306
- }>;
307
- fileName: Readonly<{
308
- type: StringConstructor;
309
- value: null;
310
- nullable: true;
311
- }>;
312
- fileSize: Readonly<{
313
- type: NumberConstructor;
314
- value: null;
315
- nullable: true;
316
- }>;
317
- lastModified: Readonly<{
318
- type: NumberConstructor;
319
- value: number;
320
- }>;
321
- uploadProgress: Readonly<{
322
- type: NumberConstructor;
323
- value: 0;
324
- }>;
325
- uuid: Readonly<{
326
- type: StringConstructor;
327
- value: null;
328
- nullable: true;
329
- }>;
330
- isImage: Readonly<{
331
- type: BooleanConstructor;
332
- value: false;
333
- }>;
334
- mimeType: Readonly<{
335
- type: StringConstructor;
336
- value: null;
337
- nullable: true;
338
- }>;
339
- ctxName: Readonly<{
340
- type: StringConstructor;
341
- value: null;
342
- nullable: true;
343
- }>;
344
- cdnUrl: Readonly<{
345
- type: StringConstructor;
346
- value: null;
347
- nullable: true;
348
- }>;
349
- cdnUrlModifiers: Readonly<{
350
- type: StringConstructor;
351
- value: null;
352
- nullable: true;
353
- }>;
354
- fileInfo: Readonly<{
355
- type: typeof UploadcareFile;
356
- value: null;
357
- nullable: true;
358
- }>;
359
- isUploading: Readonly<{
360
- type: BooleanConstructor;
361
- value: false;
362
- }>;
363
- abortController: Readonly<{
364
- type: {
365
- new (): AbortController;
366
- prototype: AbortController;
367
- };
368
- value: null;
369
- nullable: true;
370
- }>;
371
- thumbUrl: Readonly<{
372
- type: StringConstructor;
373
- value: null;
374
- nullable: true;
375
- }>;
376
- silent: Readonly<{
377
- type: BooleanConstructor;
378
- value: false;
379
- }>;
380
- source: Readonly<{
381
- type: StringConstructor;
382
- value: null;
383
- nullable: true;
384
- }>;
385
- fullPath: Readonly<{
386
- type: StringConstructor;
387
- value: null;
388
- nullable: true;
389
- }>;
390
- metadata: Readonly<{
391
- type: ObjectConstructor;
392
- value: null;
393
- nullable: true;
394
- }>;
395
- errors: Readonly<{
396
- type: ArrayConstructor;
397
- value: OutputErrorFile[];
398
- }>;
399
- uploadError: Readonly<{
400
- type: ErrorConstructor;
401
- value: null;
402
- nullable: true;
403
- }>;
404
- isRemoved: Readonly<{
405
- type: BooleanConstructor;
406
- value: false;
407
- }>;
408
- isQueuedForUploading: Readonly<{
409
- type: BooleanConstructor;
410
- value: false;
411
- }>;
412
- isValidationPending: Readonly<{
413
- type: BooleanConstructor;
414
- value: false;
415
- }>;
416
- isQueuedForValidation: Readonly<{
417
- type: BooleanConstructor;
418
- value: false;
419
- }>;
420
- }>;
421
- type UploadEntryData = ExtractDataFromSchema<typeof uploadEntrySchema>;
422
- type UploadEntryTypedData = TypedData<typeof uploadEntrySchema>;
423
- type UploadEntryKeys = ExtractKeysFromSchema<typeof uploadEntrySchema>;
424
-
425
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
426
- signal?: AbortSignal;
427
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
428
- type FileValidatorDescriptor = {
429
- runOn: 'add' | 'upload' | 'change';
430
- validator: FuncFileValidator;
431
- };
432
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
433
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
434
- declare class ValidationManager {
435
- private _blockInstance;
436
- private _uploadCollection;
437
- private _commonFileValidators;
438
- private _commonCollectionValidators;
439
- private _queue;
440
- private _runQueueDebounced;
441
- private _entryValidationState;
442
- constructor(blockInstance: UploaderBlock);
443
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: string[]): void;
444
- runCollectionValidators(): void;
445
- cleanupValidationForEntry(entry: TypedData<typeof uploadEntrySchema>): void;
446
- private _runFileValidatorsForEntry;
447
- private _addCustomTypeToValidationError;
448
- private _getEntryValidationState;
449
- private _getValidatorDescriptors;
450
- private _getValidatorDescriptorsForEntry;
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
+ }
451
416
  }
452
417
 
453
- type CameraMode = 'photo' | 'video';
454
- type CameraStatus = 'shot' | 'retake' | 'accept' | 'play' | 'stop' | 'pause' | 'resume';
455
- declare class CameraSource extends UploaderBlock {
456
- couldBeCtxOwner: boolean;
457
- activityType: "camera";
458
- private _unsubPermissions;
459
- private _capturing;
460
- private _chunks;
461
- private _mediaRecorder;
462
- private _stream;
463
- private _selectedAudioId;
464
- private _selectedCameraId;
465
- private _activeTab;
466
- private _options;
467
- private _canvas;
468
- private _ctx;
469
- private _cameraDevices;
470
- private _audioDevices;
471
- private _permissionResponses;
472
- constructor();
473
- _chooseActionWithCamera: () => void;
474
- _updateTimer: () => void;
475
- _startTimer: () => void;
476
- _stopTimer: () => void;
477
- _startTimeline: () => void;
478
- _stopTimeline: () => void;
479
- _animationFrameId: number | null;
480
- _startRecording: () => void;
481
- private _stopRecording;
482
- /** This method is used to toggle recording pause/resume */
483
- _toggleRecording: () => void;
484
- _toggleEnableAudio: () => void;
485
- /**
486
- * Previewing the video that was recorded on the camera
487
- */
488
- private _previewVideo;
489
- _retake: () => void;
490
- _accept: () => void;
491
- _handlePhoto: (status: CameraStatus) => void;
492
- _handleVideo: (status: CameraStatus) => void;
493
- private _setCameraState;
494
- private _shot;
495
- private _handleActiveTab;
496
- private _createFile;
497
- _guessExtensionByMime(mime: string | undefined): string;
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;
444
+ /**
445
+ * CSS-only attribute
446
+ */
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;
498
485
  /**
499
- * The send file to the server
486
+ * @private Super Tricky workaround for the chromium bug See
487
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=330815
500
488
  */
501
- _toSend: (file: File) => void;
502
- private get _cameraModes();
503
- private _setPermissionsState;
504
- _makeStreamInactive: () => boolean;
505
- _stopCapture: () => void;
506
- _capture: () => Promise<void>;
507
- _handlePermissionsChange: () => void;
508
- _permissionAccess: () => Promise<void>;
509
- _getPermission: () => void;
510
- _requestDeviceAccess: () => Promise<void>;
511
- _getDevices: () => Promise<void>;
512
- _onActivate: () => Promise<void>;
513
- _onDeactivate: () => Promise<void>;
514
- _handleCameraModes: (cameraModes: CameraMode[]) => void;
515
- initCallback(): void;
516
- _destroy(): void;
517
- destroyCallback(): Promise<void>;
518
- }
519
-
520
- /**
521
- * Config keys that can't be passed as attribute (because they are object or function)
522
- */
523
- declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
524
- /** Mapping of attribute names to state */
525
- declare const attrStateMapping: Record<string, string>;
526
- declare class Config extends Block {
527
- requireCtxName: boolean;
528
- constructor();
529
- private _flushValueToAttribute;
530
- private _flushValueToState;
531
- private _setValue;
532
- private _getValue;
533
- _assertSameValueDifferentReference(key: string, previousValue: unknown, nextValue: unknown): void;
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;
534
506
  initCallback(): void;
535
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
536
- get computationControllers(): any;
507
+ protected firstUpdated(changedProperties: PropertyValues<this>): void;
508
+ private _initializeSvg;
509
+ disconnectedCallback(): void;
510
+ render(): TemplateResult;
537
511
  }
538
- interface Config extends ConfigType {
512
+ declare global {
513
+ interface HTMLElementTagNameMap {
514
+ 'uc-crop-frame': CropFrame;
515
+ }
539
516
  }
540
517
 
541
- type FilesViewMode = 'grid' | 'list';
542
- declare class UploadList extends UploaderBlock {
543
- couldBeCtxOwner: boolean;
544
- historyTracked: boolean;
545
- activityType: "upload-list";
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;
546
536
  constructor();
547
- private _throttledHandleCollectionUpdate;
548
- private _updateUploadsState;
549
- private _getHeaderText;
550
- get couldOpenActivity(): boolean;
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;
551
561
  initCallback(): void;
552
- destroyCallback(): void;
562
+ disconnectedCallback(): void;
563
+ render(): TemplateResult;
564
+ }
565
+ declare global {
566
+ interface HTMLElementTagNameMap {
567
+ 'uc-editor-image-cropper': EditorImageCropper;
568
+ }
553
569
  }
554
570
 
555
- declare const ExternalUploadSource: Readonly<{
556
- readonly FACEBOOK: "facebook";
557
- readonly DROPBOX: "dropbox";
558
- readonly GDRIVE: "gdrive";
559
- readonly GPHOTOS: "gphotos";
560
- readonly FLICKR: "flickr";
561
- readonly VK: "vk";
562
- readonly EVERNOTE: "evernote";
563
- readonly BOX: "box";
564
- readonly ONEDRIVE: "onedrive";
565
- readonly HUDDLE: "huddle";
566
- }>;
567
- declare const UploadSource: Readonly<{
568
- readonly FACEBOOK: "facebook";
569
- readonly DROPBOX: "dropbox";
570
- readonly GDRIVE: "gdrive";
571
- readonly GPHOTOS: "gphotos";
572
- readonly FLICKR: "flickr";
573
- readonly VK: "vk";
574
- readonly EVERNOTE: "evernote";
575
- readonly BOX: "box";
576
- readonly ONEDRIVE: "onedrive";
577
- readonly HUDDLE: "huddle";
578
- readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
579
- readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
580
- readonly LOCAL: "local";
581
- readonly DROP_AREA: "drop-area";
582
- readonly CAMERA: "camera";
583
- readonly EXTERNAL: "external";
584
- readonly API: "js-api";
585
- readonly URL: "url";
586
- readonly DRAW: "draw";
571
+ declare const TabId: Readonly<{
572
+ readonly CROP: "crop";
573
+ readonly TUNING: "tuning";
574
+ readonly FILTERS: "filters";
587
575
  }>;
588
- type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
589
-
590
- declare const CameraSourceTypes: Readonly<{
591
- PHOTO: "photo";
592
- VIDEO: "video";
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
+ };
593
630
  }>;
594
- type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
595
631
 
596
- type ApiAddFileCommonOptions = {
597
- silent?: boolean;
598
- fileName?: string;
599
- source?: string;
600
- };
601
- declare class UploaderPublicApi {
602
- private _ctx;
603
- constructor(ctx: UploaderBlock);
604
- private get _uploadCollection();
605
- get cfg(): ConfigType;
606
- get l10n(): (str: string, variables?: Record<string, string | number>) => string;
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;
607
655
  /**
608
- * TODO: Probably we should not allow user to override `source` property
656
+ * Check if current operation and filter equals passed ones
609
657
  */
610
- addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
611
- addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
612
- addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
613
- addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
614
- fullPath?: string;
615
- }) => OutputFileEntry<"idle">;
616
- removeFileByInternalId: (internalId: string) => void;
617
- removeAllFiles(): void;
618
- uploadAll: () => void;
619
- openSystemDialog: (options?: {
620
- captureCamera?: boolean;
621
- modeCamera?: ModeCameraType;
622
- }) => void;
623
- getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
624
- getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
625
- initFlow: (force?: boolean) => void;
626
- doneFlow: () => void;
627
- setCurrentActivity: <T extends ActivityType>(activityType: T, ...[params]: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [unknown?]) => void;
628
- getCurrentActivity: () => ActivityType;
629
- setModalState: (opened: boolean) => void;
630
- private get _sourceList();
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>;
631
702
  }
632
703
 
633
- type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
634
- type LocaleDefinitionOverride = Record<string, LocaleDefinition>;
635
- type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
636
- uuid: string;
637
- cdnUrlModifiers: string;
638
- fileName: string;
639
- }) => Promise<string> | string;
640
- type SecureUploadsSignatureAndExpire = {
641
- secureSignature: string;
642
- secureExpire: string;
643
- };
644
- type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatureAndExpire | null>;
645
- type IconHrefResolver = (iconName: string) => string;
646
- type FileValidators = FileValidator[];
647
- type CollectionValidators = FuncCollectionValidator[];
648
- type ConfigType = {
649
- /**
650
- * Your project’s Public Key.
651
- */
652
- pubkey: string;
653
- /**
654
- * Allow multiple file uploads.
655
- */
656
- multiple: boolean;
657
- /**
658
- * Minimum number of files to upload.
659
- */
660
- multipleMin: number;
661
- /**
662
- * Maximum number of files to upload.
663
- */
664
- multipleMax: number;
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 {
665
787
  /**
666
- * Require user confirmation before uploading.
788
+ * CSS-only attribute
667
789
  */
668
- confirmUpload: boolean;
669
- /**
670
- * Allow only image files.
671
- */
672
- imgOnly: boolean;
673
- /**
674
- * Native file input accept attribute value. Also affects client validation settings.
675
- */
676
- accept: string;
677
- /**
678
- * Preferred types for external sources.
679
- * See [here](https://uploadcare.com/docs/file-uploader/options/#external-sources-preferred-types)
680
- */
681
- externalSourcesPreferredTypes: string;
682
- /**
683
- * Provide custom CSS to the social sources iframe
684
- */
685
- externalSourcesEmbedCss: string;
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;
847
+ min: number;
848
+ max: number;
849
+ value: number;
850
+ defaultValue: number;
851
+ zero: number;
852
+ };
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
+ }
867
+
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
+ }
930
+ }
931
+
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;
942
+ };
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>;
966
+ initCallback(): void;
967
+ private _assignSharedElements;
968
+ private _attachImageListeners;
969
+ private _detachImageListeners;
970
+ private get _imageClassName();
686
971
  /**
687
- * Store uploaded files.
972
+ * To proper work, we need non-zero size the element. So, we'll wait for it.
688
973
  */
689
- store: boolean | 'auto';
974
+ private _waitForSize;
975
+ firstUpdated(changedProperties: PropertyValues<this>): void;
976
+ disconnectedCallback(): void;
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>;
983
+ }
984
+ declare global {
985
+ interface HTMLElementTagNameMap {
986
+ 'uc-cloud-image-editor-block': CloudImageEditorBlock;
987
+ }
988
+ }
989
+
990
+ declare class CloudImageEditor extends CloudImageEditorBlock {
991
+ static styleAttrs: string[];
992
+ constructor();
993
+ initCallback(): void;
994
+ }
995
+ declare global {
996
+ interface HTMLElementTagNameMap {
997
+ 'uc-cloud-image-editor': CloudImageEditor;
998
+ }
999
+ }
1000
+
1001
+ type ActivityParams$1 = {
1002
+ internalId: string;
1003
+ };
1004
+ declare class CloudImageEditorActivity extends LitUploaderBlock {
1005
+ couldBeCtxOwner: boolean;
1006
+ activityType: "cloud-image-edit";
1007
+ private _entry?;
1008
+ private _editorConfig;
1009
+ get activityParams(): ActivityParams$1;
1010
+ initCallback(): void;
1011
+ private _handleApply;
1012
+ private _handleCancel;
1013
+ handleChange(event: CustomEvent<ChangeResult>): void;
1014
+ private _mountEditor;
1015
+ private _unmountEditor;
1016
+ render(): lit_html.TemplateResult<1> | typeof nothing;
1017
+ private _createEditorConfig;
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
+ }
1041
+
1042
+ type ActivityParams = {
1043
+ externalSourceType: string;
1044
+ };
1045
+ declare class ExternalSource extends LitUploaderBlock {
1046
+ couldBeCtxOwner: boolean;
1047
+ activityType: "external";
1048
+ private _messageBridge?;
1049
+ private _iframeRef;
1050
+ private _latestSelectionSummary;
1051
+ private _selectedList;
1052
+ private _isSelectionReady;
1053
+ private _isDoneBtnEnabled;
1054
+ private _couldSelectAll;
1055
+ private _couldDeselectAll;
1056
+ private _showSelectionStatus;
1057
+ private _showDoneBtn;
1058
+ private _doneBtnTextClass;
1059
+ private _toolbarVisible;
1060
+ private get _counterText();
1061
+ get activityParams(): ActivityParams;
1062
+ initCallback(): void;
1063
+ private _extractUrlFromSelectedFile;
1064
+ private _handleToolbarStateChange;
1065
+ private _handleSelectedFilesChange;
1066
+ private _handleIframeLoad;
1067
+ private _applyTheme;
1068
+ private _applyEmbedCss;
1069
+ private _setupL10n;
1070
+ private _remoteUrl;
1071
+ private _handleDone;
1072
+ private _handleCancel;
1073
+ private _handleSelectAll;
1074
+ private _handleDeselectAll;
1075
+ private _setSelectionSummary;
1076
+ private _mountIframe;
1077
+ private _unmountIframe;
1078
+ private _resetSelectionStatus;
1079
+ disconnectedCallback(): void;
1080
+ render(): lit_html.TemplateResult<1>;
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;
1099
+
1100
+ declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1101
+ type ActivityParamsMap = {
1102
+ 'cloud-image-edit': ActivityParams$1;
1103
+ external: ActivityParams;
1104
+ };
1105
+ declare class LitActivityBlock extends LitBlock {
1106
+ protected historyTracked: boolean;
1107
+ private [ACTIVE_PROP]?;
1108
+ init$: {
1109
+ '*currentActivity': null;
1110
+ '*currentActivityParams': {};
1111
+ '*history': never[];
1112
+ '*historyBack': null;
1113
+ '*closeModal': () => void;
1114
+ };
1115
+ private _debouncedHistoryFlush;
1116
+ private _deactivate;
1117
+ private _activate;
1118
+ initCallback(): void;
1119
+ private _historyFlush;
1120
+ private _isActivityRegistered;
1121
+ private static _activityCallbacks;
1122
+ static activities: Readonly<{
1123
+ START_FROM: 'start-from';
1124
+ CAMERA: 'camera';
1125
+ DRAW: 'draw';
1126
+ UPLOAD_LIST: 'upload-list';
1127
+ URL: 'url';
1128
+ CLOUD_IMG_EDIT: 'cloud-image-edit';
1129
+ EXTERNAL: 'external';
1130
+ }>;
1131
+ protected get isActivityActive(): boolean;
1132
+ get couldOpenActivity(): boolean;
1133
+ /** TODO: remove name argument */
1134
+ protected registerActivity(_name: string, options?: {
1135
+ onActivate?: () => void;
1136
+ onDeactivate?: () => void;
1137
+ }): void;
1138
+ private _unregisterActivity;
1139
+ disconnectedCallback(): void;
1140
+ get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1141
+ get initActivity(): string | null;
1142
+ get doneActivity(): string | null;
1143
+ historyBack(): void;
1144
+ }
1145
+
1146
+ declare const InternalEventType: Readonly<{
1147
+ readonly INIT_SOLUTION: "init-solution";
1148
+ readonly CHANGE_CONFIG: "change-config";
1149
+ readonly ACTION_EVENT: "action-event";
1150
+ readonly ERROR_EVENT: "error-event";
1151
+ }>;
1152
+ declare const EventType: Readonly<{
1153
+ readonly FILE_ADDED: "file-added";
1154
+ readonly FILE_REMOVED: "file-removed";
1155
+ readonly FILE_UPLOAD_START: "file-upload-start";
1156
+ readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
1157
+ readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
1158
+ readonly FILE_UPLOAD_FAILED: "file-upload-failed";
1159
+ readonly FILE_URL_CHANGED: "file-url-changed";
1160
+ readonly MODAL_OPEN: "modal-open";
1161
+ readonly MODAL_CLOSE: "modal-close";
1162
+ readonly DONE_CLICK: "done-click";
1163
+ readonly UPLOAD_CLICK: "upload-click";
1164
+ readonly ACTIVITY_CHANGE: "activity-change";
1165
+ readonly COMMON_UPLOAD_START: "common-upload-start";
1166
+ readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
1167
+ readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
1168
+ readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
1169
+ readonly CHANGE: "change";
1170
+ readonly GROUP_CREATED: "group-created";
1171
+ }>;
1172
+ type EventKey = (typeof EventType)[keyof typeof EventType];
1173
+ type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
1174
+ type EventPayload = {
1175
+ [EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
1176
+ [EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
1177
+ [EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
1178
+ [EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
1179
+ [EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
1180
+ [EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
1181
+ [EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
1182
+ [EventType.MODAL_OPEN]: {
1183
+ modalId: ModalId;
1184
+ };
1185
+ [EventType.MODAL_CLOSE]: {
1186
+ modalId: ModalId;
1187
+ hasActiveModals: boolean;
1188
+ };
1189
+ [EventType.ACTIVITY_CHANGE]: {
1190
+ activity: ActivityType;
1191
+ };
1192
+ [EventType.UPLOAD_CLICK]: undefined;
1193
+ [EventType.DONE_CLICK]: OutputCollectionState;
1194
+ [EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
1195
+ [EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
1196
+ [EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
1197
+ [EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
1198
+ [EventType.CHANGE]: OutputCollectionState;
1199
+ [EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
1200
+ };
1201
+ declare class EventEmitter extends SharedInstance {
1202
+ private _timeoutStore;
1203
+ private _targets;
1204
+ bindTarget(target: LitBlock): () => void;
1205
+ private _dispatch;
1206
+ emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
1207
+ debounce?: TDebounce;
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;
690
1302
  /**
691
- * Mirror the camera view.
1303
+ * Previewing the video that was recorded on the camera
692
1304
  */
693
- cameraMirror: boolean;
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;
694
1323
  /**
695
- * Default camera capture mode.
1324
+ * The send file to the server
696
1325
  */
697
- cameraCapture: 'user' | 'environment' | '';
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
+ }
1380
+ }
1381
+
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;
1389
+ }
1390
+
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
+ }
1423
+
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
+ }
1443
+
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;
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;
1556
+ initCallback(): void;
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' | '';
698
1631
  /**
699
1632
  * List of sources for file uploads.
700
1633
  */
@@ -875,1097 +1808,765 @@ type ConfigType = {
875
1808
  */
876
1809
  validationTimeout: number;
877
1810
  /**
878
- * The number of files to validate concurrently.
879
- */
880
- validationConcurrency: number;
881
- /**
882
- * The camera modes to enable in the camera modal,
883
- * it is possible to select photo or video capture.
884
- * The first mode is the default mode.
885
- * @default 'photo,video'
886
- */
887
- cameraModes: string;
888
- /**
889
- * The default tab to open in the camera modal,
890
- * it is possible to select video or photo capture
891
- * @default 'null'
892
- * @deprecated - use `cameraModes` instead
893
- */
894
- defaultCameraMode: CameraMode | null;
895
- /**
896
- * Enable audio recording.
897
- * @default true
898
- */
899
- enableAudioRecording: boolean;
900
- /**
901
- * Enable video recording.
902
- * @deprecated - use `cameraModes` instead
903
- * @default null
904
- */
905
- enableVideoRecording: boolean | null;
906
- /**
907
- * The maximum duration of the video recording in seconds
908
- * @default null
909
- */
910
- maxVideoRecordingDuration: number | null;
911
- /**
912
- * A dictionary object that can contain
913
- * the following properties from MediaRecorderOptions
914
- */
915
- mediaRecorderOptions: MediaRecorderOptions | null;
916
- filesViewMode: FilesViewMode;
917
- gridShowFileNames: boolean;
918
- cloudImageEditorAutoOpen: boolean;
919
- qualityInsights: boolean;
920
- cloudImageEditorMaskHref: string | null;
921
- /**
922
- * Adds data-testid attributes to the each block. Needed for testing purposes.
923
- * @default false
924
- */
925
- testMode: boolean;
926
- };
927
- type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
928
- type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
929
- type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKeys<ConfigPlainType>;
930
- 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;
931
- type KebabCaseKeys<T extends Record<string, unknown>> = {
932
- [Key in keyof T as KebabCase$1<Key & string>]: T[Key];
933
- };
934
- type LowerCase<S extends string> = Lowercase<S>;
935
- type LowerCaseKeys<T extends Record<string, unknown>> = {
936
- [Key in keyof T as Lowercase<Key & string>]: T[Key];
937
- };
938
- type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
939
- type OutputCustomErrorType = 'CUSTOM_ERROR';
940
- type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
941
- type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
942
- type OutputFileErrorPayload = {
943
- entry: OutputFileEntry;
944
- };
945
- type OutputErrorTypePayload = {
946
- NOT_AN_IMAGE: OutputFileErrorPayload;
947
- FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
948
- FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
949
- SOME_FILES_HAS_ERRORS: {};
950
- TOO_MANY_FILES: {
951
- min: number;
952
- max: number;
953
- total: number;
954
- };
955
- TOO_FEW_FILES: {
956
- min: number;
957
- max: number;
958
- total: number;
959
- };
960
- UPLOAD_ERROR: OutputFileErrorPayload & {
961
- error: UploadError;
962
- };
963
- NETWORK_ERROR: OutputFileErrorPayload & {
964
- error: NetworkError;
965
- };
966
- UNKNOWN_ERROR: OutputFileErrorPayload & {
967
- error?: Error;
968
- };
969
- CUSTOM_ERROR: Record<string, unknown>;
970
- };
971
- type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType ? {
972
- type?: T;
973
- message: string;
974
- payload?: OutputErrorTypePayload[T];
975
- } : T extends keyof OutputErrorTypePayload ? {
976
- type: T;
977
- message: string;
978
- payload?: OutputErrorTypePayload[T];
979
- } : never;
980
- type OutputErrorFile = OutputError<OutputFileErrorType>;
981
- type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
982
- type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
983
- status: TStatus;
984
- internalId: string;
985
- name: string;
986
- size: number;
987
- isImage: boolean;
988
- mimeType: string;
989
- metadata: Metadata | null;
990
- file: File | Blob | null;
991
- externalUrl: string | null;
992
- uploadProgress: number;
993
- fullPath: string | null;
994
- source: SourceTypes | null;
995
- isValidationPending: boolean;
996
- } & ({
997
- status: 'success';
998
- fileInfo: UploadcareFile;
999
- uuid: string;
1000
- cdnUrl: string;
1001
- cdnUrlModifiers: string;
1002
- isUploading: false;
1003
- isSuccess: true;
1004
- isFailed: false;
1005
- isRemoved: false;
1006
- errors: [];
1007
- } | {
1008
- status: 'failed';
1009
- fileInfo: UploadcareFile | null;
1010
- uuid: string | null;
1011
- cdnUrl: string | null;
1012
- cdnUrlModifiers: string | null;
1013
- isUploading: false;
1014
- isSuccess: false;
1015
- isFailed: true;
1016
- isRemoved: false;
1017
- errors: OutputError<OutputFileErrorType>[];
1018
- } | {
1019
- status: 'uploading';
1020
- fileInfo: null;
1021
- uuid: null;
1022
- cdnUrl: null;
1023
- cdnUrlModifiers: null;
1024
- isUploading: true;
1025
- isSuccess: false;
1026
- isFailed: false;
1027
- isRemoved: false;
1028
- errors: [];
1029
- } | {
1030
- status: 'removed';
1031
- fileInfo: UploadcareFile | null;
1032
- uuid: string | null;
1033
- cdnUrl: string | null;
1034
- cdnUrlModifiers: string | null;
1035
- isUploading: false;
1036
- isSuccess: false;
1037
- isFailed: false;
1038
- isRemoved: true;
1039
- errors: OutputError<OutputFileErrorType>[];
1040
- } | {
1041
- status: 'idle';
1042
- fileInfo: null;
1043
- uuid: null;
1044
- cdnUrl: null;
1045
- cdnUrlModifiers: null;
1046
- isUploading: false;
1047
- isSuccess: false;
1048
- isFailed: false;
1049
- isRemoved: false;
1050
- errors: [];
1051
- });
1052
- type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
1053
- type GroupFlag = 'has-group' | 'maybe-has-group';
1054
- type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'> = {
1055
- status: TStatus;
1056
- totalCount: number;
1057
- successCount: number;
1058
- failedCount: number;
1059
- uploadingCount: number;
1060
- progress: number;
1061
- successEntries: OutputFileEntry<'success'>[];
1062
- failedEntries: OutputFileEntry<'failed'>[];
1063
- uploadingEntries: OutputFileEntry<'uploading'>[];
1064
- idleEntries: OutputFileEntry<'idle'>[];
1065
- } & (TGroupFlag extends 'has-group' ? {
1066
- group: UploadcareGroup;
1067
- } : TGroupFlag extends 'maybe-has-group' ? {
1068
- group: UploadcareGroup | null;
1069
- } : never) & ({
1070
- status: 'idle';
1071
- isFailed: false;
1072
- isUploading: false;
1073
- isSuccess: false;
1074
- errors: [];
1075
- allEntries: OutputFileEntry<'idle' | 'success'>[];
1076
- } | {
1077
- status: 'uploading';
1078
- isFailed: false;
1079
- isUploading: true;
1080
- isSuccess: false;
1081
- errors: [];
1082
- allEntries: OutputFileEntry[];
1083
- } | {
1084
- status: 'success';
1085
- isFailed: false;
1086
- isUploading: false;
1087
- isSuccess: true;
1088
- errors: [];
1089
- allEntries: OutputFileEntry<'success'>[];
1090
- } | {
1091
- status: 'failed';
1092
- isFailed: true;
1093
- isUploading: false;
1094
- isSuccess: false;
1095
- errors: OutputError<OutputCollectionErrorType>[];
1096
- allEntries: OutputFileEntry[];
1097
- });
1098
-
1099
- declare class SecureUploadsManager {
1100
- private readonly _block;
1101
- private _secureToken;
1102
- constructor(block: UploaderBlock);
1103
- private _debugPrint;
1104
- getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
1105
- }
1106
-
1107
- type ChangeMap<T extends TypedSchema> = Record<keyof T, Set<string>>;
1108
- type TypedCollectionPropertyObserver<T extends TypedSchema> = (changeMap: ChangeMap<T>) => void;
1109
- type TypedCollectionObserverHandler<T extends TypedSchema> = (list: string[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
1110
- type TypedCollectionOptions<T extends TypedSchema> = {
1111
- typedSchema: T;
1112
- watchList?: ExtractKeysFromSchema<T>[];
1113
- handler?: TypedCollectionObserverHandler<T>;
1114
- ctxName?: string;
1115
- };
1116
- declare class TypedCollection<T extends TypedSchema> {
1117
- private __typedSchema;
1118
- private __ctxId;
1119
- private __data;
1120
- private __watchList;
1121
- private __subsMap;
1122
- private __propertyObservers;
1123
- private __collectionObservers;
1124
- private __items;
1125
- private __removed;
1126
- private __added;
1127
- private __observeTimeout?;
1128
- private __notifyTimeout?;
1129
- private __notifyObservers;
1130
- constructor(options: TypedCollectionOptions<T>);
1131
- notify(): void;
1132
- observeCollection(handler: TypedCollectionObserverHandler<T>): () => void;
1133
- unobserveCollection(handler: TypedCollectionObserverHandler<T>): void;
1134
- add(init: Partial<ExtractDataFromSchema<T>>): string;
1135
- read(id: string): TypedData<T> | null;
1136
- readProp<K extends ExtractKeysFromSchema<T>>(id: string, propName: K): ExtractDataFromSchema<T>[K] | null;
1137
- publishProp<K extends ExtractKeysFromSchema<T>>(id: string, propName: K, value: ExtractDataFromSchema<T>[K]): void;
1138
- remove(id: string): void;
1139
- clearAll(): void;
1140
- observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
1141
- unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
1142
- findItems(checkFn: (item: TypedData<T>) => boolean): string[];
1143
- items(): string[];
1144
- get size(): number;
1145
- destroy(): void;
1146
- }
1147
-
1148
- declare class UploaderBlock extends ActivityBlock {
1149
- static extSrcList: Readonly<typeof ExternalUploadSource>;
1150
- static sourceTypes: Readonly<typeof UploadSource>;
1151
- protected couldBeCtxOwner: boolean;
1152
- private isCtxOwner;
1153
- private _unobserveCollection?;
1154
- private _unobserveCollectionProperties?;
1155
- init$: {
1156
- '*commonProgress': number;
1157
- '*uploadList': never[];
1158
- '*uploadQueue': _uploadcare_upload_client.Queue;
1159
- '*collectionErrors': OutputErrorCollection[];
1160
- '*collectionState': OutputCollectionState | null;
1161
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
1162
- '*uploadTrigger': Set<string>;
1163
- '*secureUploadsManager': SecureUploadsManager | null;
1164
- '*currentActivity': null;
1165
- '*currentActivityParams': {};
1166
- '*history': never[];
1167
- '*historyBack': null;
1168
- '*closeModal': () => void;
1169
- };
1170
- private get hasCtxOwner();
1171
- initCallback(): void;
1172
- protected get validationManager(): ValidationManager;
1173
- get api(): UploaderPublicApi;
1174
- getAPI(): UploaderPublicApi;
1175
- get uploadCollection(): TypedCollection<typeof uploadEntrySchema>;
1176
- destroyCtxCallback(): void;
1177
- disconnectedCallback(): void;
1178
- connectedCallback(): void;
1179
- destroyCallback(): void;
1180
- private _initCtxOwner;
1181
- private _observeUploadCollection;
1182
- private _unobserveUploadCollection;
1183
- private _createGroup;
1184
- private _flushOutputItems;
1185
- private _handleCollectionUpdate;
1186
- private _handleCollectionPropertiesUpdate;
1187
- private _flushCommonUploadProgress;
1188
- openCloudImageEditor(): void;
1189
- private setInitialCrop;
1190
- protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
1191
- protected getUploadClientOptions(): Promise<FileFromOptions>;
1192
- getOutputData(): OutputFileEntry[];
1193
- }
1194
-
1195
- /**
1196
- * Image size
1197
- */
1198
- interface ImageSize {
1199
- width: number;
1200
- height: number;
1201
- }
1202
- interface Transformations {
1203
- enhance?: number;
1204
- brightness?: number;
1205
- exposure?: number;
1206
- gamma?: number;
1207
- contrast?: number;
1208
- saturation?: number;
1209
- vibrance?: number;
1210
- warmth?: number;
1211
- rotate?: number;
1212
- mirror?: boolean;
1213
- flip?: boolean;
1214
- filter?: {
1215
- name: string;
1216
- amount: number;
1217
- };
1218
- crop?: {
1219
- dimensions: [number, number];
1220
- coords: [number, number];
1221
- };
1222
- }
1223
- interface ApplyResult {
1224
- originalUrl: string;
1225
- cdnUrlModifiers: string;
1226
- cdnUrl: string;
1227
- transformations: Transformations;
1228
- }
1229
- interface CropAspectRatio {
1230
- type: 'aspect-ratio';
1231
- width: number;
1232
- height: number;
1233
- id: string;
1234
- hasFreeform?: boolean;
1235
- }
1236
-
1237
- type ActivityParams$1 = {
1238
- internalId: string;
1239
- };
1240
- declare class CloudImageEditorActivity extends UploaderBlock {
1241
- couldBeCtxOwner: boolean;
1242
- activityType: "cloud-image-edit";
1243
- private _entry?;
1244
- private _instance?;
1245
- get activityParams(): ActivityParams$1;
1246
- initCallback(): void;
1247
- handleApply(e: CustomEvent<ApplyResult>): void;
1248
- handleCancel(): void;
1249
- mountEditor(): void;
1250
- unmountEditor(): void;
1251
- }
1252
-
1253
- type ActivityParams = {
1254
- externalSourceType: string;
1255
- };
1256
- declare class ExternalSource extends UploaderBlock {
1257
- couldBeCtxOwner: boolean;
1258
- activityType: "external";
1259
- private _messageBridge?;
1260
- constructor();
1261
- get activityParams(): ActivityParams;
1262
- initCallback(): void;
1263
- private extractUrlFromSelectedFile;
1264
- private handleToolbarStateChange;
1265
- private handleSelectedFilesChange;
1266
- private handleIframeLoad;
1267
- private applyTheme;
1268
- private applyEmbedCss;
1269
- private setupL10n;
1270
- private remoteUrl;
1271
- private mountIframe;
1272
- private unmountIframe;
1273
- private resetSelectionStatus;
1274
- }
1275
-
1276
- declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1277
- type ActivityParamsMap = {
1278
- 'cloud-image-edit': ActivityParams$1;
1279
- external: ActivityParams;
1280
- };
1281
- declare class ActivityBlock extends Block {
1282
- protected historyTracked: boolean;
1283
- private [ACTIVE_PROP]?;
1284
- init$: {
1285
- '*currentActivity': null;
1286
- '*currentActivityParams': {};
1287
- '*history': never[];
1288
- '*historyBack': null;
1289
- '*closeModal': () => void;
1290
- };
1291
- _debouncedHistoryFlush: (() => void) & {
1292
- cancel: () => void;
1293
- };
1294
- private _deactivate;
1295
- private _activate;
1296
- initCallback(): void;
1297
- private _historyFlush;
1298
- private _isActivityRegistered;
1299
- private static _activityCallbacks;
1300
- static activities: Readonly<{
1301
- START_FROM: 'start-from';
1302
- CAMERA: 'camera';
1303
- DRAW: 'draw';
1304
- UPLOAD_LIST: 'upload-list';
1305
- URL: 'url';
1306
- CLOUD_IMG_EDIT: 'cloud-image-edit';
1307
- EXTERNAL: 'external';
1308
- }>;
1309
- get isActivityActive(): boolean;
1310
- get couldOpenActivity(): boolean;
1311
- /** TODO: remove name argument */
1312
- registerActivity(_name: string, options?: {
1313
- onActivate?: () => void;
1314
- onDeactivate?: () => void;
1315
- }): void;
1316
- unregisterActivity(): void;
1317
- destroyCallback(): void;
1318
- get activityKey(): string;
1319
- get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1320
- get initActivity(): string;
1321
- get doneActivity(): string;
1322
- historyBack(): void;
1323
- }
1324
- type RegisteredActivityType = (typeof ActivityBlock)['activities'][keyof (typeof ActivityBlock)['activities']];
1325
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1326
-
1327
- declare function defineComponents(blockExports: Record<string, any>): void;
1328
-
1329
- declare class SolutionBlock extends Block {
1330
- static styleAttrs: string[];
1331
- protected requireCtxName: boolean;
1332
- init$: {
1333
- '*solution': string | null;
1334
- '*commonProgress': number;
1335
- '*uploadList': never[];
1336
- '*uploadQueue': _uploadcare_upload_client.Queue;
1337
- '*collectionErrors': OutputErrorCollection[];
1338
- '*collectionState': OutputCollectionState | null;
1339
- '*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
1340
- '*uploadTrigger': Set<string>;
1341
- '*secureUploadsManager': SecureUploadsManager | null;
1342
- '*currentActivity': null;
1343
- '*currentActivityParams': {};
1344
- '*history': never[];
1345
- '*historyBack': null;
1346
- '*closeModal': () => void;
1347
- };
1348
- private static _template;
1349
- initCallback(): void;
1350
- static set template(value: string);
1351
- static get template(): string;
1352
- }
1353
-
1354
- declare class ActivityHeader extends ActivityBlock {
1355
- }
1356
-
1357
- declare class CloudImageEditorBlock extends Block {
1358
- ctxOwner: boolean;
1359
- static styleAttrs: string[];
1360
- private _debouncedShowLoader;
1361
- constructor();
1362
- private _showLoader;
1363
- /**
1364
- * To proper work, we need non-zero size the element. So, we'll wait for it.
1811
+ * The number of files to validate concurrently.
1365
1812
  */
1366
- private _waitForSize;
1367
- initCallback(): void;
1368
- updateImage(): Promise<void>;
1369
- initEditor(): Promise<void>;
1370
- }
1371
-
1372
- declare class CropFrame extends Block {
1373
- private readonly _handlePointerUp;
1374
- private readonly _handlePointerMove;
1375
- private readonly _handleSvgPointerMove;
1376
- private readonly _backdropMaskId;
1377
- private _backdropMask?;
1378
- private _backdropMaskInner?;
1379
- private _frameThumbs?;
1380
- private _frameGuides?;
1381
- private _draggingThumb?;
1382
- private _hoverThumb?;
1383
- private _dragStartPoint?;
1384
- private _dragStartCrop?;
1385
- private _frameImage?;
1386
- private _guidesHidden;
1387
- constructor();
1388
- private _shouldThumbBeDisabled;
1389
- private _createBackdrop;
1813
+ validationConcurrency: number;
1390
1814
  /**
1391
- * @private Super Tricky workaround for the chromium bug See
1392
- * https://bugs.chromium.org/p/chromium/issues/detail?id=330815
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'
1393
1819
  */
1394
- private _resizeBackdrop;
1395
- private _updateBackdrop;
1396
- private _updateFrame;
1397
- private _createThumb;
1398
- private _createThumbs;
1399
- private _createGuides;
1400
- private _createFrame;
1401
- private _handlePointerDown;
1402
- private _handlePointerUp_;
1403
- private _handlePointerMove_;
1404
- private _calcCropBox;
1405
- private _handleSvgPointerMove_;
1406
- private _updateCursor;
1407
- private _createMask;
1408
- private _updateMask;
1409
- private _render;
1410
- toggleThumbs(visible: boolean): void;
1411
- initCallback(): void;
1412
- destroyCallback(): void;
1413
- }
1414
-
1415
- declare class EditorButtonControl extends Block {
1416
- private _titleEl?;
1417
- constructor();
1418
- initCallback(): void;
1419
- }
1420
-
1421
- declare class EditorFreeformButtonControl extends EditorButtonControl {
1422
- initCallback(): void;
1423
- handleClick(): void;
1424
- }
1425
- interface EditorAspectRatioButtonControl {
1426
- get aspectRatio(): CropAspectRatio | undefined;
1427
- set aspectRatio(value: CropAspectRatio | undefined);
1428
- }
1429
- declare class EditorAspectRatioButtonControl extends EditorButtonControl {
1430
- constructor();
1431
- initCallback(): void;
1432
- handleClick(): void;
1433
- private _renderRectBasedOnAspectRatio;
1434
- private _aspectRatio?;
1435
- }
1436
-
1437
- declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
1438
- type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
1439
- 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"];
1440
- type FilterId = (typeof ALL_FILTERS)[number];
1441
- declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
1442
- type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
1443
- /** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
1444
- declare const COLOR_OPERATIONS_CONFIG: Readonly<{
1445
- brightness: {
1446
- zero: number;
1447
- range: readonly [-100, 100];
1448
- keypointsNumber: number;
1449
- };
1450
- exposure: {
1451
- zero: number;
1452
- range: readonly [-500, 500];
1453
- keypointsNumber: number;
1454
- };
1455
- gamma: {
1456
- zero: number;
1457
- range: readonly [0, 1000];
1458
- keypointsNumber: number;
1459
- };
1460
- contrast: {
1461
- zero: number;
1462
- range: readonly [-100, 500];
1463
- keypointsNumber: number;
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;
1464
1884
  };
1465
- saturation: {
1466
- zero: number;
1467
- range: readonly [-100, 500];
1468
- keypointsNumber: number;
1885
+ TOO_MANY_FILES: {
1886
+ min: number;
1887
+ max: number;
1888
+ total: number;
1469
1889
  };
1470
- vibrance: {
1471
- zero: number;
1472
- range: readonly [-100, 500];
1473
- keypointsNumber: number;
1890
+ TOO_FEW_FILES: {
1891
+ min: number;
1892
+ max: number;
1893
+ total: number;
1474
1894
  };
1475
- warmth: {
1476
- zero: number;
1477
- range: readonly [-100, 100];
1478
- keypointsNumber: number;
1895
+ UPLOAD_ERROR: OutputFileErrorPayload & {
1896
+ error: UploadError;
1479
1897
  };
1480
- enhance: {
1481
- zero: number;
1482
- range: readonly [0, 100];
1483
- keypointsNumber: number;
1898
+ NETWORK_ERROR: OutputFileErrorPayload & {
1899
+ error: NetworkError;
1484
1900
  };
1485
- filter: {
1486
- zero: number;
1487
- range: readonly [0, 100];
1488
- keypointsNumber: number;
1901
+ UNKNOWN_ERROR: OutputFileErrorPayload & {
1902
+ error?: Error;
1489
1903
  };
1490
- }>;
1491
-
1492
- interface EditorCropButtonControl {
1493
- get operation(): CropOperation | undefined;
1494
- set operation(value: CropOperation | undefined);
1495
- }
1496
- declare class EditorCropButtonControl extends EditorButtonControl {
1497
- private _operation;
1498
- initCallback(): void;
1499
- }
1904
+ CUSTOM_ERROR: Record<string, unknown>;
1905
+ };
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
+ });
1500
2033
 
1501
- declare class EditorFilterControl extends EditorButtonControl {
1502
- private _operation;
1503
- private _filter;
1504
- private _originalUrl;
1505
- private _observer?;
1506
- private _cancelPreload?;
1507
- constructor();
1508
- private _previewSrc;
1509
- private _observerCallback;
1510
- initCallback(): void;
1511
- destroyCallback(): void;
2034
+ declare class SecureUploadsManager extends SharedInstance {
2035
+ private _secureToken;
2036
+ getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
2037
+ destroy(): void;
1512
2038
  }
1513
2039
 
1514
- type Operations = {
1515
- flip: boolean;
1516
- mirror: boolean;
1517
- rotate: number;
2040
+ type CommonEventType = InternalEventKey | EventKey;
2041
+ type TelemetryState = TelemetryRequest & {
2042
+ eventTimestamp: number;
2043
+ location: string;
1518
2044
  };
1519
- declare class EditorImageCropper extends Block {
1520
- ctxOwner: boolean;
1521
- private _commitDebounced;
1522
- private _handleResizeThrottled;
1523
- private _imageSize;
1524
- private _canvas?;
1525
- private _ctx;
1526
- private _isActive;
1527
- private _observer?;
1528
- private _cancelPreload?;
1529
- constructor();
1530
- private _handleResize;
1531
- private _syncTransformations;
1532
- private _initCanvas;
1533
- private _alignImage;
1534
- private _alignCrop;
1535
- private _drawImage;
1536
- private _draw;
1537
- private _animateIn;
1538
- private _getCropDimensions;
1539
- private _getCropTransformation;
1540
- private _commit;
1541
- setValue<K extends keyof Operations>(operation: K, value: Operations[K]): void;
1542
- getValue<K extends keyof Operations>(operation: K): Operations[K];
1543
- activate(imageSize: ImageSize, { fromViewer }?: {
1544
- fromViewer?: boolean;
1545
- }): Promise<void>;
1546
- deactivate({ reset }?: {
1547
- reset?: boolean;
1548
- }): void;
1549
- private _transitionToCrop;
1550
- private _transitionToImage;
1551
- private _reset;
1552
- private _waitForImage;
1553
- private _handleImageLoading;
1554
- initCallback(): void;
1555
- destroyCallback(): void;
1556
- }
1557
-
1558
- type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
1559
- declare class EditorImageFader extends Block {
1560
- private _isActive;
1561
- private _hidden;
1562
- private _operation;
1563
- private _filter;
1564
- private _value?;
1565
- private _transformations;
1566
- private _keypoints;
1567
- private _container?;
1568
- private _previewImage?;
1569
- private _cancelLastImages?;
1570
- private _cancelBatchPreload?;
1571
- private _url?;
1572
- private _fromViewer?;
1573
- private _raf;
1574
- private _addKeypointDebounced;
1575
- constructor();
1576
- private _handleImageLoading;
1577
- private _flush;
1578
- private _imageSrc;
1579
- private _constructKeypoint;
2045
+ type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
2046
+ modalId?: string;
2047
+ eventType?: CommonEventType;
2048
+ };
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;
1580
2064
  /**
1581
- * Check if current operation and filter equals passed ones
2065
+ * Method to send telemetry event for Cloud Image Editor.
1582
2066
  */
1583
- private _isSame;
1584
- private _addKeypoint;
1585
- set(value: string | number): void;
1586
- private _update;
1587
- private _createPreviewImage;
1588
- private _initNodes;
1589
- setTransformations(transformations: Transformations): Promise<void>;
1590
- preload({ url, filter, operation, value, }: {
1591
- url: string;
1592
- filter?: string;
1593
- operation?: OperationKey;
1594
- value?: number;
1595
- }): Promise<void>;
1596
- private _setOriginalSrc;
1597
- activate({ url, operation, value, filter, fromViewer, }: {
1598
- url: string;
1599
- operation?: OperationKey;
1600
- value?: number;
1601
- filter?: string;
1602
- fromViewer?: boolean;
1603
- }): Promise<void>;
1604
- deactivate({ hide }?: {
1605
- hide?: boolean;
1606
- }): void;
1607
- }
1608
-
1609
- declare class EditorOperationControl extends EditorButtonControl {
1610
- private _operation;
1611
- initCallback(): void;
1612
- }
1613
-
1614
- declare class EditorScroller extends Block {
1615
- initCallback(): void;
1616
- }
1617
-
1618
- type SliderOperation = ColorOperation | 'filter';
1619
- type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
1620
- declare const FAKE_ORIGINAL_FILTER = "original";
1621
- declare class EditorSlider extends Block {
1622
- private _operation;
1623
- private _filter?;
1624
- private _originalUrl;
1625
- constructor();
1626
- setOperation(operation: SliderOperation, filter?: SliderFilter): void;
1627
- private _initializeValues;
1628
- apply(): void;
1629
- cancel(): void;
1630
- initCallback(): void;
1631
- }
1632
-
1633
- declare class EditorToolbar extends Block {
1634
- private _debouncedShowLoader;
1635
- private _cancelPreload?;
1636
- private _updateInfoTooltip;
1637
- constructor();
1638
- private _onSliderClose;
1639
- private _createOperationControl;
1640
- private _createFilterControl;
1641
- private _createToggleControl;
1642
- private _createAspectRatioControl;
1643
- private _createFreeformControl;
1644
- private _clearListAspectRatio;
1645
- private _renderControlsList;
1646
- private _activateTab;
1647
- private _unmountTabControls;
1648
- private _syncTabIndicator;
1649
- private _preloadEditedImage;
1650
- private _showLoader;
1651
- private _updateInfoTooltipHandler;
1652
- initCallback(): void;
1653
- destroyCallback(): void;
1654
- }
1655
-
1656
- declare class BtnUi extends Block {
1657
- private _iconReversed;
1658
- private _iconSingle;
1659
- private _iconHidden;
1660
- constructor();
1661
- private _iconCss;
1662
- initCallback(): void;
1663
- set reverse(_value: boolean);
1664
- }
1665
-
1666
- declare class LineLoaderUi extends Block {
1667
- private _active;
1668
- private readonly _handleTransitionEndRight;
1669
- initCallback(): void;
1670
- private _start;
1671
- private _stop;
1672
- }
1673
-
1674
- declare class PresenceToggle extends Block {
1675
- private _visible;
1676
- private _visibleStyle;
1677
- private _hiddenStyle;
1678
- private _externalTransitions;
1679
- constructor();
1680
- private _handleVisible;
1681
- initCallback(): void;
1682
- }
1683
-
1684
- declare class SliderUi extends Block {
1685
- private _observer?;
1686
- private _thumbSize;
1687
- private _zero;
1688
- private _zeroDotEl?;
1689
- private _stepsCount?;
1690
- constructor();
1691
- initCallback(): void;
1692
- private _inputEl;
1693
- private _thumbEl;
1694
- private _stepsEl;
1695
- private _updateValue;
1696
- private _updateZeroDot;
1697
- private _updateSteps;
1698
- destroyCallback(): void;
1699
- }
1700
-
1701
- declare class Copyright extends Block {
1702
- initCallback(): void;
1703
- static template: string;
2067
+ sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
2068
+ /**
2069
+ * Deeply compares two objects and returns true if they are equal, false otherwise.
2070
+ */
2071
+ private _checkObj;
2072
+ private get _timestamp();
2073
+ private get _solution();
2074
+ private get _activity();
2075
+ private get _location();
1704
2076
  }
1705
2077
 
1706
- declare class DropArea extends UploaderBlock {
1707
- static styleAttrs: string[];
1708
- private _destroyDropzone;
1709
- private _destroyContentWrapperDropzone;
1710
- private _onAreaClicked;
1711
- constructor();
1712
- isActive(): boolean;
1713
- initCallback(): void;
1714
- /** Ignore drop events if there are other visible drop areas on the page. */
1715
- private _shouldIgnore;
1716
- private _couldHandleFiles;
1717
- destroyCallback(): void;
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;
2170
+
2171
+ interface ISharedInstance {
2172
+ destroy?(): void;
2173
+ }
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;
1718
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
+ };
1719
2200
 
1720
- type EntrySubscription = ReturnType<UploadEntryTypedData['subscribe']>;
1721
- declare class FileItemConfig extends UploaderBlock {
1722
- protected _entrySubs: Set<EntrySubscription>;
1723
- protected _entry: UploadEntryTypedData | null;
1724
- protected _withEntry<A extends unknown[], R>(fn: (entry: UploadEntryTypedData, ...args: A) => R): (...args: A) => R | undefined;
1725
- protected _subEntry<K extends UploadEntryKeys>(prop: K, handler: (value: UploadEntryData[K]) => void): void;
1726
- protected _reset(): void;
1727
- disconnectedCallback(): void;
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;
2207
+ };
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;
1728
2228
  }
1729
2229
 
1730
- declare class FileItem extends FileItemConfig {
1731
- couldBeCtxOwner: boolean;
1732
- pauseRender: boolean;
1733
- private _renderedOnce;
1734
- private _observer?;
1735
- protected _isIntersecting: boolean;
1736
- protected _thumbRect?: DOMRectReadOnly;
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$: {};
1737
2244
  constructor();
1738
- private _calculateState;
1739
- private _debouncedCalculateState;
1740
- private _updateHintAndProgress;
1741
- private _handleState;
1742
- _reset(): void;
1743
- private _observerCallback;
1744
- private _handleEntryId;
1745
- private _updateShowFileNames;
1746
- initCallback(): void;
1747
- destroyCallback(): void;
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;
1748
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;
1749
2271
  disconnectedCallback(): void;
1750
- private _settingsOfShrink;
1751
- private _processShrink;
1752
- upload: () => Promise<void> | undefined;
1753
- static template: string;
1754
- static activeInstances: Set<FileItem>;
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;
1755
2287
  }
1756
2288
 
1757
- declare class FormInput extends UploaderBlock {
1758
- requireCtxName: boolean;
1759
- _validationInputElement: HTMLInputElement | null;
1760
- _dynamicInputsContainer: HTMLDivElement | null;
1761
- private get _inputName();
1762
- _createValidationInput(): HTMLInputElement;
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;
1763
2312
  initCallback(): void;
2313
+ disconnectedCallback(): void;
2314
+ private _handleDialogRef;
2315
+ render(): lit_html.TemplateResult<1>;
1764
2316
  }
1765
-
1766
- declare class Icon extends Block {
1767
- constructor();
1768
- initCallback(): void;
2317
+ declare global {
2318
+ interface HTMLElementTagNameMap {
2319
+ 'uc-modal': Modal;
2320
+ }
1769
2321
  }
1770
2322
 
1771
- declare class ImgConfig extends BaseComponent<any> {
1772
- static get observedAttributes(): string[];
1773
- constructor();
1774
- cssInit$: any;
1775
- /**
1776
- * @param {String} key
1777
- * @returns {any}
1778
- */
1779
- $$(key: string): any;
1780
- /** @param {Object<String, String | Number>} kvObj */
1781
- set$$(kvObj: any): 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;
1782
2341
  /**
1783
- * @param {String} key
1784
- * @param {(val: any) => void} kbFn
2342
+ * Register a modal with the manager
2343
+ * @param id Unique identifier for the modal
2344
+ * @param modal Modal component instance
1785
2345
  */
1786
- sub$$(key: string, kbFn: (val: any) => void): void;
1787
- analyticsParams(): string;
1788
- initAttributes(el: any): void;
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;
1789
2361
  /**
1790
- * @param {HTMLElement} el
1791
- * @param {() => void} cbkFn
2362
+ * Subscribe to modal events
2363
+ * @returns Unsubscribe function
1792
2364
  */
1793
- initIntersection(el: HTMLElement, cbkFn: () => void): void;
1794
- /** @private */
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;
2372
+ }
2373
+
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;
2393
+ };
2394
+ initCallback(): void;
2395
+ render(): lit_html.TemplateResult<1>;
2396
+ }
2397
+
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;
1795
2407
  private _isnObserver;
1796
- /** @private */
1797
2408
  private _observed;
1798
- attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
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;
2418
+ connectedCallback(): void;
2419
+ private _initCssProperties;
2420
+ disconnectedCallback(): void;
2421
+ static get observedAttributes(): string[];
2422
+ attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
1799
2423
  }
1800
2424
 
1801
2425
  declare class ImgBase extends ImgConfig {
1802
- _img: HTMLImageElement;
1803
- _imgPreview: HTMLImageElement;
1804
- /**
1805
- * @private
1806
- * @param {String} src
1807
- */
2426
+ private _img;
2427
+ private _imgPreview;
1808
2428
  private _fmtAbs;
1809
- /**
1810
- * Validate size
1811
- *
1812
- * @param {String} [size]
1813
- * @returns {String | Number}
1814
- */
1815
- _validateSize(size?: string): string | number;
1816
- /**
1817
- * Image operations
1818
- *
1819
- * @param {String} [size]
1820
- * @param {String} [blur]
1821
- */
1822
- _getCdnModifiers(size?: string, blur?: string): string;
1823
- /**
1824
- * @private
1825
- * @param {String} [size]
1826
- * @param {String} [blur]
1827
- * @returns {any}
1828
- */
2429
+ private _validateSize;
2430
+ private _getCdnModifiers;
2431
+ private _getTypedCssValue;
1829
2432
  private _getUrlBase;
1830
- /**
1831
- * @private
1832
- * @param {String} url
1833
- * @returns {String}
1834
- */
1835
2433
  private _proxyUrl;
1836
- /**
1837
- * @param {HTMLElement} el
1838
- * @param {Number} [k]
1839
- * @param {Boolean} [wOnly]
1840
- */
1841
- _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
1842
- /** @param {HTMLImageElement} img */
1843
- _setupEventProxy(img: HTMLImageElement): void;
1844
- /** @type {HTMLImageElement} */
1845
- get img(): HTMLImageElement;
1846
- get currentImg(): {
1847
- type: "PREVIEW";
1848
- img: HTMLImageElement;
1849
- } | {
1850
- type: "MAIN";
1851
- img: HTMLImageElement;
1852
- };
1853
- get hasPreviewImage(): any;
1854
- get bgSelector(): any;
1855
- get breakpoints(): number[] | null;
1856
- get hasFormatJPG(): boolean;
1857
- /** @param {HTMLElement} el */
1858
- renderBg(el: HTMLElement): void;
1859
- getSrcset(): string;
1860
- getSrc(): any;
1861
- get srcUrlPreview(): any;
1862
- renderBackground(): void;
1863
- _appendURL({ elNode, src, srcset }: {
1864
- elNode: any;
1865
- src: any;
1866
- srcset: any;
1867
- }): void;
1868
- _setupConfigForImage({ elNode }: {
1869
- elNode: any;
1870
- }): void;
1871
- loaderImage({ src, srcset, elNode }: {
1872
- src: any;
1873
- srcset: any;
1874
- elNode: any;
1875
- }): Promise<any>;
1876
- renderImage(): Promise<void>;
1877
- init(): void;
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;
1878
2452
  }
1879
2453
 
1880
2454
  declare class Img extends ImgBase {
2455
+ attributesMeta: {
2456
+ src: string;
2457
+ } | {
2458
+ uuid: string;
2459
+ };
2460
+ connectedCallback(): void;
1881
2461
  }
1882
-
1883
- declare class ProgressBar extends Block {
1884
- private _value;
1885
- private _visible;
1886
- constructor();
1887
- initCallback(): void;
2462
+ declare global {
2463
+ interface HTMLElementTagNameMap {
2464
+ 'uc-img': Img;
2465
+ }
1888
2466
  }
1889
2467
 
1890
- declare class ProgressBarCommon extends UploaderBlock {
1891
- private _unobserveCollectionCb?;
1892
- constructor();
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;
1893
2478
  initCallback(): void;
1894
- destroyCallback(): void;
2479
+ }
2480
+ declare global {
2481
+ interface HTMLElementTagNameMap {
2482
+ 'uc-form-input': FormInput;
2483
+ }
1895
2484
  }
1896
2485
 
1897
- declare class Select extends Block {
1898
- ref: {
1899
- select: HTMLSelectElement;
1900
- } & Record<string, HTMLElement>;
1901
- value: string;
1902
- constructor();
2486
+ declare class Copyright extends LitBlock {
1903
2487
  initCallback(): void;
2488
+ render(): lit_html.TemplateResult<1>;
2489
+ }
2490
+ declare global {
2491
+ interface HTMLElementTagNameMap {
2492
+ 'uc-copyright': Copyright;
2493
+ }
1904
2494
  }
1905
2495
 
1906
- declare class SimpleBtn extends UploaderBlock {
1907
- static styleAttrs: string[];
1908
- couldBeCtxOwner: boolean;
2496
+ declare class ProgressBarCommon extends LitUploaderBlock {
2497
+ private _unobserveCollectionCb?;
2498
+ private _visible;
2499
+ private _value;
1909
2500
  constructor();
1910
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
+ }
1911
2510
  }
1912
2511
 
1913
- type SourceTypeConfig = {
1914
- type: string;
1915
- activity?: ActivityType | null;
1916
- textKey?: string;
1917
- icon?: string;
1918
- activate?: () => boolean;
1919
- activityParams?: Record<string, unknown>;
1920
- };
1921
- declare class SourceBtn extends UploaderBlock {
2512
+ declare class SourceBtn extends LitUploaderBlock {
1922
2513
  couldBeCtxOwner: boolean;
1923
- private type;
1924
2514
  private _registeredTypes;
1925
- constructor();
1926
- initTypes(): void;
2515
+ type?: string;
2516
+ private _iconName;
2517
+ private _srcTypeKey;
2518
+ private _initTypes;
1927
2519
  initCallback(): void;
1928
- registerType(typeConfig: SourceTypeConfig): void;
1929
- getType(type: string): SourceTypeConfig | undefined;
2520
+ private _registerType;
1930
2521
  activate(): void;
1931
- applyType(type: string): void;
2522
+ private _applyType;
2523
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2524
+ render(): lit_html.TemplateResult<1>;
2525
+ }
2526
+ declare global {
2527
+ interface HTMLElementTagNameMap {
2528
+ 'uc-source-btn': SourceBtn;
2529
+ }
1932
2530
  }
1933
2531
 
1934
- declare class SourceList extends Block {
2532
+ declare class SourceList extends LitBlock {
2533
+ private _rawSourceList;
2534
+ private _cameraModes;
2535
+ /**
2536
+ * CSS-only attribute
2537
+ */
2538
+ wrap: boolean;
1935
2539
  initCallback(): void;
2540
+ protected updated(changedProperties: PropertyValues<this>): void;
2541
+ private _updateSources;
2542
+ private _sources;
2543
+ render(): lit_html.TemplateResult<1>;
1936
2544
  }
1937
-
1938
- declare class Spinner extends BaseComponent<void> {
2545
+ declare global {
2546
+ interface HTMLElementTagNameMap {
2547
+ 'uc-source-list': SourceList;
2548
+ }
1939
2549
  }
1940
2550
 
1941
- declare class StartFrom extends ActivityBlock {
1942
- historyTracked: boolean;
2551
+ declare class StartFrom extends LitActivityBlock {
2552
+ protected historyTracked: boolean;
1943
2553
  activityType: ActivityType;
1944
2554
  initCallback(): void;
2555
+ render(): lit_html.TemplateResult<1>;
1945
2556
  }
1946
-
1947
- declare class Thumb extends FileItemConfig {
1948
- private _renderedGridOnce;
1949
- private _thumbRect;
1950
- private _isIntersecting;
1951
- private _firstViewMode;
1952
- private _observer?;
1953
- constructor();
1954
- private _calculateThumbSize;
1955
- private _generateThumbnail;
1956
- private _debouncedGenerateThumb;
1957
- private _observerCallback;
1958
- protected _reset(): void;
1959
- private _handleEntryId;
1960
- initCallback(): void;
1961
- connectedCallback(): void;
1962
- disconnectedCallback(): void;
2557
+ declare global {
2558
+ interface HTMLElementTagNameMap {
2559
+ 'uc-start-from': StartFrom;
2560
+ }
1963
2561
  }
1964
2562
 
1965
2563
  type EventListenerMap = {
1966
2564
  [K in (typeof EventType)[keyof typeof EventType]]: (e: CustomEvent<EventPayload[K]>) => void;
1967
2565
  };
1968
- declare class UploadCtxProvider extends UploaderBlock {
2566
+ declare class UploadCtxProvider extends LitUploaderBlock {
2567
+ attributesMeta: {
2568
+ 'ctx-name': string;
2569
+ };
1969
2570
  static styleAttrs: string[];
1970
2571
  static EventType: Readonly<{
1971
2572
  readonly FILE_ADDED: "file-added";
@@ -1987,54 +2588,109 @@ declare class UploadCtxProvider extends UploaderBlock {
1987
2588
  readonly CHANGE: "change";
1988
2589
  readonly GROUP_CREATED: "group-created";
1989
2590
  }>;
1990
- requireCtxName: boolean;
2591
+ private _unbindEventEmitter;
1991
2592
  initCallback(): void;
1992
- destroyCallback(): void;
2593
+ disconnectedCallback(): void;
1993
2594
  }
1994
- interface UploadCtxProvider extends UploaderBlock {
2595
+ interface UploadCtxProvider extends LitUploaderBlock {
1995
2596
  addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
1996
2597
  removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
1997
2598
  }
2599
+ declare global {
2600
+ interface HTMLElementTagNameMap {
2601
+ 'uc-upload-ctx-provider': UploadCtxProvider;
2602
+ }
2603
+ }
1998
2604
 
1999
- declare class UrlSource extends UploaderBlock {
2605
+ declare class UrlSource extends LitUploaderBlock {
2000
2606
  couldBeCtxOwner: boolean;
2001
2607
  activityType: ActivityType;
2002
- constructor();
2608
+ private _formState;
2003
2609
  initCallback(): void;
2610
+ private _inputRef;
2611
+ private _handleInput;
2612
+ private _handleUpload;
2613
+ render(): lit_html.TemplateResult<1>;
2614
+ }
2615
+ declare global {
2616
+ interface HTMLElementTagNameMap {
2617
+ 'uc-url-source': UrlSource;
2618
+ }
2004
2619
  }
2005
2620
 
2006
- declare class CloudImageEditor extends CloudImageEditorBlock {
2621
+ declare class SimpleBtn extends LitUploaderBlock {
2007
2622
  static styleAttrs: string[];
2008
- constructor();
2623
+ couldBeCtxOwner: boolean;
2624
+ dropzone: boolean;
2625
+ private _buttonTextKey;
2626
+ private readonly _handleClick;
2009
2627
  initCallback(): void;
2628
+ render(): lit_html.TemplateResult<1>;
2629
+ }
2630
+ declare global {
2631
+ interface HTMLElementTagNameMap {
2632
+ 'uc-simple-btn': SimpleBtn;
2633
+ }
2010
2634
  }
2011
2635
 
2012
- declare class FileUploaderInline extends SolutionBlock {
2636
+ declare class FileUploaderRegular extends LitSolutionBlock {
2637
+ attributesMeta: {
2638
+ headless?: boolean;
2639
+ 'ctx-name': string;
2640
+ };
2013
2641
  static styleAttrs: string[];
2642
+ headless: boolean;
2014
2643
  constructor();
2015
- get couldHistoryBack(): boolean;
2016
- get couldShowList(): boolean;
2017
2644
  initCallback(): void;
2645
+ render(): lit_html.TemplateResult<1>;
2646
+ }
2647
+ declare global {
2648
+ interface HTMLElementTagNameMap {
2649
+ 'uc-file-uploader-regular': FileUploaderRegular;
2650
+ }
2018
2651
  }
2019
2652
 
2020
- declare class FileUploaderMinimal extends SolutionBlock {
2653
+ declare class FileUploaderInline extends LitSolutionBlock {
2654
+ attributesMeta: {
2655
+ 'ctx-name': string;
2656
+ };
2021
2657
  static styleAttrs: string[];
2022
- private handleModalOpen?;
2023
- private handleModalClose?;
2658
+ private _couldCancel;
2024
2659
  constructor();
2025
- private _handleModalOpen;
2026
- private _handleModalClose;
2660
+ private _handleCancel;
2661
+ private get _couldHistoryBack();
2662
+ private get _couldShowList();
2663
+ private _getInitActivity;
2027
2664
  initCallback(): void;
2028
- destroyCallback(): void;
2665
+ render(): lit_html.TemplateResult<1>;
2666
+ }
2667
+ declare global {
2668
+ interface HTMLElementTagNameMap {
2669
+ 'uc-file-uploader-inline': FileUploaderInline;
2670
+ }
2029
2671
  }
2030
2672
 
2031
- declare class FileUploaderRegular extends SolutionBlock {
2673
+ declare class FileUploaderMinimal extends LitSolutionBlock {
2674
+ attributesMeta: {
2675
+ 'ctx-name': string;
2676
+ };
2032
2677
  static styleAttrs: string[];
2678
+ private _singleUpload;
2679
+ private _isHiddenStartFrom;
2680
+ private _classUploadList;
2681
+ private _classStartFrom;
2682
+ private _getInitActivity;
2033
2683
  constructor();
2684
+ private _handleModalOpen;
2685
+ private _handleModalClose;
2034
2686
  initCallback(): void;
2687
+ disconnectedCallback(): void;
2688
+ render(): lit_html.TemplateResult<1>;
2689
+ }
2690
+ declare global {
2691
+ interface HTMLElementTagNameMap {
2692
+ 'uc-file-uploader-minimal': FileUploaderMinimal;
2693
+ }
2035
2694
  }
2036
2695
 
2037
- type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
2038
- declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2039
-
2040
- export { ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, 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, SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UploadCtxProvider, UploadList, UploadSource, UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
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 };