import * as lit_html from 'lit-html';
import { PropertyValues, nothing, LitElement, TemplateResult } from 'lit';
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions, Queue } from '@uploadcare/upload-client';
import { Ref } from 'lit/directives/ref.js';
import { TelemetryRequest } from '@uploadcare/quality-insights';
type Unsubscriber = () => void;
declare class PubSub> {
private static _contexts;
private _store;
private _ctxId;
private constructor();
get id(): string;
pub(key: K, value: T[K]): void;
sub(key: K, callback: (value: T[K]) => void, init?: boolean): Unsubscriber;
read(key: K): T[K];
add(key: K, value: T[K], rewrite?: boolean): void;
has(key: keyof T): boolean;
get store(): T;
static registerCtx>(initialValue: T, ctxId: string): PubSub;
static deleteCtx(ctxId: string): void;
static getCtx = Record>(ctxId: string): PubSub | null;
static hasCtx(ctxId: string): boolean;
}
type Constructor = new (...args: any[]) => T;
type SymbioteStateBag> = T;
/**
* Interface for components using SymbioteMixin
*/
declare class SymbioteComponent = Record> {
$: SymbioteStateBag;
sub(key: TKey, callback: (value: TState[TKey]) => void, init?: boolean): () => void;
pub(key: TKey, value: TState[TKey]): void;
set$(obj: T): void;
has(key: TKey): boolean;
add(key: TKey, val: TState[TKey], rewrite?: boolean): void;
add$(obj: T, rewrite?: boolean): void;
initCallback(): void;
sharedCtx: PubSub;
ctxName: string;
ctxOwner: boolean;
}
type Uid = string & {
__uid: true;
};
declare function defineComponents(blockExports: Record): void;
declare const UC_WINDOW_KEY = "UC";
type IndexModule = Record;
declare global {
interface Window {
[UC_WINDOW_KEY]?: IndexModule;
}
}
declare const _default: {
'locale-id': string;
'social-source-lang': string;
'upload-file': string;
'upload-files': string;
'choose-file': string;
'choose-files': string;
'drop-files-here': string;
'select-file-source': string;
selected: string;
upload: string;
'add-more': string;
cancel: string;
'start-from-cancel': string;
clear: string;
'camera-shot': string;
'upload-url': string;
'upload-url-placeholder': string;
'edit-image': string;
'edit-detail': string;
back: string;
done: string;
ok: string;
'remove-from-list': string;
no: string;
yes: string;
'confirm-your-action': string;
'are-you-sure': string;
'selected-count': string;
'select-all': string;
'deselect-all': string;
'upload-error': string;
'validation-error': string;
'no-files': string;
browse: string;
'not-uploaded-yet': string;
file__one: string;
file__other: string;
error__one: string;
error__other: string;
'header-uploading': string;
'header-failed': string;
'header-succeed': string;
'header-total': string;
'src-type-local': string;
'src-type-from-url': string;
'src-type-camera': string;
'src-type-mobile-video-camera': string;
'src-type-mobile-photo-camera': string;
'src-type-draw': string;
'src-type-facebook': string;
'src-type-dropbox': string;
'src-type-gdrive': string;
'src-type-ngdrive': string;
'src-type-gphotos': string;
'src-type-flickr': string;
'src-type-vk': string;
'src-type-evernote': string;
'src-type-box': string;
'src-type-onedrive': string;
'src-type-huddle': string;
'src-type-other': string;
'caption-from-url': string;
'caption-camera': string;
'caption-draw': string;
'caption-edit-file': string;
'file-no-name': string;
'toggle-fullscreen': string;
'toggle-guides': string;
rotate: string;
'flip-vertical': string;
'flip-horizontal': string;
apply: string;
brightness: string;
contrast: string;
saturation: string;
exposure: string;
gamma: string;
vibrance: string;
warmth: string;
enhance: string;
original: string;
resize: string;
crop: string;
'select-color': string;
text: string;
draw: string;
'cancel-edit': string;
'tab-view': string;
'tab-details': string;
'file-name': string;
'file-size': string;
'cdn-url': string;
'file-size-unknown': string;
'camera-permissions-denied': string;
'camera-permissions-prompt': string;
'camera-permissions-request': string;
'files-count-limit-error-title': string;
'files-count-limit-error-too-few': string;
'files-count-limit-error-too-many': string;
'files-max-size-limit-error': string;
'has-validation-errors': string;
'images-only-accepted': string;
'file-type-not-allowed': string;
'some-files-were-not-uploaded': string;
'file-item-edit-button': string;
'file-item-remove-button': string;
'a11y-editor-tab-filters': string;
'a11y-editor-tab-tuning': string;
'a11y-editor-tab-crop': string;
'a11y-activity-header-button-close': string;
flip: string;
mirror: string;
'a11y-cloud-editor-apply-filter': string;
'a11y-cloud-editor-apply-crop': string;
'a11y-cloud-editor-apply-tuning': string;
'a11y-cloud-editor-apply-aspect-ratio': string;
finished: string;
failed: string;
uploading: string;
idle: string;
'a11y-file-item-status': string;
'waiting-for': string;
'queued-uploading': string;
'queued-validation': string;
validation: string;
'crop-to-shape': string;
custom: string;
'freeform-crop': string;
};
type LocaleDefinition = typeof _default;
declare class Modal extends LitBlock {
static styleAttrs: string[];
private _mouseDownTarget;
/** WARNING: Do not rename/change this, it's used in dashboard */
protected dialogEl: lit_html_directives_ref_js.Ref;
/**
* CSS-only attribute
*/
strokes: boolean;
/**
* CSS-only attribute
*/
blockBodyScrolling: boolean;
/** WARNING: Do not rename/change this, it's used in dashboard */
protected closeDialog: () => void;
private _handleDialogClose;
private _handleDialogMouseDown;
private _handleDialogMouseUp;
show(): void;
hide(): void;
private _handleModalOpen;
private _handleModalClose;
private _handleModalCloseAll;
initCallback(): void;
disconnectedCallback(): void;
private _handleDialogRef;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-modal': Modal;
}
}
declare const InternalEventType: Readonly<{
readonly INIT_SOLUTION: "init-solution";
readonly CHANGE_CONFIG: "change-config";
readonly ACTION_EVENT: "action-event";
readonly ERROR_EVENT: "error-event";
}>;
declare const EventType: Readonly<{
readonly FILE_ADDED: "file-added";
readonly FILE_REMOVED: "file-removed";
readonly FILE_UPLOAD_START: "file-upload-start";
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
readonly FILE_URL_CHANGED: "file-url-changed";
readonly MODAL_OPEN: "modal-open";
readonly MODAL_CLOSE: "modal-close";
readonly DONE_CLICK: "done-click";
readonly UPLOAD_CLICK: "upload-click";
readonly ACTIVITY_CHANGE: "activity-change";
readonly COMMON_UPLOAD_START: "common-upload-start";
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
readonly CHANGE: "change";
readonly GROUP_CREATED: "group-created";
}>;
type EventKey = (typeof EventType)[keyof typeof EventType];
type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
type EventPayload = {
[EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
[EventType.MODAL_OPEN]: {
modalId: ModalId;
};
[EventType.MODAL_CLOSE]: {
modalId: ModalId;
hasActiveModals: boolean;
};
[EventType.ACTIVITY_CHANGE]: {
activity: ActivityType;
};
[EventType.UPLOAD_CLICK]: undefined;
[EventType.DONE_CLICK]: OutputCollectionState;
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
[EventType.CHANGE]: OutputCollectionState;
[EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
};
declare class EventEmitter extends SharedInstance {
private _timeoutStore;
private _targets;
bindTarget(target: LitBlock): () => void;
private _dispatch;
emit(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
debounce?: TDebounce;
}): void;
destroy(): void;
}
type PasteScope = 'local' | 'global' | false;
declare class ClipboardLayer extends SharedInstance {
private scopes;
private listener;
constructor(sharedInstancesBag: SharedInstancesBag);
private openUploadList;
private _listener;
private handlePaste;
registerBlock(scope: Node): () => void;
destroy(): void;
}
declare class ActivityHeader extends LitActivityBlock {
}
declare global {
interface HTMLElementTagNameMap {
'uc-activity-header': ActivityHeader;
}
}
declare class Icon extends LitBlock {
name: string;
private _resolvedHref;
private _iconHrefResolver;
initCallback(): void;
protected willUpdate(changedProperties: PropertyValues): void;
private _updateResolvedHref;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-icon': Icon;
}
}
type SelectOption = {
text: string;
value: string;
};
declare class Select extends LitBlock {
value: string;
disabled: boolean;
options: SelectOption[];
render(): lit_html.TemplateResult<1>;
private _handleChange;
}
declare global {
interface HTMLElementTagNameMap {
'uc-select': Select;
}
}
type CameraMode = 'photo' | 'video';
declare class CameraSource extends LitUploaderBlock {
couldBeCtxOwner: boolean;
activityType: "camera";
private _unsubPermissions;
private _capturing;
private _chunks;
private _mediaRecorder;
private _stream;
private _selectedAudioId;
private _selectedCameraId;
private _activeTab;
private _options;
private _canvas;
private _ctx;
private _cameraDevices;
private _audioDevices;
private _permissionResponses;
private _permissionCleanupFns;
private _currentVideoSource;
private readonly _handlePreviewPlay;
private readonly _handlePreviewPause;
private _timerRef;
private _lineRef;
private _videoRef;
private _switcherRef;
private _startTime;
private _elapsedTime;
private _videoTransformCss;
private _videoHidden;
private _messageHidden;
private _requestBtnHidden;
private _cameraSelectOptions;
private _cameraSelectHidden;
private _l10nMessage;
private _timerHidden;
private _cameraHidden;
private _cameraActionsHidden;
private _audioSelectOptions;
private _audioSelectHidden;
private _audioSelectDisabled;
private _audioToggleMicrophoneHidden;
private _tabCameraHidden;
private _tabVideoHidden;
private _currentIcon;
private _currentTimelineIcon;
private _toggleMicrophoneIcon;
private _mutableClassButton;
private _chooseActionWithCamera;
private _handleCameraSelectChange;
private _handleAudioSelectChange;
private _handleRequestPermissions;
private _handleStartCamera;
private _handleToggleRecording;
private _handleToggleAudio;
private _handleRetake;
private _handleAccept;
private _handleClickTab;
private _updateTimer;
private _startTimer;
private _stopTimer;
private _startTimeline;
private _stopTimeline;
private _animationFrameId;
private _startRecording;
private _stopRecording;
/** This method is used to toggle recording pause/resume */
private _toggleRecording;
private _toggleEnableAudio;
/**
* Previewing the video that was recorded on the camera
*/
private _previewVideo;
private _attachPreviewListeners;
private _detachPreviewListeners;
private _setVideoSource;
/**
* Do not bind srcObject directly in the template, because it stops video pausing on shot.
* I really don'y know why but that's how it is. Assigning srcObject manually fixes the issue.
*/
private _applyVideoSource;
private _retake;
private _accept;
private _handlePhoto;
private _handleVideo;
private _setCameraState;
private _shot;
private _handleActiveTab;
private _createFile;
private _guessExtensionByMime;
/**
* The send file to the server
*/
private _toSend;
private get _cameraModes();
private _setPermissionsState;
private _makeStreamInactive;
private _stopCapture;
private _capture;
private _handlePermissionsChange;
private _permissionAccess;
private _teardownPermissionListeners;
private _requestDeviceAccess;
private _getDevices;
private _onActivate;
private _onDeactivate;
private _handleCameraModes;
initCallback(): void;
firstUpdated(changedProperties: PropertyValues): void;
updated(changedProperties: PropertyValues): void;
private _destroy;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-camera-source': CameraSource;
}
}
/**
* Config keys that can't be passed as attribute (because they are object or function)
*/
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
/** Mapping of attribute names to state */
declare const attrStateMapping: Record;
declare class Config extends LitBlock {
attributesMeta: Partial & {
'ctx-name': string;
};
init$: LitBlock["init$"] & ConfigType;
private _computationControllers;
private _flushValueToAttribute;
private _flushValueToState;
private _setValue;
private _getValue;
private _assertSameValueDifferentReference;
initCallback(): void;
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
static get observedAttributes(): string[];
}
interface Config extends ConfigType {
}
declare global {
interface HTMLElementTagNameMap {
'uc-config': Config;
}
}
declare class TypedData> {
private _ctxId;
private _data;
constructor(initialValue: T);
get uid(): Uid;
setValue(prop: K, value: T[K]): void;
setMultipleValues(updObj: Partial): void;
getValue(prop: K): T[K];
subscribe(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
destroy(): void;
}
interface UploadEntryData extends Record {
file: File | null;
externalUrl: string | null;
fileName: string | null;
fileSize: number | null;
lastModified: number;
uploadProgress: number;
uuid: string | null;
isImage: boolean;
mimeType: string | null;
ctxName: string | null;
cdnUrl: string | null;
cdnUrlModifiers: string | null;
fileInfo: UploadcareFile | null;
isUploading: boolean;
abortController: AbortController | null;
thumbUrl: string | null;
silent: boolean;
source: string | null;
fullPath: string | null;
metadata: Metadata | null;
errors: OutputErrorFile[];
uploadError: Error | null;
isRemoved: boolean;
isQueuedForUploading: boolean;
isValidationPending: boolean;
isQueuedForValidation: boolean;
}
type UploadEntryTypedData = TypedData;
type UploadEntryKeys = keyof UploadEntryData;
declare class FileItemConfig extends LitUploaderBlock {
private _entrySubs;
protected entry: UploadEntryTypedData | null;
protected withEntry(fn: (entry: UploadEntryTypedData, ...args: A) => R): (...args: A) => R | undefined;
protected subEntry(prop: K, handler: (value: UploadEntryData[K]) => void): void;
protected reset(): void;
disconnectedCallback(): void;
}
declare class Thumb extends FileItemConfig {
badgeIcon: string;
uid: Uid;
private _thumbUrl;
private _renderedGridOnce;
private _thumbRect;
private _isIntersecting;
private _firstViewMode;
private _observer?;
private _pendingThumbUpdate?;
private _calculateThumbSize;
private _generateThumbnail;
private _debouncedGenerateThumb;
private _decodeImage;
private _cancelPendingThumbUpdate;
private _scheduleThumbUpdate;
private _requestThumbGeneration;
protected firstUpdated(changedProperties: PropertyValues): void;
protected updated(changedProperties: PropertyValues): void;
private _observerCallback;
protected reset(): void;
private _bindToEntry;
initCallback(): void;
connectedCallback(): void;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-thumb': Thumb;
}
}
declare class ProgressBar extends LitBlock {
hasFileName: boolean;
value: number;
visible: boolean;
private _progressValue;
private readonly _fakeProgressLineRef;
private readonly _handleFakeProgressAnimation;
protected firstUpdated(changedProperties: PropertyValues): void;
protected updated(changedProperties: PropertyValues): void;
disconnectedCallback(): void;
private _normalizeProgressValue;
private _updateProgressValueStyle;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-progress-bar': ProgressBar;
}
}
declare class FileItem extends FileItemConfig {
protected couldBeCtxOwner: boolean;
private _pauseRender;
uid: Uid;
private _itemName;
private _errorText;
private _hint;
private _progressValue;
private _progressVisible;
private _badgeIcon;
private _isFinished;
private _isFailed;
private _isUploading;
private _isFocused;
private _isEditable;
private _showFileNames;
private _ariaLabelStatusFile;
private _renderedOnce;
private _observer?;
private _handleEdit;
private _handleRemove;
private _handleUploadClick;
private _calculateState;
private _debouncedCalculateState;
private _updateHintAndProgress;
private _handleState;
protected reset(): void;
private _observerCallback;
private _handleEntryId;
private _updateShowFileNames;
protected willUpdate(changedProperties: PropertyValues): void;
initCallback(): void;
connectedCallback(): void;
disconnectedCallback(): void;
private _upload;
static activeInstances: Set;
protected shouldUpdate(changedProperties: PropertyValues): boolean;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-file-item': FileItem;
}
}
declare class DropArea extends LitUploaderBlock {
static styleAttrs: string[];
/**
* CSS-only attribute
*/
single: boolean;
/**
* CSS-only attribute
*/
ghost: boolean;
disabled: boolean;
clickable: boolean;
withIcon: boolean;
fullscreen: boolean;
initflow: boolean;
text?: string;
private _isEnabled;
private _isVisible;
private get _localizedText();
private _destroyDropzone;
private _destroyContentWrapperDropzone;
private _contentWrapperRef;
private readonly _handleAreaInteraction;
private _sourceListAllowsLocal;
private _clickableListenersAttached;
isActive(): boolean;
initCallback(): void;
protected willUpdate(changedProperties: PropertyValues): void;
protected updated(changedProperties: PropertyValues): void;
/** Ignore drop events if there are other visible drop areas on the page. */
private _shouldIgnore;
private _couldHandleFiles;
private _updateIsEnabled;
private _updateVisibility;
private _updateDragStateAttribute;
private _setupContentWrapperDropzone;
private _updateClickableListeners;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-drop-area': DropArea;
}
}
type FilesViewMode = 'grid' | 'list';
declare class UploadList extends LitUploaderBlock {
couldBeCtxOwner: boolean;
protected historyTracked: boolean;
activityType: "upload-list";
private _doneBtnVisible;
private _doneBtnEnabled;
private _uploadBtnVisible;
private _addMoreBtnVisible;
private _addMoreBtnEnabled;
private _commonErrorMessage;
private _hasFiles;
private _latestSummary;
private get _headerText();
private _handleAdd;
private _handleUpload;
private _handleDone;
private _handleCancel;
private _throttledHandleCollectionUpdate;
private _updateUploadsState;
private _getHeaderText;
get couldOpenActivity(): boolean;
initCallback(): void;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-upload-list': UploadList;
}
}
declare const ExternalUploadSource: Readonly<{
readonly FACEBOOK: "facebook";
readonly DROPBOX: "dropbox";
readonly GDRIVE: "gdrive";
readonly GPHOTOS: "gphotos";
readonly FLICKR: "flickr";
readonly VK: "vk";
readonly EVERNOTE: "evernote";
readonly BOX: "box";
readonly ONEDRIVE: "onedrive";
readonly HUDDLE: "huddle";
}>;
declare const UploadSource: Readonly<{
readonly FACEBOOK: "facebook";
readonly DROPBOX: "dropbox";
readonly GDRIVE: "gdrive";
readonly GPHOTOS: "gphotos";
readonly FLICKR: "flickr";
readonly VK: "vk";
readonly EVERNOTE: "evernote";
readonly BOX: "box";
readonly ONEDRIVE: "onedrive";
readonly HUDDLE: "huddle";
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
readonly LOCAL: "local";
readonly DROP_AREA: "drop-area";
readonly CAMERA: "camera";
readonly EXTERNAL: "external";
readonly API: "js-api";
readonly URL: "url";
readonly DRAW: "draw";
}>;
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
type ChangeMap> = Record>;
type TypedCollectionPropertyObserver> = (changeMap: ChangeMap) => void;
type TypedCollectionObserverHandler> = (list: Uid[], added: Set>, removed: Set>) => void;
type TypedCollectionOptions> = {
initialValue: T;
watchList?: (keyof T)[];
handler?: TypedCollectionObserverHandler;
};
declare class TypedCollection> {
private static readonly _destroyDelayMs;
private _ctxId;
private _data;
private _watchList;
private _subsMap;
private _propertyObservers;
private _collectionObservers;
private _items;
private _removed;
private _added;
private _markedToDestroy;
private _observeTimeout?;
private _notifyTimeout?;
private _destroyTimeout?;
private _notifyObservers;
private _initialValue;
constructor(options: TypedCollectionOptions);
private _notify;
private _scheduleDestroyMarkedItems;
observeCollection(handler: TypedCollectionObserverHandler): () => void;
unobserveCollection(handler: TypedCollectionObserverHandler): void;
add(init: Partial): Uid;
hasItem(id: Uid): boolean;
read(id: Uid): TypedData | null;
readProp(id: Uid, propName: K): T[K];
publishProp(id: Uid, propName: K, value: T[K]): void;
remove(id: Uid): void;
clearAll(): void;
observeProperties(handler: TypedCollectionPropertyObserver): () => void;
unobserveProperties(handler: TypedCollectionPropertyObserver): void;
findItems(checkFn: (item: TypedData) => boolean): Uid[];
items(): Uid[];
get size(): number;
destroy(): void;
}
declare const CameraSourceTypes: Readonly<{
PHOTO: "photo";
VIDEO: "video";
}>;
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
declare function buildOutputCollectionState(bag: SharedInstancesBag): OutputCollectionState;
type ApiAddFileCommonOptions = {
silent?: boolean;
fileName?: string;
source?: string;
};
declare class UploaderPublicApi extends SharedInstance {
private _l10n;
get _uploadCollection(): TypedCollection;
get cfg(): Readonly;
get l10n(): (str: string, variables?: Record) => string;
/**
* TODO: Probably we should not allow user to override `source` property
*/
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
fullPath?: string;
}) => OutputFileEntry<"idle">;
removeFileByInternalId: (internalId: string) => void;
removeAllFiles(): void;
uploadAll: () => void;
openSystemDialog: (options?: {
captureCamera?: boolean;
modeCamera?: ModeCameraType;
}) => void;
getOutputItem(entryId: string): OutputFileEntry;
getOutputCollectionState(): ReturnType>;
initFlow: (force?: boolean) => void;
doneFlow: () => void;
setCurrentActivity: (activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
getCurrentActivity: () => ActivityType;
setModalState: (opened: boolean) => void;
private get _sourceList();
}
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise | Metadata;
type LocaleDefinitionOverride = Record>;
type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
uuid: string;
cdnUrlModifiers: string;
fileName: string;
}) => Promise | string;
type SecureUploadsSignatureAndExpire = {
secureSignature: string;
secureExpire: string;
};
type SecureUploadsSignatureResolver = () => Promise;
type IconHrefResolver = (iconName: string) => string;
type FileValidators = FileValidator[];
type CollectionValidators = FuncCollectionValidator[];
type ConfigType = {
/**
* Your project’s Public Key.
*/
pubkey: string;
/**
* Allow multiple file uploads.
*/
multiple: boolean;
/**
* Minimum number of files to upload.
*/
multipleMin: number;
/**
* Maximum number of files to upload.
*/
multipleMax: number;
/**
* Require user confirmation before uploading.
*/
confirmUpload: boolean;
/**
* Allow only image files.
*/
imgOnly: boolean;
/**
* Native file input accept attribute value. Also affects client validation settings.
*/
accept: string;
/**
* Preferred types for external sources.
* See [here](https://uploadcare.com/docs/file-uploader/options/#external-sources-preferred-types)
*/
externalSourcesPreferredTypes: string;
/**
* Provide custom CSS to the social sources iframe
*/
externalSourcesEmbedCss: string;
/**
* Store uploaded files.
*/
store: boolean | 'auto';
/**
* Mirror the camera view.
*/
cameraMirror: boolean;
/**
* Default camera capture mode.
*/
cameraCapture: 'user' | 'environment' | '';
/**
* List of sources for file uploads.
*/
sourceList: string;
/**
* Top-level origin for the uploader.
* This is used for Google Drive Picker if there is no access to the origin due to the cross-origin policy.
*/
topLevelOrigin: string;
/**
* Maximum size of local files in bytes.
*/
maxLocalFileSizeBytes: number;
/**
* Thumbnail size.
*/
thumbSize: number;
/**
* Show the upload list even if it is empty.
*/
showEmptyList: boolean;
/**
* Use local image editor.
*/
useLocalImageEditor: boolean;
/**
* Enable cloud image editing.
*/
useCloudImageEditor: boolean;
/**
* Tabs to show in the cloud image editor.
*
* @default 'crop, tuning, filters'
*/
cloudImageEditorTabs: string;
/**
* Remove copyright information.
*/
removeCopyright: boolean;
/**
* Defines the crop behavior. When uploading images, your users can select a crop area with a defined aspect ratio.
*/
cropPreset: string;
/**
* Image shrink options.
*/
imageShrink: string;
/**
* Lock scroll when modal is open.
*/
modalScrollLock: boolean;
/**
* Show strokes on modal backdrop.
*/
modalBackdropStrokes: boolean;
/**
* Wrap the source list.
*/
sourceListWrap: boolean;
/**
* Key to revoke Custom OAuth access. See [OAuth docs](https://uploadcare.com/docs/upload-sources/#oauth) for details.
*/
remoteTabSessionKey: string;
/**
* Set custom CNAME.
*/
cdnCname: string;
/**
* Set CNAME base domain for prefixed CDN URLs.
*/
cdnCnamePrefixed: string;
/**
* Set a custom upload URL.
*/
baseUrl: string;
/**
* Set a custom social sources URL.
*/
socialBaseUrl: string;
/**
* Secure signature for uploads.
*/
secureSignature: string;
/**
* Expiry time for secure uploads.
*/
secureExpire: string;
/**
* Proxy URL for secure delivery.
*/
secureDeliveryProxy: string;
/**
* Maximum number of retry attempts for throttled requests.
*/
retryThrottledRequestMaxTimes: number;
/**
* Maximum number of retry attempts for network errors.
*/
retryNetworkErrorMaxTimes: number;
/**
* Minimum file size for multipart uploads.
*/
multipartMinFileSize: number;
/**
* Chunk size for multipart uploads.
*/
multipartChunkSize: number;
/**
* Maximum number of concurrent requests.
*/
maxConcurrentRequests: number;
/**
* Maximum number of concurrent multipart requests.
*/
multipartMaxConcurrentRequests: number;
/**
* Maximum number of attempts for multipart uploads.
*/
multipartMaxAttempts: number;
/**
* Check for URL duplicates.
*/
checkForUrlDuplicates: boolean;
/**
* Save URL for recurrent uploads.
*/
saveUrlForRecurrentUploads: boolean;
/**
* Group output files.
*/
groupOutput: boolean;
/**
* User agent integration string.
*/
userAgentIntegration: string;
/**
* Enable debug mode.
*/
debug: boolean;
/**
* Locale name for the uploader.
*/
localeName: string;
/**
* Expiry threshold for secure uploads.
*/
secureUploadsExpireThreshold: number;
/**
* Metadata for the file.
*/
metadata: Metadata | MetadataCallback | null;
/**
* Override locale definitions.
*/
localeDefinitionOverride: LocaleDefinitionOverride | null;
/**
* Resolver for secure uploads signature.
*/
secureUploadsSignatureResolver: SecureUploadsSignatureResolver | null;
/**
* Resolver for secure delivery proxy URL.
*/
secureDeliveryProxyUrlResolver: SecureDeliveryProxyUrlResolver | null;
/**
* Resolver for icon href.
*/
iconHrefResolver: IconHrefResolver | null;
/**
* Validators for individual files.
*/
fileValidators: FileValidators;
/**
* Validators for file collections.
*/
collectionValidators: CollectionValidators;
/**
* Timeout for async validation functions, in milliseconds.
*/
validationTimeout: number;
/**
* The number of files to validate concurrently.
*/
validationConcurrency: number;
/**
* The camera modes to enable in the camera modal,
* it is possible to select photo or video capture.
* The first mode is the default mode.
* @default 'photo,video'
*/
cameraModes: string;
/**
* The default tab to open in the camera modal,
* it is possible to select video or photo capture
* @default 'null'
* @deprecated - use `cameraModes` instead
*/
defaultCameraMode: CameraMode | null;
/**
* Enable audio recording.
* @default true
*/
enableAudioRecording: boolean;
/**
* Enable video recording.
* @deprecated - use `cameraModes` instead
* @default null
*/
enableVideoRecording: boolean | null;
/**
* The maximum duration of the video recording in seconds
* @default null
*/
maxVideoRecordingDuration: number | null;
/**
* A dictionary object that can contain
* the following properties from MediaRecorderOptions
*/
mediaRecorderOptions: MediaRecorderOptions | null;
filesViewMode: FilesViewMode;
gridShowFileNames: boolean;
cloudImageEditorAutoOpen: boolean;
qualityInsights: boolean;
cloudImageEditorMaskHref: string | null;
/**
* Adds data-testid attributes to the each block. Needed for testing purposes.
* @default false
*/
testMode: boolean;
/**
* Define the clipboard paste scope.
*/
pasteScope: PasteScope;
};
type ConfigComplexType = Pick;
type ConfigPlainType = Omit;
type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
type OutputCustomErrorType = 'CUSTOM_ERROR';
type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
type OutputFileErrorPayload = {
entry: OutputFileEntry;
};
type OutputErrorTypePayload = {
NOT_AN_IMAGE: OutputFileErrorPayload;
FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
SOME_FILES_HAS_ERRORS: {
[k: string]: never;
};
TOO_MANY_FILES: {
min: number;
max: number;
total: number;
};
TOO_FEW_FILES: {
min: number;
max: number;
total: number;
};
UPLOAD_ERROR: OutputFileErrorPayload & {
error: UploadError;
};
NETWORK_ERROR: OutputFileErrorPayload & {
error: NetworkError;
};
UNKNOWN_ERROR: OutputFileErrorPayload & {
error?: Error;
};
CUSTOM_ERROR: Record;
};
type OutputError = T extends OutputCustomErrorType ? {
type?: T;
message: string;
payload?: OutputErrorTypePayload[T];
} : T extends keyof OutputErrorTypePayload ? {
type: T;
message: string;
payload?: OutputErrorTypePayload[T];
} : never;
type OutputErrorFile = OutputError;
type OutputErrorCollection = OutputError;
type OutputFileEntry = {
status: TStatus;
internalId: string;
name: string;
size: number;
isImage: boolean;
mimeType: string;
metadata: Metadata | null;
file: File | Blob | null;
externalUrl: string | null;
uploadProgress: number;
fullPath: string | null;
source: SourceTypes | null;
isValidationPending: boolean;
} & ({
status: 'success';
fileInfo: UploadcareFile;
uuid: string;
cdnUrl: string;
cdnUrlModifiers: string;
isUploading: false;
isSuccess: true;
isFailed: false;
isRemoved: false;
errors: [];
} | {
status: 'failed';
fileInfo: UploadcareFile | null;
uuid: string | null;
cdnUrl: string | null;
cdnUrlModifiers: string | null;
isUploading: false;
isSuccess: false;
isFailed: true;
isRemoved: false;
errors: OutputError[];
} | {
status: 'uploading';
fileInfo: null;
uuid: null;
cdnUrl: null;
cdnUrlModifiers: null;
isUploading: true;
isSuccess: false;
isFailed: false;
isRemoved: false;
errors: [];
} | {
status: 'removed';
fileInfo: UploadcareFile | null;
uuid: string | null;
cdnUrl: string | null;
cdnUrlModifiers: string | null;
isUploading: false;
isSuccess: false;
isFailed: false;
isRemoved: true;
errors: OutputError[];
} | {
status: 'idle';
fileInfo: null;
uuid: null;
cdnUrl: null;
cdnUrlModifiers: null;
isUploading: false;
isSuccess: false;
isFailed: false;
isRemoved: false;
errors: [];
});
type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
type GroupFlag = 'has-group' | 'maybe-has-group';
type OutputCollectionState = {
status: TStatus;
totalCount: number;
successCount: number;
failedCount: number;
uploadingCount: number;
progress: number;
successEntries: OutputFileEntry<'success'>[];
failedEntries: OutputFileEntry<'failed'>[];
uploadingEntries: OutputFileEntry<'uploading'>[];
idleEntries: OutputFileEntry<'idle'>[];
} & (TGroupFlag extends 'has-group' ? {
group: UploadcareGroup;
} : TGroupFlag extends 'maybe-has-group' ? {
group: UploadcareGroup | null;
} : never) & ({
status: 'idle';
isFailed: false;
isUploading: false;
isSuccess: false;
errors: [];
allEntries: OutputFileEntry<'idle' | 'success'>[];
} | {
status: 'uploading';
isFailed: false;
isUploading: true;
isSuccess: false;
errors: [];
allEntries: OutputFileEntry[];
} | {
status: 'success';
isFailed: false;
isUploading: false;
isSuccess: true;
errors: [];
allEntries: OutputFileEntry<'success'>[];
} | {
status: 'failed';
isFailed: true;
isUploading: false;
isSuccess: false;
errors: OutputError[];
allEntries: OutputFileEntry[];
});
declare class SecureUploadsManager extends SharedInstance {
private _secureToken;
getSecureToken(): Promise;
destroy(): void;
}
declare class LitUploaderBlock extends LitActivityBlock {
static extSrcList: Readonly;
static sourceTypes: Readonly;
protected couldBeCtxOwner: boolean;
private _isCtxOwner;
private _unobserveCollection?;
private _unobserveCollectionProperties?;
init$: {
'*commonProgress': number;
'*uploadList': never[];
'*uploadQueue': _uploadcare_upload_client.Queue;
'*collectionErrors': OutputErrorCollection[];
'*collectionState': OutputCollectionState | null;
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
'*uploadTrigger': Set;
'*currentActivity': null;
'*currentActivityParams': {};
'*history': never[];
'*historyBack': null;
'*closeModal': () => void;
};
private get _hasCtxOwner();
initCallback(): void;
getAPI(): UploaderPublicApi;
get validationManager(): ValidationManager;
get api(): UploaderPublicApi;
get uploadCollection(): TypedCollection;
get secureUploadsManager(): SecureUploadsManager;
disconnectedCallback(): void;
connectedCallback(): void;
private _initCtxOwner;
private _observeUploadCollection;
private _unobserveUploadCollection;
private _createGroup;
private _flushOutputItems;
private _handleCollectionUpdate;
private _handleCollectionPropertiesUpdate;
private _flushCommonUploadProgress;
private _openCloudImageEditor;
private _setInitialCrop;
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
protected getUploadClientOptions(): Promise;
getOutputData(): OutputFileEntry[];
}
/**
* Mapping of loading resources per operation
*/
type LoadingOperations = Map>;
/**
* Image size
*/
interface ImageSize {
width: number;
height: number;
}
interface Transformations {
enhance?: number;
brightness?: number;
exposure?: number;
gamma?: number;
contrast?: number;
saturation?: number;
vibrance?: number;
warmth?: number;
rotate?: number;
mirror?: boolean;
flip?: boolean;
filter?: {
name: string;
amount: number;
};
crop?: {
dimensions: [number, number];
coords: [number, number];
};
}
interface ApplyResult {
originalUrl: string;
cdnUrlModifiers: string;
cdnUrl: string;
transformations: Transformations;
}
type ChangeResult = ApplyResult;
interface CropAspectRatio {
type: 'aspect-ratio';
width: number;
height: number;
id: string;
hasFreeform?: boolean;
}
type CropPresetList = CropAspectRatio[];
declare class CloudImageEditor extends CloudImageEditorBlock {
static styleAttrs: string[];
constructor();
initCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-cloud-image-editor': CloudImageEditor;
}
}
type ActivityParams$1 = {
internalId: string;
};
declare class CloudImageEditorActivity extends LitUploaderBlock {
couldBeCtxOwner: boolean;
activityType: "cloud-image-edit";
private _entry?;
private _editorConfig;
get activityParams(): ActivityParams$1;
initCallback(): void;
private _handleApply;
private _handleCancel;
handleChange(event: CustomEvent): void;
private _mountEditor;
private _unmountEditor;
render(): lit_html.TemplateResult<1> | typeof nothing;
private _createEditorConfig;
}
declare global {
interface HTMLElementTagNameMap {
'uc-cloud-image-editor-activity': CloudImageEditorActivity;
}
}
declare class Spinner extends LitBlock {
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-spinner': Spinner;
}
}
type ActivityParams = {
externalSourceType: string;
};
declare class ExternalSource extends LitUploaderBlock {
couldBeCtxOwner: boolean;
activityType: "external";
private _messageBridge?;
private _iframeRef;
private _latestSelectionSummary;
private _selectedList;
private _isSelectionReady;
private _isDoneBtnEnabled;
private _couldSelectAll;
private _couldDeselectAll;
private _showSelectionStatus;
private _showDoneBtn;
private _doneBtnTextClass;
private _toolbarVisible;
private get _counterText();
get activityParams(): ActivityParams;
initCallback(): void;
private _extractUrlFromSelectedFile;
private _handleToolbarStateChange;
private _handleSelectedFilesChange;
private _handleIframeLoad;
private _applyTheme;
private _applyEmbedCss;
private _setupL10n;
private _remoteUrl;
private _handleDone;
private _handleCancel;
private _handleSelectAll;
private _handleDeselectAll;
private _setSelectionSummary;
private _mountIframe;
private _unmountIframe;
private _resetSelectionStatus;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-external-source': ExternalSource;
}
}
declare const ACTIVITY_TYPES: Readonly<{
START_FROM: "start-from";
CAMERA: "camera";
DRAW: "draw";
UPLOAD_LIST: "upload-list";
URL: "url";
CLOUD_IMG_EDIT: "cloud-image-edit";
EXTERNAL: "external";
}>;
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
type ActivityType = RegisteredActivityType | (string & {}) | null;
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
type ActivityParamsMap = {
'cloud-image-edit': ActivityParams$1;
external: ActivityParams;
};
declare class LitActivityBlock extends LitBlock {
protected historyTracked: boolean;
private [ACTIVE_PROP]?;
init$: {
'*currentActivity': null;
'*currentActivityParams': {};
'*history': never[];
'*historyBack': null;
'*closeModal': () => void;
};
private _debouncedHistoryFlush;
private _deactivate;
private _activate;
initCallback(): void;
private _historyFlush;
private _isActivityRegistered;
private static _activityCallbacks;
static activities: Readonly<{
START_FROM: 'start-from';
CAMERA: 'camera';
DRAW: 'draw';
UPLOAD_LIST: 'upload-list';
URL: 'url';
CLOUD_IMG_EDIT: 'cloud-image-edit';
EXTERNAL: 'external';
}>;
protected get isActivityActive(): boolean;
get couldOpenActivity(): boolean;
/** TODO: remove name argument */
protected registerActivity(_name: string, options?: {
onActivate?: () => void;
onDeactivate?: () => void;
}): void;
private _unregisterActivity;
disconnectedCallback(): void;
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
get initActivity(): string | null;
get doneActivity(): string | null;
historyBack(): void;
}
declare const ModalEvents: Readonly<{
readonly ADD: "modal:add";
readonly DELETE: "modal:delete";
readonly OPEN: "modal:open";
readonly CLOSE: "modal:close";
readonly CLOSE_ALL: "modal:closeAll";
readonly DESTROY: "modal:destroy";
}>;
type ModalId = ActivityType;
type ModalCb = (data: {
id: ModalId;
modal: Modal;
}) => void;
type ModalEventType = (typeof ModalEvents)[keyof typeof ModalEvents];
declare class ModalManager extends SharedInstance {
private _modals;
private _activeModals;
private _subscribers;
/**
* Register a modal with the manager
* @param id Unique identifier for the modal
* @param modal Modal component instance
*/
registerModal(id: ModalId, modal: Modal): void;
/** Remove a modal by ID. */
deleteModal(id: ModalId): boolean;
/** Open a modal by its ID. */
open(id: ModalId): boolean;
/** Close a specific modal by ID. */
close(id: ModalId): boolean;
/** Toggle a modal - open if closed, close if open. */
toggle(id: ModalId): boolean;
/** True if there are any active modals. */
get hasActiveModals(): boolean;
/** Close the most recently opened modal and return to the previous one. */
back(): boolean;
/** Close all open modals. */
closeAll(): number;
/**
* Subscribe to modal events
* @returns Unsubscribe function
*/
subscribe(event: ModalEventType, callback: ModalCb): () => void;
/** Unsubscribe from modal events */
unsubscribe(event: ModalEventType, callback: ModalCb | undefined): void;
/** Notify all subscribers of a modal event. */
private _notify;
/** Destroy the modal manager, clean up resources */
destroy(): void;
}
declare class LitSolutionBlock extends LitBlock {
static styleAttrs: string[];
init$: {
'*solution': string | null;
'*commonProgress': number;
'*uploadList': never[];
'*uploadQueue': _uploadcare_upload_client.Queue;
'*collectionErrors': OutputErrorCollection[];
'*collectionState': OutputCollectionState | null;
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
'*uploadTrigger': Set;
'*currentActivity': null;
'*currentActivityParams': {};
'*history': never[];
'*historyBack': null;
'*closeModal': () => void;
};
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
type CssPropValue = string | number | undefined | null;
declare const ImgConfig_base: typeof LitElement & Constructor & {
reg(tagName: string): void;
} & Constructor<{
getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
}>;
declare class ImgConfig extends ImgConfig_base {
private _state;
private _subscribers;
private _isnObserver;
private _observed;
createRenderRoot(): HTMLElement | ShadowRoot;
constructor();
protected $$(key: string): unknown;
protected set$$(kvObj: Record): void;
protected sub$$(key: string, kbFn: (val: T) => void): void;
private _notify;
protected analyticsParams(): string;
protected initAttributes(el: HTMLElement): void;
protected initIntersection(el: HTMLElement, cbkFn: () => void): void;
connectedCallback(): void;
private _initCssProperties;
disconnectedCallback(): void;
static get observedAttributes(): string[];
attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
}
declare class ImgBase extends ImgConfig {
private _img;
private _imgPreview;
private _fmtAbs;
private _validateSize;
private _getCdnModifiers;
private _getTypedCssValue;
private _getUrlBase;
private _proxyUrl;
protected _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
private _setupEventProxy;
protected get img(): HTMLImageElement;
private get _currentImg();
private get _hasPreviewImage();
private get _bgSelector();
private get _breakpoints();
private get _hasFormatJPG();
private _renderBg;
private _getSrcset;
private _getSrc;
private get _srcUrlPreview();
private _renderBackground;
private _appendURL;
private _setupConfigForImage;
private _loaderImage;
private _renderImage;
protected init(): void;
}
declare class Img extends ImgBase {
attributesMeta: {
src: string;
} | {
uuid: string;
};
connectedCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-img': Img;
}
}
declare class FormInput extends LitUploaderBlock {
attributesMeta: {
'ctx-name': string;
name?: string;
};
private _validationInputElement;
private _dynamicInputsContainer;
nameAttrValue?: string;
private get _inputName();
private _createValidationInput;
initCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-form-input': FormInput;
}
}
declare class Copyright extends LitBlock {
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-copyright': Copyright;
}
}
declare class ProgressBarCommon extends LitUploaderBlock {
private _unobserveCollectionCb?;
private _visible;
private _value;
constructor();
initCallback(): void;
protected updated(changedProperties: PropertyValues): void;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-progress-bar-common': ProgressBarCommon;
}
}
declare class SourceBtn extends LitUploaderBlock {
couldBeCtxOwner: boolean;
private _registeredTypes;
type?: string;
private _iconName;
private _srcTypeKey;
private _initTypes;
initCallback(): void;
private _registerType;
activate(): void;
private _applyType;
protected willUpdate(changedProperties: PropertyValues): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-source-btn': SourceBtn;
}
}
declare class SourceList extends LitBlock {
private _rawSourceList;
private _cameraModes;
/**
* CSS-only attribute
*/
wrap: boolean;
initCallback(): void;
protected updated(changedProperties: PropertyValues): void;
private _updateSources;
private _sources;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-source-list': SourceList;
}
}
declare class StartFrom extends LitActivityBlock {
protected historyTracked: boolean;
activityType: ActivityType;
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-start-from': StartFrom;
}
}
type EventListenerMap = {
[K in (typeof EventType)[keyof typeof EventType]]: (e: CustomEvent) => void;
};
declare class UploadCtxProvider extends LitUploaderBlock {
attributesMeta: {
'ctx-name': string;
};
static styleAttrs: string[];
static EventType: Readonly<{
readonly FILE_ADDED: "file-added";
readonly FILE_REMOVED: "file-removed";
readonly FILE_UPLOAD_START: "file-upload-start";
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
readonly FILE_URL_CHANGED: "file-url-changed";
readonly MODAL_OPEN: "modal-open";
readonly MODAL_CLOSE: "modal-close";
readonly DONE_CLICK: "done-click";
readonly UPLOAD_CLICK: "upload-click";
readonly ACTIVITY_CHANGE: "activity-change";
readonly COMMON_UPLOAD_START: "common-upload-start";
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
readonly CHANGE: "change";
readonly GROUP_CREATED: "group-created";
}>;
private _unbindEventEmitter;
initCallback(): void;
disconnectedCallback(): void;
}
interface UploadCtxProvider extends LitUploaderBlock {
addEventListener(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-upload-ctx-provider': UploadCtxProvider;
}
}
declare class UrlSource extends LitUploaderBlock {
couldBeCtxOwner: boolean;
activityType: ActivityType;
private _formState;
initCallback(): void;
private _inputRef;
private _handleInput;
private _handleUpload;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-url-source': UrlSource;
}
}
declare class SimpleBtn extends LitUploaderBlock {
static styleAttrs: string[];
couldBeCtxOwner: boolean;
dropzone: boolean;
private _buttonTextKey;
private readonly _handleClick;
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-simple-btn': SimpleBtn;
}
}
declare class FileUploaderRegular extends LitSolutionBlock {
attributesMeta: {
headless?: boolean;
'ctx-name': string;
};
static styleAttrs: string[];
headless: boolean;
constructor();
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-file-uploader-regular': FileUploaderRegular;
}
}
declare class FileUploaderInline extends LitSolutionBlock {
attributesMeta: {
'ctx-name': string;
};
static styleAttrs: string[];
private _couldCancel;
constructor();
private _handleCancel;
private get _couldHistoryBack();
private get _couldShowList();
private _getInitActivity;
initCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-file-uploader-inline': FileUploaderInline;
}
}
declare class FileUploaderMinimal extends LitSolutionBlock {
attributesMeta: {
'ctx-name': string;
};
static styleAttrs: string[];
private _singleUpload;
private _isHiddenStartFrom;
private _classUploadList;
private _classStartFrom;
private _getInitActivity;
constructor();
private _handleModalOpen;
private _handleModalClose;
initCallback(): void;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-file-uploader-minimal': FileUploaderMinimal;
}
}
declare class A11y implements ISharedInstance {
private _destroyKeyUX;
private readonly _scopedWindow;
constructor();
registerBlock(scope: LitBlock): void;
destroy(): void;
}
declare class LocaleManager extends SharedInstance {
private _localeName;
constructor(sharedInstancesBag: SharedInstancesBag);
}
type CommonEventType = InternalEventKey | EventKey;
type TelemetryState = TelemetryRequest & {
eventTimestamp: number;
location: string;
};
type TelemetryEventBody = Partial> & {
modalId?: string;
eventType?: CommonEventType;
};
declare class TelemetryManager extends SharedInstance {
private readonly _sessionId;
private readonly _telemetryInstance;
private _config;
private _initialized;
private _lastPayload;
private readonly _queue;
private _isEnabled;
constructor(sharedInstancesBag: SharedInstancesBag);
private _init;
private _setConfig;
private _formattingPayload;
private _excludedEvents;
sendEvent(body: TelemetryEventBody): void;
sendEventError(error: unknown, context?: string): void;
/**
* Method to send telemetry event for Cloud Image Editor.
*/
sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record): void;
/**
* Deeply compares two objects and returns true if they are equal, false otherwise.
*/
private _checkObj;
private get _timestamp();
private get _solution();
private get _activity();
private get _location();
}
declare const TabId: Readonly<{
readonly CROP: "crop";
readonly TUNING: "tuning";
readonly FILTERS: "filters";
}>;
type TabIdValue$1 = (typeof TabId)[keyof typeof TabId];
declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
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"];
type FilterId = (typeof ALL_FILTERS)[number];
declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
/** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
declare const COLOR_OPERATIONS_CONFIG: Readonly<{
brightness: {
zero: number;
range: readonly [-100, 100];
keypointsNumber: number;
};
exposure: {
zero: number;
range: readonly [-500, 500];
keypointsNumber: number;
};
gamma: {
zero: number;
range: readonly [0, 1000];
keypointsNumber: number;
};
contrast: {
zero: number;
range: readonly [-100, 500];
keypointsNumber: number;
};
saturation: {
zero: number;
range: readonly [-100, 500];
keypointsNumber: number;
};
vibrance: {
zero: number;
range: readonly [-100, 500];
keypointsNumber: number;
};
warmth: {
zero: number;
range: readonly [-100, 100];
keypointsNumber: number;
};
enhance: {
zero: number;
range: readonly [0, 100];
keypointsNumber: number;
};
filter: {
zero: number;
range: readonly [0, 100];
keypointsNumber: number;
};
}>;
type SharedConfigState = {
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
};
type BlocksRegistry = Set;
type ActivityBlockCtxState = {
'*currentActivity': string | null;
'*currentActivityParams': Record;
'*history': (string | null)[];
'*historyBack': (() => void) | null;
'*closeModal': () => void;
};
type UploaderBlockCtxState = ActivityBlockCtxState & {
'*commonProgress': number;
'*uploadList': {
uid: Uid;
}[];
'*uploadQueue': Queue;
'*collectionErrors': OutputErrorCollection[];
'*collectionState': OutputCollectionState | null;
'*groupInfo': UploadcareGroup | null;
'*uploadTrigger': Set;
};
type SolutionBlockCtxState = UploaderBlockCtxState & {
'*solution': string | null;
};
type CloudImageEditorState = {
'*originalUrl': string | null;
'*loadingOperations': LoadingOperations;
'*faderEl': EditorImageFader | null;
'*cropperEl': EditorImageCropper | null;
'*imgEl': HTMLImageElement | null;
'*imgContainerEl': HTMLElement | null;
'*networkProblems': boolean;
'*imageSize': {
width: number;
height: number;
} | null;
'*editorTransformations': Transformations;
'*cropPresetList': CropPresetList;
'*currentAspectRatio': CropAspectRatio | null;
'*tabList': readonly TabIdValue$1[];
'*tabId': TabIdValue$1;
'*on.retryNetwork': () => void;
'*on.apply': (transformations: Transformations) => void;
'*on.cancel': () => void;
};
type EditorImageCropperState = {
'*padding': number;
'*operations': {
rotate: number;
mirror: boolean;
flip: boolean;
};
'*imageBox': {
x: number;
y: number;
width: number;
height: number;
};
'*cropBox': {
x: number;
y: number;
width: number;
height: number;
};
};
type EditorToolbarState = {
'*showListAspectRatio': boolean;
'*sliderEl': EditorSlider | null;
'*showSlider': boolean;
'*currentFilter': string;
'*currentOperation': string | null;
'*operationTooltip': string | null;
};
type DynamicBlockState = {
'*blocksRegistry': BlocksRegistry;
'*eventEmitter': EventEmitter;
'*localeManager': LocaleManager;
'*telemetryManager': TelemetryManager;
'*a11y': A11y;
'*modalManager': ModalManager | null;
'*clipboard': ClipboardLayer;
};
type DynamicUploaderBlockState = {
'*uploadCollection': TypedCollection;
'*publicApi': UploaderPublicApi;
'*validationManager': ValidationManager;
'*secureUploadsManager': SecureUploadsManager;
};
type LocaleState = {
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
};
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
interface ISharedInstance {
destroy?(): void;
}
declare class SharedInstance {
protected _ctx: PubSub;
protected _sharedInstancesBag: SharedInstancesBag;
private _subscriptions;
private _cfgProxy;
protected _debugPrint: (...args: unknown[]) => void;
constructor(sharedInstancesBag: SharedInstancesBag);
protected addSub(unsub: () => void): void;
protected get _cfg(): Readonly;
destroy(): void;
}
type SharedInstancesState = Pick;
type SharedInstancesBag = ReturnType;
declare const createSharedInstancesBag: (getCtx: () => PubSub) => {
readonly ctx: PubSub;
readonly modalManager: ModalManager | null;
readonly telemetryManager: TelemetryManager;
readonly localeManager: LocaleManager;
readonly a11y: A11y;
readonly blocksRegistry: Set;
readonly eventEmitter: EventEmitter;
readonly uploadCollection: TypedCollection;
readonly secureUploadsManager: SecureUploadsManager;
readonly api: UploaderPublicApi;
readonly validationManager: ValidationManager;
};
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
signal?: AbortSignal;
}) => undefined | OutputErrorFile | Promise;
type FileValidatorDescriptor = {
runOn: 'add' | 'upload' | 'change';
validator: FuncFileValidator;
};
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
type FuncCollectionValidator = (collection: ReturnType>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
declare class ValidationManager extends SharedInstance {
private get _uploadCollection();
private _commonFileValidators;
private _commonCollectionValidators;
private _queue;
private _runQueueDebounced;
private _isDestroyed;
private _entryValidationState;
constructor(sharedInstancesBag: SharedInstancesBag);
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
runCollectionValidators(): void;
cleanupValidationForEntry(entry: TypedData): void;
private _runFileValidatorsForEntry;
private _addCustomTypeToValidationError;
private _getEntryValidationState;
private _getValidatorDescriptors;
private _getValidatorDescriptorsForEntry;
destroy(): void;
}
declare const LitBlockBase: typeof LitElement & Constructor<{
willYield: boolean;
yield(slot: string, defaultContent?: unknown): unknown;
}> & Constructor<{
getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
}> & Constructor> & Constructor & {
reg(tagName: string): void;
};
declare class LitBlock extends LitBlockBase {
private _cfgProxy;
protected _sharedContextInstances: Map;
static styleAttrs: string[];
activityType: ActivityType;
init$: {};
constructor();
l10n: (str: string, variables?: Record) => string;
debugPrint: (...args: unknown[]) => void;
protected _sharedInstancesBag: {
readonly ctx: PubSub;
readonly modalManager: ModalManager | null;
readonly telemetryManager: TelemetryManager;
readonly localeManager: LocaleManager;
readonly a11y: A11y;
readonly blocksRegistry: Set;
readonly eventEmitter: EventEmitter;
readonly uploadCollection: TypedCollection;
readonly secureUploadsManager: SecureUploadsManager;
readonly api: UploaderPublicApi;
readonly validationManager: ValidationManager;
};
emit(type: Parameters[0], payload?: Parameters[1], options?: Parameters[2]): void;
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
connectedCallback(): void;
initCallback(): void;
get testId(): string;
get modalManager(): ModalManager | null;
get telemetryManager(): TelemetryManager;
get localeManager(): LocaleManager;
get a11y(): A11y;
get clipboardLayer(): ClipboardLayer;
get blocksRegistry(): Set;
get eventEmitter(): EventEmitter;
disconnectedCallback(): void;
/**
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
*/
private destroyCtxCallback;
/**
* Adds a shared context instance if it does not exist yet.
* @param key The shared state key.
* @param resolver The resolver function that creates the instance.
*/
protected _addSharedContextInstance(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable): void;
private _destroySharedContextInstances;
protected _getSharedContextInstance(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable : SharedState[TKey];
protected proxyUrl(url: string): Promise;
get cfg(): ConfigType;
subConfigValue(key: T, callback: (value: ConfigType[T]) => void): () => void;
}
declare function initState(fnCtx: CloudImageEditorBlock): {
'*originalUrl': null;
'*loadingOperations': LoadingOperations;
'*faderEl': null;
'*cropperEl': null;
'*imgEl': null;
'*imgContainerEl': null;
'*networkProblems': boolean;
'*imageSize': null;
'*editorTransformations': {};
'*cropPresetList': never[];
'*currentAspectRatio': null;
'*tabList': readonly ["crop", "tuning", "filters"];
'*tabId': "crop";
'*on.retryNetwork': () => void;
'*on.apply': (transformations: Transformations) => void;
'*on.cancel': () => void;
};
type PresenceToggleStyle = {
transition?: string;
visible?: string;
hidden?: string;
};
declare class PresenceToggle extends LitBlock {
private _visible;
private _styles;
private _visibleStyle;
private _hiddenStyle;
private _externalTransitions;
private _initialRenderComplete;
set visible(value: boolean);
get visible(): boolean;
set styles(styles: PresenceToggleStyle);
get styles(): PresenceToggleStyle;
private _handleVisible;
private _dispatchInitialRenderEvent;
initCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-presence-toggle': PresenceToggle;
}
}
declare class LineLoaderUi extends LitBlock {
active: boolean;
private readonly _lineRef;
private _isAnimating;
private readonly _handleTransitionEndRight;
protected firstUpdated(changedProperties: PropertyValues): void;
protected updated(changedProperties: PropertyValues): void;
private _start;
private _stop;
private _resetLine;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-line-loader-ui': LineLoaderUi;
}
}
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';
type Theme = string | null;
declare class BtnUi extends LitBlock {
text: string;
icon: string;
reverse: boolean;
theme: Theme;
ariaRole: AriaRole | undefined;
ariaControls: string;
titleProp: string;
/**
* CSS-only attribute
*/
active: boolean;
protected firstUpdated(changed: PropertyValues): void;
protected updated(changed: PropertyValues): void;
private _applyReverse;
private _applyThemeClass;
private get _iconClassMap();
private get _computedIconHidden();
private get _computedIconSingle();
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-btn-ui': BtnUi;
}
}
declare class CropFrame extends LitBlock {
private _backdropMask?;
private _backdropMaskInner?;
private readonly _backdropMaskId;
private _frameThumbs?;
private _frameGuides?;
private _draggingThumb?;
private _hoverThumb?;
private _dragStartPoint?;
private _dragStartCrop?;
private _frameImage?;
private _guidesHidden;
private _draggingValue;
private readonly _svgRef;
private _svgReady;
private _pendingMaskHref;
private get _svgElement();
private get _dragging();
private set _dragging(value);
private _applyGuidesDragState;
private _shouldThumbBeDisabled;
private _createBackdrop;
/**
* @private Super Tricky workaround for the chromium bug See
* https://bugs.chromium.org/p/chromium/issues/detail?id=330815
*/
private _resizeBackdrop;
private _updateBackdrop;
private _updateFrame;
private _createThumb;
private _createThumbs;
private _createGuides;
private _createFrame;
private _handlePointerDown;
private readonly _handlePointerUp;
private readonly _handlePointerMove;
private _calcCropBox;
private readonly _handleSvgPointerMove;
private _updateCursor;
private _createMask;
private _updateMask;
private _render;
toggleThumbs(visible: boolean): void;
initCallback(): void;
protected firstUpdated(changedProperties: PropertyValues): void;
private _initializeSvg;
disconnectedCallback(): void;
render(): TemplateResult;
}
declare global {
interface HTMLElementTagNameMap {
'uc-crop-frame': CropFrame;
}
}
type Operations = {
flip: boolean;
mirror: boolean;
rotate: number;
};
declare class EditorImageCropper extends LitBlock {
ctxOwner: boolean;
private _commitDebounced;
private _handleResizeThrottled;
private _imageSize;
private _canvas?;
private _ctx;
private _isActive;
private _observer?;
private _image;
private _cancelPreload?;
private readonly _canvasRef;
private readonly _frameRef;
constructor();
protected firstUpdated(changedProperties: PropertyValues): void;
private _syncTransformations;
private _initCanvas;
private _alignImage;
private _alignCrop;
private _drawImage;
private _draw;
private _animateIn;
private _getCropDimensions;
private _getCropTransformation;
private _commit;
setValue(operation: K, value: Operations[K]): void;
getValue(operation: K): Operations[K];
activate(imageSize: ImageSize, { fromViewer }?: {
fromViewer?: boolean;
}): Promise;
deactivate({ reset }?: {
reset?: boolean;
}): void;
private _transitionToCrop;
private _transitionToImage;
private _reset;
private _waitForImage;
private _handleImageLoading;
initCallback(): void;
disconnectedCallback(): void;
render(): TemplateResult;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-image-cropper': EditorImageCropper;
}
}
type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
declare class EditorImageFader extends LitBlock {
private _isActive;
private _hidden;
private _operation;
private _filter;
private _value?;
private _transformations;
private _keypoints;
private _previewImage?;
private _cancelLastImages?;
private _cancelBatchPreload?;
private _url?;
private _fromViewer?;
private _raf;
private _addKeypointDebounced;
private readonly _previewHostRef;
private readonly _layersHostRef;
constructor();
private _handleImageLoading;
private _flush;
private _imageSrc;
private _constructKeypoint;
/**
* Check if current operation and filter equals passed ones
*/
private _isSame;
set(value: string | number): void;
private _update;
private _createPreviewImage;
private _initNodes;
setTransformations(transformations: Transformations): Promise;
preload({ url, filter, operation, value, }: {
url: string;
filter?: string;
operation?: OperationKey;
value?: number;
}): Promise;
private _setOriginalSrc;
activate({ url, operation, value, filter, fromViewer, }: {
url: string;
operation?: OperationKey;
value?: number;
filter?: string;
fromViewer?: boolean;
}): Promise;
deactivate({ hide }?: {
hide?: boolean;
}): void;
private _ensurePreviewAttached;
private _clearLayersHost;
render(): TemplateResult;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-image-fader': EditorImageFader;
}
}
declare class EditorButtonControl extends LitBlock {
active: boolean;
title: string;
protected icon: string;
protected titleProp: string;
protected get buttonClasses(): Record;
private _updateHostStateClasses;
protected onClick(_event: MouseEvent): void;
connectedCallback(): void;
protected updated(changedProperties: PropertyValues): void;
render(): lit_html.TemplateResult<1>;
}
declare class EditorFreeformButtonControl extends EditorButtonControl {
initCallback(): void;
onClick(): void;
private _computeTitle;
render(): lit_html.TemplateResult<1>;
}
declare class EditorAspectRatioButtonControl extends EditorButtonControl {
private _aspectRatio;
get aspectRatio(): CropAspectRatio | null;
set aspectRatio(value: CropAspectRatio | null);
initCallback(): void;
protected onClick(): void;
private _updateAspectRatioPresentation;
private _renderIcon;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-freeform-button-control': EditorFreeformButtonControl;
'uc-editor-aspect-ratio-button-control': EditorAspectRatioButtonControl;
}
}
declare class EditorCropButtonControl extends EditorButtonControl {
operation: CropOperation | undefined;
protected willUpdate(changedProperties: PropertyValues): void;
protected onClick(e: MouseEvent): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-crop-button-control': EditorCropButtonControl;
}
}
declare class EditorFilterControl extends EditorButtonControl {
private _operation;
private _filter;
private _originalUrl;
private _observer?;
private _cancelPreload?;
private _lastPreviewRequestId;
private _previewVisibilityCheckRaf?;
private _previewVisibilityCheckTimeout?;
private _previewImage;
private _previewLoaded;
isOriginal: boolean;
private _iconSize;
get filter(): string;
set filter(value: string);
onClick(e: MouseEvent): void;
private _previewSrc;
private _observerCallback;
initCallback(): void;
disconnectedCallback(): void;
protected updated(changedProperties: PropertyValues): void;
private _updateFilterLabels;
private _loadPreview;
private _schedulePreviewVisibilityCheck;
private _clearPreviewVisibilityChecks;
private get _shouldShowPreview();
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-filter-control': EditorFilterControl;
}
}
declare class EditorOperationControl extends EditorButtonControl {
private _operation;
get operation(): ColorOperation | '';
set operation(value: ColorOperation | '');
private _updateOperationMetadata;
initCallback(): void;
protected onClick(e: MouseEvent): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-operation-control': EditorOperationControl;
}
}
declare class EditorScroller extends LitBlock {
/**
* CSS-only attribute
*/
hiddenScrollbar: boolean;
private readonly _handleWheel;
connectedCallback(): void;
disconnectedCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-scroller': EditorScroller;
}
}
declare class SliderUi extends LitBlock {
private _observer?;
private _thumbSize;
private _zeroDotEl?;
private _stepsCount?;
private readonly _inputRef;
private readonly _thumbRef;
private readonly _stepsRef;
disabled: boolean;
min: number;
max: number;
defaultValue: number;
zero: number;
private _currentValue;
constructor();
private _emitSliderEvent;
private readonly _handleSliderInput;
private readonly _handleSliderChange;
private readonly _handleInputFocus;
private readonly _handleInputBlur;
protected firstUpdated(changedProperties: PropertyValues): void;
protected willUpdate(changedProperties: PropertyValues): void;
private _updateValue;
private _updateZeroDot;
private _updateSteps;
disconnectedCallback(): void;
private _setCurrentValue;
private _syncInputValue;
private _extractEventValue;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-slider-ui': SliderUi;
}
}
type SliderOperation = ColorOperation | 'filter';
type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
declare const FAKE_ORIGINAL_FILTER = "original";
declare class EditorSlider extends LitBlock {
state: {
operation: SliderOperation;
filter: SliderFilter | undefined;
originalUrl: string;
disabled: boolean;
min: number;
max: number;
value: number;
defaultValue: number;
zero: number;
};
private _handleInput;
setOperation(operation: SliderOperation, filter?: SliderFilter): void;
private _initializeValues;
apply(): void;
cancel(): void;
initCallback(): void;
protected updated(changedProperties: PropertyValues): void;
render(): lit_html.TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-slider': EditorSlider;
}
}
type TabIdValue = (typeof TabId)[keyof typeof TabId];
declare class EditorToolbar extends LitBlock {
private _showLoader;
showMainToolbar: boolean;
showSubToolbar: boolean;
private _showTabToggles;
tabList: readonly TabIdValue[];
activeTab: TabIdValue;
private _useSliderPanel;
private _tooltipVisible;
private _operationTooltip;
private _tabIndicatorOffset;
private _tabIndicatorWidth;
private readonly _sliderRef;
private readonly _tabIndicatorRef;
protected readonly tabToggleRefs: Record>;
private readonly _handleWindowResize;
private _cropPresets;
private _cancelPreload?;
private readonly _debouncedShowLoader;
private readonly _updateInfoTooltip;
private readonly _subTopToolbarStyles;
private readonly _subBottomToolbarStyles;
private readonly _tabToggleStyles;
private readonly _tabTogglesStyles;
init$: Record;
private _onSliderClose;
private _activateTab;
private _applyTabState;
private _syncTabIndicator;
private get _hasAspectRatioPicker();
private _renderControlsByTab;
private _renderCropTabControls;
private _renderFilterTabControls;
private _renderTuningTabControls;
private _renderControlGroup;
private _renderFreeformControl;
private _renderAspectRatioControl;
private _renderCropOperationControl;
private _renderFilterControl;
private _renderOperationControl;
private _renderAspectRatioList;
private _preloadEditedImage;
initCallback(): void;
connectedCallback(): void;
firstUpdated(changedProperties: PropertyValues): void;
protected updated(changedProperties: PropertyValues): void;
disconnectedCallback(): void;
private _assignSharedElements;
private readonly _handleCancel;
private readonly _handleApply;
private readonly _handleApplySlider;
private readonly _handleCancelSlider;
private readonly _handleTabClick;
private _renderTabToggle;
private _renderTabContent;
render(): TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'uc-editor-toolbar': EditorToolbar;
}
}
declare class CloudImageEditorBlock extends LitBlock {
attributesMeta: ({
uuid: string;
} | {
'cdn-url': string;
}) & Partial<{
tabs: string;
'crop-preset': string;
}> & {
'ctx-name': string;
};
ctxOwner: boolean;
static styleAttrs: string[];
private _statusMessage;
private _imageSrc;
private _fileType;
private _showLoader;
uuid: string | null;
cdnUrl: string | null;
cropPreset: string;
tabs: string | null;
private _hasNetworkProblems;
private _isInitialized;
private _pendingInitUpdate;
private readonly _debouncedShowLoader;
private readonly _imgRef;
private readonly _cropperRef;
private readonly _faderRef;
private readonly _imgContainerRef;
private readonly _handleImageLoad;
private readonly _handleImageError;
private readonly _handleRetryNetwork;
private _scheduleInitialization;
init$: ReturnType;
initCallback(): void;
private _assignSharedElements;
private _attachImageListeners;
private _detachImageListeners;
private get _imageClassName();
/**
* To proper work, we need non-zero size the element. So, we'll wait for it.
*/
private _waitForSize;
firstUpdated(changedProperties: PropertyValues): void;
disconnectedCallback(): void;
render(): lit_html.TemplateResult<1>;
protected updated(changedProperties: PropertyValues): void;
private _syncTabListFromProp;
private _syncCropPresetState;
updateImage(): Promise;
initEditor(): Promise;
}
declare global {
interface HTMLElementTagNameMap {
'uc-cloud-image-editor-block': CloudImageEditorBlock;
}
}
export { BtnUi, CloudImageEditor, CloudImageEditorBlock, Config, CropFrame, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, Icon, LineLoaderUi, PresenceToggle, SliderUi, defineComponents };