@uploadcare/file-uploader 1.25.0-alpha.8 → 1.25.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.
- package/dist/abstract/loadFileUploaderFrom.js +75 -4
- package/dist/env.js +33 -4
- package/dist/index.css +2660 -5
- package/dist/index.d.ts +962 -1296
- package/dist/index.js +12012 -6
- package/dist/index.layered.css +2716 -4
- package/dist/index.ssr.js +779 -549
- package/dist/locales/file-uploader/ar.js +165 -4
- package/dist/locales/file-uploader/az.js +157 -4
- package/dist/locales/file-uploader/ca.js +159 -4
- package/dist/locales/file-uploader/cs.js +161 -4
- package/dist/locales/file-uploader/da.js +157 -4
- package/dist/locales/file-uploader/de.js +157 -4
- package/dist/locales/file-uploader/el.js +157 -4
- package/dist/locales/file-uploader/en.js +157 -4
- package/dist/locales/file-uploader/es.js +159 -4
- package/dist/locales/file-uploader/et.js +157 -4
- package/dist/locales/file-uploader/fi.js +157 -4
- package/dist/locales/file-uploader/fr.js +159 -4
- package/dist/locales/file-uploader/he.js +159 -4
- package/dist/locales/file-uploader/hy.js +157 -4
- package/dist/locales/file-uploader/is.js +157 -4
- package/dist/locales/file-uploader/it.js +159 -4
- package/dist/locales/file-uploader/ja.js +157 -4
- package/dist/locales/file-uploader/ka.js +157 -4
- package/dist/locales/file-uploader/kk.js +157 -4
- package/dist/locales/file-uploader/ko.js +157 -4
- package/dist/locales/file-uploader/lv.js +159 -4
- package/dist/locales/file-uploader/nb.js +157 -4
- package/dist/locales/file-uploader/nl.js +157 -4
- package/dist/locales/file-uploader/pl.js +161 -4
- package/dist/locales/file-uploader/pt.js +159 -4
- package/dist/locales/file-uploader/ro.js +159 -4
- package/dist/locales/file-uploader/ru.js +161 -4
- package/dist/locales/file-uploader/sk.js +161 -4
- package/dist/locales/file-uploader/sr.js +159 -4
- package/dist/locales/file-uploader/sv.js +157 -4
- package/dist/locales/file-uploader/tr.js +157 -4
- package/dist/locales/file-uploader/uk.js +161 -4
- package/dist/locales/file-uploader/vi.js +157 -4
- package/dist/locales/file-uploader/zh-TW.js +157 -4
- package/dist/locales/file-uploader/zh.js +157 -4
- package/package.json +31 -36
- package/types/jsx.d.ts +48 -75
- package/web/file-uploader.iife.min.d.ts +984 -1318
- package/web/file-uploader.iife.min.js +27 -6
- package/web/file-uploader.min.d.ts +984 -1318
- package/web/file-uploader.min.js +26 -5
- package/web/uc-basic.layered.min.css +23 -4
- package/web/uc-basic.min.css +23 -4
- package/web/uc-cloud-image-editor.layered.min.css +23 -4
- package/web/uc-cloud-image-editor.min.css +23 -4
- package/web/uc-cloud-image-editor.min.d.ts +537 -738
- package/web/uc-cloud-image-editor.min.js +26 -5
- package/web/uc-file-uploader-inline.layered.min.css +23 -4
- package/web/uc-file-uploader-inline.min.css +23 -4
- package/web/uc-file-uploader-inline.min.d.ts +984 -1318
- package/web/uc-file-uploader-inline.min.js +26 -5
- package/web/uc-file-uploader-minimal.layered.min.css +23 -4
- package/web/uc-file-uploader-minimal.min.css +23 -4
- package/web/uc-file-uploader-minimal.min.d.ts +984 -1318
- package/web/uc-file-uploader-minimal.min.js +26 -5
- package/web/uc-file-uploader-regular.layered.min.css +23 -4
- package/web/uc-file-uploader-regular.min.css +23 -4
- package/web/uc-file-uploader-regular.min.d.ts +984 -1318
- package/web/uc-file-uploader-regular.min.js +26 -5
- package/web/uc-img.min.d.ts +100 -55
- package/web/uc-img.min.js +25 -5
- package/web/file-uploader.iife.min.js.LEGAL.txt +0 -71
- package/web/file-uploader.min.js.LEGAL.txt +0 -71
- package/web/uc-cloud-image-editor.min.js.LEGAL.txt +0 -70
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +0 -71
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +0 -71
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +0 -71
- package/web/uc-img.min.js.LEGAL.txt +0 -24
|
@@ -1,180 +1,169 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PropertyValues, LitElement, TemplateResult } from 'lit';
|
|
3
|
-
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
4
|
-
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
1
|
+
import { BaseComponent } from '@symbiotejs/symbiote';
|
|
5
2
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
type Constructor<T = unknown> = new (...args: any[]) => T;
|
|
10
|
-
|
|
11
|
-
type SymbioteStateBag<T extends Record<string, unknown>> = T;
|
|
12
|
-
/**
|
|
13
|
-
* Interface for components using SymbioteMixin
|
|
14
|
-
*/
|
|
15
|
-
declare class SymbioteComponent<TState extends Record<string, unknown> = Record<string, unknown>> {
|
|
16
|
-
$: SymbioteStateBag<TState>;
|
|
17
|
-
sub<TKey extends keyof TState>(key: TKey, callback: (value: TState[TKey]) => void, init?: boolean): () => void;
|
|
18
|
-
pub<TKey extends keyof TState>(key: TKey, value: TState[TKey]): void;
|
|
19
|
-
set$<T extends {
|
|
20
|
-
[K in keyof T]: K extends keyof TState ? TState[K] : never;
|
|
21
|
-
}>(obj: T): void;
|
|
22
|
-
has<TKey extends keyof TState>(key: TKey): boolean;
|
|
23
|
-
add<TKey extends keyof TState>(key: TKey, val: TState[TKey], rewrite?: boolean): void;
|
|
24
|
-
add$<T extends {
|
|
25
|
-
[K in keyof T]: K extends keyof TState ? TState[K] : never;
|
|
26
|
-
}>(obj: T, rewrite?: boolean): void;
|
|
27
|
-
initCallback(): void;
|
|
28
|
-
ctxName: string;
|
|
29
|
-
ctxOwner: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare class A11y {
|
|
33
|
-
private _destroyKeyUX;
|
|
34
|
-
private readonly _scopedWindow;
|
|
35
|
-
constructor();
|
|
36
|
-
registerBlock(scope: LitBlock): void;
|
|
37
|
-
destroy(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class LocaleManager {
|
|
41
|
-
private _blockInstance;
|
|
42
|
-
private _localeName;
|
|
43
|
-
constructor(blockInstance: LitBlock);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare class Modal extends LitBlock {
|
|
47
|
-
static styleAttrs: string[];
|
|
48
|
-
private _mouseDownTarget;
|
|
49
|
-
/** WARNING: Do not this, it's used in dashboard */
|
|
50
|
-
protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
|
|
51
|
-
/** WARNING: Do not this, it's used in dashboard */
|
|
52
|
-
protected closeDialog: () => void;
|
|
53
|
-
private _handleDialogClose;
|
|
54
|
-
private _handleDialogMouseDown;
|
|
55
|
-
private _handleDialogMouseUp;
|
|
56
|
-
show(): void;
|
|
57
|
-
hide(): void;
|
|
58
|
-
private _handleModalOpen;
|
|
59
|
-
private _handleModalClose;
|
|
60
|
-
private _handleModalCloseAll;
|
|
61
|
-
initCallback(): void;
|
|
62
|
-
disconnectedCallback(): void;
|
|
63
|
-
private _handleDialogRef;
|
|
64
|
-
render(): lit_html.TemplateResult<1>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
type Subscription = {
|
|
68
|
-
remove: () => void;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type Uid = string & {
|
|
72
|
-
__uid: true;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
declare function defineComponents(blockExports: Record<string, any>): void;
|
|
76
|
-
|
|
77
|
-
declare const UC_WINDOW_KEY = "UC";
|
|
78
|
-
type IndexModule = Record<string, any>;
|
|
79
|
-
declare global {
|
|
80
|
-
interface Window {
|
|
81
|
-
[UC_WINDOW_KEY]?: IndexModule;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
3
|
+
import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions } from '@uploadcare/upload-client';
|
|
4
|
+
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
84
5
|
|
|
85
6
|
type LocaleDefinition = Record<string, string>;
|
|
86
7
|
|
|
87
|
-
declare
|
|
88
|
-
name: string;
|
|
89
|
-
private _resolvedHref;
|
|
90
|
-
private _iconHrefResolver;
|
|
91
|
-
initCallback(): void;
|
|
92
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
93
|
-
private _updateResolvedHref;
|
|
94
|
-
render(): lit_html.TemplateResult<1>;
|
|
95
|
-
}
|
|
8
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(uploaderBlock: UploaderBlock): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
96
9
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
readonly ERROR_EVENT: "error-event";
|
|
102
|
-
}>;
|
|
103
|
-
declare const EventType: Readonly<{
|
|
104
|
-
readonly FILE_ADDED: "file-added";
|
|
105
|
-
readonly FILE_REMOVED: "file-removed";
|
|
106
|
-
readonly FILE_UPLOAD_START: "file-upload-start";
|
|
107
|
-
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
|
|
108
|
-
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
|
|
109
|
-
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
|
|
110
|
-
readonly FILE_URL_CHANGED: "file-url-changed";
|
|
111
|
-
readonly MODAL_OPEN: "modal-open";
|
|
112
|
-
readonly MODAL_CLOSE: "modal-close";
|
|
113
|
-
readonly DONE_CLICK: "done-click";
|
|
114
|
-
readonly UPLOAD_CLICK: "upload-click";
|
|
115
|
-
readonly ACTIVITY_CHANGE: "activity-change";
|
|
116
|
-
readonly COMMON_UPLOAD_START: "common-upload-start";
|
|
117
|
-
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
|
|
118
|
-
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
|
|
119
|
-
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
|
|
120
|
-
readonly CHANGE: "change";
|
|
121
|
-
readonly GROUP_CREATED: "group-created";
|
|
10
|
+
type TypedSchema = Record<string, {
|
|
11
|
+
type: unknown;
|
|
12
|
+
value: unknown;
|
|
13
|
+
nullable?: boolean;
|
|
122
14
|
}>;
|
|
123
|
-
type
|
|
124
|
-
type
|
|
125
|
-
type
|
|
126
|
-
[
|
|
127
|
-
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
|
|
128
|
-
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
|
|
129
|
-
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
|
|
130
|
-
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
|
|
131
|
-
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
|
|
132
|
-
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
|
|
133
|
-
[EventType.MODAL_OPEN]: {
|
|
134
|
-
modalId: ModalId;
|
|
135
|
-
};
|
|
136
|
-
[EventType.MODAL_CLOSE]: {
|
|
137
|
-
modalId: ModalId;
|
|
138
|
-
hasActiveModals: boolean;
|
|
139
|
-
};
|
|
140
|
-
[EventType.ACTIVITY_CHANGE]: {
|
|
141
|
-
activity: ActivityType;
|
|
142
|
-
};
|
|
143
|
-
[EventType.UPLOAD_CLICK]: void;
|
|
144
|
-
[EventType.DONE_CLICK]: OutputCollectionState;
|
|
145
|
-
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
|
|
146
|
-
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
|
|
147
|
-
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
|
|
148
|
-
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
|
|
149
|
-
[EventType.CHANGE]: OutputCollectionState;
|
|
150
|
-
[EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
|
|
15
|
+
type Constructor<T = any> = new (...args: any[]) => T;
|
|
16
|
+
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;
|
|
17
|
+
type ExtractDataFromSchema<T extends TypedSchema> = {
|
|
18
|
+
[K in keyof T]: ExtractType<T[K]['type'], T[K]['value']> | (T[K]['nullable'] extends true ? null : never);
|
|
151
19
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
private
|
|
155
|
-
private
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
private _ctxId;
|
|
168
|
-
private _data;
|
|
169
|
-
constructor(initialValue: T);
|
|
170
|
-
get uid(): Uid;
|
|
171
|
-
setValue<K extends keyof T>(prop: K, value: T[K]): void;
|
|
172
|
-
setMultipleValues(updObj: Partial<T>): void;
|
|
173
|
-
getValue<K extends keyof T>(prop: K): T[K];
|
|
174
|
-
subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Subscription;
|
|
20
|
+
type ExtractKeysFromSchema<T extends TypedSchema> = Extract<keyof T, string>;
|
|
21
|
+
declare class TypedData<T extends TypedSchema> {
|
|
22
|
+
private __typedSchema;
|
|
23
|
+
private __ctxId;
|
|
24
|
+
private __schema;
|
|
25
|
+
private __data;
|
|
26
|
+
constructor(typedSchema: T, ctxName?: string);
|
|
27
|
+
get uid(): string;
|
|
28
|
+
setValue<K extends ExtractKeysFromSchema<T>>(prop: K, value: ExtractDataFromSchema<T>[K]): void;
|
|
29
|
+
setMultipleValues(updObj: Partial<ExtractDataFromSchema<T>>): void;
|
|
30
|
+
getValue<K extends ExtractKeysFromSchema<T>>(prop: K): ExtractDataFromSchema<T>[K];
|
|
31
|
+
subscribe<K extends ExtractKeysFromSchema<T>>(prop: K, handler: (newVal: ExtractDataFromSchema<T>[K]) => void): {
|
|
32
|
+
remove: () => void;
|
|
33
|
+
callback: Function;
|
|
34
|
+
};
|
|
175
35
|
remove(): void;
|
|
176
36
|
}
|
|
177
37
|
|
|
38
|
+
declare const uploadEntrySchema: Readonly<{
|
|
39
|
+
file: Readonly<{
|
|
40
|
+
type: {
|
|
41
|
+
new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
|
42
|
+
prototype: File;
|
|
43
|
+
};
|
|
44
|
+
value: null;
|
|
45
|
+
nullable: true;
|
|
46
|
+
}>;
|
|
47
|
+
externalUrl: Readonly<{
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
value: null;
|
|
50
|
+
nullable: true;
|
|
51
|
+
}>;
|
|
52
|
+
fileName: Readonly<{
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
value: null;
|
|
55
|
+
nullable: true;
|
|
56
|
+
}>;
|
|
57
|
+
fileSize: Readonly<{
|
|
58
|
+
type: NumberConstructor;
|
|
59
|
+
value: null;
|
|
60
|
+
nullable: true;
|
|
61
|
+
}>;
|
|
62
|
+
lastModified: Readonly<{
|
|
63
|
+
type: NumberConstructor;
|
|
64
|
+
value: number;
|
|
65
|
+
}>;
|
|
66
|
+
uploadProgress: Readonly<{
|
|
67
|
+
type: NumberConstructor;
|
|
68
|
+
value: 0;
|
|
69
|
+
}>;
|
|
70
|
+
uuid: Readonly<{
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
value: null;
|
|
73
|
+
nullable: true;
|
|
74
|
+
}>;
|
|
75
|
+
isImage: Readonly<{
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
value: false;
|
|
78
|
+
}>;
|
|
79
|
+
mimeType: Readonly<{
|
|
80
|
+
type: StringConstructor;
|
|
81
|
+
value: null;
|
|
82
|
+
nullable: true;
|
|
83
|
+
}>;
|
|
84
|
+
ctxName: Readonly<{
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
value: null;
|
|
87
|
+
nullable: true;
|
|
88
|
+
}>;
|
|
89
|
+
cdnUrl: Readonly<{
|
|
90
|
+
type: StringConstructor;
|
|
91
|
+
value: null;
|
|
92
|
+
nullable: true;
|
|
93
|
+
}>;
|
|
94
|
+
cdnUrlModifiers: Readonly<{
|
|
95
|
+
type: StringConstructor;
|
|
96
|
+
value: null;
|
|
97
|
+
nullable: true;
|
|
98
|
+
}>;
|
|
99
|
+
fileInfo: Readonly<{
|
|
100
|
+
type: typeof UploadcareFile;
|
|
101
|
+
value: null;
|
|
102
|
+
nullable: true;
|
|
103
|
+
}>;
|
|
104
|
+
isUploading: Readonly<{
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
value: false;
|
|
107
|
+
}>;
|
|
108
|
+
abortController: Readonly<{
|
|
109
|
+
type: {
|
|
110
|
+
new (): AbortController;
|
|
111
|
+
prototype: AbortController;
|
|
112
|
+
};
|
|
113
|
+
value: null;
|
|
114
|
+
nullable: true;
|
|
115
|
+
}>;
|
|
116
|
+
thumbUrl: Readonly<{
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
value: null;
|
|
119
|
+
nullable: true;
|
|
120
|
+
}>;
|
|
121
|
+
silent: Readonly<{
|
|
122
|
+
type: BooleanConstructor;
|
|
123
|
+
value: false;
|
|
124
|
+
}>;
|
|
125
|
+
source: Readonly<{
|
|
126
|
+
type: StringConstructor;
|
|
127
|
+
value: null;
|
|
128
|
+
nullable: true;
|
|
129
|
+
}>;
|
|
130
|
+
fullPath: Readonly<{
|
|
131
|
+
type: StringConstructor;
|
|
132
|
+
value: null;
|
|
133
|
+
nullable: true;
|
|
134
|
+
}>;
|
|
135
|
+
metadata: Readonly<{
|
|
136
|
+
type: ObjectConstructor;
|
|
137
|
+
value: null;
|
|
138
|
+
nullable: true;
|
|
139
|
+
}>;
|
|
140
|
+
errors: Readonly<{
|
|
141
|
+
type: ArrayConstructor;
|
|
142
|
+
value: OutputErrorFile[];
|
|
143
|
+
}>;
|
|
144
|
+
uploadError: Readonly<{
|
|
145
|
+
type: ErrorConstructor;
|
|
146
|
+
value: null;
|
|
147
|
+
nullable: true;
|
|
148
|
+
}>;
|
|
149
|
+
isRemoved: Readonly<{
|
|
150
|
+
type: BooleanConstructor;
|
|
151
|
+
value: false;
|
|
152
|
+
}>;
|
|
153
|
+
isQueuedForUploading: Readonly<{
|
|
154
|
+
type: BooleanConstructor;
|
|
155
|
+
value: false;
|
|
156
|
+
}>;
|
|
157
|
+
isValidationPending: Readonly<{
|
|
158
|
+
type: BooleanConstructor;
|
|
159
|
+
value: false;
|
|
160
|
+
}>;
|
|
161
|
+
isQueuedForValidation: Readonly<{
|
|
162
|
+
type: BooleanConstructor;
|
|
163
|
+
value: false;
|
|
164
|
+
}>;
|
|
165
|
+
}>;
|
|
166
|
+
|
|
178
167
|
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
179
168
|
signal?: AbortSignal;
|
|
180
169
|
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
@@ -192,10 +181,10 @@ declare class ValidationManager {
|
|
|
192
181
|
private _queue;
|
|
193
182
|
private _runQueueDebounced;
|
|
194
183
|
private _entryValidationState;
|
|
195
|
-
constructor(blockInstance:
|
|
196
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?:
|
|
184
|
+
constructor(blockInstance: UploaderBlock);
|
|
185
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: string[]): void;
|
|
197
186
|
runCollectionValidators(): void;
|
|
198
|
-
cleanupValidationForEntry(entry: TypedData<
|
|
187
|
+
cleanupValidationForEntry(entry: TypedData<typeof uploadEntrySchema>): void;
|
|
199
188
|
private _runFileValidatorsForEntry;
|
|
200
189
|
private _addCustomTypeToValidationError;
|
|
201
190
|
private _getEntryValidationState;
|
|
@@ -205,26 +194,19 @@ declare class ValidationManager {
|
|
|
205
194
|
|
|
206
195
|
type CameraMode = 'photo' | 'video';
|
|
207
196
|
|
|
208
|
-
/**
|
|
209
|
-
* Config keys that can't be passed as attribute (because they are object or function)
|
|
210
|
-
*/
|
|
211
|
-
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
212
197
|
/** Mapping of attribute names to state */
|
|
213
198
|
declare const attrStateMapping: Record<string, string>;
|
|
214
|
-
declare class Config extends
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
};
|
|
218
|
-
init$: LitBlock["init$"] & ConfigType;
|
|
219
|
-
private _computationControllers;
|
|
199
|
+
declare class Config extends Block {
|
|
200
|
+
requireCtxName: boolean;
|
|
201
|
+
constructor();
|
|
220
202
|
private _flushValueToAttribute;
|
|
221
203
|
private _flushValueToState;
|
|
222
204
|
private _setValue;
|
|
223
205
|
private _getValue;
|
|
224
|
-
|
|
206
|
+
_assertSameValueDifferentReference(key: string, previousValue: unknown, nextValue: unknown): void;
|
|
225
207
|
initCallback(): void;
|
|
226
208
|
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
227
|
-
|
|
209
|
+
get computationControllers(): any;
|
|
228
210
|
}
|
|
229
211
|
interface Config extends ConfigType {
|
|
230
212
|
}
|
|
@@ -279,7 +261,7 @@ type ApiAddFileCommonOptions = {
|
|
|
279
261
|
};
|
|
280
262
|
declare class UploaderPublicApi {
|
|
281
263
|
private _ctx;
|
|
282
|
-
constructor(ctx:
|
|
264
|
+
constructor(ctx: UploaderBlock);
|
|
283
265
|
private get _uploadCollection();
|
|
284
266
|
get cfg(): ConfigType;
|
|
285
267
|
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -303,7 +285,7 @@ declare class UploaderPublicApi {
|
|
|
303
285
|
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
304
286
|
initFlow: (force?: boolean) => void;
|
|
305
287
|
doneFlow: () => void;
|
|
306
|
-
setCurrentActivity: <T extends
|
|
288
|
+
setCurrentActivity: <T extends ActivityType>(activityType: T, ...[params]: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [unknown?]) => void;
|
|
307
289
|
getCurrentActivity: () => ActivityType;
|
|
308
290
|
setModalState: (opened: boolean) => void;
|
|
309
291
|
private get _sourceList();
|
|
@@ -603,8 +585,6 @@ type ConfigType = {
|
|
|
603
585
|
*/
|
|
604
586
|
testMode: boolean;
|
|
605
587
|
};
|
|
606
|
-
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
607
|
-
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
608
588
|
type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
|
|
609
589
|
type OutputCustomErrorType = 'CUSTOM_ERROR';
|
|
610
590
|
type OutputFileErrorType = OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' | 'UPLOAD_ERROR' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
|
|
@@ -616,9 +596,7 @@ type OutputErrorTypePayload = {
|
|
|
616
596
|
NOT_AN_IMAGE: OutputFileErrorPayload;
|
|
617
597
|
FORBIDDEN_FILE_TYPE: OutputFileErrorPayload;
|
|
618
598
|
FILE_SIZE_EXCEEDED: OutputFileErrorPayload;
|
|
619
|
-
SOME_FILES_HAS_ERRORS: {
|
|
620
|
-
[k: string]: never;
|
|
621
|
-
};
|
|
599
|
+
SOME_FILES_HAS_ERRORS: {};
|
|
622
600
|
TOO_MANY_FILES: {
|
|
623
601
|
min: number;
|
|
624
602
|
max: number;
|
|
@@ -768,98 +746,60 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
768
746
|
allEntries: OutputFileEntry[];
|
|
769
747
|
});
|
|
770
748
|
|
|
771
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
772
|
-
file: File | null;
|
|
773
|
-
externalUrl: string | null;
|
|
774
|
-
fileName: string | null;
|
|
775
|
-
fileSize: number | null;
|
|
776
|
-
lastModified: number;
|
|
777
|
-
uploadProgress: number;
|
|
778
|
-
uuid: string | null;
|
|
779
|
-
isImage: boolean;
|
|
780
|
-
mimeType: string | null;
|
|
781
|
-
ctxName: string | null;
|
|
782
|
-
cdnUrl: string | null;
|
|
783
|
-
cdnUrlModifiers: string | null;
|
|
784
|
-
fileInfo: UploadcareFile | null;
|
|
785
|
-
isUploading: boolean;
|
|
786
|
-
abortController: AbortController | null;
|
|
787
|
-
thumbUrl: string | null;
|
|
788
|
-
silent: boolean;
|
|
789
|
-
source: string | null;
|
|
790
|
-
fullPath: string | null;
|
|
791
|
-
metadata: Metadata | null;
|
|
792
|
-
errors: OutputErrorFile[];
|
|
793
|
-
uploadError: Error | null;
|
|
794
|
-
isRemoved: boolean;
|
|
795
|
-
isQueuedForUploading: boolean;
|
|
796
|
-
isValidationPending: boolean;
|
|
797
|
-
isQueuedForValidation: boolean;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
type ActivityParams$1 = {
|
|
801
|
-
externalSourceType: string;
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
declare class CloudImageEditor extends CloudImageEditorBlock {
|
|
805
|
-
static styleAttrs: string[];
|
|
806
|
-
constructor();
|
|
807
|
-
initCallback(): void;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
749
|
declare class SecureUploadsManager {
|
|
811
750
|
private readonly _block;
|
|
812
751
|
private _secureToken;
|
|
813
|
-
constructor(block:
|
|
752
|
+
constructor(block: UploaderBlock);
|
|
814
753
|
private _debugPrint;
|
|
815
754
|
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
816
755
|
}
|
|
817
756
|
|
|
818
|
-
type ChangeMap<T extends
|
|
819
|
-
type TypedCollectionPropertyObserver<T extends
|
|
820
|
-
type TypedCollectionObserverHandler<T extends
|
|
821
|
-
type TypedCollectionOptions<T extends
|
|
822
|
-
|
|
823
|
-
watchList?:
|
|
757
|
+
type ChangeMap<T extends TypedSchema> = Record<keyof T, Set<string>>;
|
|
758
|
+
type TypedCollectionPropertyObserver<T extends TypedSchema> = (changeMap: ChangeMap<T>) => void;
|
|
759
|
+
type TypedCollectionObserverHandler<T extends TypedSchema> = (list: string[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
760
|
+
type TypedCollectionOptions<T extends TypedSchema> = {
|
|
761
|
+
typedSchema: T;
|
|
762
|
+
watchList?: ExtractKeysFromSchema<T>[];
|
|
824
763
|
handler?: TypedCollectionObserverHandler<T>;
|
|
764
|
+
ctxName?: string;
|
|
825
765
|
};
|
|
826
|
-
declare class TypedCollection<T extends
|
|
827
|
-
private
|
|
828
|
-
private
|
|
829
|
-
private
|
|
830
|
-
private
|
|
831
|
-
private
|
|
832
|
-
private
|
|
833
|
-
private
|
|
834
|
-
private
|
|
835
|
-
private
|
|
836
|
-
private
|
|
837
|
-
private
|
|
838
|
-
private
|
|
839
|
-
private
|
|
766
|
+
declare class TypedCollection<T extends TypedSchema> {
|
|
767
|
+
private __typedSchema;
|
|
768
|
+
private __ctxId;
|
|
769
|
+
private __data;
|
|
770
|
+
private __watchList;
|
|
771
|
+
private __subsMap;
|
|
772
|
+
private __propertyObservers;
|
|
773
|
+
private __collectionObservers;
|
|
774
|
+
private __items;
|
|
775
|
+
private __removed;
|
|
776
|
+
private __added;
|
|
777
|
+
private __observeTimeout?;
|
|
778
|
+
private __notifyTimeout?;
|
|
779
|
+
private __notifyObservers;
|
|
840
780
|
constructor(options: TypedCollectionOptions<T>);
|
|
841
|
-
|
|
781
|
+
notify(): void;
|
|
842
782
|
observeCollection(handler: TypedCollectionObserverHandler<T>): () => void;
|
|
843
783
|
unobserveCollection(handler: TypedCollectionObserverHandler<T>): void;
|
|
844
|
-
add(init: Partial<T
|
|
845
|
-
read(id:
|
|
846
|
-
readProp<K extends
|
|
847
|
-
publishProp<K extends
|
|
848
|
-
remove(id:
|
|
784
|
+
add(init: Partial<ExtractDataFromSchema<T>>): string;
|
|
785
|
+
read(id: string): TypedData<T> | null;
|
|
786
|
+
readProp<K extends ExtractKeysFromSchema<T>>(id: string, propName: K): ExtractDataFromSchema<T>[K] | null;
|
|
787
|
+
publishProp<K extends ExtractKeysFromSchema<T>>(id: string, propName: K, value: ExtractDataFromSchema<T>[K]): void;
|
|
788
|
+
remove(id: string): void;
|
|
849
789
|
clearAll(): void;
|
|
850
790
|
observeProperties(handler: TypedCollectionPropertyObserver<T>): () => void;
|
|
851
791
|
unobserveProperties(handler: TypedCollectionPropertyObserver<T>): void;
|
|
852
|
-
findItems(checkFn: (item: TypedData<T>) => boolean):
|
|
853
|
-
items():
|
|
792
|
+
findItems(checkFn: (item: TypedData<T>) => boolean): string[];
|
|
793
|
+
items(): string[];
|
|
854
794
|
get size(): number;
|
|
855
795
|
destroy(): void;
|
|
856
796
|
}
|
|
857
797
|
|
|
858
|
-
declare class
|
|
798
|
+
declare class UploaderBlock extends ActivityBlock {
|
|
859
799
|
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
860
800
|
static sourceTypes: Readonly<typeof UploadSource>;
|
|
861
801
|
protected couldBeCtxOwner: boolean;
|
|
862
|
-
private
|
|
802
|
+
private isCtxOwner;
|
|
863
803
|
private _unobserveCollection?;
|
|
864
804
|
private _unobserveCollectionProperties?;
|
|
865
805
|
init$: {
|
|
@@ -870,21 +810,23 @@ declare class LitUploaderBlock extends LitActivityBlock {
|
|
|
870
810
|
'*collectionState': OutputCollectionState | null;
|
|
871
811
|
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
872
812
|
'*uploadTrigger': Set<string>;
|
|
813
|
+
'*secureUploadsManager': SecureUploadsManager | null;
|
|
873
814
|
'*currentActivity': null;
|
|
874
815
|
'*currentActivityParams': {};
|
|
875
816
|
'*history': never[];
|
|
876
817
|
'*historyBack': null;
|
|
877
818
|
'*closeModal': () => void;
|
|
878
819
|
};
|
|
879
|
-
private get
|
|
820
|
+
private get hasCtxOwner();
|
|
880
821
|
initCallback(): void;
|
|
881
822
|
protected get validationManager(): ValidationManager;
|
|
882
823
|
get api(): UploaderPublicApi;
|
|
883
824
|
getAPI(): UploaderPublicApi;
|
|
884
|
-
get uploadCollection(): TypedCollection<
|
|
885
|
-
|
|
825
|
+
get uploadCollection(): TypedCollection<typeof uploadEntrySchema>;
|
|
826
|
+
destroyCtxCallback(): void;
|
|
886
827
|
disconnectedCallback(): void;
|
|
887
828
|
connectedCallback(): void;
|
|
829
|
+
destroyCallback(): void;
|
|
888
830
|
private _initCtxOwner;
|
|
889
831
|
private _observeUploadCollection;
|
|
890
832
|
private _unobserveUploadCollection;
|
|
@@ -893,17 +835,13 @@ declare class LitUploaderBlock extends LitActivityBlock {
|
|
|
893
835
|
private _handleCollectionUpdate;
|
|
894
836
|
private _handleCollectionPropertiesUpdate;
|
|
895
837
|
private _flushCommonUploadProgress;
|
|
896
|
-
|
|
897
|
-
private
|
|
838
|
+
openCloudImageEditor(): void;
|
|
839
|
+
private setInitialCrop;
|
|
898
840
|
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
899
841
|
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
900
842
|
getOutputData(): OutputFileEntry[];
|
|
901
843
|
}
|
|
902
844
|
|
|
903
|
-
/**
|
|
904
|
-
* Mapping of loading resources per operation
|
|
905
|
-
*/
|
|
906
|
-
type LoadingOperations = Map<string, Map<string, boolean>>;
|
|
907
845
|
/**
|
|
908
846
|
* Image size
|
|
909
847
|
*/
|
|
@@ -939,18 +877,21 @@ interface CropAspectRatio {
|
|
|
939
877
|
id: string;
|
|
940
878
|
hasFreeform?: boolean;
|
|
941
879
|
}
|
|
942
|
-
type CropPresetList = CropAspectRatio[];
|
|
943
880
|
|
|
944
|
-
type ActivityParams = {
|
|
881
|
+
type ActivityParams$1 = {
|
|
945
882
|
internalId: string;
|
|
946
883
|
};
|
|
947
884
|
|
|
885
|
+
type ActivityParams = {
|
|
886
|
+
externalSourceType: string;
|
|
887
|
+
};
|
|
888
|
+
|
|
948
889
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
949
890
|
type ActivityParamsMap = {
|
|
950
|
-
'cloud-image-edit': ActivityParams;
|
|
951
|
-
external: ActivityParams
|
|
891
|
+
'cloud-image-edit': ActivityParams$1;
|
|
892
|
+
external: ActivityParams;
|
|
952
893
|
};
|
|
953
|
-
declare class
|
|
894
|
+
declare class ActivityBlock extends Block {
|
|
954
895
|
protected historyTracked: boolean;
|
|
955
896
|
private [ACTIVE_PROP]?;
|
|
956
897
|
init$: {
|
|
@@ -960,7 +901,9 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
960
901
|
'*historyBack': null;
|
|
961
902
|
'*closeModal': () => void;
|
|
962
903
|
};
|
|
963
|
-
|
|
904
|
+
_debouncedHistoryFlush: (() => void) & {
|
|
905
|
+
cancel: () => void;
|
|
906
|
+
};
|
|
964
907
|
private _deactivate;
|
|
965
908
|
private _activate;
|
|
966
909
|
initCallback(): void;
|
|
@@ -976,23 +919,46 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
976
919
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
977
920
|
EXTERNAL: 'external';
|
|
978
921
|
}>;
|
|
979
|
-
|
|
922
|
+
get isActivityActive(): boolean;
|
|
980
923
|
get couldOpenActivity(): boolean;
|
|
981
924
|
/** TODO: remove name argument */
|
|
982
|
-
|
|
925
|
+
registerActivity(_name: string, options?: {
|
|
983
926
|
onActivate?: () => void;
|
|
984
927
|
onDeactivate?: () => void;
|
|
985
928
|
}): void;
|
|
986
|
-
|
|
987
|
-
|
|
929
|
+
unregisterActivity(): void;
|
|
930
|
+
destroyCallback(): void;
|
|
931
|
+
get activityKey(): string;
|
|
988
932
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
989
|
-
get initActivity(): string
|
|
990
|
-
get doneActivity(): string
|
|
933
|
+
get initActivity(): string;
|
|
934
|
+
get doneActivity(): string;
|
|
991
935
|
historyBack(): void;
|
|
992
936
|
}
|
|
993
|
-
type RegisteredActivityType = (typeof
|
|
937
|
+
type RegisteredActivityType = (typeof ActivityBlock)['activities'][keyof (typeof ActivityBlock)['activities']];
|
|
994
938
|
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
995
939
|
|
|
940
|
+
declare class Modal extends Block {
|
|
941
|
+
static styleAttrs: string[];
|
|
942
|
+
static StateConsumerScope: string;
|
|
943
|
+
private _mouseDownTarget;
|
|
944
|
+
handleModalOpen: ModalCb;
|
|
945
|
+
handleModalClose: ModalCb;
|
|
946
|
+
handleModalCloseAll: ModalCb;
|
|
947
|
+
constructor();
|
|
948
|
+
_handleBackdropClick: () => void;
|
|
949
|
+
_closeDialog: () => void;
|
|
950
|
+
_handleDialogClose: () => void;
|
|
951
|
+
_handleDialogMouseDown: (e: MouseEvent) => void;
|
|
952
|
+
_handleDialogMouseUp: (e: MouseEvent) => void;
|
|
953
|
+
show(): void;
|
|
954
|
+
hide(): void;
|
|
955
|
+
private _handleModalOpen;
|
|
956
|
+
private _handleModalClose;
|
|
957
|
+
private _handleModalCloseAll;
|
|
958
|
+
initCallback(): void;
|
|
959
|
+
destroyCallback(): void;
|
|
960
|
+
}
|
|
961
|
+
|
|
996
962
|
declare const ModalEvents: Readonly<{
|
|
997
963
|
readonly ADD: "modal:add";
|
|
998
964
|
readonly DELETE: "modal:delete";
|
|
@@ -1012,7 +978,7 @@ declare class ModalManager {
|
|
|
1012
978
|
private _activeModals;
|
|
1013
979
|
private _subscribers;
|
|
1014
980
|
private _block;
|
|
1015
|
-
constructor(block:
|
|
981
|
+
constructor(block: Block);
|
|
1016
982
|
private _debugPrint;
|
|
1017
983
|
/**
|
|
1018
984
|
* Register a modal with the manager
|
|
@@ -1047,6 +1013,95 @@ declare class ModalManager {
|
|
|
1047
1013
|
destroy(): void;
|
|
1048
1014
|
}
|
|
1049
1015
|
|
|
1016
|
+
declare const InternalEventType: Readonly<{
|
|
1017
|
+
readonly INIT_SOLUTION: "init-solution";
|
|
1018
|
+
readonly CHANGE_CONFIG: "change-config";
|
|
1019
|
+
readonly ACTION_EVENT: "action-event";
|
|
1020
|
+
readonly ERROR_EVENT: "error-event";
|
|
1021
|
+
}>;
|
|
1022
|
+
declare const EventType: Readonly<{
|
|
1023
|
+
readonly FILE_ADDED: "file-added";
|
|
1024
|
+
readonly FILE_REMOVED: "file-removed";
|
|
1025
|
+
readonly FILE_UPLOAD_START: "file-upload-start";
|
|
1026
|
+
readonly FILE_UPLOAD_PROGRESS: "file-upload-progress";
|
|
1027
|
+
readonly FILE_UPLOAD_SUCCESS: "file-upload-success";
|
|
1028
|
+
readonly FILE_UPLOAD_FAILED: "file-upload-failed";
|
|
1029
|
+
readonly FILE_URL_CHANGED: "file-url-changed";
|
|
1030
|
+
readonly MODAL_OPEN: "modal-open";
|
|
1031
|
+
readonly MODAL_CLOSE: "modal-close";
|
|
1032
|
+
readonly DONE_CLICK: "done-click";
|
|
1033
|
+
readonly UPLOAD_CLICK: "upload-click";
|
|
1034
|
+
readonly ACTIVITY_CHANGE: "activity-change";
|
|
1035
|
+
readonly COMMON_UPLOAD_START: "common-upload-start";
|
|
1036
|
+
readonly COMMON_UPLOAD_PROGRESS: "common-upload-progress";
|
|
1037
|
+
readonly COMMON_UPLOAD_SUCCESS: "common-upload-success";
|
|
1038
|
+
readonly COMMON_UPLOAD_FAILED: "common-upload-failed";
|
|
1039
|
+
readonly CHANGE: "change";
|
|
1040
|
+
readonly GROUP_CREATED: "group-created";
|
|
1041
|
+
}>;
|
|
1042
|
+
type EventKey = (typeof EventType)[keyof typeof EventType];
|
|
1043
|
+
type InternalEventKey = (typeof InternalEventType)[keyof typeof InternalEventType];
|
|
1044
|
+
type EventPayload = {
|
|
1045
|
+
[EventType.FILE_ADDED]: OutputFileEntry<'idle'>;
|
|
1046
|
+
[EventType.FILE_REMOVED]: OutputFileEntry<'removed'>;
|
|
1047
|
+
[EventType.FILE_UPLOAD_START]: OutputFileEntry<'uploading'>;
|
|
1048
|
+
[EventType.FILE_UPLOAD_PROGRESS]: OutputFileEntry<'uploading'>;
|
|
1049
|
+
[EventType.FILE_UPLOAD_SUCCESS]: OutputFileEntry<'success'>;
|
|
1050
|
+
[EventType.FILE_UPLOAD_FAILED]: OutputFileEntry<'failed'>;
|
|
1051
|
+
[EventType.FILE_URL_CHANGED]: OutputFileEntry<'success'>;
|
|
1052
|
+
[EventType.MODAL_OPEN]: {
|
|
1053
|
+
modalId: ModalId;
|
|
1054
|
+
};
|
|
1055
|
+
[EventType.MODAL_CLOSE]: {
|
|
1056
|
+
modalId: ModalId;
|
|
1057
|
+
hasActiveModals: boolean;
|
|
1058
|
+
};
|
|
1059
|
+
[EventType.ACTIVITY_CHANGE]: {
|
|
1060
|
+
activity: ActivityType;
|
|
1061
|
+
};
|
|
1062
|
+
[EventType.UPLOAD_CLICK]: void;
|
|
1063
|
+
[EventType.DONE_CLICK]: OutputCollectionState;
|
|
1064
|
+
[EventType.COMMON_UPLOAD_START]: OutputCollectionState<'uploading'>;
|
|
1065
|
+
[EventType.COMMON_UPLOAD_PROGRESS]: OutputCollectionState<'uploading'>;
|
|
1066
|
+
[EventType.COMMON_UPLOAD_SUCCESS]: OutputCollectionState<'success'>;
|
|
1067
|
+
[EventType.COMMON_UPLOAD_FAILED]: OutputCollectionState<'failed'>;
|
|
1068
|
+
[EventType.CHANGE]: OutputCollectionState;
|
|
1069
|
+
[EventType.GROUP_CREATED]: OutputCollectionState<'success', 'has-group'>;
|
|
1070
|
+
};
|
|
1071
|
+
declare class EventEmitter {
|
|
1072
|
+
private _timeoutStore;
|
|
1073
|
+
private _targets;
|
|
1074
|
+
private _debugPrint;
|
|
1075
|
+
constructor(debugPrint: (...args: unknown[]) => void);
|
|
1076
|
+
bindTarget(target: Block): void;
|
|
1077
|
+
unbindTarget(target: Block): void;
|
|
1078
|
+
private _dispatch;
|
|
1079
|
+
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1080
|
+
debounce?: TDebounce;
|
|
1081
|
+
}): void;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
declare class A11y {
|
|
1085
|
+
private _destroyKeyUX;
|
|
1086
|
+
private readonly _scopedWindow;
|
|
1087
|
+
constructor();
|
|
1088
|
+
registerBlock(scope: Block): void;
|
|
1089
|
+
destroy(): void;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
type LocaleChangeCallback = () => void;
|
|
1093
|
+
declare class LocaleManager {
|
|
1094
|
+
private _blockInstance;
|
|
1095
|
+
private _localeName;
|
|
1096
|
+
private _callbacks;
|
|
1097
|
+
private _boundBlocks;
|
|
1098
|
+
constructor(blockInstance: Block);
|
|
1099
|
+
onLocaleChange(callback: LocaleChangeCallback): () => void;
|
|
1100
|
+
bindL10n(block: Block, key: string, resolver: LocaleChangeCallback): void;
|
|
1101
|
+
destroyL10nBindings(block: Block): void;
|
|
1102
|
+
destroy(): void;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1050
1105
|
type CommonEventType = InternalEventKey | EventKey;
|
|
1051
1106
|
type TelemetryState = TelemetryRequest & {
|
|
1052
1107
|
eventTimestamp: number;
|
|
@@ -1056,289 +1111,97 @@ type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> &
|
|
|
1056
1111
|
modalId?: string;
|
|
1057
1112
|
eventType?: CommonEventType;
|
|
1058
1113
|
};
|
|
1059
|
-
|
|
1114
|
+
declare class TelemetryManager {
|
|
1115
|
+
private readonly _sessionId;
|
|
1116
|
+
private readonly _telemetryInstance;
|
|
1117
|
+
private readonly _block;
|
|
1118
|
+
private _config;
|
|
1119
|
+
private _initialized;
|
|
1120
|
+
private _lastPayload;
|
|
1121
|
+
private readonly _queue;
|
|
1122
|
+
constructor(block: Block);
|
|
1123
|
+
private _init;
|
|
1124
|
+
private _setConfig;
|
|
1125
|
+
private _formattingPayload;
|
|
1126
|
+
private _excludedEvents;
|
|
1060
1127
|
sendEvent(body: TelemetryEventBody): void;
|
|
1061
1128
|
sendEventError(error: unknown, context?: string): void;
|
|
1129
|
+
/**
|
|
1130
|
+
* Method to send telemetry event for Cloud Image Editor.
|
|
1131
|
+
*/
|
|
1062
1132
|
sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
|
|
1133
|
+
/**
|
|
1134
|
+
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
1135
|
+
*/
|
|
1136
|
+
private _checkObj;
|
|
1137
|
+
private get _timestamp();
|
|
1138
|
+
private get _solution();
|
|
1139
|
+
private get _activity();
|
|
1140
|
+
private get _location();
|
|
1063
1141
|
}
|
|
1064
1142
|
|
|
1065
|
-
declare
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
|
|
1072
|
-
type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
|
|
1073
|
-
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"];
|
|
1074
|
-
type FilterId = (typeof ALL_FILTERS)[number];
|
|
1075
|
-
declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
|
|
1076
|
-
type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
|
|
1077
|
-
/** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
|
|
1078
|
-
declare const COLOR_OPERATIONS_CONFIG: Readonly<{
|
|
1079
|
-
brightness: {
|
|
1080
|
-
zero: number;
|
|
1081
|
-
range: readonly [-100, 100];
|
|
1082
|
-
keypointsNumber: number;
|
|
1083
|
-
};
|
|
1084
|
-
exposure: {
|
|
1085
|
-
zero: number;
|
|
1086
|
-
range: readonly [-500, 500];
|
|
1087
|
-
keypointsNumber: number;
|
|
1088
|
-
};
|
|
1089
|
-
gamma: {
|
|
1090
|
-
zero: number;
|
|
1091
|
-
range: readonly [0, 1000];
|
|
1092
|
-
keypointsNumber: number;
|
|
1093
|
-
};
|
|
1094
|
-
contrast: {
|
|
1095
|
-
zero: number;
|
|
1096
|
-
range: readonly [-100, 500];
|
|
1097
|
-
keypointsNumber: number;
|
|
1098
|
-
};
|
|
1099
|
-
saturation: {
|
|
1100
|
-
zero: number;
|
|
1101
|
-
range: readonly [-100, 500];
|
|
1102
|
-
keypointsNumber: number;
|
|
1103
|
-
};
|
|
1104
|
-
vibrance: {
|
|
1105
|
-
zero: number;
|
|
1106
|
-
range: readonly [-100, 500];
|
|
1107
|
-
keypointsNumber: number;
|
|
1108
|
-
};
|
|
1109
|
-
warmth: {
|
|
1110
|
-
zero: number;
|
|
1111
|
-
range: readonly [-100, 100];
|
|
1112
|
-
keypointsNumber: number;
|
|
1113
|
-
};
|
|
1114
|
-
enhance: {
|
|
1115
|
-
zero: number;
|
|
1116
|
-
range: readonly [0, 100];
|
|
1117
|
-
keypointsNumber: number;
|
|
1118
|
-
};
|
|
1119
|
-
filter: {
|
|
1120
|
-
zero: number;
|
|
1121
|
-
range: readonly [0, 100];
|
|
1122
|
-
keypointsNumber: number;
|
|
1123
|
-
};
|
|
1124
|
-
}>;
|
|
1125
|
-
|
|
1126
|
-
type SharedConfigState = {
|
|
1127
|
-
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
1128
|
-
};
|
|
1129
|
-
type BlocksRegistry = Set<LitBlock>;
|
|
1130
|
-
type ActivityBlockCtxState = {
|
|
1131
|
-
'*currentActivity': string | null;
|
|
1132
|
-
'*currentActivityParams': Record<string, unknown>;
|
|
1133
|
-
'*history': (string | null)[];
|
|
1134
|
-
'*historyBack': (() => void) | null;
|
|
1135
|
-
'*closeModal': () => void;
|
|
1136
|
-
};
|
|
1137
|
-
type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
1138
|
-
'*commonProgress': number;
|
|
1139
|
-
'*uploadList': {
|
|
1140
|
-
uid: Uid;
|
|
1141
|
-
}[];
|
|
1142
|
-
'*uploadQueue': Queue;
|
|
1143
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1144
|
-
'*collectionState': OutputCollectionState | null;
|
|
1145
|
-
'*groupInfo': UploadcareGroup | null;
|
|
1146
|
-
'*uploadTrigger': Set<Uid>;
|
|
1147
|
-
};
|
|
1148
|
-
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
1149
|
-
'*solution': string | null;
|
|
1150
|
-
};
|
|
1151
|
-
type CloudImageEditorState = {
|
|
1152
|
-
'*originalUrl': string | null;
|
|
1153
|
-
'*loadingOperations': LoadingOperations;
|
|
1154
|
-
'*faderEl': EditorImageFader | null;
|
|
1155
|
-
'*cropperEl': EditorImageCropper | null;
|
|
1156
|
-
'*imgEl': HTMLImageElement | null;
|
|
1157
|
-
'*imgContainerEl': HTMLElement | null;
|
|
1158
|
-
'*networkProblems': boolean;
|
|
1159
|
-
'*imageSize': {
|
|
1160
|
-
width: number;
|
|
1161
|
-
height: number;
|
|
1162
|
-
} | null;
|
|
1163
|
-
'*editorTransformations': Transformations;
|
|
1164
|
-
'*cropPresetList': CropPresetList;
|
|
1165
|
-
'*currentAspectRatio': CropAspectRatio | null;
|
|
1166
|
-
'*tabList': readonly TabIdValue$1[];
|
|
1167
|
-
'*tabId': TabIdValue$1;
|
|
1168
|
-
'*on.retryNetwork': () => void;
|
|
1169
|
-
'*on.apply': (transformations: Transformations) => void;
|
|
1170
|
-
'*on.cancel': () => void;
|
|
1171
|
-
};
|
|
1172
|
-
type EditorImageCropperState = {
|
|
1173
|
-
'*padding': number;
|
|
1174
|
-
'*operations': {
|
|
1175
|
-
rotate: number;
|
|
1176
|
-
mirror: boolean;
|
|
1177
|
-
flip: boolean;
|
|
1178
|
-
};
|
|
1179
|
-
'*imageBox': {
|
|
1180
|
-
x: number;
|
|
1181
|
-
y: number;
|
|
1182
|
-
width: number;
|
|
1183
|
-
height: number;
|
|
1184
|
-
};
|
|
1185
|
-
'*cropBox': {
|
|
1186
|
-
x: number;
|
|
1187
|
-
y: number;
|
|
1188
|
-
width: number;
|
|
1189
|
-
height: number;
|
|
1190
|
-
};
|
|
1191
|
-
};
|
|
1192
|
-
type EditorToolbarState = {
|
|
1193
|
-
'*showListAspectRatio': boolean;
|
|
1194
|
-
'*sliderEl': EditorSlider | null;
|
|
1195
|
-
'*showSlider': boolean;
|
|
1196
|
-
'*currentFilter': string;
|
|
1197
|
-
'*currentOperation': string | null;
|
|
1198
|
-
'*operationTooltip': string | null;
|
|
1199
|
-
};
|
|
1200
|
-
type DynamicBlockState = {
|
|
1201
|
-
'*blocksRegistry': BlocksRegistry;
|
|
1202
|
-
'*eventEmitter': EventEmitter;
|
|
1203
|
-
'*localeManager': LocaleManager;
|
|
1204
|
-
'*telemetryManager': ITelemetryManager;
|
|
1205
|
-
'*a11y': A11y;
|
|
1206
|
-
'*modalManager': ModalManager | null;
|
|
1207
|
-
};
|
|
1208
|
-
type DynamicUploaderBlockState = {
|
|
1209
|
-
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
1210
|
-
'*publicApi': UploaderPublicApi;
|
|
1211
|
-
'*validationManager': ValidationManager;
|
|
1212
|
-
'*secureUploadsManager': SecureUploadsManager;
|
|
1213
|
-
};
|
|
1214
|
-
type LocaleState = {
|
|
1215
|
-
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
1216
|
-
};
|
|
1217
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
1218
|
-
|
|
1219
|
-
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
1220
|
-
willYield: boolean;
|
|
1221
|
-
yield(slot: string, defaultContent?: unknown): unknown;
|
|
1222
|
-
}> & Constructor<{
|
|
1223
|
-
getCssData(propName: string, silentCheck?: boolean): string | number | boolean | null | undefined;
|
|
1224
|
-
}> & Constructor<SymbioteComponent<SharedState>> & Constructor<LitElement> & {
|
|
1225
|
-
reg(tagName: string): void;
|
|
1226
|
-
};
|
|
1227
|
-
declare class LitBlock extends LitBlockBase {
|
|
1228
|
-
private _cfgProxy;
|
|
1229
|
-
private _sharedContextInstances;
|
|
1143
|
+
declare class Block extends BaseComponent<any> {
|
|
1144
|
+
private __cfgProxy?;
|
|
1145
|
+
protected l10nProcessorSubs: Map<string, Set<{
|
|
1146
|
+
remove: () => void;
|
|
1147
|
+
}>>;
|
|
1148
|
+
static StateConsumerScope: string | null;
|
|
1230
1149
|
static styleAttrs: string[];
|
|
1150
|
+
protected requireCtxName: boolean;
|
|
1231
1151
|
activityType: ActivityType;
|
|
1232
1152
|
init$: {};
|
|
1233
|
-
constructor();
|
|
1234
1153
|
l10n(str: string, variables?: Record<string, string | number>): string;
|
|
1235
|
-
private
|
|
1154
|
+
private pluralize;
|
|
1155
|
+
protected bindL10n(key: string, resolver: () => void): void;
|
|
1156
|
+
constructor();
|
|
1236
1157
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
1237
|
-
hasBlockInCtx(callback: (block:
|
|
1158
|
+
hasBlockInCtx(callback: (block: Block) => boolean): boolean;
|
|
1159
|
+
setOrAddState(prop: string, newVal: any): void;
|
|
1238
1160
|
connectedCallback(): void;
|
|
1161
|
+
disconnectedCallback(): void;
|
|
1239
1162
|
initCallback(): void;
|
|
1240
1163
|
get testId(): string;
|
|
1241
|
-
get modalManager(): ModalManager |
|
|
1242
|
-
get telemetryManager():
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1164
|
+
get modalManager(): ModalManager | undefined;
|
|
1165
|
+
get telemetryManager(): TelemetryManager | {
|
|
1166
|
+
sendEvent: () => void;
|
|
1167
|
+
sendEventCloudImageEditor: () => void;
|
|
1168
|
+
sendEventError: () => void;
|
|
1169
|
+
};
|
|
1170
|
+
protected get localeManager(): LocaleManager | null;
|
|
1171
|
+
protected get a11y(): A11y | null;
|
|
1172
|
+
protected get blocksRegistry(): Set<Block>;
|
|
1173
|
+
destroyCallback(): void;
|
|
1248
1174
|
/**
|
|
1249
1175
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
1250
1176
|
*/
|
|
1251
1177
|
protected destroyCtxCallback(): void;
|
|
1252
|
-
/**
|
|
1253
|
-
* Adds a shared context instance if it does not exist yet.
|
|
1254
|
-
* @param key The shared state key.
|
|
1255
|
-
* @param resolver The resolver function that creates the instance.
|
|
1256
|
-
* @param persist Whether to persist the instance in the context if the creator block is removed. It's usually needed for those instances that depends on the current block. Defaults to false.
|
|
1257
|
-
*/
|
|
1258
|
-
protected addSharedContextInstance<TKey extends keyof SharedState>(key: TKey, resolver: () => SharedState[TKey], { persist }?: {
|
|
1259
|
-
persist?: boolean | undefined;
|
|
1260
|
-
}): void;
|
|
1261
|
-
private _destroySharedContextInstances;
|
|
1262
|
-
protected getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
1263
1178
|
protected proxyUrl(url: string): Promise<string>;
|
|
1264
1179
|
get cfg(): ConfigType;
|
|
1265
|
-
subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void):
|
|
1180
|
+
subConfigValue<T extends keyof ConfigType>(key: T, callback: (value: ConfigType[T]) => void): void;
|
|
1266
1181
|
debugPrint(...args: unknown[]): void;
|
|
1182
|
+
static reg(name?: string): void;
|
|
1267
1183
|
}
|
|
1268
1184
|
|
|
1269
|
-
declare
|
|
1270
|
-
'*originalUrl': null;
|
|
1271
|
-
'*loadingOperations': LoadingOperations;
|
|
1272
|
-
'*faderEl': null;
|
|
1273
|
-
'*cropperEl': null;
|
|
1274
|
-
'*imgEl': null;
|
|
1275
|
-
'*imgContainerEl': null;
|
|
1276
|
-
'*networkProblems': boolean;
|
|
1277
|
-
'*imageSize': null;
|
|
1278
|
-
'*editorTransformations': {};
|
|
1279
|
-
'*cropPresetList': never[];
|
|
1280
|
-
'*currentAspectRatio': null;
|
|
1281
|
-
'*tabList': readonly ["crop", "tuning", "filters"];
|
|
1282
|
-
'*tabId': "crop";
|
|
1283
|
-
'*on.retryNetwork': () => void;
|
|
1284
|
-
'*on.apply': (transformations: Transformations) => void;
|
|
1285
|
-
'*on.cancel': () => void;
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
declare class CloudImageEditorBlock extends LitBlock {
|
|
1289
|
-
attributesMeta: ({
|
|
1290
|
-
uuid: string;
|
|
1291
|
-
} | {
|
|
1292
|
-
'cdn-url': string;
|
|
1293
|
-
}) & Partial<{
|
|
1294
|
-
tabs: string;
|
|
1295
|
-
'crop-preset': string;
|
|
1296
|
-
}> & {
|
|
1297
|
-
'ctx-name': string;
|
|
1298
|
-
};
|
|
1185
|
+
declare class CloudImageEditorBlock extends Block {
|
|
1299
1186
|
ctxOwner: boolean;
|
|
1300
1187
|
static styleAttrs: string[];
|
|
1301
|
-
private
|
|
1302
|
-
|
|
1303
|
-
private _fileType;
|
|
1188
|
+
private _debouncedShowLoader;
|
|
1189
|
+
constructor();
|
|
1304
1190
|
private _showLoader;
|
|
1305
|
-
uuid: string | null;
|
|
1306
|
-
cdnUrl: string | null;
|
|
1307
|
-
cropPreset: string;
|
|
1308
|
-
tabs: string | null;
|
|
1309
|
-
private _hasNetworkProblems;
|
|
1310
|
-
private _isInitialized;
|
|
1311
|
-
private _pendingInitUpdate;
|
|
1312
|
-
private readonly _debouncedShowLoader;
|
|
1313
|
-
private readonly _imgRef;
|
|
1314
|
-
private readonly _cropperRef;
|
|
1315
|
-
private readonly _faderRef;
|
|
1316
|
-
private readonly _imgContainerRef;
|
|
1317
|
-
private readonly _handleImageLoad;
|
|
1318
|
-
private readonly _handleImageError;
|
|
1319
|
-
private readonly _handleRetryNetwork;
|
|
1320
|
-
private _scheduleInitialization;
|
|
1321
|
-
init$: ReturnType<typeof initState>;
|
|
1322
|
-
initCallback(): void;
|
|
1323
|
-
private _assignSharedElements;
|
|
1324
|
-
private _attachImageListeners;
|
|
1325
|
-
private _detachImageListeners;
|
|
1326
|
-
private get _imageClassName();
|
|
1327
1191
|
/**
|
|
1328
1192
|
* To proper work, we need non-zero size the element. So, we'll wait for it.
|
|
1329
1193
|
*/
|
|
1330
1194
|
private _waitForSize;
|
|
1331
|
-
|
|
1332
|
-
disconnectedCallback(): void;
|
|
1333
|
-
render(): lit_html.TemplateResult<1>;
|
|
1334
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1335
|
-
private _syncTabListFromProp;
|
|
1336
|
-
private _syncCropPresetState;
|
|
1195
|
+
initCallback(): void;
|
|
1337
1196
|
updateImage(): Promise<void>;
|
|
1338
1197
|
initEditor(): Promise<void>;
|
|
1339
1198
|
}
|
|
1340
1199
|
|
|
1341
|
-
declare class CropFrame extends
|
|
1200
|
+
declare class CropFrame extends Block {
|
|
1201
|
+
private readonly _handlePointerUp;
|
|
1202
|
+
private readonly _handlePointerMove;
|
|
1203
|
+
private readonly _handleSvgPointerMove;
|
|
1204
|
+
private readonly _backdropMaskId;
|
|
1342
1205
|
private _backdropMask?;
|
|
1343
1206
|
private _backdropMaskInner?;
|
|
1344
1207
|
private _frameThumbs?;
|
|
@@ -1349,14 +1212,7 @@ declare class CropFrame extends LitBlock {
|
|
|
1349
1212
|
private _dragStartCrop?;
|
|
1350
1213
|
private _frameImage?;
|
|
1351
1214
|
private _guidesHidden;
|
|
1352
|
-
|
|
1353
|
-
private readonly _svgRef;
|
|
1354
|
-
private _svgReady;
|
|
1355
|
-
private _pendingMaskHref;
|
|
1356
|
-
private get _svgElement();
|
|
1357
|
-
private get _dragging();
|
|
1358
|
-
private set _dragging(value);
|
|
1359
|
-
private _applyGuidesDragState;
|
|
1215
|
+
constructor();
|
|
1360
1216
|
private _shouldThumbBeDisabled;
|
|
1361
1217
|
private _createBackdrop;
|
|
1362
1218
|
/**
|
|
@@ -1371,56 +1227,103 @@ declare class CropFrame extends LitBlock {
|
|
|
1371
1227
|
private _createGuides;
|
|
1372
1228
|
private _createFrame;
|
|
1373
1229
|
private _handlePointerDown;
|
|
1374
|
-
private
|
|
1375
|
-
private
|
|
1230
|
+
private _handlePointerUp_;
|
|
1231
|
+
private _handlePointerMove_;
|
|
1376
1232
|
private _calcCropBox;
|
|
1377
|
-
private
|
|
1233
|
+
private _handleSvgPointerMove_;
|
|
1378
1234
|
private _updateCursor;
|
|
1379
1235
|
private _createMask;
|
|
1380
1236
|
private _updateMask;
|
|
1381
1237
|
private _render;
|
|
1382
1238
|
toggleThumbs(visible: boolean): void;
|
|
1383
1239
|
initCallback(): void;
|
|
1384
|
-
|
|
1385
|
-
private _initializeSvg;
|
|
1386
|
-
disconnectedCallback(): void;
|
|
1387
|
-
render(): TemplateResult;
|
|
1240
|
+
destroyCallback(): void;
|
|
1388
1241
|
}
|
|
1389
1242
|
|
|
1390
|
-
declare class EditorButtonControl extends
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
protected titleProp: string;
|
|
1395
|
-
protected get buttonClasses(): Record<string, boolean>;
|
|
1396
|
-
private _updateHostStateClasses;
|
|
1397
|
-
protected onClick(_event: MouseEvent): void;
|
|
1398
|
-
connectedCallback(): void;
|
|
1399
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1400
|
-
render(): lit_html.TemplateResult<1>;
|
|
1243
|
+
declare class EditorButtonControl extends Block {
|
|
1244
|
+
private _titleEl?;
|
|
1245
|
+
constructor();
|
|
1246
|
+
initCallback(): void;
|
|
1401
1247
|
}
|
|
1402
1248
|
|
|
1403
1249
|
declare class EditorFreeformButtonControl extends EditorButtonControl {
|
|
1404
1250
|
initCallback(): void;
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1251
|
+
handleClick(): void;
|
|
1252
|
+
}
|
|
1253
|
+
interface EditorAspectRatioButtonControl {
|
|
1254
|
+
get aspectRatio(): CropAspectRatio | undefined;
|
|
1255
|
+
set aspectRatio(value: CropAspectRatio | undefined);
|
|
1408
1256
|
}
|
|
1409
1257
|
declare class EditorAspectRatioButtonControl extends EditorButtonControl {
|
|
1410
|
-
|
|
1411
|
-
get aspectRatio(): CropAspectRatio | null;
|
|
1412
|
-
set aspectRatio(value: CropAspectRatio | null);
|
|
1258
|
+
constructor();
|
|
1413
1259
|
initCallback(): void;
|
|
1414
|
-
|
|
1415
|
-
private
|
|
1416
|
-
private
|
|
1417
|
-
render(): lit_html.TemplateResult<1>;
|
|
1260
|
+
handleClick(): void;
|
|
1261
|
+
private _renderRectBasedOnAspectRatio;
|
|
1262
|
+
private _aspectRatio?;
|
|
1418
1263
|
}
|
|
1419
1264
|
|
|
1265
|
+
declare const ALL_COLOR_OPERATIONS: readonly ["brightness", "exposure", "gamma", "contrast", "saturation", "vibrance", "warmth", "enhance"];
|
|
1266
|
+
type ColorOperation = (typeof ALL_COLOR_OPERATIONS)[number];
|
|
1267
|
+
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"];
|
|
1268
|
+
type FilterId = (typeof ALL_FILTERS)[number];
|
|
1269
|
+
declare const ALL_CROP_OPERATIONS: readonly ["rotate", "mirror", "flip"];
|
|
1270
|
+
type CropOperation = (typeof ALL_CROP_OPERATIONS)[number];
|
|
1271
|
+
/** KeypointsNumber is the number of keypoints loaded from each side of zero, not total number */
|
|
1272
|
+
declare const COLOR_OPERATIONS_CONFIG: Readonly<{
|
|
1273
|
+
brightness: {
|
|
1274
|
+
zero: number;
|
|
1275
|
+
range: readonly [-100, 100];
|
|
1276
|
+
keypointsNumber: number;
|
|
1277
|
+
};
|
|
1278
|
+
exposure: {
|
|
1279
|
+
zero: number;
|
|
1280
|
+
range: readonly [-500, 500];
|
|
1281
|
+
keypointsNumber: number;
|
|
1282
|
+
};
|
|
1283
|
+
gamma: {
|
|
1284
|
+
zero: number;
|
|
1285
|
+
range: readonly [0, 1000];
|
|
1286
|
+
keypointsNumber: number;
|
|
1287
|
+
};
|
|
1288
|
+
contrast: {
|
|
1289
|
+
zero: number;
|
|
1290
|
+
range: readonly [-100, 500];
|
|
1291
|
+
keypointsNumber: number;
|
|
1292
|
+
};
|
|
1293
|
+
saturation: {
|
|
1294
|
+
zero: number;
|
|
1295
|
+
range: readonly [-100, 500];
|
|
1296
|
+
keypointsNumber: number;
|
|
1297
|
+
};
|
|
1298
|
+
vibrance: {
|
|
1299
|
+
zero: number;
|
|
1300
|
+
range: readonly [-100, 500];
|
|
1301
|
+
keypointsNumber: number;
|
|
1302
|
+
};
|
|
1303
|
+
warmth: {
|
|
1304
|
+
zero: number;
|
|
1305
|
+
range: readonly [-100, 100];
|
|
1306
|
+
keypointsNumber: number;
|
|
1307
|
+
};
|
|
1308
|
+
enhance: {
|
|
1309
|
+
zero: number;
|
|
1310
|
+
range: readonly [0, 100];
|
|
1311
|
+
keypointsNumber: number;
|
|
1312
|
+
};
|
|
1313
|
+
filter: {
|
|
1314
|
+
zero: number;
|
|
1315
|
+
range: readonly [0, 100];
|
|
1316
|
+
keypointsNumber: number;
|
|
1317
|
+
};
|
|
1318
|
+
}>;
|
|
1319
|
+
|
|
1320
|
+
interface EditorCropButtonControl {
|
|
1321
|
+
get operation(): CropOperation | undefined;
|
|
1322
|
+
set operation(value: CropOperation | undefined);
|
|
1323
|
+
}
|
|
1420
1324
|
declare class EditorCropButtonControl extends EditorButtonControl {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
protected onClick(e: MouseEvent): void;
|
|
1325
|
+
private _operation;
|
|
1326
|
+
initCallback(): void;
|
|
1424
1327
|
}
|
|
1425
1328
|
|
|
1426
1329
|
declare class EditorFilterControl extends EditorButtonControl {
|
|
@@ -1429,27 +1332,11 @@ declare class EditorFilterControl extends EditorButtonControl {
|
|
|
1429
1332
|
private _originalUrl;
|
|
1430
1333
|
private _observer?;
|
|
1431
1334
|
private _cancelPreload?;
|
|
1432
|
-
|
|
1433
|
-
private _previewVisibilityCheckRaf?;
|
|
1434
|
-
private _previewVisibilityCheckTimeout?;
|
|
1435
|
-
private _previewImage;
|
|
1436
|
-
private _previewLoaded;
|
|
1437
|
-
isOriginal: boolean;
|
|
1438
|
-
private _iconSize;
|
|
1439
|
-
get filter(): string;
|
|
1440
|
-
set filter(value: string);
|
|
1441
|
-
onClick(e: MouseEvent): void;
|
|
1335
|
+
constructor();
|
|
1442
1336
|
private _previewSrc;
|
|
1443
1337
|
private _observerCallback;
|
|
1444
1338
|
initCallback(): void;
|
|
1445
|
-
|
|
1446
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1447
|
-
private _updateFilterLabels;
|
|
1448
|
-
private _loadPreview;
|
|
1449
|
-
private _schedulePreviewVisibilityCheck;
|
|
1450
|
-
private _clearPreviewVisibilityChecks;
|
|
1451
|
-
private get _shouldShowPreview();
|
|
1452
|
-
render(): lit_html.TemplateResult<1>;
|
|
1339
|
+
destroyCallback(): void;
|
|
1453
1340
|
}
|
|
1454
1341
|
|
|
1455
1342
|
type Operations = {
|
|
@@ -1457,7 +1344,7 @@ type Operations = {
|
|
|
1457
1344
|
mirror: boolean;
|
|
1458
1345
|
rotate: number;
|
|
1459
1346
|
};
|
|
1460
|
-
declare class EditorImageCropper extends
|
|
1347
|
+
declare class EditorImageCropper extends Block {
|
|
1461
1348
|
ctxOwner: boolean;
|
|
1462
1349
|
private _commitDebounced;
|
|
1463
1350
|
private _handleResizeThrottled;
|
|
@@ -1466,12 +1353,9 @@ declare class EditorImageCropper extends LitBlock {
|
|
|
1466
1353
|
private _ctx;
|
|
1467
1354
|
private _isActive;
|
|
1468
1355
|
private _observer?;
|
|
1469
|
-
private _image;
|
|
1470
1356
|
private _cancelPreload?;
|
|
1471
|
-
private readonly _canvasRef;
|
|
1472
|
-
private readonly _frameRef;
|
|
1473
1357
|
constructor();
|
|
1474
|
-
|
|
1358
|
+
private _handleResize;
|
|
1475
1359
|
private _syncTransformations;
|
|
1476
1360
|
private _initCanvas;
|
|
1477
1361
|
private _alignImage;
|
|
@@ -1496,12 +1380,11 @@ declare class EditorImageCropper extends LitBlock {
|
|
|
1496
1380
|
private _waitForImage;
|
|
1497
1381
|
private _handleImageLoading;
|
|
1498
1382
|
initCallback(): void;
|
|
1499
|
-
|
|
1500
|
-
render(): TemplateResult;
|
|
1383
|
+
destroyCallback(): void;
|
|
1501
1384
|
}
|
|
1502
1385
|
|
|
1503
1386
|
type OperationKey = keyof typeof COLOR_OPERATIONS_CONFIG;
|
|
1504
|
-
declare class EditorImageFader extends
|
|
1387
|
+
declare class EditorImageFader extends Block {
|
|
1505
1388
|
private _isActive;
|
|
1506
1389
|
private _hidden;
|
|
1507
1390
|
private _operation;
|
|
@@ -1509,6 +1392,7 @@ declare class EditorImageFader extends LitBlock {
|
|
|
1509
1392
|
private _value?;
|
|
1510
1393
|
private _transformations;
|
|
1511
1394
|
private _keypoints;
|
|
1395
|
+
private _container?;
|
|
1512
1396
|
private _previewImage?;
|
|
1513
1397
|
private _cancelLastImages?;
|
|
1514
1398
|
private _cancelBatchPreload?;
|
|
@@ -1516,8 +1400,6 @@ declare class EditorImageFader extends LitBlock {
|
|
|
1516
1400
|
private _fromViewer?;
|
|
1517
1401
|
private _raf;
|
|
1518
1402
|
private _addKeypointDebounced;
|
|
1519
|
-
private readonly _previewHostRef;
|
|
1520
|
-
private readonly _layersHostRef;
|
|
1521
1403
|
constructor();
|
|
1522
1404
|
private _handleImageLoading;
|
|
1523
1405
|
private _flush;
|
|
@@ -1527,6 +1409,7 @@ declare class EditorImageFader extends LitBlock {
|
|
|
1527
1409
|
* Check if current operation and filter equals passed ones
|
|
1528
1410
|
*/
|
|
1529
1411
|
private _isSame;
|
|
1412
|
+
private _addKeypoint;
|
|
1530
1413
|
set(value: string | number): void;
|
|
1531
1414
|
private _update;
|
|
1532
1415
|
private _createPreviewImage;
|
|
@@ -1549,195 +1432,111 @@ declare class EditorImageFader extends LitBlock {
|
|
|
1549
1432
|
deactivate({ hide }?: {
|
|
1550
1433
|
hide?: boolean;
|
|
1551
1434
|
}): void;
|
|
1552
|
-
private _ensurePreviewAttached;
|
|
1553
|
-
private _clearLayersHost;
|
|
1554
|
-
render(): TemplateResult;
|
|
1555
1435
|
}
|
|
1556
1436
|
|
|
1557
1437
|
declare class EditorOperationControl extends EditorButtonControl {
|
|
1558
1438
|
private _operation;
|
|
1559
|
-
get operation(): ColorOperation | '';
|
|
1560
|
-
set operation(value: ColorOperation | '');
|
|
1561
|
-
private _updateOperationMetadata;
|
|
1562
1439
|
initCallback(): void;
|
|
1563
|
-
protected onClick(e: MouseEvent): void;
|
|
1564
1440
|
}
|
|
1565
1441
|
|
|
1566
|
-
declare class EditorScroller extends
|
|
1567
|
-
|
|
1568
|
-
connectedCallback(): void;
|
|
1569
|
-
disconnectedCallback(): void;
|
|
1442
|
+
declare class EditorScroller extends Block {
|
|
1443
|
+
initCallback(): void;
|
|
1570
1444
|
}
|
|
1571
1445
|
|
|
1572
1446
|
type SliderOperation = ColorOperation | 'filter';
|
|
1573
1447
|
type SliderFilter = FilterId | typeof FAKE_ORIGINAL_FILTER;
|
|
1574
1448
|
declare const FAKE_ORIGINAL_FILTER = "original";
|
|
1575
|
-
declare class EditorSlider extends
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
disabled: boolean;
|
|
1581
|
-
min: number;
|
|
1582
|
-
max: number;
|
|
1583
|
-
value: number;
|
|
1584
|
-
defaultValue: number;
|
|
1585
|
-
zero: number;
|
|
1586
|
-
};
|
|
1587
|
-
private _handleInput;
|
|
1449
|
+
declare class EditorSlider extends Block {
|
|
1450
|
+
private _operation;
|
|
1451
|
+
private _filter?;
|
|
1452
|
+
private _originalUrl;
|
|
1453
|
+
constructor();
|
|
1588
1454
|
setOperation(operation: SliderOperation, filter?: SliderFilter): void;
|
|
1589
1455
|
private _initializeValues;
|
|
1590
1456
|
apply(): void;
|
|
1591
1457
|
cancel(): void;
|
|
1592
1458
|
initCallback(): void;
|
|
1593
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1594
|
-
render(): lit_html.TemplateResult<1>;
|
|
1595
1459
|
}
|
|
1596
1460
|
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
private _showLoader;
|
|
1600
|
-
showMainToolbar: boolean;
|
|
1601
|
-
showSubToolbar: boolean;
|
|
1602
|
-
private _showTabToggles;
|
|
1603
|
-
tabList: readonly TabIdValue[];
|
|
1604
|
-
activeTab: TabIdValue;
|
|
1605
|
-
private _useSliderPanel;
|
|
1606
|
-
private _tooltipVisible;
|
|
1607
|
-
private _operationTooltip;
|
|
1608
|
-
private _tabIndicatorOffset;
|
|
1609
|
-
private _tabIndicatorWidth;
|
|
1610
|
-
private readonly _sliderRef;
|
|
1611
|
-
private readonly _tabIndicatorRef;
|
|
1612
|
-
protected readonly tabToggleRefs: Record<TabIdValue, Ref<HTMLElement>>;
|
|
1613
|
-
private readonly _handleWindowResize;
|
|
1614
|
-
private _cropPresets;
|
|
1461
|
+
declare class EditorToolbar extends Block {
|
|
1462
|
+
private _debouncedShowLoader;
|
|
1615
1463
|
private _cancelPreload?;
|
|
1616
|
-
private
|
|
1617
|
-
|
|
1618
|
-
private readonly _subTopToolbarStyles;
|
|
1619
|
-
private readonly _subBottomToolbarStyles;
|
|
1620
|
-
private readonly _tabContentStyles;
|
|
1621
|
-
private readonly _tabToggleStyles;
|
|
1622
|
-
private readonly _tabTogglesStyles;
|
|
1623
|
-
init$: Record<string, unknown>;
|
|
1464
|
+
private _updateInfoTooltip;
|
|
1465
|
+
constructor();
|
|
1624
1466
|
private _onSliderClose;
|
|
1467
|
+
private _createOperationControl;
|
|
1468
|
+
private _createFilterControl;
|
|
1469
|
+
private _createToggleControl;
|
|
1470
|
+
private _createAspectRatioControl;
|
|
1471
|
+
private _createFreeformControl;
|
|
1472
|
+
private _clearListAspectRatio;
|
|
1473
|
+
private _renderControlsList;
|
|
1625
1474
|
private _activateTab;
|
|
1626
|
-
private
|
|
1475
|
+
private _unmountTabControls;
|
|
1627
1476
|
private _syncTabIndicator;
|
|
1628
|
-
private get _hasAspectRatioPicker();
|
|
1629
|
-
private _renderControlsByTab;
|
|
1630
|
-
private _renderCropTabControls;
|
|
1631
|
-
private _renderFilterTabControls;
|
|
1632
|
-
private _renderTuningTabControls;
|
|
1633
|
-
private _renderControlGroup;
|
|
1634
|
-
private _renderFreeformControl;
|
|
1635
|
-
private _renderAspectRatioControl;
|
|
1636
|
-
private _renderCropOperationControl;
|
|
1637
|
-
private _renderFilterControl;
|
|
1638
|
-
private _renderOperationControl;
|
|
1639
|
-
private _renderAspectRatioList;
|
|
1640
1477
|
private _preloadEditedImage;
|
|
1478
|
+
private _showLoader;
|
|
1479
|
+
private _updateInfoTooltipHandler;
|
|
1641
1480
|
initCallback(): void;
|
|
1642
|
-
|
|
1643
|
-
firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
1644
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1645
|
-
disconnectedCallback(): void;
|
|
1646
|
-
private _assignSharedElements;
|
|
1647
|
-
private readonly _handleCancel;
|
|
1648
|
-
private readonly _handleApply;
|
|
1649
|
-
private readonly _handleApplySlider;
|
|
1650
|
-
private readonly _handleCancelSlider;
|
|
1651
|
-
private readonly _handleTabClick;
|
|
1652
|
-
private _renderTabToggle;
|
|
1653
|
-
private _renderTabContent;
|
|
1654
|
-
render(): TemplateResult<1>;
|
|
1481
|
+
destroyCallback(): void;
|
|
1655
1482
|
}
|
|
1656
1483
|
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
ariaControls: string;
|
|
1666
|
-
titleProp: string;
|
|
1667
|
-
protected firstUpdated(changed: PropertyValues<this>): void;
|
|
1668
|
-
protected updated(changed: PropertyValues<this>): void;
|
|
1669
|
-
private _applyReverse;
|
|
1670
|
-
private _applyThemeClass;
|
|
1671
|
-
private get _iconClassMap();
|
|
1672
|
-
private get _computedIconHidden();
|
|
1673
|
-
private get _computedIconSingle();
|
|
1674
|
-
render(): lit_html.TemplateResult<1>;
|
|
1484
|
+
declare class BtnUi extends Block {
|
|
1485
|
+
private _iconReversed;
|
|
1486
|
+
private _iconSingle;
|
|
1487
|
+
private _iconHidden;
|
|
1488
|
+
constructor();
|
|
1489
|
+
private _iconCss;
|
|
1490
|
+
initCallback(): void;
|
|
1491
|
+
set reverse(_value: boolean);
|
|
1675
1492
|
}
|
|
1676
1493
|
|
|
1677
|
-
declare class LineLoaderUi extends
|
|
1678
|
-
|
|
1679
|
-
private readonly _lineRef;
|
|
1680
|
-
private _isAnimating;
|
|
1494
|
+
declare class LineLoaderUi extends Block {
|
|
1495
|
+
private _active;
|
|
1681
1496
|
private readonly _handleTransitionEndRight;
|
|
1682
|
-
|
|
1683
|
-
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1497
|
+
initCallback(): void;
|
|
1684
1498
|
private _start;
|
|
1685
1499
|
private _stop;
|
|
1686
|
-
private _resetLine;
|
|
1687
|
-
render(): lit_html.TemplateResult<1>;
|
|
1688
1500
|
}
|
|
1689
1501
|
|
|
1690
|
-
|
|
1691
|
-
transition?: string;
|
|
1692
|
-
visible?: string;
|
|
1693
|
-
hidden?: string;
|
|
1694
|
-
};
|
|
1695
|
-
declare class PresenceToggle extends LitBlock {
|
|
1502
|
+
declare class PresenceToggle extends Block {
|
|
1696
1503
|
private _visible;
|
|
1697
|
-
private _styles;
|
|
1698
1504
|
private _visibleStyle;
|
|
1699
1505
|
private _hiddenStyle;
|
|
1700
1506
|
private _externalTransitions;
|
|
1701
|
-
|
|
1702
|
-
set visible(value: boolean);
|
|
1703
|
-
get visible(): boolean;
|
|
1704
|
-
set styles(styles: PresenceToggleStyle);
|
|
1705
|
-
get styles(): PresenceToggleStyle;
|
|
1507
|
+
constructor();
|
|
1706
1508
|
private _handleVisible;
|
|
1707
|
-
private _dispatchInitialRenderEvent;
|
|
1708
1509
|
initCallback(): void;
|
|
1709
1510
|
}
|
|
1710
1511
|
|
|
1711
|
-
declare class SliderUi extends
|
|
1512
|
+
declare class SliderUi extends Block {
|
|
1712
1513
|
private _observer?;
|
|
1713
1514
|
private _thumbSize;
|
|
1515
|
+
private _zero;
|
|
1714
1516
|
private _zeroDotEl?;
|
|
1715
1517
|
private _stepsCount?;
|
|
1716
|
-
private readonly _inputRef;
|
|
1717
|
-
private readonly _thumbRef;
|
|
1718
|
-
private readonly _stepsRef;
|
|
1719
|
-
disabled: boolean;
|
|
1720
|
-
min: number;
|
|
1721
|
-
max: number;
|
|
1722
|
-
defaultValue: number;
|
|
1723
|
-
zero: number;
|
|
1724
|
-
private _currentValue;
|
|
1725
1518
|
constructor();
|
|
1726
|
-
|
|
1727
|
-
private
|
|
1728
|
-
private
|
|
1729
|
-
private
|
|
1730
|
-
private readonly _handleInputBlur;
|
|
1731
|
-
protected firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
1732
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1519
|
+
initCallback(): void;
|
|
1520
|
+
private _inputEl;
|
|
1521
|
+
private _thumbEl;
|
|
1522
|
+
private _stepsEl;
|
|
1733
1523
|
private _updateValue;
|
|
1734
1524
|
private _updateZeroDot;
|
|
1735
1525
|
private _updateSteps;
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1526
|
+
destroyCallback(): void;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
declare class CloudImageEditor extends CloudImageEditorBlock {
|
|
1530
|
+
static styleAttrs: string[];
|
|
1531
|
+
constructor();
|
|
1532
|
+
initCallback(): void;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
declare function defineComponents(blockExports: Record<string, any>): void;
|
|
1536
|
+
|
|
1537
|
+
declare class Icon extends Block {
|
|
1538
|
+
constructor();
|
|
1539
|
+
initCallback(): void;
|
|
1741
1540
|
}
|
|
1742
1541
|
|
|
1743
1542
|
export { BtnUi, CloudImageEditor, CloudImageEditorBlock, Config, CropFrame, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, Icon, LineLoaderUi, PresenceToggle, SliderUi, defineComponents };
|