@uploadcare/file-uploader 1.28.0-rc.0 → 1.28.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/README.md +2 -1
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +289 -664
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +68 -109
- package/dist/locales/file-uploader/ar.d.ts +3 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +3 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +3 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +3 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +3 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +3 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +3 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +3 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +3 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +3 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +3 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +3 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +3 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +3 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +3 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +3 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +3 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +3 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +3 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +3 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +3 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +3 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +3 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +3 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +3 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +3 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +3 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +3 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +3 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +3 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +3 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +3 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +3 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +3 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +3 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +292 -664
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.iife.min.js.LEGAL.txt +1 -1
- package/web/file-uploader.min.d.ts +292 -664
- package/web/file-uploader.min.js +4 -4
- package/web/file-uploader.min.js.LEGAL.txt +1 -1
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +3 -3
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +244 -616
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +3 -3
- package/web/uc-file-uploader-inline.min.d.ts +292 -664
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.d.ts +292 -664
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +1 -1
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +3 -3
- package/web/uc-file-uploader-regular.min.d.ts +292 -664
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +1 -1
- package/web/uc-img.min.js +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import _default from './locales/file-uploader/en.js';
|
|
|
4
4
|
import * as lit_html from 'lit-html';
|
|
5
5
|
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
6
6
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
7
|
-
import {
|
|
7
|
+
import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
|
|
8
8
|
export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
|
|
9
9
|
import { Ref } from 'lit/directives/ref.js';
|
|
10
10
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
@@ -90,72 +90,8 @@ declare class A11y implements ISharedInstance {
|
|
|
90
90
|
declare class LocaleManager extends SharedInstance {
|
|
91
91
|
private _localeName;
|
|
92
92
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
93
|
-
private _applyOverrides;
|
|
94
|
-
private _applyPluginLocales;
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
/**
|
|
98
|
-
* Custom configuration options registration system for plugins
|
|
99
|
-
*/
|
|
100
|
-
type CustomConfigDefinition<T = unknown> = {
|
|
101
|
-
/**
|
|
102
|
-
* Config option name (will be used as property and optionally as attribute)
|
|
103
|
-
*/
|
|
104
|
-
name: string;
|
|
105
|
-
/**
|
|
106
|
-
* Default value for the config option
|
|
107
|
-
*/
|
|
108
|
-
defaultValue: T;
|
|
109
|
-
/**
|
|
110
|
-
* Whether this config can be set via HTML attribute
|
|
111
|
-
* @default true
|
|
112
|
-
*/
|
|
113
|
-
attribute?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Convert attribute string to config value
|
|
116
|
-
* Only used if attribute is true
|
|
117
|
-
*/
|
|
118
|
-
fromAttribute?: (value: string | null) => T;
|
|
119
|
-
/**
|
|
120
|
-
* Convert config value to attribute string
|
|
121
|
-
* Only used if attribute is true
|
|
122
|
-
*/
|
|
123
|
-
toAttribute?: (value: T) => string | null;
|
|
124
|
-
/**
|
|
125
|
-
* Normalize/validate the config value
|
|
126
|
-
*/
|
|
127
|
-
normalize?: (value: unknown) => T;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Registry for custom config options defined by plugins
|
|
131
|
-
* This is managed by the PluginManager as a shared instance property
|
|
132
|
-
*/
|
|
133
|
-
declare class CustomConfigRegistry {
|
|
134
|
-
private _definitions;
|
|
135
|
-
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
136
|
-
unregister(name: string): void;
|
|
137
|
-
unregisterByPlugin(pluginId: string): void;
|
|
138
|
-
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
139
|
-
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Interface for TypeScript module augmentation
|
|
143
|
-
* Plugins should extend this interface to add their custom config types
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* declare module '@uploadcare/file-uploader' {
|
|
148
|
-
* interface CustomConfig {
|
|
149
|
-
* 'my-custom-option': string;
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
interface CustomConfig {
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
158
|
-
|
|
159
95
|
declare class TypedData<T extends Record<string, unknown>> {
|
|
160
96
|
private _ctxId;
|
|
161
97
|
private _data;
|
|
@@ -168,41 +104,6 @@ declare class TypedData<T extends Record<string, unknown>> {
|
|
|
168
104
|
destroy(): void;
|
|
169
105
|
}
|
|
170
106
|
|
|
171
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
172
|
-
signal?: AbortSignal;
|
|
173
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
174
|
-
type FileValidatorDescriptor = {
|
|
175
|
-
runOn: 'add' | 'upload' | 'change';
|
|
176
|
-
validator: FuncFileValidator;
|
|
177
|
-
};
|
|
178
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
179
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
180
|
-
declare class ValidationManager extends SharedInstance {
|
|
181
|
-
private get _uploadCollection();
|
|
182
|
-
private _commonFileValidators;
|
|
183
|
-
private _commonCollectionValidators;
|
|
184
|
-
private _queue;
|
|
185
|
-
private _runQueueDebounced;
|
|
186
|
-
private _isDestroyed;
|
|
187
|
-
private _entryValidationState;
|
|
188
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
189
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
190
|
-
runCollectionValidators(): void;
|
|
191
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
192
|
-
private _runFileValidatorsForEntry;
|
|
193
|
-
private _addCustomTypeToValidationError;
|
|
194
|
-
private _getEntryValidationState;
|
|
195
|
-
private _getValidatorDescriptors;
|
|
196
|
-
private _getValidatorDescriptorsForEntry;
|
|
197
|
-
destroy(): void;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
declare class SecureUploadsManager extends SharedInstance {
|
|
201
|
-
private _secureToken;
|
|
202
|
-
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
203
|
-
destroy(): void;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
107
|
type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
|
|
207
108
|
type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
|
|
208
109
|
type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
@@ -254,6 +155,157 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
254
155
|
}>;
|
|
255
156
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
256
157
|
|
|
158
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
159
|
+
|
|
160
|
+
interface UploadEntryData extends Record<string, unknown> {
|
|
161
|
+
file: File | null;
|
|
162
|
+
externalUrl: string | null;
|
|
163
|
+
fileName: string | null;
|
|
164
|
+
fileSize: number | null;
|
|
165
|
+
lastModified: number;
|
|
166
|
+
uploadProgress: number;
|
|
167
|
+
uuid: string | null;
|
|
168
|
+
isImage: boolean;
|
|
169
|
+
mimeType: string | null;
|
|
170
|
+
ctxName: string | null;
|
|
171
|
+
cdnUrl: string | null;
|
|
172
|
+
cdnUrlModifiers: string | null;
|
|
173
|
+
fileInfo: UploadcareFile | null;
|
|
174
|
+
isUploading: boolean;
|
|
175
|
+
abortController: AbortController | null;
|
|
176
|
+
thumbUrl: string | null;
|
|
177
|
+
silent: boolean;
|
|
178
|
+
source: string | null;
|
|
179
|
+
fullPath: string | null;
|
|
180
|
+
metadata: Metadata | null;
|
|
181
|
+
errors: OutputErrorFile[];
|
|
182
|
+
uploadError: Error | null;
|
|
183
|
+
isRemoved: boolean;
|
|
184
|
+
isQueuedForUploading: boolean;
|
|
185
|
+
isValidationPending: boolean;
|
|
186
|
+
isQueuedForValidation: boolean;
|
|
187
|
+
}
|
|
188
|
+
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
189
|
+
type UploadEntryKeys = keyof UploadEntryData;
|
|
190
|
+
|
|
191
|
+
type ApiAddFileCommonOptions = {
|
|
192
|
+
silent?: boolean;
|
|
193
|
+
fileName?: string;
|
|
194
|
+
source?: string;
|
|
195
|
+
};
|
|
196
|
+
declare class UploaderPublicApi extends SharedInstance {
|
|
197
|
+
private _l10n;
|
|
198
|
+
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
199
|
+
get cfg(): Readonly<ConfigType>;
|
|
200
|
+
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
201
|
+
/**
|
|
202
|
+
* TODO: Probably we should not allow user to override `source` property
|
|
203
|
+
*/
|
|
204
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
205
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
206
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
207
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
208
|
+
fullPath?: string;
|
|
209
|
+
}) => OutputFileEntry<"idle">;
|
|
210
|
+
removeFileByInternalId: (internalId: string) => void;
|
|
211
|
+
removeAllFiles(): void;
|
|
212
|
+
uploadAll: () => void;
|
|
213
|
+
openSystemDialog: (options?: {
|
|
214
|
+
captureCamera?: boolean;
|
|
215
|
+
modeCamera?: ModeCameraType;
|
|
216
|
+
}) => void;
|
|
217
|
+
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
218
|
+
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
219
|
+
initFlow: (force?: boolean) => void;
|
|
220
|
+
doneFlow: () => void;
|
|
221
|
+
setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
|
|
222
|
+
getCurrentActivity: () => ActivityType;
|
|
223
|
+
setModalState: (opened: boolean) => void;
|
|
224
|
+
private get _sourceList();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare const ExternalUploadSource: Readonly<{
|
|
228
|
+
readonly FACEBOOK: "facebook";
|
|
229
|
+
readonly DROPBOX: "dropbox";
|
|
230
|
+
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
231
|
+
readonly GDRIVE: "gdrive";
|
|
232
|
+
readonly GPHOTOS: "gphotos";
|
|
233
|
+
readonly FLICKR: "flickr";
|
|
234
|
+
readonly VK: "vk";
|
|
235
|
+
readonly EVERNOTE: "evernote";
|
|
236
|
+
readonly BOX: "box";
|
|
237
|
+
readonly ONEDRIVE: "onedrive";
|
|
238
|
+
readonly HUDDLE: "huddle";
|
|
239
|
+
}>;
|
|
240
|
+
declare const UploadSource: Readonly<{
|
|
241
|
+
readonly FACEBOOK: "facebook";
|
|
242
|
+
readonly DROPBOX: "dropbox";
|
|
243
|
+
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
244
|
+
readonly GDRIVE: "gdrive";
|
|
245
|
+
readonly GPHOTOS: "gphotos";
|
|
246
|
+
readonly FLICKR: "flickr";
|
|
247
|
+
readonly VK: "vk";
|
|
248
|
+
readonly EVERNOTE: "evernote";
|
|
249
|
+
readonly BOX: "box";
|
|
250
|
+
readonly ONEDRIVE: "onedrive";
|
|
251
|
+
readonly HUDDLE: "huddle";
|
|
252
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
253
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
254
|
+
readonly LOCAL: "local";
|
|
255
|
+
readonly DROP_AREA: "drop-area";
|
|
256
|
+
readonly CAMERA: "camera";
|
|
257
|
+
readonly EXTERNAL: "external";
|
|
258
|
+
readonly API: "js-api";
|
|
259
|
+
readonly URL: "url";
|
|
260
|
+
readonly DRAW: "draw";
|
|
261
|
+
}>;
|
|
262
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
263
|
+
|
|
264
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
265
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
266
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
267
|
+
protected couldBeCtxOwner: boolean;
|
|
268
|
+
private _isCtxOwner;
|
|
269
|
+
private _unobserveCollection?;
|
|
270
|
+
private _unobserveCollectionProperties?;
|
|
271
|
+
init$: {
|
|
272
|
+
'*commonProgress': number;
|
|
273
|
+
'*uploadList': never[];
|
|
274
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
275
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
276
|
+
'*collectionState': OutputCollectionState | null;
|
|
277
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
278
|
+
'*uploadTrigger': Set<string>;
|
|
279
|
+
'*currentActivity': null;
|
|
280
|
+
'*currentActivityParams': {};
|
|
281
|
+
'*history': never[];
|
|
282
|
+
'*historyBack': null;
|
|
283
|
+
'*closeModal': () => void;
|
|
284
|
+
};
|
|
285
|
+
private get _hasCtxOwner();
|
|
286
|
+
initCallback(): void;
|
|
287
|
+
getAPI(): UploaderPublicApi;
|
|
288
|
+
get validationManager(): ValidationManager;
|
|
289
|
+
get api(): UploaderPublicApi;
|
|
290
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
291
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
292
|
+
disconnectedCallback(): void;
|
|
293
|
+
connectedCallback(): void;
|
|
294
|
+
private _initCtxOwner;
|
|
295
|
+
private _observeUploadCollection;
|
|
296
|
+
private _unobserveUploadCollection;
|
|
297
|
+
private _createGroup;
|
|
298
|
+
private _flushOutputItems;
|
|
299
|
+
private _handleCollectionUpdate;
|
|
300
|
+
private _handleCollectionPropertiesUpdate;
|
|
301
|
+
private _flushCommonUploadProgress;
|
|
302
|
+
private _openCloudImageEditor;
|
|
303
|
+
private _setInitialCrop;
|
|
304
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
305
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
306
|
+
getOutputData(): OutputFileEntry[];
|
|
307
|
+
}
|
|
308
|
+
|
|
257
309
|
/**
|
|
258
310
|
* Mapping of loading resources per operation
|
|
259
311
|
*/
|
|
@@ -368,14 +420,11 @@ declare global {
|
|
|
368
420
|
declare class Icon extends LitBlock {
|
|
369
421
|
name: string;
|
|
370
422
|
private _resolvedHref;
|
|
371
|
-
private _pluginSvg;
|
|
372
423
|
private _iconHrefResolver;
|
|
373
|
-
private _unsubscribePlugins?;
|
|
374
424
|
initCallback(): void;
|
|
375
425
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
376
426
|
private _updateResolvedHref;
|
|
377
427
|
render(): lit_html.TemplateResult<1>;
|
|
378
|
-
disconnectedCallback(): void;
|
|
379
428
|
}
|
|
380
429
|
declare global {
|
|
381
430
|
interface HTMLElementTagNameMap {
|
|
@@ -906,7 +955,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
906
955
|
private _hasNetworkProblems;
|
|
907
956
|
private _isInitialized;
|
|
908
957
|
private _pendingInitUpdate;
|
|
909
|
-
private _pendingSizeWait;
|
|
910
958
|
private readonly _debouncedShowLoader;
|
|
911
959
|
private readonly _imgRef;
|
|
912
960
|
private readonly _cropperRef;
|
|
@@ -956,11 +1004,12 @@ type ActivityParams$1 = {
|
|
|
956
1004
|
internalId: string;
|
|
957
1005
|
};
|
|
958
1006
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1007
|
+
couldBeCtxOwner: boolean;
|
|
1008
|
+
activityType: "cloud-image-edit";
|
|
959
1009
|
private _entry?;
|
|
960
1010
|
private _editorConfig;
|
|
961
1011
|
get activityParams(): ActivityParams$1;
|
|
962
1012
|
initCallback(): void;
|
|
963
|
-
disconnectedCallback(): void;
|
|
964
1013
|
private _handleApply;
|
|
965
1014
|
private _handleCancel;
|
|
966
1015
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -997,6 +1046,7 @@ type ActivityParams = {
|
|
|
997
1046
|
};
|
|
998
1047
|
declare class ExternalSource extends LitUploaderBlock {
|
|
999
1048
|
couldBeCtxOwner: boolean;
|
|
1049
|
+
activityType: "external";
|
|
1000
1050
|
private _messageBridge?;
|
|
1001
1051
|
private _iframeRef;
|
|
1002
1052
|
private _latestSelectionSummary;
|
|
@@ -1040,26 +1090,22 @@ declare global {
|
|
|
1040
1090
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1041
1091
|
START_FROM: "start-from";
|
|
1042
1092
|
CAMERA: "camera";
|
|
1093
|
+
DRAW: "draw";
|
|
1043
1094
|
UPLOAD_LIST: "upload-list";
|
|
1044
1095
|
URL: "url";
|
|
1045
1096
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1046
1097
|
EXTERNAL: "external";
|
|
1047
1098
|
}>;
|
|
1048
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1049
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1099
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1100
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1050
1101
|
|
|
1051
1102
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1052
|
-
interface CustomActivities {
|
|
1053
|
-
}
|
|
1054
1103
|
type ActivityParamsMap = {
|
|
1055
1104
|
'cloud-image-edit': ActivityParams$1;
|
|
1056
1105
|
external: ActivityParams;
|
|
1057
|
-
} & {
|
|
1058
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1059
1106
|
};
|
|
1060
1107
|
declare class LitActivityBlock extends LitBlock {
|
|
1061
1108
|
protected historyTracked: boolean;
|
|
1062
|
-
activityType: ActivityType;
|
|
1063
1109
|
private [ACTIVE_PROP]?;
|
|
1064
1110
|
init$: {
|
|
1065
1111
|
'*currentActivity': null;
|
|
@@ -1073,11 +1119,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1073
1119
|
private _activate;
|
|
1074
1120
|
initCallback(): void;
|
|
1075
1121
|
private _historyFlush;
|
|
1076
|
-
|
|
1122
|
+
private _isActivityRegistered;
|
|
1077
1123
|
private static _activityCallbacks;
|
|
1078
1124
|
static activities: Readonly<{
|
|
1079
1125
|
START_FROM: 'start-from';
|
|
1080
1126
|
CAMERA: 'camera';
|
|
1127
|
+
DRAW: 'draw';
|
|
1081
1128
|
UPLOAD_LIST: 'upload-list';
|
|
1082
1129
|
URL: 'url';
|
|
1083
1130
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1093,8 +1140,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1093
1140
|
private _unregisterActivity;
|
|
1094
1141
|
disconnectedCallback(): void;
|
|
1095
1142
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1096
|
-
get initActivity():
|
|
1097
|
-
get doneActivity():
|
|
1143
|
+
get initActivity(): string | null;
|
|
1144
|
+
get doneActivity(): string | null;
|
|
1098
1145
|
historyBack(): void;
|
|
1099
1146
|
}
|
|
1100
1147
|
|
|
@@ -1156,9 +1203,7 @@ type EventPayload = {
|
|
|
1156
1203
|
declare class EventEmitter extends SharedInstance {
|
|
1157
1204
|
private _timeoutStore;
|
|
1158
1205
|
private _targets;
|
|
1159
|
-
private _listeners;
|
|
1160
1206
|
bindTarget(target: LitBlock): () => void;
|
|
1161
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1162
1207
|
private _dispatch;
|
|
1163
1208
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1164
1209
|
debounce?: TDebounce;
|
|
@@ -1166,121 +1211,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1166
1211
|
destroy(): void;
|
|
1167
1212
|
}
|
|
1168
1213
|
|
|
1169
|
-
type
|
|
1170
|
-
|
|
1171
|
-
fileName?: string;
|
|
1172
|
-
source?: string;
|
|
1214
|
+
type EventMap = {
|
|
1215
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1173
1216
|
};
|
|
1174
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
1175
|
-
private _l10n;
|
|
1176
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1177
|
-
get cfg(): Readonly<ConfigType>;
|
|
1178
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
1179
|
-
/**
|
|
1180
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
1181
|
-
*/
|
|
1182
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1183
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1184
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1185
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
1186
|
-
fullPath?: string;
|
|
1187
|
-
}) => OutputFileEntry<"idle">;
|
|
1188
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
1189
|
-
removeAllFiles(): void;
|
|
1190
|
-
uploadAll: () => void;
|
|
1191
|
-
openSystemDialog: (options?: {
|
|
1192
|
-
captureCamera?: boolean;
|
|
1193
|
-
modeCamera?: ModeCameraType;
|
|
1194
|
-
}) => void;
|
|
1195
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
1196
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
1197
|
-
initFlow: (force?: boolean) => void;
|
|
1198
|
-
doneFlow: () => void;
|
|
1199
|
-
private _pluginsReady;
|
|
1200
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1201
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1202
|
-
getCurrentActivity: () => ActivityType;
|
|
1203
|
-
historyBack: () => void;
|
|
1204
|
-
setModalState: (opened: boolean) => void;
|
|
1205
|
-
private get _sourceList();
|
|
1206
|
-
}
|
|
1207
1217
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
readonly HUDDLE: "huddle";
|
|
1219
|
-
}>;
|
|
1220
|
-
declare const UploadSource: Readonly<{
|
|
1221
|
-
readonly FACEBOOK: "facebook";
|
|
1222
|
-
readonly DROPBOX: "dropbox";
|
|
1223
|
-
readonly GDRIVE: "gdrive";
|
|
1224
|
-
readonly GPHOTOS: "gphotos";
|
|
1225
|
-
readonly FLICKR: "flickr";
|
|
1226
|
-
readonly VK: "vk";
|
|
1227
|
-
readonly EVERNOTE: "evernote";
|
|
1228
|
-
readonly BOX: "box";
|
|
1229
|
-
readonly ONEDRIVE: "onedrive";
|
|
1230
|
-
readonly HUDDLE: "huddle";
|
|
1231
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1232
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1233
|
-
readonly LOCAL: "local";
|
|
1234
|
-
readonly DROP_AREA: "drop-area";
|
|
1235
|
-
readonly CAMERA: "camera";
|
|
1236
|
-
readonly EXTERNAL: "external";
|
|
1237
|
-
readonly API: "js-api";
|
|
1238
|
-
readonly URL: "url";
|
|
1239
|
-
}>;
|
|
1240
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1241
|
-
|
|
1242
|
-
declare class LitUploaderBlock extends LitActivityBlock {
|
|
1243
|
-
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
1244
|
-
static sourceTypes: Readonly<typeof UploadSource>;
|
|
1245
|
-
protected couldBeCtxOwner: boolean;
|
|
1246
|
-
private _isCtxOwner;
|
|
1247
|
-
private _unobserveCollection?;
|
|
1248
|
-
private _unobserveCollectionProperties?;
|
|
1249
|
-
init$: {
|
|
1250
|
-
'*commonProgress': number;
|
|
1251
|
-
'*uploadList': never[];
|
|
1252
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1253
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1254
|
-
'*collectionState': OutputCollectionState | null;
|
|
1255
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1256
|
-
'*uploadTrigger': Set<string>;
|
|
1257
|
-
'*currentActivity': null;
|
|
1258
|
-
'*currentActivityParams': {};
|
|
1259
|
-
'*history': never[];
|
|
1260
|
-
'*historyBack': null;
|
|
1261
|
-
'*closeModal': () => void;
|
|
1262
|
-
};
|
|
1263
|
-
private get _hasCtxOwner();
|
|
1264
|
-
initCallback(): void;
|
|
1265
|
-
getAPI(): UploaderPublicApi;
|
|
1266
|
-
get validationManager(): ValidationManager;
|
|
1267
|
-
get api(): UploaderPublicApi;
|
|
1268
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1269
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1270
|
-
disconnectedCallback(): void;
|
|
1271
|
-
connectedCallback(): void;
|
|
1272
|
-
private _initCtxOwner;
|
|
1273
|
-
private _observeUploadCollection;
|
|
1274
|
-
private _unobserveUploadCollection;
|
|
1275
|
-
private _createGroup;
|
|
1276
|
-
private _flushOutputItems;
|
|
1277
|
-
private _handleCollectionUpdate;
|
|
1278
|
-
private _handleCollectionPropertiesUpdate;
|
|
1279
|
-
private _flushCommonUploadProgress;
|
|
1280
|
-
private _setInitialCrop;
|
|
1281
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1282
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1283
|
-
getOutputData(): OutputFileEntry[];
|
|
1218
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1219
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1220
|
+
private scopes;
|
|
1221
|
+
private listener;
|
|
1222
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1223
|
+
private openUploadList;
|
|
1224
|
+
private _listener;
|
|
1225
|
+
private handlePaste;
|
|
1226
|
+
registerBlock(scope: Node): () => void;
|
|
1227
|
+
destroy(): void;
|
|
1284
1228
|
}
|
|
1285
1229
|
|
|
1286
1230
|
type SelectOption = {
|
|
@@ -1303,6 +1247,7 @@ declare global {
|
|
|
1303
1247
|
type CameraMode = 'photo' | 'video';
|
|
1304
1248
|
declare class CameraSource extends LitUploaderBlock {
|
|
1305
1249
|
couldBeCtxOwner: boolean;
|
|
1250
|
+
activityType: "camera";
|
|
1306
1251
|
private _unsubPermissions;
|
|
1307
1252
|
private _capturing;
|
|
1308
1253
|
private _chunks;
|
|
@@ -1422,54 +1367,25 @@ declare global {
|
|
|
1422
1367
|
/**
|
|
1423
1368
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1424
1369
|
*/
|
|
1425
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1370
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
1371
|
+
/** Mapping of attribute names to state */
|
|
1372
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1426
1373
|
declare class Config extends LitBlock {
|
|
1427
1374
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
1428
1375
|
'ctx-name': string;
|
|
1429
1376
|
};
|
|
1430
1377
|
init$: LitBlock["init$"] & ConfigType;
|
|
1431
1378
|
private _computationControllers;
|
|
1432
|
-
private _pluginChangeUnsubscribe?;
|
|
1433
|
-
private _mutationObserver?;
|
|
1434
|
-
/**
|
|
1435
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1436
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1437
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1438
|
-
*/
|
|
1439
|
-
private _customAttrKeyMapping;
|
|
1440
|
-
/** Set of all custom config names registered by plugins */
|
|
1441
|
-
private _customConfigKeys;
|
|
1442
|
-
/**
|
|
1443
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1444
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1445
|
-
*/
|
|
1446
|
-
private _customConfigSubscriptions;
|
|
1447
|
-
/**
|
|
1448
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1449
|
-
*/
|
|
1450
|
-
private _isCustomConfig;
|
|
1451
|
-
/**
|
|
1452
|
-
* Get the custom config definition for a key
|
|
1453
|
-
*/
|
|
1454
|
-
private _getCustomConfigDefinition;
|
|
1455
|
-
/**
|
|
1456
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1457
|
-
*/
|
|
1458
|
-
private _getAttributeNames;
|
|
1459
1379
|
private _flushValueToAttribute;
|
|
1460
1380
|
private _flushValueToState;
|
|
1461
1381
|
private _setValue;
|
|
1462
1382
|
private _getValue;
|
|
1463
1383
|
private _assertSameValueDifferentReference;
|
|
1464
|
-
private _processCustomConfigs;
|
|
1465
|
-
private _setupCustomConfigs;
|
|
1466
|
-
private _setupMutationObserver;
|
|
1467
1384
|
initCallback(): void;
|
|
1468
|
-
attributeChangedCallback(name:
|
|
1469
|
-
disconnectedCallback(): void;
|
|
1385
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1470
1386
|
static get observedAttributes(): string[];
|
|
1471
1387
|
}
|
|
1472
|
-
interface Config extends ConfigType
|
|
1388
|
+
interface Config extends ConfigType {
|
|
1473
1389
|
}
|
|
1474
1390
|
declare global {
|
|
1475
1391
|
interface HTMLElementTagNameMap {
|
|
@@ -1553,12 +1469,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1553
1469
|
private _isFailed;
|
|
1554
1470
|
private _isUploading;
|
|
1555
1471
|
private _isFocused;
|
|
1472
|
+
private _isEditable;
|
|
1556
1473
|
private _showFileNames;
|
|
1557
1474
|
private _ariaLabelStatusFile;
|
|
1558
|
-
private _pluginFileActions;
|
|
1559
1475
|
private _renderedOnce;
|
|
1560
1476
|
private _observer?;
|
|
1561
|
-
private
|
|
1477
|
+
private _handleEdit;
|
|
1562
1478
|
private _handleRemove;
|
|
1563
1479
|
private _handleUploadClick;
|
|
1564
1480
|
private _calculateState;
|
|
@@ -1570,8 +1486,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1570
1486
|
private _handleEntryId;
|
|
1571
1487
|
private _updateShowFileNames;
|
|
1572
1488
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1573
|
-
private _updatePluginFileActions;
|
|
1574
|
-
private _handlePluginFileAction;
|
|
1575
1489
|
initCallback(): void;
|
|
1576
1490
|
connectedCallback(): void;
|
|
1577
1491
|
disconnectedCallback(): void;
|
|
@@ -1604,7 +1518,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1604
1518
|
text?: string;
|
|
1605
1519
|
private _isEnabled;
|
|
1606
1520
|
private _isVisible;
|
|
1607
|
-
private
|
|
1521
|
+
private _dropTextKey;
|
|
1522
|
+
private _isMultiple;
|
|
1523
|
+
private _updateDropText;
|
|
1608
1524
|
private _destroyDropzone;
|
|
1609
1525
|
private _destroyContentWrapperDropzone;
|
|
1610
1526
|
private _contentWrapperRef;
|
|
@@ -1613,7 +1529,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1613
1529
|
private _clickableListenersAttached;
|
|
1614
1530
|
isActive(): boolean;
|
|
1615
1531
|
initCallback(): void;
|
|
1616
|
-
protected willUpdate(changedProperties: PropertyValues<this
|
|
1532
|
+
protected willUpdate(changedProperties: PropertyValues<this & {
|
|
1533
|
+
localeId: string;
|
|
1534
|
+
}>): void;
|
|
1617
1535
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1618
1536
|
/** Ignore drop events if there are other visible drop areas on the page. */
|
|
1619
1537
|
private _shouldIgnore;
|
|
@@ -1876,10 +1794,6 @@ type ConfigType = {
|
|
|
1876
1794
|
* Expiry threshold for secure uploads.
|
|
1877
1795
|
*/
|
|
1878
1796
|
secureUploadsExpireThreshold: number;
|
|
1879
|
-
/**
|
|
1880
|
-
* Array of plugins to register with the uploader instance.
|
|
1881
|
-
*/
|
|
1882
|
-
plugins: UploaderPlugin[];
|
|
1883
1797
|
/**
|
|
1884
1798
|
* Metadata for the file.
|
|
1885
1799
|
*/
|
|
@@ -2140,225 +2054,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2140
2054
|
allEntries: OutputFileEntry[];
|
|
2141
2055
|
});
|
|
2142
2056
|
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
};
|
|
2147
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2148
|
-
type PluginSourceRegistration = {
|
|
2149
|
-
id: string;
|
|
2150
|
-
label: string;
|
|
2151
|
-
icon?: string;
|
|
2152
|
-
/**
|
|
2153
|
-
* @internal
|
|
2154
|
-
*
|
|
2155
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2156
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2157
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2158
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2159
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2160
|
-
*/
|
|
2161
|
-
expand?: () => string[];
|
|
2162
|
-
onSelect: () => Promise<void> | void;
|
|
2163
|
-
};
|
|
2164
|
-
type PluginRenderDispose = () => void;
|
|
2165
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2166
|
-
type PluginActivityRegistration = {
|
|
2167
|
-
id: string;
|
|
2168
|
-
render: PluginRender;
|
|
2169
|
-
};
|
|
2170
|
-
type PluginFileActionRegistration = {
|
|
2171
|
-
/** Unique action identifier. */
|
|
2172
|
-
id: string;
|
|
2173
|
-
/** Icon name to display in the action button. */
|
|
2174
|
-
icon: string;
|
|
2175
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2176
|
-
label: string;
|
|
2177
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2178
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2179
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2180
|
-
};
|
|
2181
|
-
type PluginFileHookContext = {
|
|
2182
|
-
/** The file to transform */
|
|
2183
|
-
file: File | Blob;
|
|
2184
|
-
};
|
|
2185
|
-
type PluginFileHookRegistration = {
|
|
2186
|
-
/**
|
|
2187
|
-
* When the hook is called:
|
|
2188
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2189
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2190
|
-
*
|
|
2191
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2192
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2193
|
-
*/
|
|
2194
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2195
|
-
handler: (context: PluginFileHookContext) => PluginFileHookContext | Promise<PluginFileHookContext>;
|
|
2196
|
-
};
|
|
2197
|
-
type PluginRegistryApi = {
|
|
2198
|
-
registerSource: (source: PluginSourceRegistration) => PluginSourceRegistration;
|
|
2199
|
-
registerActivity: (activity: PluginActivityRegistration) => PluginActivityRegistration;
|
|
2200
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => PluginFileActionRegistration;
|
|
2201
|
-
registerFileHook: (hook: PluginFileHookRegistration) => PluginFileHookRegistration;
|
|
2202
|
-
registerIcon: (icon: PluginIconRegistration) => PluginIconRegistration;
|
|
2203
|
-
registerI18n: (i18n: PluginI18nRegistration) => PluginI18nRegistration;
|
|
2204
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2205
|
-
};
|
|
2206
|
-
/**
|
|
2207
|
-
* API for managing plugin config subscriptions
|
|
2208
|
-
*/
|
|
2209
|
-
type PluginConfigApi = {
|
|
2210
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2211
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2212
|
-
};
|
|
2213
|
-
/**
|
|
2214
|
-
* API for managing plugin activity interactions
|
|
2215
|
-
*/
|
|
2216
|
-
type PluginActivityApi = {
|
|
2217
|
-
/**
|
|
2218
|
-
* Get the current activity parameters.
|
|
2219
|
-
*
|
|
2220
|
-
* @returns The current activity parameters object
|
|
2221
|
-
*
|
|
2222
|
-
* @example
|
|
2223
|
-
* ```typescript
|
|
2224
|
-
* const params = pluginApi.activity.getParams();
|
|
2225
|
-
* console.log('Current params:', params);
|
|
2226
|
-
* ```
|
|
2227
|
-
*/
|
|
2228
|
-
getParams: () => Record<string, unknown>;
|
|
2229
|
-
/**
|
|
2230
|
-
* Subscribe to changes in activity parameters.
|
|
2231
|
-
* The callback will be called immediately with the current params,
|
|
2232
|
-
* and then whenever the params change.
|
|
2233
|
-
*
|
|
2234
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2235
|
-
*
|
|
2236
|
-
* @param callback - Function to call with the new params
|
|
2237
|
-
* @returns Unsubscribe function
|
|
2238
|
-
*
|
|
2239
|
-
* @example
|
|
2240
|
-
* ```typescript
|
|
2241
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2242
|
-
* console.log('Activity params changed:', params);
|
|
2243
|
-
* });
|
|
2244
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2245
|
-
* ```
|
|
2246
|
-
*/
|
|
2247
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2248
|
-
};
|
|
2249
|
-
type PluginFileEntryUpdate = {
|
|
2250
|
-
file?: File | Blob;
|
|
2251
|
-
cdnUrl?: string | null;
|
|
2252
|
-
cdnUrlModifiers?: string | null;
|
|
2253
|
-
mimeType?: string | null;
|
|
2254
|
-
};
|
|
2255
|
-
type PluginFilesApi = {
|
|
2256
|
-
/**
|
|
2257
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2258
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2259
|
-
*/
|
|
2260
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2261
|
-
};
|
|
2262
|
-
type PluginApi = {
|
|
2263
|
-
registry: PluginRegistryApi;
|
|
2264
|
-
config: PluginConfigApi;
|
|
2265
|
-
activity: PluginActivityApi;
|
|
2266
|
-
files: PluginFilesApi;
|
|
2267
|
-
};
|
|
2268
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2269
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2270
|
-
type PluginSetupParams = {
|
|
2271
|
-
pluginApi: PluginApi;
|
|
2272
|
-
uploaderApi: PluginUploaderApi;
|
|
2273
|
-
};
|
|
2274
|
-
type UploaderPlugin = {
|
|
2275
|
-
id: string;
|
|
2276
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2277
|
-
};
|
|
2278
|
-
type Owned<T> = T & {
|
|
2279
|
-
pluginId: string;
|
|
2280
|
-
};
|
|
2281
|
-
type PluginRegistrySnapshot = {
|
|
2282
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2283
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2284
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2285
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2286
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2287
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
type EventMap = {
|
|
2291
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2292
|
-
};
|
|
2293
|
-
|
|
2294
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2295
|
-
file: File | null;
|
|
2296
|
-
externalUrl: string | null;
|
|
2297
|
-
fileName: string | null;
|
|
2298
|
-
fileSize: number | null;
|
|
2299
|
-
lastModified: number;
|
|
2300
|
-
uploadProgress: number;
|
|
2301
|
-
uuid: string | null;
|
|
2302
|
-
isImage: boolean;
|
|
2303
|
-
mimeType: string | null;
|
|
2304
|
-
ctxName: string | null;
|
|
2305
|
-
cdnUrl: string | null;
|
|
2306
|
-
cdnUrlModifiers: string | null;
|
|
2307
|
-
fileInfo: UploadcareFile | null;
|
|
2308
|
-
isUploading: boolean;
|
|
2309
|
-
abortController: AbortController | null;
|
|
2310
|
-
thumbUrl: string | null;
|
|
2311
|
-
silent: boolean;
|
|
2312
|
-
source: string | null;
|
|
2313
|
-
fullPath: string | null;
|
|
2314
|
-
metadata: Metadata | null;
|
|
2315
|
-
errors: OutputErrorFile[];
|
|
2316
|
-
uploadError: Error | null;
|
|
2317
|
-
isRemoved: boolean;
|
|
2318
|
-
isQueuedForUploading: boolean;
|
|
2319
|
-
isValidationPending: boolean;
|
|
2320
|
-
isQueuedForValidation: boolean;
|
|
2321
|
-
}
|
|
2322
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2323
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2324
|
-
|
|
2325
|
-
declare class PluginRegistry {
|
|
2326
|
-
private _sources;
|
|
2327
|
-
private _activities;
|
|
2328
|
-
private _fileActions;
|
|
2329
|
-
private _fileHooks;
|
|
2330
|
-
private _icons;
|
|
2331
|
-
private _i18n;
|
|
2332
|
-
readonly config: CustomConfigRegistry;
|
|
2333
|
-
private _own;
|
|
2334
|
-
addSource(pluginId: string, item: PluginSourceRegistration): PluginSourceRegistration;
|
|
2335
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): PluginActivityRegistration;
|
|
2336
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): PluginFileActionRegistration;
|
|
2337
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): PluginFileHookRegistration;
|
|
2338
|
-
addIcon(pluginId: string, item: PluginIconRegistration): PluginIconRegistration;
|
|
2339
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): PluginI18nRegistration;
|
|
2340
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2341
|
-
purge(pluginId: string): void;
|
|
2342
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
declare class PluginManager extends SharedInstance {
|
|
2346
|
-
private _plugins;
|
|
2347
|
-
private _subscribers;
|
|
2348
|
-
private _pluginsUpdate;
|
|
2349
|
-
private _lazyPluginLoader;
|
|
2350
|
-
readonly registry: PluginRegistry;
|
|
2351
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2352
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2353
|
-
pluginsReady(): Promise<void>;
|
|
2354
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2355
|
-
private _syncPlugins;
|
|
2356
|
-
private _registerPlugin;
|
|
2357
|
-
private _unregisterPlugin;
|
|
2358
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2359
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2057
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2058
|
+
private _secureToken;
|
|
2059
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2360
2060
|
destroy(): void;
|
|
2361
|
-
private _notifySubscribers;
|
|
2362
2061
|
}
|
|
2363
2062
|
|
|
2364
2063
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2399,87 +2098,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2399
2098
|
private get _location();
|
|
2400
2099
|
}
|
|
2401
2100
|
|
|
2402
|
-
interface ISharedInstance {
|
|
2403
|
-
destroy?(): void;
|
|
2404
|
-
}
|
|
2405
|
-
declare class SharedInstance {
|
|
2406
|
-
protected _ctx: PubSub<SharedState>;
|
|
2407
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2408
|
-
private _subscriptions;
|
|
2409
|
-
private _cfgProxy;
|
|
2410
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2411
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2412
|
-
protected addSub(unsub: () => void): void;
|
|
2413
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2414
|
-
destroy(): void;
|
|
2415
|
-
}
|
|
2416
|
-
declare const instanceKeyMap: {
|
|
2417
|
-
modalManager: "*modalManager";
|
|
2418
|
-
pluginManager: "*pluginManager";
|
|
2419
|
-
telemetryManager: "*telemetryManager";
|
|
2420
|
-
localeManager: "*localeManager";
|
|
2421
|
-
a11y: "*a11y";
|
|
2422
|
-
clipboard: "*clipboard";
|
|
2423
|
-
blocksRegistry: "*blocksRegistry";
|
|
2424
|
-
eventEmitter: "*eventEmitter";
|
|
2425
|
-
uploadCollection: "*uploadCollection";
|
|
2426
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2427
|
-
api: "*publicApi";
|
|
2428
|
-
validationManager: "*validationManager";
|
|
2429
|
-
};
|
|
2430
|
-
type InstanceTypeMap = {
|
|
2431
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2432
|
-
};
|
|
2433
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2434
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2435
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2436
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2437
|
-
readonly ctx: PubSub<SharedState>;
|
|
2438
|
-
readonly modalManager: ModalManager | null;
|
|
2439
|
-
readonly pluginManager: PluginManager;
|
|
2440
|
-
readonly telemetryManager: TelemetryManager;
|
|
2441
|
-
readonly localeManager: LocaleManager;
|
|
2442
|
-
readonly a11y: A11y;
|
|
2443
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2444
|
-
readonly eventEmitter: EventEmitter;
|
|
2445
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2446
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2447
|
-
readonly api: UploaderPublicApi;
|
|
2448
|
-
readonly validationManager: ValidationManager;
|
|
2449
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2450
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2451
|
-
};
|
|
2452
|
-
|
|
2453
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2454
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2455
|
-
private scopes;
|
|
2456
|
-
private listener;
|
|
2457
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2458
|
-
private openUploadList;
|
|
2459
|
-
private _listener;
|
|
2460
|
-
private handlePaste;
|
|
2461
|
-
registerBlock(scope: Node): () => void;
|
|
2462
|
-
destroy(): void;
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2466
|
-
type LazyPluginEntry = {
|
|
2467
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2468
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2469
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
2101
|
type SharedConfigState = {
|
|
2473
2102
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2474
2103
|
};
|
|
2475
|
-
type SharedCustomConfigState = {
|
|
2476
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2477
|
-
};
|
|
2478
2104
|
type BlocksRegistry = Set<LitBlock>;
|
|
2479
2105
|
type ActivityBlockCtxState = {
|
|
2480
|
-
'*currentActivity':
|
|
2106
|
+
'*currentActivity': string | null;
|
|
2481
2107
|
'*currentActivityParams': Record<string, unknown>;
|
|
2482
|
-
'*history': (
|
|
2108
|
+
'*history': (string | null)[];
|
|
2483
2109
|
'*historyBack': (() => void) | null;
|
|
2484
2110
|
'*closeModal': () => void;
|
|
2485
2111
|
};
|
|
@@ -2496,7 +2122,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2496
2122
|
};
|
|
2497
2123
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2498
2124
|
'*solution': string | null;
|
|
2499
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2500
2125
|
};
|
|
2501
2126
|
type CloudImageEditorState = {
|
|
2502
2127
|
'*originalUrl': string | null;
|
|
@@ -2547,9 +2172,7 @@ type EditorToolbarState = {
|
|
|
2547
2172
|
'*currentOperation': string | null;
|
|
2548
2173
|
'*operationTooltip': string | null;
|
|
2549
2174
|
};
|
|
2550
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2551
2175
|
type DynamicBlockState = {
|
|
2552
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2553
2176
|
'*blocksRegistry': BlocksRegistry;
|
|
2554
2177
|
'*eventEmitter': EventEmitter;
|
|
2555
2178
|
'*localeManager': LocaleManager;
|
|
@@ -2557,7 +2180,6 @@ type DynamicBlockState = {
|
|
|
2557
2180
|
'*a11y': A11y;
|
|
2558
2181
|
'*modalManager': ModalManager | null;
|
|
2559
2182
|
'*clipboard': ClipboardLayer;
|
|
2560
|
-
'*pluginManager': PluginManager;
|
|
2561
2183
|
};
|
|
2562
2184
|
type DynamicUploaderBlockState = {
|
|
2563
2185
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2568,7 +2190,66 @@ type DynamicUploaderBlockState = {
|
|
|
2568
2190
|
type LocaleState = {
|
|
2569
2191
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2570
2192
|
};
|
|
2571
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2193
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2194
|
+
|
|
2195
|
+
interface ISharedInstance {
|
|
2196
|
+
destroy?(): void;
|
|
2197
|
+
}
|
|
2198
|
+
declare class SharedInstance {
|
|
2199
|
+
protected _ctx: PubSub<SharedState>;
|
|
2200
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2201
|
+
private _subscriptions;
|
|
2202
|
+
private _cfgProxy;
|
|
2203
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2204
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2205
|
+
protected addSub(unsub: () => void): void;
|
|
2206
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2207
|
+
destroy(): void;
|
|
2208
|
+
}
|
|
2209
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2210
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2211
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2212
|
+
readonly ctx: PubSub<SharedState>;
|
|
2213
|
+
readonly modalManager: ModalManager | null;
|
|
2214
|
+
readonly telemetryManager: TelemetryManager;
|
|
2215
|
+
readonly localeManager: LocaleManager;
|
|
2216
|
+
readonly a11y: A11y;
|
|
2217
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2218
|
+
readonly eventEmitter: EventEmitter;
|
|
2219
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2220
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2221
|
+
readonly api: UploaderPublicApi;
|
|
2222
|
+
readonly validationManager: ValidationManager;
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2226
|
+
signal?: AbortSignal;
|
|
2227
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2228
|
+
type FileValidatorDescriptor = {
|
|
2229
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2230
|
+
validator: FuncFileValidator;
|
|
2231
|
+
};
|
|
2232
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2233
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2234
|
+
declare class ValidationManager extends SharedInstance {
|
|
2235
|
+
private get _uploadCollection();
|
|
2236
|
+
private _commonFileValidators;
|
|
2237
|
+
private _commonCollectionValidators;
|
|
2238
|
+
private _queue;
|
|
2239
|
+
private _runQueueDebounced;
|
|
2240
|
+
private _isDestroyed;
|
|
2241
|
+
private _entryValidationState;
|
|
2242
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2243
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2244
|
+
runCollectionValidators(): void;
|
|
2245
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2246
|
+
private _runFileValidatorsForEntry;
|
|
2247
|
+
private _addCustomTypeToValidationError;
|
|
2248
|
+
private _getEntryValidationState;
|
|
2249
|
+
private _getValidatorDescriptors;
|
|
2250
|
+
private _getValidatorDescriptorsForEntry;
|
|
2251
|
+
destroy(): void;
|
|
2252
|
+
}
|
|
2572
2253
|
|
|
2573
2254
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2574
2255
|
willYield: boolean;
|
|
@@ -2580,7 +2261,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2580
2261
|
};
|
|
2581
2262
|
declare class LitBlock extends LitBlockBase {
|
|
2582
2263
|
private _cfgProxy;
|
|
2264
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2583
2265
|
static styleAttrs: string[];
|
|
2266
|
+
activityType: ActivityType;
|
|
2584
2267
|
init$: {};
|
|
2585
2268
|
constructor();
|
|
2586
2269
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2588,7 +2271,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2588
2271
|
protected _sharedInstancesBag: {
|
|
2589
2272
|
readonly ctx: PubSub<SharedState>;
|
|
2590
2273
|
readonly modalManager: ModalManager | null;
|
|
2591
|
-
readonly pluginManager: PluginManager;
|
|
2592
2274
|
readonly telemetryManager: TelemetryManager;
|
|
2593
2275
|
readonly localeManager: LocaleManager;
|
|
2594
2276
|
readonly a11y: A11y;
|
|
@@ -2598,34 +2280,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2598
2280
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2599
2281
|
readonly api: UploaderPublicApi;
|
|
2600
2282
|
readonly validationManager: ValidationManager;
|
|
2601
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2602
|
-
modalManager: ModalManager | null;
|
|
2603
|
-
pluginManager: PluginManager;
|
|
2604
|
-
telemetryManager: TelemetryManager;
|
|
2605
|
-
localeManager: LocaleManager;
|
|
2606
|
-
a11y: A11y;
|
|
2607
|
-
clipboard: ClipboardLayer;
|
|
2608
|
-
blocksRegistry: BlocksRegistry;
|
|
2609
|
-
eventEmitter: EventEmitter;
|
|
2610
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2611
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2612
|
-
api: UploaderPublicApi;
|
|
2613
|
-
validationManager: ValidationManager;
|
|
2614
|
-
}[TName]>) => void): () => void;
|
|
2615
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2616
|
-
modalManager: ModalManager | null;
|
|
2617
|
-
pluginManager: PluginManager;
|
|
2618
|
-
telemetryManager: TelemetryManager;
|
|
2619
|
-
localeManager: LocaleManager;
|
|
2620
|
-
a11y: A11y;
|
|
2621
|
-
clipboard: ClipboardLayer;
|
|
2622
|
-
blocksRegistry: BlocksRegistry;
|
|
2623
|
-
eventEmitter: EventEmitter;
|
|
2624
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2625
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2626
|
-
api: UploaderPublicApi;
|
|
2627
|
-
validationManager: ValidationManager;
|
|
2628
|
-
}[TName]>>;
|
|
2629
2283
|
};
|
|
2630
2284
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2631
2285
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2644,7 +2298,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2644
2298
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2645
2299
|
*/
|
|
2646
2300
|
private destroyCtxCallback;
|
|
2647
|
-
|
|
2301
|
+
/**
|
|
2302
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2303
|
+
* @param key The shared state key.
|
|
2304
|
+
* @param resolver The resolver function that creates the instance.
|
|
2305
|
+
*/
|
|
2648
2306
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2649
2307
|
private _destroySharedContextInstances;
|
|
2650
2308
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2671,7 +2329,7 @@ declare class Modal extends LitBlock {
|
|
|
2671
2329
|
private _handleDialogClose;
|
|
2672
2330
|
private _handleDialogMouseDown;
|
|
2673
2331
|
private _handleDialogMouseUp;
|
|
2674
|
-
show():
|
|
2332
|
+
show(): void;
|
|
2675
2333
|
hide(): void;
|
|
2676
2334
|
private _handleModalOpen;
|
|
2677
2335
|
private _handleModalClose;
|
|
@@ -2743,10 +2401,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2743
2401
|
|
|
2744
2402
|
declare class LitSolutionBlock extends LitBlock {
|
|
2745
2403
|
static styleAttrs: string[];
|
|
2746
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2747
2404
|
init$: {
|
|
2748
2405
|
'*solution': string | null;
|
|
2749
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2750
2406
|
'*commonProgress': number;
|
|
2751
2407
|
'*uploadList': never[];
|
|
2752
2408
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -2878,20 +2534,18 @@ declare global {
|
|
|
2878
2534
|
}
|
|
2879
2535
|
}
|
|
2880
2536
|
|
|
2881
|
-
type SourceButtonConfig = {
|
|
2882
|
-
id: string;
|
|
2883
|
-
label: string;
|
|
2884
|
-
icon?: string;
|
|
2885
|
-
onClick: () => void | Promise<void>;
|
|
2886
|
-
};
|
|
2887
2537
|
declare class SourceBtn extends LitUploaderBlock {
|
|
2888
2538
|
couldBeCtxOwner: boolean;
|
|
2889
|
-
|
|
2539
|
+
private _registeredTypes;
|
|
2540
|
+
type?: string;
|
|
2890
2541
|
private _iconName;
|
|
2891
2542
|
private _srcTypeKey;
|
|
2892
|
-
|
|
2893
|
-
|
|
2543
|
+
private _initTypes;
|
|
2544
|
+
initCallback(): void;
|
|
2545
|
+
private _registerType;
|
|
2894
2546
|
activate(): void;
|
|
2547
|
+
private _applyType;
|
|
2548
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2895
2549
|
render(): lit_html.TemplateResult<1>;
|
|
2896
2550
|
}
|
|
2897
2551
|
declare global {
|
|
@@ -2900,10 +2554,9 @@ declare global {
|
|
|
2900
2554
|
}
|
|
2901
2555
|
}
|
|
2902
2556
|
|
|
2903
|
-
declare class SourceList extends
|
|
2557
|
+
declare class SourceList extends LitBlock {
|
|
2904
2558
|
private _rawSourceList;
|
|
2905
|
-
private
|
|
2906
|
-
private _sources;
|
|
2559
|
+
private _cameraModes;
|
|
2907
2560
|
/**
|
|
2908
2561
|
* CSS-only attribute
|
|
2909
2562
|
*/
|
|
@@ -2911,10 +2564,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
2911
2564
|
initCallback(): void;
|
|
2912
2565
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
2913
2566
|
private _updateSources;
|
|
2914
|
-
private
|
|
2915
|
-
private _makePluginSourceConfig;
|
|
2567
|
+
private _sources;
|
|
2916
2568
|
render(): lit_html.TemplateResult<1>;
|
|
2917
|
-
disconnectedCallback(): void;
|
|
2918
2569
|
}
|
|
2919
2570
|
declare global {
|
|
2920
2571
|
interface HTMLElementTagNameMap {
|
|
@@ -2969,6 +2620,8 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
2969
2620
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
2970
2621
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
2971
2622
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2623
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2624
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
2972
2625
|
}
|
|
2973
2626
|
declare global {
|
|
2974
2627
|
interface HTMLElementTagNameMap {
|
|
@@ -2976,65 +2629,38 @@ declare global {
|
|
|
2976
2629
|
}
|
|
2977
2630
|
}
|
|
2978
2631
|
|
|
2979
|
-
declare class
|
|
2980
|
-
static styleAttrs: string[];
|
|
2632
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
2981
2633
|
couldBeCtxOwner: boolean;
|
|
2982
|
-
|
|
2983
|
-
private
|
|
2984
|
-
private readonly _handleClick;
|
|
2634
|
+
activityType: ActivityType;
|
|
2635
|
+
private _formState;
|
|
2985
2636
|
initCallback(): void;
|
|
2637
|
+
private _inputRef;
|
|
2638
|
+
private _handleInput;
|
|
2639
|
+
private _handleUpload;
|
|
2986
2640
|
render(): lit_html.TemplateResult<1>;
|
|
2987
2641
|
}
|
|
2988
2642
|
declare global {
|
|
2989
2643
|
interface HTMLElementTagNameMap {
|
|
2990
|
-
'uc-
|
|
2644
|
+
'uc-url-source': UrlSource;
|
|
2991
2645
|
}
|
|
2992
2646
|
}
|
|
2993
2647
|
|
|
2994
|
-
declare class
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
private _ensureRegistered;
|
|
3001
|
-
private _renderActivity;
|
|
3002
|
-
private _disposeActivity;
|
|
3003
|
-
disconnectedCallback(): void;
|
|
3004
|
-
render(): lit_html.TemplateResult<1>;
|
|
3005
|
-
}
|
|
3006
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3007
|
-
mode: 'modal' | 'inline';
|
|
3008
|
-
private _activities;
|
|
3009
|
-
private _unsubscribePlugins?;
|
|
2648
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2649
|
+
static styleAttrs: string[];
|
|
2650
|
+
couldBeCtxOwner: boolean;
|
|
2651
|
+
dropzone: boolean;
|
|
2652
|
+
private _buttonTextKey;
|
|
2653
|
+
private readonly _handleClick;
|
|
3010
2654
|
initCallback(): void;
|
|
3011
|
-
private _syncActivities;
|
|
3012
|
-
disconnectedCallback(): void;
|
|
3013
|
-
render(): lit_html.TemplateResult<1>;
|
|
3014
|
-
}
|
|
3015
|
-
declare global {
|
|
3016
|
-
interface HTMLElementTagNameMap {
|
|
3017
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3018
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3023
|
-
private _formState;
|
|
3024
|
-
private _inputRef;
|
|
3025
|
-
private _handleInput;
|
|
3026
|
-
private _handleUpload;
|
|
3027
|
-
firstUpdated(): void;
|
|
3028
2655
|
render(): lit_html.TemplateResult<1>;
|
|
3029
2656
|
}
|
|
3030
2657
|
declare global {
|
|
3031
2658
|
interface HTMLElementTagNameMap {
|
|
3032
|
-
'uc-
|
|
2659
|
+
'uc-simple-btn': SimpleBtn;
|
|
3033
2660
|
}
|
|
3034
2661
|
}
|
|
3035
2662
|
|
|
3036
2663
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3037
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3038
2664
|
attributesMeta: {
|
|
3039
2665
|
headless?: boolean;
|
|
3040
2666
|
'ctx-name': string;
|
|
@@ -3052,7 +2678,6 @@ declare global {
|
|
|
3052
2678
|
}
|
|
3053
2679
|
|
|
3054
2680
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3055
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3056
2681
|
attributesMeta: {
|
|
3057
2682
|
'ctx-name': string;
|
|
3058
2683
|
};
|
|
@@ -3073,7 +2698,6 @@ declare global {
|
|
|
3073
2698
|
}
|
|
3074
2699
|
|
|
3075
2700
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3076
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3077
2701
|
attributesMeta: {
|
|
3078
2702
|
'ctx-name': string;
|
|
3079
2703
|
};
|
|
@@ -3082,6 +2706,7 @@ declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
|
3082
2706
|
private _isHiddenStartFrom;
|
|
3083
2707
|
private _classUploadList;
|
|
3084
2708
|
private _classStartFrom;
|
|
2709
|
+
private _buttonTextKey;
|
|
3085
2710
|
private _getInitActivity;
|
|
3086
2711
|
constructor();
|
|
3087
2712
|
private _handleModalOpen;
|
|
@@ -3096,4 +2721,4 @@ declare global {
|
|
|
3096
2721
|
}
|
|
3097
2722
|
}
|
|
3098
2723
|
|
|
3099
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2724
|
+
export { LitActivityBlock as ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, BaseComponent, LitBlock as Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, PubSub as Data, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
|