@uploadcare/file-uploader 1.28.0-alpha.669 → 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 +296 -684
- 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 +299 -684
- 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 +299 -684
- 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 +3 -3
- package/web/uc-cloud-image-editor.min.css +3 -3
- package/web/uc-cloud-image-editor.min.d.ts +244 -629
- 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 +299 -684
- 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 +299 -684
- 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 +299 -684
- 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
|
@@ -2,7 +2,7 @@ import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
|
|
|
2
2
|
import * as lit_html from 'lit-html';
|
|
3
3
|
import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
|
|
4
4
|
import * as _uploadcare_upload_client from '@uploadcare/upload-client';
|
|
5
|
-
import {
|
|
5
|
+
import { UploadcareFile, Metadata, FileFromOptions, UploadError, NetworkError, UploadcareGroup, Queue } from '@uploadcare/upload-client';
|
|
6
6
|
export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
|
|
7
7
|
import { Ref } from 'lit/directives/ref.js';
|
|
8
8
|
import { TelemetryRequest } from '@uploadcare/quality-insights';
|
|
@@ -93,6 +93,7 @@ declare const _default: {
|
|
|
93
93
|
'choose-file': string;
|
|
94
94
|
'choose-files': string;
|
|
95
95
|
'drop-files-here': string;
|
|
96
|
+
'drop-file-here': string;
|
|
96
97
|
'select-file-source': string;
|
|
97
98
|
selected: string;
|
|
98
99
|
upload: string;
|
|
@@ -134,6 +135,7 @@ declare const _default: {
|
|
|
134
135
|
'src-type-camera': string;
|
|
135
136
|
'src-type-mobile-video-camera': string;
|
|
136
137
|
'src-type-mobile-photo-camera': string;
|
|
138
|
+
'src-type-draw': string;
|
|
137
139
|
'src-type-facebook': string;
|
|
138
140
|
'src-type-dropbox': string;
|
|
139
141
|
'src-type-gdrive': string;
|
|
@@ -148,6 +150,7 @@ declare const _default: {
|
|
|
148
150
|
'src-type-other': string;
|
|
149
151
|
'caption-from-url': string;
|
|
150
152
|
'caption-camera': string;
|
|
153
|
+
'caption-draw': string;
|
|
151
154
|
'caption-edit-file': string;
|
|
152
155
|
'file-no-name': string;
|
|
153
156
|
'toggle-fullscreen': string;
|
|
@@ -229,72 +232,8 @@ declare class A11y implements ISharedInstance {
|
|
|
229
232
|
declare class LocaleManager extends SharedInstance {
|
|
230
233
|
private _localeName;
|
|
231
234
|
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
232
|
-
private _applyOverrides;
|
|
233
|
-
private _applyPluginLocales;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
|
-
/**
|
|
237
|
-
* Custom configuration options registration system for plugins
|
|
238
|
-
*/
|
|
239
|
-
type CustomConfigDefinition<T = unknown> = {
|
|
240
|
-
/**
|
|
241
|
-
* Config option name (will be used as property and optionally as attribute)
|
|
242
|
-
*/
|
|
243
|
-
name: string;
|
|
244
|
-
/**
|
|
245
|
-
* Default value for the config option
|
|
246
|
-
*/
|
|
247
|
-
defaultValue: T;
|
|
248
|
-
/**
|
|
249
|
-
* Whether this config can be set via HTML attribute
|
|
250
|
-
* @default true
|
|
251
|
-
*/
|
|
252
|
-
attribute?: boolean;
|
|
253
|
-
/**
|
|
254
|
-
* Convert attribute string to config value
|
|
255
|
-
* Only used if attribute is true
|
|
256
|
-
*/
|
|
257
|
-
fromAttribute?: (value: string | null) => T;
|
|
258
|
-
/**
|
|
259
|
-
* Convert config value to attribute string
|
|
260
|
-
* Only used if attribute is true
|
|
261
|
-
*/
|
|
262
|
-
toAttribute?: (value: T) => string | null;
|
|
263
|
-
/**
|
|
264
|
-
* Normalize/validate the config value
|
|
265
|
-
*/
|
|
266
|
-
normalize?: (value: unknown) => T;
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* Registry for custom config options defined by plugins
|
|
270
|
-
* This is managed by the PluginManager as a shared instance property
|
|
271
|
-
*/
|
|
272
|
-
declare class CustomConfigRegistry {
|
|
273
|
-
private _definitions;
|
|
274
|
-
register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
275
|
-
unregister(name: string): void;
|
|
276
|
-
unregisterByPlugin(pluginId: string): void;
|
|
277
|
-
get(name: string): CustomConfigDefinition<any> | undefined;
|
|
278
|
-
getAll(): Map<string, CustomConfigDefinition<any>>;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Interface for TypeScript module augmentation
|
|
282
|
-
* Plugins should extend this interface to add their custom config types
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* ```typescript
|
|
286
|
-
* declare module '@uploadcare/file-uploader' {
|
|
287
|
-
* interface CustomConfig {
|
|
288
|
-
* 'my-custom-option': string;
|
|
289
|
-
* }
|
|
290
|
-
* }
|
|
291
|
-
* ```
|
|
292
|
-
*/
|
|
293
|
-
interface CustomConfig {
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
297
|
-
|
|
298
237
|
declare class TypedData<T extends Record<string, unknown>> {
|
|
299
238
|
private _ctxId;
|
|
300
239
|
private _data;
|
|
@@ -307,41 +246,6 @@ declare class TypedData<T extends Record<string, unknown>> {
|
|
|
307
246
|
destroy(): void;
|
|
308
247
|
}
|
|
309
248
|
|
|
310
|
-
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
311
|
-
signal?: AbortSignal;
|
|
312
|
-
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
313
|
-
type FileValidatorDescriptor = {
|
|
314
|
-
runOn: 'add' | 'upload' | 'change';
|
|
315
|
-
validator: FuncFileValidator;
|
|
316
|
-
};
|
|
317
|
-
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
318
|
-
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
319
|
-
declare class ValidationManager extends SharedInstance {
|
|
320
|
-
private get _uploadCollection();
|
|
321
|
-
private _commonFileValidators;
|
|
322
|
-
private _commonCollectionValidators;
|
|
323
|
-
private _queue;
|
|
324
|
-
private _runQueueDebounced;
|
|
325
|
-
private _isDestroyed;
|
|
326
|
-
private _entryValidationState;
|
|
327
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
328
|
-
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
329
|
-
runCollectionValidators(): void;
|
|
330
|
-
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
331
|
-
private _runFileValidatorsForEntry;
|
|
332
|
-
private _addCustomTypeToValidationError;
|
|
333
|
-
private _getEntryValidationState;
|
|
334
|
-
private _getValidatorDescriptors;
|
|
335
|
-
private _getValidatorDescriptorsForEntry;
|
|
336
|
-
destroy(): void;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
declare class SecureUploadsManager extends SharedInstance {
|
|
340
|
-
private _secureToken;
|
|
341
|
-
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
342
|
-
destroy(): void;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
249
|
type ChangeMap<T extends Record<string, unknown>> = Record<keyof T, Set<Uid>>;
|
|
346
250
|
type TypedCollectionPropertyObserver<T extends Record<string, unknown>> = (changeMap: ChangeMap<T>) => void;
|
|
347
251
|
type TypedCollectionObserverHandler<T extends Record<string, unknown>> = (list: Uid[], added: Set<TypedData<T>>, removed: Set<TypedData<T>>) => void;
|
|
@@ -393,6 +297,157 @@ declare const CameraSourceTypes: Readonly<{
|
|
|
393
297
|
}>;
|
|
394
298
|
type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
|
|
395
299
|
|
|
300
|
+
declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
|
|
301
|
+
|
|
302
|
+
interface UploadEntryData extends Record<string, unknown> {
|
|
303
|
+
file: File | null;
|
|
304
|
+
externalUrl: string | null;
|
|
305
|
+
fileName: string | null;
|
|
306
|
+
fileSize: number | null;
|
|
307
|
+
lastModified: number;
|
|
308
|
+
uploadProgress: number;
|
|
309
|
+
uuid: string | null;
|
|
310
|
+
isImage: boolean;
|
|
311
|
+
mimeType: string | null;
|
|
312
|
+
ctxName: string | null;
|
|
313
|
+
cdnUrl: string | null;
|
|
314
|
+
cdnUrlModifiers: string | null;
|
|
315
|
+
fileInfo: UploadcareFile | null;
|
|
316
|
+
isUploading: boolean;
|
|
317
|
+
abortController: AbortController | null;
|
|
318
|
+
thumbUrl: string | null;
|
|
319
|
+
silent: boolean;
|
|
320
|
+
source: string | null;
|
|
321
|
+
fullPath: string | null;
|
|
322
|
+
metadata: Metadata | null;
|
|
323
|
+
errors: OutputErrorFile[];
|
|
324
|
+
uploadError: Error | null;
|
|
325
|
+
isRemoved: boolean;
|
|
326
|
+
isQueuedForUploading: boolean;
|
|
327
|
+
isValidationPending: boolean;
|
|
328
|
+
isQueuedForValidation: boolean;
|
|
329
|
+
}
|
|
330
|
+
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
331
|
+
type UploadEntryKeys = keyof UploadEntryData;
|
|
332
|
+
|
|
333
|
+
type ApiAddFileCommonOptions = {
|
|
334
|
+
silent?: boolean;
|
|
335
|
+
fileName?: string;
|
|
336
|
+
source?: string;
|
|
337
|
+
};
|
|
338
|
+
declare class UploaderPublicApi extends SharedInstance {
|
|
339
|
+
private _l10n;
|
|
340
|
+
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
341
|
+
get cfg(): Readonly<ConfigType>;
|
|
342
|
+
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
343
|
+
/**
|
|
344
|
+
* TODO: Probably we should not allow user to override `source` property
|
|
345
|
+
*/
|
|
346
|
+
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
347
|
+
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
348
|
+
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
349
|
+
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
350
|
+
fullPath?: string;
|
|
351
|
+
}) => OutputFileEntry<"idle">;
|
|
352
|
+
removeFileByInternalId: (internalId: string) => void;
|
|
353
|
+
removeAllFiles(): void;
|
|
354
|
+
uploadAll: () => void;
|
|
355
|
+
openSystemDialog: (options?: {
|
|
356
|
+
captureCamera?: boolean;
|
|
357
|
+
modeCamera?: ModeCameraType;
|
|
358
|
+
}) => void;
|
|
359
|
+
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
360
|
+
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
361
|
+
initFlow: (force?: boolean) => void;
|
|
362
|
+
doneFlow: () => void;
|
|
363
|
+
setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
|
|
364
|
+
getCurrentActivity: () => ActivityType;
|
|
365
|
+
setModalState: (opened: boolean) => void;
|
|
366
|
+
private get _sourceList();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare const ExternalUploadSource: Readonly<{
|
|
370
|
+
readonly FACEBOOK: "facebook";
|
|
371
|
+
readonly DROPBOX: "dropbox";
|
|
372
|
+
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
373
|
+
readonly GDRIVE: "gdrive";
|
|
374
|
+
readonly GPHOTOS: "gphotos";
|
|
375
|
+
readonly FLICKR: "flickr";
|
|
376
|
+
readonly VK: "vk";
|
|
377
|
+
readonly EVERNOTE: "evernote";
|
|
378
|
+
readonly BOX: "box";
|
|
379
|
+
readonly ONEDRIVE: "onedrive";
|
|
380
|
+
readonly HUDDLE: "huddle";
|
|
381
|
+
}>;
|
|
382
|
+
declare const UploadSource: Readonly<{
|
|
383
|
+
readonly FACEBOOK: "facebook";
|
|
384
|
+
readonly DROPBOX: "dropbox";
|
|
385
|
+
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
386
|
+
readonly GDRIVE: "gdrive";
|
|
387
|
+
readonly GPHOTOS: "gphotos";
|
|
388
|
+
readonly FLICKR: "flickr";
|
|
389
|
+
readonly VK: "vk";
|
|
390
|
+
readonly EVERNOTE: "evernote";
|
|
391
|
+
readonly BOX: "box";
|
|
392
|
+
readonly ONEDRIVE: "onedrive";
|
|
393
|
+
readonly HUDDLE: "huddle";
|
|
394
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
395
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
396
|
+
readonly LOCAL: "local";
|
|
397
|
+
readonly DROP_AREA: "drop-area";
|
|
398
|
+
readonly CAMERA: "camera";
|
|
399
|
+
readonly EXTERNAL: "external";
|
|
400
|
+
readonly API: "js-api";
|
|
401
|
+
readonly URL: "url";
|
|
402
|
+
readonly DRAW: "draw";
|
|
403
|
+
}>;
|
|
404
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
405
|
+
|
|
406
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
407
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
408
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
409
|
+
protected couldBeCtxOwner: boolean;
|
|
410
|
+
private _isCtxOwner;
|
|
411
|
+
private _unobserveCollection?;
|
|
412
|
+
private _unobserveCollectionProperties?;
|
|
413
|
+
init$: {
|
|
414
|
+
'*commonProgress': number;
|
|
415
|
+
'*uploadList': never[];
|
|
416
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
417
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
418
|
+
'*collectionState': OutputCollectionState | null;
|
|
419
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
420
|
+
'*uploadTrigger': Set<string>;
|
|
421
|
+
'*currentActivity': null;
|
|
422
|
+
'*currentActivityParams': {};
|
|
423
|
+
'*history': never[];
|
|
424
|
+
'*historyBack': null;
|
|
425
|
+
'*closeModal': () => void;
|
|
426
|
+
};
|
|
427
|
+
private get _hasCtxOwner();
|
|
428
|
+
initCallback(): void;
|
|
429
|
+
getAPI(): UploaderPublicApi;
|
|
430
|
+
get validationManager(): ValidationManager;
|
|
431
|
+
get api(): UploaderPublicApi;
|
|
432
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
433
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
434
|
+
disconnectedCallback(): void;
|
|
435
|
+
connectedCallback(): void;
|
|
436
|
+
private _initCtxOwner;
|
|
437
|
+
private _observeUploadCollection;
|
|
438
|
+
private _unobserveUploadCollection;
|
|
439
|
+
private _createGroup;
|
|
440
|
+
private _flushOutputItems;
|
|
441
|
+
private _handleCollectionUpdate;
|
|
442
|
+
private _handleCollectionPropertiesUpdate;
|
|
443
|
+
private _flushCommonUploadProgress;
|
|
444
|
+
private _openCloudImageEditor;
|
|
445
|
+
private _setInitialCrop;
|
|
446
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
447
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
448
|
+
getOutputData(): OutputFileEntry[];
|
|
449
|
+
}
|
|
450
|
+
|
|
396
451
|
/**
|
|
397
452
|
* Mapping of loading resources per operation
|
|
398
453
|
*/
|
|
@@ -507,14 +562,11 @@ declare global {
|
|
|
507
562
|
declare class Icon extends LitBlock {
|
|
508
563
|
name: string;
|
|
509
564
|
private _resolvedHref;
|
|
510
|
-
private _pluginSvg;
|
|
511
565
|
private _iconHrefResolver;
|
|
512
|
-
private _unsubscribePlugins?;
|
|
513
566
|
initCallback(): void;
|
|
514
567
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
515
568
|
private _updateResolvedHref;
|
|
516
569
|
render(): lit_html.TemplateResult<1>;
|
|
517
|
-
disconnectedCallback(): void;
|
|
518
570
|
}
|
|
519
571
|
declare global {
|
|
520
572
|
interface HTMLElementTagNameMap {
|
|
@@ -1045,7 +1097,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
1045
1097
|
private _hasNetworkProblems;
|
|
1046
1098
|
private _isInitialized;
|
|
1047
1099
|
private _pendingInitUpdate;
|
|
1048
|
-
private _pendingSizeWait;
|
|
1049
1100
|
private readonly _debouncedShowLoader;
|
|
1050
1101
|
private readonly _imgRef;
|
|
1051
1102
|
private readonly _cropperRef;
|
|
@@ -1095,11 +1146,12 @@ type ActivityParams$1 = {
|
|
|
1095
1146
|
internalId: string;
|
|
1096
1147
|
};
|
|
1097
1148
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1149
|
+
couldBeCtxOwner: boolean;
|
|
1150
|
+
activityType: "cloud-image-edit";
|
|
1098
1151
|
private _entry?;
|
|
1099
1152
|
private _editorConfig;
|
|
1100
1153
|
get activityParams(): ActivityParams$1;
|
|
1101
1154
|
initCallback(): void;
|
|
1102
|
-
disconnectedCallback(): void;
|
|
1103
1155
|
private _handleApply;
|
|
1104
1156
|
private _handleCancel;
|
|
1105
1157
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -1136,6 +1188,7 @@ type ActivityParams = {
|
|
|
1136
1188
|
};
|
|
1137
1189
|
declare class ExternalSource extends LitUploaderBlock {
|
|
1138
1190
|
couldBeCtxOwner: boolean;
|
|
1191
|
+
activityType: "external";
|
|
1139
1192
|
private _messageBridge?;
|
|
1140
1193
|
private _iframeRef;
|
|
1141
1194
|
private _latestSelectionSummary;
|
|
@@ -1179,26 +1232,22 @@ declare global {
|
|
|
1179
1232
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1180
1233
|
START_FROM: "start-from";
|
|
1181
1234
|
CAMERA: "camera";
|
|
1235
|
+
DRAW: "draw";
|
|
1182
1236
|
UPLOAD_LIST: "upload-list";
|
|
1183
1237
|
URL: "url";
|
|
1184
1238
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1185
1239
|
EXTERNAL: "external";
|
|
1186
1240
|
}>;
|
|
1187
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1188
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1241
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1242
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1189
1243
|
|
|
1190
1244
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1191
|
-
interface CustomActivities {
|
|
1192
|
-
}
|
|
1193
1245
|
type ActivityParamsMap = {
|
|
1194
1246
|
'cloud-image-edit': ActivityParams$1;
|
|
1195
1247
|
external: ActivityParams;
|
|
1196
|
-
} & {
|
|
1197
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1198
1248
|
};
|
|
1199
1249
|
declare class LitActivityBlock extends LitBlock {
|
|
1200
1250
|
protected historyTracked: boolean;
|
|
1201
|
-
activityType: ActivityType;
|
|
1202
1251
|
private [ACTIVE_PROP]?;
|
|
1203
1252
|
init$: {
|
|
1204
1253
|
'*currentActivity': null;
|
|
@@ -1212,11 +1261,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1212
1261
|
private _activate;
|
|
1213
1262
|
initCallback(): void;
|
|
1214
1263
|
private _historyFlush;
|
|
1215
|
-
|
|
1264
|
+
private _isActivityRegistered;
|
|
1216
1265
|
private static _activityCallbacks;
|
|
1217
1266
|
static activities: Readonly<{
|
|
1218
1267
|
START_FROM: 'start-from';
|
|
1219
1268
|
CAMERA: 'camera';
|
|
1269
|
+
DRAW: 'draw';
|
|
1220
1270
|
UPLOAD_LIST: 'upload-list';
|
|
1221
1271
|
URL: 'url';
|
|
1222
1272
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1232,8 +1282,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1232
1282
|
private _unregisterActivity;
|
|
1233
1283
|
disconnectedCallback(): void;
|
|
1234
1284
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1235
|
-
get initActivity():
|
|
1236
|
-
get doneActivity():
|
|
1285
|
+
get initActivity(): string | null;
|
|
1286
|
+
get doneActivity(): string | null;
|
|
1237
1287
|
historyBack(): void;
|
|
1238
1288
|
}
|
|
1239
1289
|
|
|
@@ -1295,9 +1345,7 @@ type EventPayload = {
|
|
|
1295
1345
|
declare class EventEmitter extends SharedInstance {
|
|
1296
1346
|
private _timeoutStore;
|
|
1297
1347
|
private _targets;
|
|
1298
|
-
private _listeners;
|
|
1299
1348
|
bindTarget(target: LitBlock): () => void;
|
|
1300
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1301
1349
|
private _dispatch;
|
|
1302
1350
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1303
1351
|
debounce?: TDebounce;
|
|
@@ -1305,121 +1353,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1305
1353
|
destroy(): void;
|
|
1306
1354
|
}
|
|
1307
1355
|
|
|
1308
|
-
type
|
|
1309
|
-
|
|
1310
|
-
fileName?: string;
|
|
1311
|
-
source?: string;
|
|
1356
|
+
type EventMap = {
|
|
1357
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1312
1358
|
};
|
|
1313
|
-
declare class UploaderPublicApi extends SharedInstance {
|
|
1314
|
-
private _l10n;
|
|
1315
|
-
get _uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1316
|
-
get cfg(): Readonly<ConfigType>;
|
|
1317
|
-
get l10n(): (str: string, variables?: Record<string, string | number>) => string;
|
|
1318
|
-
/**
|
|
1319
|
-
* TODO: Probably we should not allow user to override `source` property
|
|
1320
|
-
*/
|
|
1321
|
-
addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1322
|
-
addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1323
|
-
addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
|
|
1324
|
-
addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
|
|
1325
|
-
fullPath?: string;
|
|
1326
|
-
}) => OutputFileEntry<"idle">;
|
|
1327
|
-
removeFileByInternalId: (internalId: string) => void;
|
|
1328
|
-
removeAllFiles(): void;
|
|
1329
|
-
uploadAll: () => void;
|
|
1330
|
-
openSystemDialog: (options?: {
|
|
1331
|
-
captureCamera?: boolean;
|
|
1332
|
-
modeCamera?: ModeCameraType;
|
|
1333
|
-
}) => void;
|
|
1334
|
-
getOutputItem<TStatus extends OutputFileStatus>(entryId: string): OutputFileEntry<TStatus>;
|
|
1335
|
-
getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
|
|
1336
|
-
initFlow: (force?: boolean) => void;
|
|
1337
|
-
doneFlow: () => void;
|
|
1338
|
-
private _pluginsReady;
|
|
1339
|
-
setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
|
|
1340
|
-
on: <T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void) => (() => void);
|
|
1341
|
-
getCurrentActivity: () => ActivityType;
|
|
1342
|
-
historyBack: () => void;
|
|
1343
|
-
setModalState: (opened: boolean) => void;
|
|
1344
|
-
private get _sourceList();
|
|
1345
|
-
}
|
|
1346
1359
|
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
readonly HUDDLE: "huddle";
|
|
1358
|
-
}>;
|
|
1359
|
-
declare const UploadSource: Readonly<{
|
|
1360
|
-
readonly FACEBOOK: "facebook";
|
|
1361
|
-
readonly DROPBOX: "dropbox";
|
|
1362
|
-
readonly GDRIVE: "gdrive";
|
|
1363
|
-
readonly GPHOTOS: "gphotos";
|
|
1364
|
-
readonly FLICKR: "flickr";
|
|
1365
|
-
readonly VK: "vk";
|
|
1366
|
-
readonly EVERNOTE: "evernote";
|
|
1367
|
-
readonly BOX: "box";
|
|
1368
|
-
readonly ONEDRIVE: "onedrive";
|
|
1369
|
-
readonly HUDDLE: "huddle";
|
|
1370
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1371
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1372
|
-
readonly LOCAL: "local";
|
|
1373
|
-
readonly DROP_AREA: "drop-area";
|
|
1374
|
-
readonly CAMERA: "camera";
|
|
1375
|
-
readonly EXTERNAL: "external";
|
|
1376
|
-
readonly API: "js-api";
|
|
1377
|
-
readonly URL: "url";
|
|
1378
|
-
}>;
|
|
1379
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1380
|
-
|
|
1381
|
-
declare class LitUploaderBlock extends LitActivityBlock {
|
|
1382
|
-
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
1383
|
-
static sourceTypes: Readonly<typeof UploadSource>;
|
|
1384
|
-
protected couldBeCtxOwner: boolean;
|
|
1385
|
-
private _isCtxOwner;
|
|
1386
|
-
private _unobserveCollection?;
|
|
1387
|
-
private _unobserveCollectionProperties?;
|
|
1388
|
-
init$: {
|
|
1389
|
-
'*commonProgress': number;
|
|
1390
|
-
'*uploadList': never[];
|
|
1391
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1392
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1393
|
-
'*collectionState': OutputCollectionState | null;
|
|
1394
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1395
|
-
'*uploadTrigger': Set<string>;
|
|
1396
|
-
'*currentActivity': null;
|
|
1397
|
-
'*currentActivityParams': {};
|
|
1398
|
-
'*history': never[];
|
|
1399
|
-
'*historyBack': null;
|
|
1400
|
-
'*closeModal': () => void;
|
|
1401
|
-
};
|
|
1402
|
-
private get _hasCtxOwner();
|
|
1403
|
-
initCallback(): void;
|
|
1404
|
-
getAPI(): UploaderPublicApi;
|
|
1405
|
-
get validationManager(): ValidationManager;
|
|
1406
|
-
get api(): UploaderPublicApi;
|
|
1407
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1408
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1409
|
-
disconnectedCallback(): void;
|
|
1410
|
-
connectedCallback(): void;
|
|
1411
|
-
private _initCtxOwner;
|
|
1412
|
-
private _observeUploadCollection;
|
|
1413
|
-
private _unobserveUploadCollection;
|
|
1414
|
-
private _createGroup;
|
|
1415
|
-
private _flushOutputItems;
|
|
1416
|
-
private _handleCollectionUpdate;
|
|
1417
|
-
private _handleCollectionPropertiesUpdate;
|
|
1418
|
-
private _flushCommonUploadProgress;
|
|
1419
|
-
private _setInitialCrop;
|
|
1420
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1421
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1422
|
-
getOutputData(): OutputFileEntry[];
|
|
1360
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1361
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1362
|
+
private scopes;
|
|
1363
|
+
private listener;
|
|
1364
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1365
|
+
private openUploadList;
|
|
1366
|
+
private _listener;
|
|
1367
|
+
private handlePaste;
|
|
1368
|
+
registerBlock(scope: Node): () => void;
|
|
1369
|
+
destroy(): void;
|
|
1423
1370
|
}
|
|
1424
1371
|
|
|
1425
1372
|
type SelectOption = {
|
|
@@ -1442,6 +1389,7 @@ declare global {
|
|
|
1442
1389
|
type CameraMode = 'photo' | 'video';
|
|
1443
1390
|
declare class CameraSource extends LitUploaderBlock {
|
|
1444
1391
|
couldBeCtxOwner: boolean;
|
|
1392
|
+
activityType: "camera";
|
|
1445
1393
|
private _unsubPermissions;
|
|
1446
1394
|
private _capturing;
|
|
1447
1395
|
private _chunks;
|
|
@@ -1560,55 +1508,26 @@ declare global {
|
|
|
1560
1508
|
|
|
1561
1509
|
/**
|
|
1562
1510
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1563
|
-
*/
|
|
1564
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
private
|
|
1573
|
-
/**
|
|
1574
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1575
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1576
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1577
|
-
*/
|
|
1578
|
-
private _customAttrKeyMapping;
|
|
1579
|
-
/** Set of all custom config names registered by plugins */
|
|
1580
|
-
private _customConfigKeys;
|
|
1581
|
-
/**
|
|
1582
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1583
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1584
|
-
*/
|
|
1585
|
-
private _customConfigSubscriptions;
|
|
1586
|
-
/**
|
|
1587
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1588
|
-
*/
|
|
1589
|
-
private _isCustomConfig;
|
|
1590
|
-
/**
|
|
1591
|
-
* Get the custom config definition for a key
|
|
1592
|
-
*/
|
|
1593
|
-
private _getCustomConfigDefinition;
|
|
1594
|
-
/**
|
|
1595
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1596
|
-
*/
|
|
1597
|
-
private _getAttributeNames;
|
|
1511
|
+
*/
|
|
1512
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
|
|
1513
|
+
/** Mapping of attribute names to state */
|
|
1514
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1515
|
+
declare class Config extends LitBlock {
|
|
1516
|
+
attributesMeta: Partial<ConfigPlainType> & {
|
|
1517
|
+
'ctx-name': string;
|
|
1518
|
+
};
|
|
1519
|
+
init$: LitBlock["init$"] & ConfigType;
|
|
1520
|
+
private _computationControllers;
|
|
1598
1521
|
private _flushValueToAttribute;
|
|
1599
1522
|
private _flushValueToState;
|
|
1600
1523
|
private _setValue;
|
|
1601
1524
|
private _getValue;
|
|
1602
1525
|
private _assertSameValueDifferentReference;
|
|
1603
|
-
private _processCustomConfigs;
|
|
1604
|
-
private _setupCustomConfigs;
|
|
1605
|
-
private _setupMutationObserver;
|
|
1606
1526
|
initCallback(): void;
|
|
1607
|
-
attributeChangedCallback(name:
|
|
1608
|
-
disconnectedCallback(): void;
|
|
1527
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1609
1528
|
static get observedAttributes(): string[];
|
|
1610
1529
|
}
|
|
1611
|
-
interface Config extends ConfigType
|
|
1530
|
+
interface Config extends ConfigType {
|
|
1612
1531
|
}
|
|
1613
1532
|
declare global {
|
|
1614
1533
|
interface HTMLElementTagNameMap {
|
|
@@ -1692,12 +1611,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1692
1611
|
private _isFailed;
|
|
1693
1612
|
private _isUploading;
|
|
1694
1613
|
private _isFocused;
|
|
1614
|
+
private _isEditable;
|
|
1695
1615
|
private _showFileNames;
|
|
1696
1616
|
private _ariaLabelStatusFile;
|
|
1697
|
-
private _pluginFileActions;
|
|
1698
1617
|
private _renderedOnce;
|
|
1699
1618
|
private _observer?;
|
|
1700
|
-
private
|
|
1619
|
+
private _handleEdit;
|
|
1701
1620
|
private _handleRemove;
|
|
1702
1621
|
private _handleUploadClick;
|
|
1703
1622
|
private _calculateState;
|
|
@@ -1709,8 +1628,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1709
1628
|
private _handleEntryId;
|
|
1710
1629
|
private _updateShowFileNames;
|
|
1711
1630
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1712
|
-
private _updatePluginFileActions;
|
|
1713
|
-
private _handlePluginFileAction;
|
|
1714
1631
|
initCallback(): void;
|
|
1715
1632
|
connectedCallback(): void;
|
|
1716
1633
|
disconnectedCallback(): void;
|
|
@@ -1743,7 +1660,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1743
1660
|
text?: string;
|
|
1744
1661
|
private _isEnabled;
|
|
1745
1662
|
private _isVisible;
|
|
1746
|
-
private
|
|
1663
|
+
private _dropTextKey;
|
|
1664
|
+
private _isMultiple;
|
|
1665
|
+
private _updateDropText;
|
|
1747
1666
|
private _destroyDropzone;
|
|
1748
1667
|
private _destroyContentWrapperDropzone;
|
|
1749
1668
|
private _contentWrapperRef;
|
|
@@ -1752,7 +1671,9 @@ declare class DropArea extends LitUploaderBlock {
|
|
|
1752
1671
|
private _clickableListenersAttached;
|
|
1753
1672
|
isActive(): boolean;
|
|
1754
1673
|
initCallback(): void;
|
|
1755
|
-
protected willUpdate(changedProperties: PropertyValues<this
|
|
1674
|
+
protected willUpdate(changedProperties: PropertyValues<this & {
|
|
1675
|
+
localeId: string;
|
|
1676
|
+
}>): void;
|
|
1756
1677
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
1757
1678
|
/** Ignore drop events if there are other visible drop areas on the page. */
|
|
1758
1679
|
private _shouldIgnore;
|
|
@@ -2015,10 +1936,6 @@ type ConfigType = {
|
|
|
2015
1936
|
* Expiry threshold for secure uploads.
|
|
2016
1937
|
*/
|
|
2017
1938
|
secureUploadsExpireThreshold: number;
|
|
2018
|
-
/**
|
|
2019
|
-
* Array of plugins to register with the uploader instance.
|
|
2020
|
-
*/
|
|
2021
|
-
plugins: UploaderPlugin[];
|
|
2022
1939
|
/**
|
|
2023
1940
|
* Metadata for the file.
|
|
2024
1941
|
*/
|
|
@@ -2279,237 +2196,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2279
2196
|
allEntries: OutputFileEntry[];
|
|
2280
2197
|
});
|
|
2281
2198
|
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
};
|
|
2286
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2287
|
-
type PluginSourceRegistration = {
|
|
2288
|
-
id: string;
|
|
2289
|
-
label: string;
|
|
2290
|
-
icon?: string;
|
|
2291
|
-
/**
|
|
2292
|
-
* @internal
|
|
2293
|
-
*
|
|
2294
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2295
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2296
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2297
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2298
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2299
|
-
*/
|
|
2300
|
-
expand?: () => string[];
|
|
2301
|
-
onSelect: () => Promise<void> | void;
|
|
2302
|
-
};
|
|
2303
|
-
type PluginRenderDispose = () => void;
|
|
2304
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2305
|
-
type PluginActivityRegistration = {
|
|
2306
|
-
id: string;
|
|
2307
|
-
render: PluginRender;
|
|
2308
|
-
};
|
|
2309
|
-
type PluginFileActionRegistration = {
|
|
2310
|
-
/** Unique action identifier. */
|
|
2311
|
-
id: string;
|
|
2312
|
-
/** Icon name to display in the action button. */
|
|
2313
|
-
icon: string;
|
|
2314
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2315
|
-
label: string;
|
|
2316
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2317
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2318
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2319
|
-
};
|
|
2320
|
-
type PluginFileHookResult = {
|
|
2321
|
-
/** The (optionally transformed) file */
|
|
2322
|
-
file: File | Blob;
|
|
2323
|
-
};
|
|
2324
|
-
type PluginFileHookContext = PluginFileHookResult & {
|
|
2325
|
-
/**
|
|
2326
|
-
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
2327
|
-
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
2328
|
-
*/
|
|
2329
|
-
signal: AbortSignal;
|
|
2330
|
-
};
|
|
2331
|
-
type PluginFileHookRegistration = {
|
|
2332
|
-
/**
|
|
2333
|
-
* When the hook is called:
|
|
2334
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2335
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2336
|
-
*
|
|
2337
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2338
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2339
|
-
*/
|
|
2340
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2341
|
-
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
2342
|
-
/**
|
|
2343
|
-
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
2344
|
-
* @default 30000
|
|
2345
|
-
*/
|
|
2346
|
-
timeout?: number;
|
|
2347
|
-
};
|
|
2348
|
-
type PluginRegistryApi = {
|
|
2349
|
-
registerSource: (source: PluginSourceRegistration) => void;
|
|
2350
|
-
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
2351
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
2352
|
-
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
2353
|
-
registerIcon: (icon: PluginIconRegistration) => void;
|
|
2354
|
-
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
2355
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2356
|
-
};
|
|
2357
|
-
/**
|
|
2358
|
-
* API for managing plugin config subscriptions
|
|
2359
|
-
*/
|
|
2360
|
-
type PluginConfigApi = {
|
|
2361
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2362
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2363
|
-
};
|
|
2364
|
-
/**
|
|
2365
|
-
* API for managing plugin activity interactions
|
|
2366
|
-
*/
|
|
2367
|
-
type PluginActivityApi = {
|
|
2368
|
-
/**
|
|
2369
|
-
* Get the current activity parameters.
|
|
2370
|
-
*
|
|
2371
|
-
* @returns The current activity parameters object
|
|
2372
|
-
*
|
|
2373
|
-
* @example
|
|
2374
|
-
* ```typescript
|
|
2375
|
-
* const params = pluginApi.activity.getParams();
|
|
2376
|
-
* console.log('Current params:', params);
|
|
2377
|
-
* ```
|
|
2378
|
-
*/
|
|
2379
|
-
getParams: () => Record<string, unknown>;
|
|
2380
|
-
/**
|
|
2381
|
-
* Subscribe to changes in activity parameters.
|
|
2382
|
-
* The callback will be called immediately with the current params,
|
|
2383
|
-
* and then whenever the params change.
|
|
2384
|
-
*
|
|
2385
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2386
|
-
*
|
|
2387
|
-
* @param callback - Function to call with the new params
|
|
2388
|
-
* @returns Unsubscribe function
|
|
2389
|
-
*
|
|
2390
|
-
* @example
|
|
2391
|
-
* ```typescript
|
|
2392
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2393
|
-
* console.log('Activity params changed:', params);
|
|
2394
|
-
* });
|
|
2395
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2396
|
-
* ```
|
|
2397
|
-
*/
|
|
2398
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2399
|
-
};
|
|
2400
|
-
type PluginFileEntryUpdate = {
|
|
2401
|
-
file?: File | Blob;
|
|
2402
|
-
cdnUrl?: string | null;
|
|
2403
|
-
cdnUrlModifiers?: string | null;
|
|
2404
|
-
mimeType?: string | null;
|
|
2405
|
-
};
|
|
2406
|
-
type PluginFilesApi = {
|
|
2407
|
-
/**
|
|
2408
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2409
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2410
|
-
*/
|
|
2411
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2412
|
-
};
|
|
2413
|
-
type PluginApi = {
|
|
2414
|
-
registry: PluginRegistryApi;
|
|
2415
|
-
config: PluginConfigApi;
|
|
2416
|
-
activity: PluginActivityApi;
|
|
2417
|
-
files: PluginFilesApi;
|
|
2418
|
-
};
|
|
2419
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2420
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2421
|
-
type PluginSetupParams = {
|
|
2422
|
-
pluginApi: PluginApi;
|
|
2423
|
-
uploaderApi: PluginUploaderApi;
|
|
2424
|
-
};
|
|
2425
|
-
type UploaderPlugin = {
|
|
2426
|
-
id: string;
|
|
2427
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2428
|
-
};
|
|
2429
|
-
type Owned<T> = T & {
|
|
2430
|
-
pluginId: string;
|
|
2431
|
-
};
|
|
2432
|
-
type PluginRegistrySnapshot = {
|
|
2433
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2434
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2435
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2436
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2437
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2438
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2439
|
-
};
|
|
2440
|
-
|
|
2441
|
-
type EventMap = {
|
|
2442
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2443
|
-
};
|
|
2444
|
-
|
|
2445
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2446
|
-
file: File | null;
|
|
2447
|
-
externalUrl: string | null;
|
|
2448
|
-
fileName: string | null;
|
|
2449
|
-
fileSize: number | null;
|
|
2450
|
-
lastModified: number;
|
|
2451
|
-
uploadProgress: number;
|
|
2452
|
-
uuid: string | null;
|
|
2453
|
-
isImage: boolean;
|
|
2454
|
-
mimeType: string | null;
|
|
2455
|
-
ctxName: string | null;
|
|
2456
|
-
cdnUrl: string | null;
|
|
2457
|
-
cdnUrlModifiers: string | null;
|
|
2458
|
-
fileInfo: UploadcareFile | null;
|
|
2459
|
-
isUploading: boolean;
|
|
2460
|
-
abortController: AbortController | null;
|
|
2461
|
-
thumbUrl: string | null;
|
|
2462
|
-
silent: boolean;
|
|
2463
|
-
source: string | null;
|
|
2464
|
-
fullPath: string | null;
|
|
2465
|
-
metadata: Metadata | null;
|
|
2466
|
-
errors: OutputErrorFile[];
|
|
2467
|
-
uploadError: Error | null;
|
|
2468
|
-
isRemoved: boolean;
|
|
2469
|
-
isQueuedForUploading: boolean;
|
|
2470
|
-
isValidationPending: boolean;
|
|
2471
|
-
isQueuedForValidation: boolean;
|
|
2472
|
-
}
|
|
2473
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2474
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2475
|
-
|
|
2476
|
-
declare class PluginRegistry {
|
|
2477
|
-
private _sources;
|
|
2478
|
-
private _activities;
|
|
2479
|
-
private _fileActions;
|
|
2480
|
-
private _fileHooks;
|
|
2481
|
-
private _icons;
|
|
2482
|
-
private _i18n;
|
|
2483
|
-
readonly config: CustomConfigRegistry;
|
|
2484
|
-
private _own;
|
|
2485
|
-
addSource(pluginId: string, item: PluginSourceRegistration): void;
|
|
2486
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): void;
|
|
2487
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
|
|
2488
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
|
|
2489
|
-
addIcon(pluginId: string, item: PluginIconRegistration): void;
|
|
2490
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): void;
|
|
2491
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2492
|
-
purge(pluginId: string): void;
|
|
2493
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
declare class PluginManager extends SharedInstance {
|
|
2497
|
-
private _plugins;
|
|
2498
|
-
private _subscribers;
|
|
2499
|
-
private _pluginsUpdate;
|
|
2500
|
-
private _lazyPluginLoader;
|
|
2501
|
-
readonly registry: PluginRegistry;
|
|
2502
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2503
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2504
|
-
pluginsReady(): Promise<void>;
|
|
2505
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2506
|
-
private _syncPlugins;
|
|
2507
|
-
private _registerPlugin;
|
|
2508
|
-
private _unregisterPlugin;
|
|
2509
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2510
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2199
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2200
|
+
private _secureToken;
|
|
2201
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2511
2202
|
destroy(): void;
|
|
2512
|
-
private _notifySubscribers;
|
|
2513
2203
|
}
|
|
2514
2204
|
|
|
2515
2205
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2550,87 +2240,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2550
2240
|
private get _location();
|
|
2551
2241
|
}
|
|
2552
2242
|
|
|
2553
|
-
interface ISharedInstance {
|
|
2554
|
-
destroy?(): void;
|
|
2555
|
-
}
|
|
2556
|
-
declare class SharedInstance {
|
|
2557
|
-
protected _ctx: PubSub<SharedState>;
|
|
2558
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2559
|
-
private _subscriptions;
|
|
2560
|
-
private _cfgProxy;
|
|
2561
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2562
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2563
|
-
protected addSub(unsub: () => void): void;
|
|
2564
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2565
|
-
destroy(): void;
|
|
2566
|
-
}
|
|
2567
|
-
declare const instanceKeyMap: {
|
|
2568
|
-
modalManager: "*modalManager";
|
|
2569
|
-
pluginManager: "*pluginManager";
|
|
2570
|
-
telemetryManager: "*telemetryManager";
|
|
2571
|
-
localeManager: "*localeManager";
|
|
2572
|
-
a11y: "*a11y";
|
|
2573
|
-
clipboard: "*clipboard";
|
|
2574
|
-
blocksRegistry: "*blocksRegistry";
|
|
2575
|
-
eventEmitter: "*eventEmitter";
|
|
2576
|
-
uploadCollection: "*uploadCollection";
|
|
2577
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2578
|
-
api: "*publicApi";
|
|
2579
|
-
validationManager: "*validationManager";
|
|
2580
|
-
};
|
|
2581
|
-
type InstanceTypeMap = {
|
|
2582
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2583
|
-
};
|
|
2584
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2585
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2586
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2587
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2588
|
-
readonly ctx: PubSub<SharedState>;
|
|
2589
|
-
readonly modalManager: ModalManager | null;
|
|
2590
|
-
readonly pluginManager: PluginManager;
|
|
2591
|
-
readonly telemetryManager: TelemetryManager;
|
|
2592
|
-
readonly localeManager: LocaleManager;
|
|
2593
|
-
readonly a11y: A11y;
|
|
2594
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2595
|
-
readonly eventEmitter: EventEmitter;
|
|
2596
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2597
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2598
|
-
readonly api: UploaderPublicApi;
|
|
2599
|
-
readonly validationManager: ValidationManager;
|
|
2600
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2601
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2602
|
-
};
|
|
2603
|
-
|
|
2604
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2605
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2606
|
-
private scopes;
|
|
2607
|
-
private listener;
|
|
2608
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2609
|
-
private openUploadList;
|
|
2610
|
-
private _listener;
|
|
2611
|
-
private handlePaste;
|
|
2612
|
-
registerBlock(scope: Node): () => void;
|
|
2613
|
-
destroy(): void;
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2617
|
-
type LazyPluginEntry = {
|
|
2618
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2619
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2620
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2621
|
-
};
|
|
2622
|
-
|
|
2623
2243
|
type SharedConfigState = {
|
|
2624
2244
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2625
2245
|
};
|
|
2626
|
-
type SharedCustomConfigState = {
|
|
2627
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2628
|
-
};
|
|
2629
2246
|
type BlocksRegistry = Set<LitBlock>;
|
|
2630
2247
|
type ActivityBlockCtxState = {
|
|
2631
|
-
'*currentActivity':
|
|
2248
|
+
'*currentActivity': string | null;
|
|
2632
2249
|
'*currentActivityParams': Record<string, unknown>;
|
|
2633
|
-
'*history': (
|
|
2250
|
+
'*history': (string | null)[];
|
|
2634
2251
|
'*historyBack': (() => void) | null;
|
|
2635
2252
|
'*closeModal': () => void;
|
|
2636
2253
|
};
|
|
@@ -2647,7 +2264,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2647
2264
|
};
|
|
2648
2265
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2649
2266
|
'*solution': string | null;
|
|
2650
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2651
2267
|
};
|
|
2652
2268
|
type CloudImageEditorState = {
|
|
2653
2269
|
'*originalUrl': string | null;
|
|
@@ -2698,9 +2314,7 @@ type EditorToolbarState = {
|
|
|
2698
2314
|
'*currentOperation': string | null;
|
|
2699
2315
|
'*operationTooltip': string | null;
|
|
2700
2316
|
};
|
|
2701
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2702
2317
|
type DynamicBlockState = {
|
|
2703
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2704
2318
|
'*blocksRegistry': BlocksRegistry;
|
|
2705
2319
|
'*eventEmitter': EventEmitter;
|
|
2706
2320
|
'*localeManager': LocaleManager;
|
|
@@ -2708,7 +2322,6 @@ type DynamicBlockState = {
|
|
|
2708
2322
|
'*a11y': A11y;
|
|
2709
2323
|
'*modalManager': ModalManager | null;
|
|
2710
2324
|
'*clipboard': ClipboardLayer;
|
|
2711
|
-
'*pluginManager': PluginManager;
|
|
2712
2325
|
};
|
|
2713
2326
|
type DynamicUploaderBlockState = {
|
|
2714
2327
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2719,7 +2332,66 @@ type DynamicUploaderBlockState = {
|
|
|
2719
2332
|
type LocaleState = {
|
|
2720
2333
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2721
2334
|
};
|
|
2722
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2335
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2336
|
+
|
|
2337
|
+
interface ISharedInstance {
|
|
2338
|
+
destroy?(): void;
|
|
2339
|
+
}
|
|
2340
|
+
declare class SharedInstance {
|
|
2341
|
+
protected _ctx: PubSub<SharedState>;
|
|
2342
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2343
|
+
private _subscriptions;
|
|
2344
|
+
private _cfgProxy;
|
|
2345
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2346
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2347
|
+
protected addSub(unsub: () => void): void;
|
|
2348
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2349
|
+
destroy(): void;
|
|
2350
|
+
}
|
|
2351
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2352
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2353
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2354
|
+
readonly ctx: PubSub<SharedState>;
|
|
2355
|
+
readonly modalManager: ModalManager | null;
|
|
2356
|
+
readonly telemetryManager: TelemetryManager;
|
|
2357
|
+
readonly localeManager: LocaleManager;
|
|
2358
|
+
readonly a11y: A11y;
|
|
2359
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2360
|
+
readonly eventEmitter: EventEmitter;
|
|
2361
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2362
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2363
|
+
readonly api: UploaderPublicApi;
|
|
2364
|
+
readonly validationManager: ValidationManager;
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2368
|
+
signal?: AbortSignal;
|
|
2369
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2370
|
+
type FileValidatorDescriptor = {
|
|
2371
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2372
|
+
validator: FuncFileValidator;
|
|
2373
|
+
};
|
|
2374
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2375
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2376
|
+
declare class ValidationManager extends SharedInstance {
|
|
2377
|
+
private get _uploadCollection();
|
|
2378
|
+
private _commonFileValidators;
|
|
2379
|
+
private _commonCollectionValidators;
|
|
2380
|
+
private _queue;
|
|
2381
|
+
private _runQueueDebounced;
|
|
2382
|
+
private _isDestroyed;
|
|
2383
|
+
private _entryValidationState;
|
|
2384
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2385
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2386
|
+
runCollectionValidators(): void;
|
|
2387
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2388
|
+
private _runFileValidatorsForEntry;
|
|
2389
|
+
private _addCustomTypeToValidationError;
|
|
2390
|
+
private _getEntryValidationState;
|
|
2391
|
+
private _getValidatorDescriptors;
|
|
2392
|
+
private _getValidatorDescriptorsForEntry;
|
|
2393
|
+
destroy(): void;
|
|
2394
|
+
}
|
|
2723
2395
|
|
|
2724
2396
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2725
2397
|
willYield: boolean;
|
|
@@ -2731,7 +2403,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2731
2403
|
};
|
|
2732
2404
|
declare class LitBlock extends LitBlockBase {
|
|
2733
2405
|
private _cfgProxy;
|
|
2406
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2734
2407
|
static styleAttrs: string[];
|
|
2408
|
+
activityType: ActivityType;
|
|
2735
2409
|
init$: {};
|
|
2736
2410
|
constructor();
|
|
2737
2411
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2739,7 +2413,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2739
2413
|
protected _sharedInstancesBag: {
|
|
2740
2414
|
readonly ctx: PubSub<SharedState>;
|
|
2741
2415
|
readonly modalManager: ModalManager | null;
|
|
2742
|
-
readonly pluginManager: PluginManager;
|
|
2743
2416
|
readonly telemetryManager: TelemetryManager;
|
|
2744
2417
|
readonly localeManager: LocaleManager;
|
|
2745
2418
|
readonly a11y: A11y;
|
|
@@ -2749,34 +2422,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2749
2422
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2750
2423
|
readonly api: UploaderPublicApi;
|
|
2751
2424
|
readonly validationManager: ValidationManager;
|
|
2752
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2753
|
-
modalManager: ModalManager | null;
|
|
2754
|
-
pluginManager: PluginManager;
|
|
2755
|
-
telemetryManager: TelemetryManager;
|
|
2756
|
-
localeManager: LocaleManager;
|
|
2757
|
-
a11y: A11y;
|
|
2758
|
-
clipboard: ClipboardLayer;
|
|
2759
|
-
blocksRegistry: BlocksRegistry;
|
|
2760
|
-
eventEmitter: EventEmitter;
|
|
2761
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2762
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2763
|
-
api: UploaderPublicApi;
|
|
2764
|
-
validationManager: ValidationManager;
|
|
2765
|
-
}[TName]>) => void): () => void;
|
|
2766
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2767
|
-
modalManager: ModalManager | null;
|
|
2768
|
-
pluginManager: PluginManager;
|
|
2769
|
-
telemetryManager: TelemetryManager;
|
|
2770
|
-
localeManager: LocaleManager;
|
|
2771
|
-
a11y: A11y;
|
|
2772
|
-
clipboard: ClipboardLayer;
|
|
2773
|
-
blocksRegistry: BlocksRegistry;
|
|
2774
|
-
eventEmitter: EventEmitter;
|
|
2775
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2776
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2777
|
-
api: UploaderPublicApi;
|
|
2778
|
-
validationManager: ValidationManager;
|
|
2779
|
-
}[TName]>>;
|
|
2780
2425
|
};
|
|
2781
2426
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2782
2427
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2795,7 +2440,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2795
2440
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2796
2441
|
*/
|
|
2797
2442
|
private destroyCtxCallback;
|
|
2798
|
-
|
|
2443
|
+
/**
|
|
2444
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2445
|
+
* @param key The shared state key.
|
|
2446
|
+
* @param resolver The resolver function that creates the instance.
|
|
2447
|
+
*/
|
|
2799
2448
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2800
2449
|
private _destroySharedContextInstances;
|
|
2801
2450
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2807,7 +2456,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2807
2456
|
declare class Modal extends LitBlock {
|
|
2808
2457
|
static styleAttrs: string[];
|
|
2809
2458
|
private _mouseDownTarget;
|
|
2810
|
-
private _isActive;
|
|
2811
2459
|
/** WARNING: Do not rename/change this, it's used in dashboard */
|
|
2812
2460
|
protected dialogEl: lit_html_directives_ref_js.Ref<HTMLDialogElement>;
|
|
2813
2461
|
/**
|
|
@@ -2823,7 +2471,7 @@ declare class Modal extends LitBlock {
|
|
|
2823
2471
|
private _handleDialogClose;
|
|
2824
2472
|
private _handleDialogMouseDown;
|
|
2825
2473
|
private _handleDialogMouseUp;
|
|
2826
|
-
show():
|
|
2474
|
+
show(): void;
|
|
2827
2475
|
hide(): void;
|
|
2828
2476
|
private _handleModalOpen;
|
|
2829
2477
|
private _handleModalClose;
|
|
@@ -2895,10 +2543,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2895
2543
|
|
|
2896
2544
|
declare class LitSolutionBlock extends LitBlock {
|
|
2897
2545
|
static styleAttrs: string[];
|
|
2898
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2899
2546
|
init$: {
|
|
2900
2547
|
'*solution': string | null;
|
|
2901
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2902
2548
|
'*commonProgress': number;
|
|
2903
2549
|
'*uploadList': never[];
|
|
2904
2550
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -3030,20 +2676,18 @@ declare global {
|
|
|
3030
2676
|
}
|
|
3031
2677
|
}
|
|
3032
2678
|
|
|
3033
|
-
type SourceButtonConfig = {
|
|
3034
|
-
id: string;
|
|
3035
|
-
label: string;
|
|
3036
|
-
icon?: string;
|
|
3037
|
-
onClick: () => void | Promise<void>;
|
|
3038
|
-
};
|
|
3039
2679
|
declare class SourceBtn extends LitUploaderBlock {
|
|
3040
2680
|
couldBeCtxOwner: boolean;
|
|
3041
|
-
|
|
2681
|
+
private _registeredTypes;
|
|
2682
|
+
type?: string;
|
|
3042
2683
|
private _iconName;
|
|
3043
2684
|
private _srcTypeKey;
|
|
3044
|
-
|
|
3045
|
-
|
|
2685
|
+
private _initTypes;
|
|
2686
|
+
initCallback(): void;
|
|
2687
|
+
private _registerType;
|
|
3046
2688
|
activate(): void;
|
|
2689
|
+
private _applyType;
|
|
2690
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
3047
2691
|
render(): lit_html.TemplateResult<1>;
|
|
3048
2692
|
}
|
|
3049
2693
|
declare global {
|
|
@@ -3052,10 +2696,9 @@ declare global {
|
|
|
3052
2696
|
}
|
|
3053
2697
|
}
|
|
3054
2698
|
|
|
3055
|
-
declare class SourceList extends
|
|
2699
|
+
declare class SourceList extends LitBlock {
|
|
3056
2700
|
private _rawSourceList;
|
|
3057
|
-
private
|
|
3058
|
-
private _sources;
|
|
2701
|
+
private _cameraModes;
|
|
3059
2702
|
/**
|
|
3060
2703
|
* CSS-only attribute
|
|
3061
2704
|
*/
|
|
@@ -3063,10 +2706,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
3063
2706
|
initCallback(): void;
|
|
3064
2707
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
3065
2708
|
private _updateSources;
|
|
3066
|
-
private
|
|
3067
|
-
private _makePluginSourceConfig;
|
|
2709
|
+
private _sources;
|
|
3068
2710
|
render(): lit_html.TemplateResult<1>;
|
|
3069
|
-
disconnectedCallback(): void;
|
|
3070
2711
|
}
|
|
3071
2712
|
declare global {
|
|
3072
2713
|
interface HTMLElementTagNameMap {
|
|
@@ -3121,6 +2762,8 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
3121
2762
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
3122
2763
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
3123
2764
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2765
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2766
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
3124
2767
|
}
|
|
3125
2768
|
declare global {
|
|
3126
2769
|
interface HTMLElementTagNameMap {
|
|
@@ -3128,65 +2771,38 @@ declare global {
|
|
|
3128
2771
|
}
|
|
3129
2772
|
}
|
|
3130
2773
|
|
|
3131
|
-
declare class
|
|
3132
|
-
static styleAttrs: string[];
|
|
2774
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
3133
2775
|
couldBeCtxOwner: boolean;
|
|
3134
|
-
|
|
3135
|
-
private
|
|
3136
|
-
private readonly _handleClick;
|
|
2776
|
+
activityType: ActivityType;
|
|
2777
|
+
private _formState;
|
|
3137
2778
|
initCallback(): void;
|
|
2779
|
+
private _inputRef;
|
|
2780
|
+
private _handleInput;
|
|
2781
|
+
private _handleUpload;
|
|
3138
2782
|
render(): lit_html.TemplateResult<1>;
|
|
3139
2783
|
}
|
|
3140
2784
|
declare global {
|
|
3141
2785
|
interface HTMLElementTagNameMap {
|
|
3142
|
-
'uc-
|
|
2786
|
+
'uc-url-source': UrlSource;
|
|
3143
2787
|
}
|
|
3144
2788
|
}
|
|
3145
2789
|
|
|
3146
|
-
declare class
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
private _ensureRegistered;
|
|
3153
|
-
private _renderActivity;
|
|
3154
|
-
private _disposeActivity;
|
|
3155
|
-
disconnectedCallback(): void;
|
|
3156
|
-
render(): lit_html.TemplateResult<1>;
|
|
3157
|
-
}
|
|
3158
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3159
|
-
mode: 'modal' | 'inline';
|
|
3160
|
-
private _activities;
|
|
3161
|
-
private _unsubscribePlugins?;
|
|
2790
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2791
|
+
static styleAttrs: string[];
|
|
2792
|
+
couldBeCtxOwner: boolean;
|
|
2793
|
+
dropzone: boolean;
|
|
2794
|
+
private _buttonTextKey;
|
|
2795
|
+
private readonly _handleClick;
|
|
3162
2796
|
initCallback(): void;
|
|
3163
|
-
private _syncActivities;
|
|
3164
|
-
disconnectedCallback(): void;
|
|
3165
|
-
render(): lit_html.TemplateResult<1>;
|
|
3166
|
-
}
|
|
3167
|
-
declare global {
|
|
3168
|
-
interface HTMLElementTagNameMap {
|
|
3169
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3170
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
|
-
|
|
3174
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3175
|
-
private _formState;
|
|
3176
|
-
private _inputRef;
|
|
3177
|
-
private _handleInput;
|
|
3178
|
-
private _handleUpload;
|
|
3179
|
-
firstUpdated(): void;
|
|
3180
2797
|
render(): lit_html.TemplateResult<1>;
|
|
3181
2798
|
}
|
|
3182
2799
|
declare global {
|
|
3183
2800
|
interface HTMLElementTagNameMap {
|
|
3184
|
-
'uc-
|
|
2801
|
+
'uc-simple-btn': SimpleBtn;
|
|
3185
2802
|
}
|
|
3186
2803
|
}
|
|
3187
2804
|
|
|
3188
2805
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3189
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3190
2806
|
attributesMeta: {
|
|
3191
2807
|
headless?: boolean;
|
|
3192
2808
|
'ctx-name': string;
|
|
@@ -3204,7 +2820,6 @@ declare global {
|
|
|
3204
2820
|
}
|
|
3205
2821
|
|
|
3206
2822
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3207
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3208
2823
|
attributesMeta: {
|
|
3209
2824
|
'ctx-name': string;
|
|
3210
2825
|
};
|
|
@@ -3225,7 +2840,6 @@ declare global {
|
|
|
3225
2840
|
}
|
|
3226
2841
|
|
|
3227
2842
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3228
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3229
2843
|
attributesMeta: {
|
|
3230
2844
|
'ctx-name': string;
|
|
3231
2845
|
};
|
|
@@ -3234,6 +2848,7 @@ declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
|
3234
2848
|
private _isHiddenStartFrom;
|
|
3235
2849
|
private _classUploadList;
|
|
3236
2850
|
private _classStartFrom;
|
|
2851
|
+
private _buttonTextKey;
|
|
3237
2852
|
private _getInitActivity;
|
|
3238
2853
|
constructor();
|
|
3239
2854
|
private _handleModalOpen;
|
|
@@ -3251,4 +2866,4 @@ declare global {
|
|
|
3251
2866
|
declare const PACKAGE_NAME = "blocks";
|
|
3252
2867
|
declare const PACKAGE_VERSION: string;
|
|
3253
2868
|
|
|
3254
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2869
|
+
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, PACKAGE_NAME, PACKAGE_VERSION, 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, loadFileUploaderFrom, toKebabCase };
|