@uploadcare/file-uploader 1.29.0-alpha.2 → 1.30.0-alpha.1
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 +0 -2
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +3 -3
- package/dist/index.d.ts +337 -691
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +82 -115
- package/dist/locales/file-uploader/ar.d.ts +2 -0
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +2 -0
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +2 -0
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +2 -0
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +2 -0
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +2 -0
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +2 -0
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +2 -0
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +2 -0
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +2 -0
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +2 -0
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +2 -0
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +2 -0
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +2 -0
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +2 -0
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +2 -0
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +2 -0
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +2 -0
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +2 -0
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +2 -0
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +2 -0
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +2 -0
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +2 -0
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +2 -0
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +2 -0
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +2 -0
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +2 -0
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +2 -0
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +2 -0
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +2 -0
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +2 -0
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +2 -0
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +2 -0
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +2 -0
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +2 -0
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +339 -691
- 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 +339 -691
- 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 +291 -643
- 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 +339 -691
- 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 +339 -691
- 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 +339 -691
- 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,155 @@ 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 GDRIVE: "gdrive";
|
|
231
|
+
readonly GPHOTOS: "gphotos";
|
|
232
|
+
readonly FLICKR: "flickr";
|
|
233
|
+
readonly VK: "vk";
|
|
234
|
+
readonly EVERNOTE: "evernote";
|
|
235
|
+
readonly BOX: "box";
|
|
236
|
+
readonly ONEDRIVE: "onedrive";
|
|
237
|
+
readonly HUDDLE: "huddle";
|
|
238
|
+
}>;
|
|
239
|
+
declare const UploadSource: Readonly<{
|
|
240
|
+
readonly FACEBOOK: "facebook";
|
|
241
|
+
readonly DROPBOX: "dropbox";
|
|
242
|
+
readonly GDRIVE: "gdrive";
|
|
243
|
+
readonly GPHOTOS: "gphotos";
|
|
244
|
+
readonly FLICKR: "flickr";
|
|
245
|
+
readonly VK: "vk";
|
|
246
|
+
readonly EVERNOTE: "evernote";
|
|
247
|
+
readonly BOX: "box";
|
|
248
|
+
readonly ONEDRIVE: "onedrive";
|
|
249
|
+
readonly HUDDLE: "huddle";
|
|
250
|
+
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
251
|
+
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
252
|
+
readonly LOCAL: "local";
|
|
253
|
+
readonly DROP_AREA: "drop-area";
|
|
254
|
+
readonly CAMERA: "camera";
|
|
255
|
+
readonly EXTERNAL: "external";
|
|
256
|
+
readonly API: "js-api";
|
|
257
|
+
readonly URL: "url";
|
|
258
|
+
readonly DRAW: "draw";
|
|
259
|
+
}>;
|
|
260
|
+
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
261
|
+
|
|
262
|
+
declare class LitUploaderBlock extends LitActivityBlock {
|
|
263
|
+
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
264
|
+
static sourceTypes: Readonly<typeof UploadSource>;
|
|
265
|
+
protected couldBeCtxOwner: boolean;
|
|
266
|
+
private _isCtxOwner;
|
|
267
|
+
private _unobserveCollection?;
|
|
268
|
+
private _unobserveCollectionProperties?;
|
|
269
|
+
init$: {
|
|
270
|
+
'*commonProgress': number;
|
|
271
|
+
'*uploadList': never[];
|
|
272
|
+
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
273
|
+
'*collectionErrors': OutputErrorCollection[];
|
|
274
|
+
'*collectionState': OutputCollectionState | null;
|
|
275
|
+
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
276
|
+
'*uploadTrigger': Set<string>;
|
|
277
|
+
'*currentActivity': null;
|
|
278
|
+
'*currentActivityParams': {};
|
|
279
|
+
'*history': never[];
|
|
280
|
+
'*historyBack': null;
|
|
281
|
+
'*closeModal': () => void;
|
|
282
|
+
};
|
|
283
|
+
private get _hasCtxOwner();
|
|
284
|
+
initCallback(): void;
|
|
285
|
+
getAPI(): UploaderPublicApi;
|
|
286
|
+
get validationManager(): ValidationManager;
|
|
287
|
+
get api(): UploaderPublicApi;
|
|
288
|
+
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
289
|
+
get secureUploadsManager(): SecureUploadsManager;
|
|
290
|
+
disconnectedCallback(): void;
|
|
291
|
+
connectedCallback(): void;
|
|
292
|
+
private _initCtxOwner;
|
|
293
|
+
private _observeUploadCollection;
|
|
294
|
+
private _unobserveUploadCollection;
|
|
295
|
+
private _createGroup;
|
|
296
|
+
private _flushOutputItems;
|
|
297
|
+
private _handleCollectionUpdate;
|
|
298
|
+
private _handleCollectionPropertiesUpdate;
|
|
299
|
+
private _flushCommonUploadProgress;
|
|
300
|
+
private _openCloudImageEditor;
|
|
301
|
+
private _setInitialCrop;
|
|
302
|
+
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
303
|
+
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
304
|
+
getOutputData(): OutputFileEntry[];
|
|
305
|
+
}
|
|
306
|
+
|
|
257
307
|
/**
|
|
258
308
|
* Mapping of loading resources per operation
|
|
259
309
|
*/
|
|
@@ -368,14 +418,11 @@ declare global {
|
|
|
368
418
|
declare class Icon extends LitBlock {
|
|
369
419
|
name: string;
|
|
370
420
|
private _resolvedHref;
|
|
371
|
-
private _pluginSvg;
|
|
372
421
|
private _iconHrefResolver;
|
|
373
|
-
private _unsubscribePlugins?;
|
|
374
422
|
initCallback(): void;
|
|
375
423
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
376
424
|
private _updateResolvedHref;
|
|
377
425
|
render(): lit_html.TemplateResult<1>;
|
|
378
|
-
disconnectedCallback(): void;
|
|
379
426
|
}
|
|
380
427
|
declare global {
|
|
381
428
|
interface HTMLElementTagNameMap {
|
|
@@ -906,7 +953,6 @@ declare class CloudImageEditorBlock extends LitBlock {
|
|
|
906
953
|
private _hasNetworkProblems;
|
|
907
954
|
private _isInitialized;
|
|
908
955
|
private _pendingInitUpdate;
|
|
909
|
-
private _pendingSizeWait;
|
|
910
956
|
private readonly _debouncedShowLoader;
|
|
911
957
|
private readonly _imgRef;
|
|
912
958
|
private readonly _cropperRef;
|
|
@@ -956,11 +1002,12 @@ type ActivityParams$1 = {
|
|
|
956
1002
|
internalId: string;
|
|
957
1003
|
};
|
|
958
1004
|
declare class CloudImageEditorActivity extends LitUploaderBlock {
|
|
1005
|
+
couldBeCtxOwner: boolean;
|
|
1006
|
+
activityType: "cloud-image-edit";
|
|
959
1007
|
private _entry?;
|
|
960
1008
|
private _editorConfig;
|
|
961
1009
|
get activityParams(): ActivityParams$1;
|
|
962
1010
|
initCallback(): void;
|
|
963
|
-
disconnectedCallback(): void;
|
|
964
1011
|
private _handleApply;
|
|
965
1012
|
private _handleCancel;
|
|
966
1013
|
handleChange(event: CustomEvent<ChangeResult>): void;
|
|
@@ -997,6 +1044,7 @@ type ActivityParams = {
|
|
|
997
1044
|
};
|
|
998
1045
|
declare class ExternalSource extends LitUploaderBlock {
|
|
999
1046
|
couldBeCtxOwner: boolean;
|
|
1047
|
+
activityType: "external";
|
|
1000
1048
|
private _messageBridge?;
|
|
1001
1049
|
private _iframeRef;
|
|
1002
1050
|
private _latestSelectionSummary;
|
|
@@ -1040,26 +1088,22 @@ declare global {
|
|
|
1040
1088
|
declare const ACTIVITY_TYPES: Readonly<{
|
|
1041
1089
|
START_FROM: "start-from";
|
|
1042
1090
|
CAMERA: "camera";
|
|
1091
|
+
DRAW: "draw";
|
|
1043
1092
|
UPLOAD_LIST: "upload-list";
|
|
1044
1093
|
URL: "url";
|
|
1045
1094
|
CLOUD_IMG_EDIT: "cloud-image-edit";
|
|
1046
1095
|
EXTERNAL: "external";
|
|
1047
1096
|
}>;
|
|
1048
|
-
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES]
|
|
1049
|
-
type ActivityType = RegisteredActivityType | null;
|
|
1097
|
+
type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
|
|
1098
|
+
type ActivityType = RegisteredActivityType | (string & {}) | null;
|
|
1050
1099
|
|
|
1051
1100
|
declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
|
|
1052
|
-
interface CustomActivities {
|
|
1053
|
-
}
|
|
1054
1101
|
type ActivityParamsMap = {
|
|
1055
1102
|
'cloud-image-edit': ActivityParams$1;
|
|
1056
1103
|
external: ActivityParams;
|
|
1057
|
-
} & {
|
|
1058
|
-
[Key in keyof CustomActivities]: CustomActivities[Key]['params'];
|
|
1059
1104
|
};
|
|
1060
1105
|
declare class LitActivityBlock extends LitBlock {
|
|
1061
1106
|
protected historyTracked: boolean;
|
|
1062
|
-
activityType: ActivityType;
|
|
1063
1107
|
private [ACTIVE_PROP]?;
|
|
1064
1108
|
init$: {
|
|
1065
1109
|
'*currentActivity': null;
|
|
@@ -1073,11 +1117,12 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1073
1117
|
private _activate;
|
|
1074
1118
|
initCallback(): void;
|
|
1075
1119
|
private _historyFlush;
|
|
1076
|
-
|
|
1120
|
+
private _isActivityRegistered;
|
|
1077
1121
|
private static _activityCallbacks;
|
|
1078
1122
|
static activities: Readonly<{
|
|
1079
1123
|
START_FROM: 'start-from';
|
|
1080
1124
|
CAMERA: 'camera';
|
|
1125
|
+
DRAW: 'draw';
|
|
1081
1126
|
UPLOAD_LIST: 'upload-list';
|
|
1082
1127
|
URL: 'url';
|
|
1083
1128
|
CLOUD_IMG_EDIT: 'cloud-image-edit';
|
|
@@ -1093,8 +1138,8 @@ declare class LitActivityBlock extends LitBlock {
|
|
|
1093
1138
|
private _unregisterActivity;
|
|
1094
1139
|
disconnectedCallback(): void;
|
|
1095
1140
|
get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
|
|
1096
|
-
get initActivity():
|
|
1097
|
-
get doneActivity():
|
|
1141
|
+
get initActivity(): string | null;
|
|
1142
|
+
get doneActivity(): string | null;
|
|
1098
1143
|
historyBack(): void;
|
|
1099
1144
|
}
|
|
1100
1145
|
|
|
@@ -1156,9 +1201,7 @@ type EventPayload = {
|
|
|
1156
1201
|
declare class EventEmitter extends SharedInstance {
|
|
1157
1202
|
private _timeoutStore;
|
|
1158
1203
|
private _targets;
|
|
1159
|
-
private _listeners;
|
|
1160
1204
|
bindTarget(target: LitBlock): () => void;
|
|
1161
|
-
on<T extends EventKey>(type: T, handler: (payload: EventPayload[T]) => void): () => void;
|
|
1162
1205
|
private _dispatch;
|
|
1163
1206
|
emit<T extends EventKey, TDebounce extends boolean | number | undefined = undefined>(type: T, payload?: TDebounce extends false | undefined ? EventPayload[T] : () => EventPayload[T], options?: {
|
|
1164
1207
|
debounce?: TDebounce;
|
|
@@ -1166,123 +1209,20 @@ declare class EventEmitter extends SharedInstance {
|
|
|
1166
1209
|
destroy(): void;
|
|
1167
1210
|
}
|
|
1168
1211
|
|
|
1169
|
-
type
|
|
1170
|
-
|
|
1171
|
-
fileName?: string;
|
|
1172
|
-
source?: string;
|
|
1212
|
+
type EventMap = {
|
|
1213
|
+
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
1173
1214
|
};
|
|
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
1215
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
readonly ONEDRIVE: "onedrive";
|
|
1219
|
-
readonly HUDDLE: "huddle";
|
|
1220
|
-
}>;
|
|
1221
|
-
declare const UploadSource: Readonly<{
|
|
1222
|
-
readonly FACEBOOK: "facebook";
|
|
1223
|
-
readonly DROPBOX: "dropbox";
|
|
1224
|
-
readonly DROPBOX_CHOOSER: "dropboxchooser";
|
|
1225
|
-
readonly GDRIVE: "gdrive";
|
|
1226
|
-
readonly GPHOTOS: "gphotos";
|
|
1227
|
-
readonly FLICKR: "flickr";
|
|
1228
|
-
readonly VK: "vk";
|
|
1229
|
-
readonly EVERNOTE: "evernote";
|
|
1230
|
-
readonly BOX: "box";
|
|
1231
|
-
readonly ONEDRIVE: "onedrive";
|
|
1232
|
-
readonly HUDDLE: "huddle";
|
|
1233
|
-
readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
|
|
1234
|
-
readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
|
|
1235
|
-
readonly LOCAL: "local";
|
|
1236
|
-
readonly DROP_AREA: "drop-area";
|
|
1237
|
-
readonly CAMERA: "camera";
|
|
1238
|
-
readonly EXTERNAL: "external";
|
|
1239
|
-
readonly API: "js-api";
|
|
1240
|
-
readonly URL: "url";
|
|
1241
|
-
}>;
|
|
1242
|
-
type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
|
|
1243
|
-
|
|
1244
|
-
declare class LitUploaderBlock extends LitActivityBlock {
|
|
1245
|
-
static extSrcList: Readonly<typeof ExternalUploadSource>;
|
|
1246
|
-
static sourceTypes: Readonly<typeof UploadSource>;
|
|
1247
|
-
protected couldBeCtxOwner: boolean;
|
|
1248
|
-
private _isCtxOwner;
|
|
1249
|
-
private _unobserveCollection?;
|
|
1250
|
-
private _unobserveCollectionProperties?;
|
|
1251
|
-
init$: {
|
|
1252
|
-
'*commonProgress': number;
|
|
1253
|
-
'*uploadList': never[];
|
|
1254
|
-
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
1255
|
-
'*collectionErrors': OutputErrorCollection[];
|
|
1256
|
-
'*collectionState': OutputCollectionState | null;
|
|
1257
|
-
'*groupInfo': _uploadcare_upload_client.UploadcareGroup | null;
|
|
1258
|
-
'*uploadTrigger': Set<string>;
|
|
1259
|
-
'*currentActivity': null;
|
|
1260
|
-
'*currentActivityParams': {};
|
|
1261
|
-
'*history': never[];
|
|
1262
|
-
'*historyBack': null;
|
|
1263
|
-
'*closeModal': () => void;
|
|
1264
|
-
};
|
|
1265
|
-
private get _hasCtxOwner();
|
|
1266
|
-
initCallback(): void;
|
|
1267
|
-
getAPI(): UploaderPublicApi;
|
|
1268
|
-
get validationManager(): ValidationManager;
|
|
1269
|
-
get api(): UploaderPublicApi;
|
|
1270
|
-
get uploadCollection(): TypedCollection<UploadEntryData>;
|
|
1271
|
-
get secureUploadsManager(): SecureUploadsManager;
|
|
1272
|
-
disconnectedCallback(): void;
|
|
1273
|
-
connectedCallback(): void;
|
|
1274
|
-
private _initCtxOwner;
|
|
1275
|
-
private _observeUploadCollection;
|
|
1276
|
-
private _unobserveUploadCollection;
|
|
1277
|
-
private _createGroup;
|
|
1278
|
-
private _flushOutputItems;
|
|
1279
|
-
private _handleCollectionUpdate;
|
|
1280
|
-
private _handleCollectionPropertiesUpdate;
|
|
1281
|
-
private _flushCommonUploadProgress;
|
|
1282
|
-
private _setInitialCrop;
|
|
1283
|
-
protected getMetadataFor(entryId: string): Promise<_uploadcare_upload_client.Metadata | undefined>;
|
|
1284
|
-
protected getUploadClientOptions(): Promise<FileFromOptions>;
|
|
1285
|
-
getOutputData(): OutputFileEntry[];
|
|
1216
|
+
type PasteScope = 'local' | 'global' | false;
|
|
1217
|
+
declare class ClipboardLayer extends SharedInstance {
|
|
1218
|
+
private scopes;
|
|
1219
|
+
private listener;
|
|
1220
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
1221
|
+
private openUploadList;
|
|
1222
|
+
private _listener;
|
|
1223
|
+
private handlePaste;
|
|
1224
|
+
registerBlock(scope: Node): () => void;
|
|
1225
|
+
destroy(): void;
|
|
1286
1226
|
}
|
|
1287
1227
|
|
|
1288
1228
|
type SelectOption = {
|
|
@@ -1305,6 +1245,7 @@ declare global {
|
|
|
1305
1245
|
type CameraMode = 'photo' | 'video';
|
|
1306
1246
|
declare class CameraSource extends LitUploaderBlock {
|
|
1307
1247
|
couldBeCtxOwner: boolean;
|
|
1248
|
+
activityType: "camera";
|
|
1308
1249
|
private _unsubPermissions;
|
|
1309
1250
|
private _capturing;
|
|
1310
1251
|
private _chunks;
|
|
@@ -1326,6 +1267,7 @@ declare class CameraSource extends LitUploaderBlock {
|
|
|
1326
1267
|
private _timerRef;
|
|
1327
1268
|
private _lineRef;
|
|
1328
1269
|
private _videoRef;
|
|
1270
|
+
private _switcherRef;
|
|
1329
1271
|
private _startTime;
|
|
1330
1272
|
private _elapsedTime;
|
|
1331
1273
|
private _videoTransformCss;
|
|
@@ -1423,54 +1365,25 @@ declare global {
|
|
|
1423
1365
|
/**
|
|
1424
1366
|
* Config keys that can't be passed as attribute (because they are object or function)
|
|
1425
1367
|
*/
|
|
1426
|
-
declare const complexConfigKeys: readonly ["metadata", "
|
|
1368
|
+
declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions", "smartBtn"];
|
|
1369
|
+
/** Mapping of attribute names to state */
|
|
1370
|
+
declare const attrStateMapping: Record<string, string>;
|
|
1427
1371
|
declare class Config extends LitBlock {
|
|
1428
1372
|
attributesMeta: Partial<ConfigPlainType> & {
|
|
1429
1373
|
'ctx-name': string;
|
|
1430
1374
|
};
|
|
1431
1375
|
init$: LitBlock["init$"] & ConfigType;
|
|
1432
1376
|
private _computationControllers;
|
|
1433
|
-
private _pluginChangeUnsubscribe?;
|
|
1434
|
-
private _mutationObserver?;
|
|
1435
|
-
/**
|
|
1436
|
-
* Mapping of attribute names to custom config keys for plugin-registered configs.
|
|
1437
|
-
* Updated dynamically when plugins are registered or changed.
|
|
1438
|
-
* Similar to builtinAttrKeyMapping but for custom configs.
|
|
1439
|
-
*/
|
|
1440
|
-
private _customAttrKeyMapping;
|
|
1441
|
-
/** Set of all custom config names registered by plugins */
|
|
1442
|
-
private _customConfigKeys;
|
|
1443
|
-
/**
|
|
1444
|
-
* Map of custom config subscriptions (config name -> unsubscribe function)
|
|
1445
|
-
* Used to track and clean up subscriptions when plugins change
|
|
1446
|
-
*/
|
|
1447
|
-
private _customConfigSubscriptions;
|
|
1448
|
-
/**
|
|
1449
|
-
* Check if a key is a custom config (registered by plugins)
|
|
1450
|
-
*/
|
|
1451
|
-
private _isCustomConfig;
|
|
1452
|
-
/**
|
|
1453
|
-
* Get the custom config definition for a key
|
|
1454
|
-
*/
|
|
1455
|
-
private _getCustomConfigDefinition;
|
|
1456
|
-
/**
|
|
1457
|
-
* Get attribute names for a config key (kebab-case and lowercase)
|
|
1458
|
-
*/
|
|
1459
|
-
private _getAttributeNames;
|
|
1460
1377
|
private _flushValueToAttribute;
|
|
1461
1378
|
private _flushValueToState;
|
|
1462
1379
|
private _setValue;
|
|
1463
1380
|
private _getValue;
|
|
1464
1381
|
private _assertSameValueDifferentReference;
|
|
1465
|
-
private _processCustomConfigs;
|
|
1466
|
-
private _setupCustomConfigs;
|
|
1467
|
-
private _setupMutationObserver;
|
|
1468
1382
|
initCallback(): void;
|
|
1469
|
-
attributeChangedCallback(name:
|
|
1470
|
-
disconnectedCallback(): void;
|
|
1383
|
+
attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
|
|
1471
1384
|
static get observedAttributes(): string[];
|
|
1472
1385
|
}
|
|
1473
|
-
interface Config extends ConfigType
|
|
1386
|
+
interface Config extends ConfigType {
|
|
1474
1387
|
}
|
|
1475
1388
|
declare global {
|
|
1476
1389
|
interface HTMLElementTagNameMap {
|
|
@@ -1554,12 +1467,12 @@ declare class FileItem extends FileItemConfig {
|
|
|
1554
1467
|
private _isFailed;
|
|
1555
1468
|
private _isUploading;
|
|
1556
1469
|
private _isFocused;
|
|
1470
|
+
private _isEditable;
|
|
1557
1471
|
private _showFileNames;
|
|
1558
1472
|
private _ariaLabelStatusFile;
|
|
1559
|
-
private _pluginFileActions;
|
|
1560
1473
|
private _renderedOnce;
|
|
1561
1474
|
private _observer?;
|
|
1562
|
-
private
|
|
1475
|
+
private _handleEdit;
|
|
1563
1476
|
private _handleRemove;
|
|
1564
1477
|
private _handleUploadClick;
|
|
1565
1478
|
private _calculateState;
|
|
@@ -1571,8 +1484,6 @@ declare class FileItem extends FileItemConfig {
|
|
|
1571
1484
|
private _handleEntryId;
|
|
1572
1485
|
private _updateShowFileNames;
|
|
1573
1486
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1574
|
-
private _updatePluginFileActions;
|
|
1575
|
-
private _handlePluginFileAction;
|
|
1576
1487
|
initCallback(): void;
|
|
1577
1488
|
connectedCallback(): void;
|
|
1578
1489
|
disconnectedCallback(): void;
|
|
@@ -1669,6 +1580,69 @@ declare global {
|
|
|
1669
1580
|
}
|
|
1670
1581
|
}
|
|
1671
1582
|
|
|
1583
|
+
declare class SourceBtn extends LitUploaderBlock {
|
|
1584
|
+
couldBeCtxOwner: boolean;
|
|
1585
|
+
private _registeredTypes;
|
|
1586
|
+
type?: string;
|
|
1587
|
+
onlyIcon: boolean;
|
|
1588
|
+
private _iconName;
|
|
1589
|
+
private _srcTypeKey;
|
|
1590
|
+
private _initTypes;
|
|
1591
|
+
initCallback(): void;
|
|
1592
|
+
private _registerType;
|
|
1593
|
+
activate(): void;
|
|
1594
|
+
private _applyType;
|
|
1595
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
1596
|
+
render(): lit_html.TemplateResult<1>;
|
|
1597
|
+
}
|
|
1598
|
+
declare global {
|
|
1599
|
+
interface HTMLElementTagNameMap {
|
|
1600
|
+
'uc-source-btn': SourceBtn;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
declare class Dropdown extends LitBlock {
|
|
1605
|
+
private _id;
|
|
1606
|
+
private readonly _handleContentClick;
|
|
1607
|
+
protected render(): unknown;
|
|
1608
|
+
}
|
|
1609
|
+
declare global {
|
|
1610
|
+
interface HTMLElementTagNameMap {
|
|
1611
|
+
'uc-dropdown': Dropdown;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
type SmartButtonMode = 'auto' | 'allwrap' | 'nowrap';
|
|
1616
|
+
type AdvancedSmartBtnConfig = {
|
|
1617
|
+
sourceList: string;
|
|
1618
|
+
mode: SmartButtonMode;
|
|
1619
|
+
};
|
|
1620
|
+
declare class SmartBtn extends LitUploaderBlock {
|
|
1621
|
+
static styleAttrs: string[];
|
|
1622
|
+
couldBeCtxOwner: boolean;
|
|
1623
|
+
dropzone: boolean;
|
|
1624
|
+
private _sourceList;
|
|
1625
|
+
private _status;
|
|
1626
|
+
private _multiple;
|
|
1627
|
+
private _entry;
|
|
1628
|
+
private _lastDigest;
|
|
1629
|
+
private _showDropdown;
|
|
1630
|
+
private get isIdle();
|
|
1631
|
+
private get buttonText();
|
|
1632
|
+
private _throttledHandleCollectionUpdate;
|
|
1633
|
+
private _updateButtonBasedOnCollectionState;
|
|
1634
|
+
private _removeEntries;
|
|
1635
|
+
initCallback(): void;
|
|
1636
|
+
private readonly _handleClickAbort;
|
|
1637
|
+
private readonly _handleClick;
|
|
1638
|
+
render(): lit_html.TemplateResult<1>;
|
|
1639
|
+
}
|
|
1640
|
+
declare global {
|
|
1641
|
+
interface HTMLElementTagNameMap {
|
|
1642
|
+
'uc-smart-btn': SmartBtn;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1672
1646
|
type MetadataCallback = (fileEntry: OutputFileEntry) => Promise<Metadata> | Metadata;
|
|
1673
1647
|
type LocaleDefinitionOverride = Record<string, Partial<LocaleDefinition>>;
|
|
1674
1648
|
type SecureDeliveryProxyUrlResolver = (previewUrl: string, urlParts: {
|
|
@@ -1881,10 +1855,6 @@ type ConfigType = {
|
|
|
1881
1855
|
* Expiry threshold for secure uploads.
|
|
1882
1856
|
*/
|
|
1883
1857
|
secureUploadsExpireThreshold: number;
|
|
1884
|
-
/**
|
|
1885
|
-
* Array of plugins to register with the uploader instance.
|
|
1886
|
-
*/
|
|
1887
|
-
plugins: UploaderPlugin[];
|
|
1888
1858
|
/**
|
|
1889
1859
|
* Metadata for the file.
|
|
1890
1860
|
*/
|
|
@@ -1970,6 +1940,7 @@ type ConfigType = {
|
|
|
1970
1940
|
* Define the clipboard paste scope.
|
|
1971
1941
|
*/
|
|
1972
1942
|
pasteScope: PasteScope;
|
|
1943
|
+
smartBtn: AdvancedSmartBtnConfig | null;
|
|
1973
1944
|
};
|
|
1974
1945
|
type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
|
|
1975
1946
|
type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
|
|
@@ -2145,237 +2116,10 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
|
|
|
2145
2116
|
allEntries: OutputFileEntry[];
|
|
2146
2117
|
});
|
|
2147
2118
|
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
};
|
|
2152
|
-
type PluginI18nRegistration = Record<string, Record<string, string>>;
|
|
2153
|
-
type PluginSourceRegistration = {
|
|
2154
|
-
id: string;
|
|
2155
|
-
label: string;
|
|
2156
|
-
icon?: string;
|
|
2157
|
-
/**
|
|
2158
|
-
* @internal
|
|
2159
|
-
*
|
|
2160
|
-
* Optional expansion function. When present, SourceList calls this to determine
|
|
2161
|
-
* which source IDs should actually be rendered in place of this source.
|
|
2162
|
-
* Useful for sources that map to multiple device-specific variants (e.g. camera
|
|
2163
|
-
* expanding to separate photo/video buttons on mobile).
|
|
2164
|
-
* Return `[id]` (the source's own id) to render it as-is.
|
|
2165
|
-
*/
|
|
2166
|
-
expand?: () => string[];
|
|
2167
|
-
onSelect: () => Promise<void> | void;
|
|
2168
|
-
};
|
|
2169
|
-
type PluginRenderDispose = () => void;
|
|
2170
|
-
type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
|
|
2171
|
-
type PluginActivityRegistration = {
|
|
2172
|
-
id: string;
|
|
2173
|
-
render: PluginRender;
|
|
2174
|
-
};
|
|
2175
|
-
type PluginFileActionRegistration = {
|
|
2176
|
-
/** Unique action identifier. */
|
|
2177
|
-
id: string;
|
|
2178
|
-
/** Icon name to display in the action button. */
|
|
2179
|
-
icon: string;
|
|
2180
|
-
/** Label shown next to the icon in the action button. Accepts a plain string or an i18n key registered via `registerI18n`. */
|
|
2181
|
-
label: string;
|
|
2182
|
-
/** Return `true` to show the action button for the given file entry. */
|
|
2183
|
-
shouldRender: (fileEntry: OutputFileEntry) => boolean;
|
|
2184
|
-
onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
|
|
2185
|
-
};
|
|
2186
|
-
type PluginFileHookResult = {
|
|
2187
|
-
/** The (optionally transformed) file */
|
|
2188
|
-
file: File | Blob;
|
|
2189
|
-
};
|
|
2190
|
-
type PluginFileHookContext = PluginFileHookResult & {
|
|
2191
|
-
/**
|
|
2192
|
-
* An AbortSignal that fires when the operation is cancelled (e.g. upload aborted or file removed).
|
|
2193
|
-
* Hooks should respect this signal to avoid doing unnecessary work.
|
|
2194
|
-
*/
|
|
2195
|
-
signal: AbortSignal;
|
|
2196
|
-
};
|
|
2197
|
-
type PluginFileHookRegistration = {
|
|
2198
|
-
/**
|
|
2199
|
-
* When the hook is called:
|
|
2200
|
-
* - `'beforeUpload'`: called right before the file is uploaded.
|
|
2201
|
-
* - `'onAdd'`: called after the file is added to the upload list.
|
|
2202
|
-
*
|
|
2203
|
-
* Return the (optionally transformed) file. After the hook runs, `mimeType`,
|
|
2204
|
-
* `isImage`, `fileSize`, and `fileName` are all re-derived from the returned file.
|
|
2205
|
-
*/
|
|
2206
|
-
type: 'beforeUpload' | 'onAdd';
|
|
2207
|
-
handler: (context: PluginFileHookContext) => PluginFileHookResult | Promise<PluginFileHookResult>;
|
|
2208
|
-
/**
|
|
2209
|
-
* Maximum time in milliseconds to wait for the hook to complete before skipping it.
|
|
2210
|
-
* @default 30000
|
|
2211
|
-
*/
|
|
2212
|
-
timeout?: number;
|
|
2213
|
-
};
|
|
2214
|
-
type PluginRegistryApi = {
|
|
2215
|
-
registerSource: (source: PluginSourceRegistration) => void;
|
|
2216
|
-
registerActivity: (activity: PluginActivityRegistration) => void;
|
|
2217
|
-
registerFileAction: (fileAction: PluginFileActionRegistration) => void;
|
|
2218
|
-
registerFileHook: (hook: PluginFileHookRegistration) => void;
|
|
2219
|
-
registerIcon: (icon: PluginIconRegistration) => void;
|
|
2220
|
-
registerI18n: (i18n: PluginI18nRegistration) => void;
|
|
2221
|
-
registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
|
|
2222
|
-
};
|
|
2223
|
-
/**
|
|
2224
|
-
* API for managing plugin config subscriptions
|
|
2225
|
-
*/
|
|
2226
|
-
type PluginConfigApi = {
|
|
2227
|
-
get: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey) => (ConfigType & CustomConfig)[TKey];
|
|
2228
|
-
subscribe: <TKey extends keyof (ConfigType & CustomConfig)>(configName: TKey, callback: (value: (ConfigType & CustomConfig)[TKey]) => void) => () => void;
|
|
2229
|
-
};
|
|
2230
|
-
/**
|
|
2231
|
-
* API for managing plugin activity interactions
|
|
2232
|
-
*/
|
|
2233
|
-
type PluginActivityApi = {
|
|
2234
|
-
/**
|
|
2235
|
-
* Get the current activity parameters.
|
|
2236
|
-
*
|
|
2237
|
-
* @returns The current activity parameters object
|
|
2238
|
-
*
|
|
2239
|
-
* @example
|
|
2240
|
-
* ```typescript
|
|
2241
|
-
* const params = pluginApi.activity.getParams();
|
|
2242
|
-
* console.log('Current params:', params);
|
|
2243
|
-
* ```
|
|
2244
|
-
*/
|
|
2245
|
-
getParams: () => Record<string, unknown>;
|
|
2246
|
-
/**
|
|
2247
|
-
* Subscribe to changes in activity parameters.
|
|
2248
|
-
* The callback will be called immediately with the current params,
|
|
2249
|
-
* and then whenever the params change.
|
|
2250
|
-
*
|
|
2251
|
-
* Subscriptions are automatically cleaned up when the plugin is disposed.
|
|
2252
|
-
*
|
|
2253
|
-
* @param callback - Function to call with the new params
|
|
2254
|
-
* @returns Unsubscribe function
|
|
2255
|
-
*
|
|
2256
|
-
* @example
|
|
2257
|
-
* ```typescript
|
|
2258
|
-
* pluginApi.activity.subscribeToParams((params) => {
|
|
2259
|
-
* console.log('Activity params changed:', params);
|
|
2260
|
-
* });
|
|
2261
|
-
* // Cleanup happens automatically on plugin disposal
|
|
2262
|
-
* ```
|
|
2263
|
-
*/
|
|
2264
|
-
subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
|
|
2265
|
-
};
|
|
2266
|
-
type PluginFileEntryUpdate = {
|
|
2267
|
-
file?: File | Blob;
|
|
2268
|
-
cdnUrl?: string | null;
|
|
2269
|
-
cdnUrlModifiers?: string | null;
|
|
2270
|
-
mimeType?: string | null;
|
|
2271
|
-
};
|
|
2272
|
-
type PluginFilesApi = {
|
|
2273
|
-
/**
|
|
2274
|
-
* Update mutable properties of a file entry by its internalId.
|
|
2275
|
-
* `fileSize` is recalculated automatically when `file` is provided.
|
|
2276
|
-
*/
|
|
2277
|
-
update: (internalId: string, changes: PluginFileEntryUpdate) => void;
|
|
2278
|
-
};
|
|
2279
|
-
type PluginApi = {
|
|
2280
|
-
registry: PluginRegistryApi;
|
|
2281
|
-
config: PluginConfigApi;
|
|
2282
|
-
activity: PluginActivityApi;
|
|
2283
|
-
files: PluginFilesApi;
|
|
2284
|
-
};
|
|
2285
|
-
type PluginUploaderApi = UploaderPublicApi;
|
|
2286
|
-
type PluginSetupResult = (() => void) | void | Promise<(() => void) | void>;
|
|
2287
|
-
type PluginSetupParams = {
|
|
2288
|
-
pluginApi: PluginApi;
|
|
2289
|
-
uploaderApi: PluginUploaderApi;
|
|
2290
|
-
};
|
|
2291
|
-
type UploaderPlugin = {
|
|
2292
|
-
id: string;
|
|
2293
|
-
setup: (params: PluginSetupParams) => PluginSetupResult;
|
|
2294
|
-
};
|
|
2295
|
-
type Owned<T> = T & {
|
|
2296
|
-
pluginId: string;
|
|
2297
|
-
};
|
|
2298
|
-
type PluginRegistrySnapshot = {
|
|
2299
|
-
sources: Owned<PluginSourceRegistration>[];
|
|
2300
|
-
activities: Owned<PluginActivityRegistration>[];
|
|
2301
|
-
fileActions: Owned<PluginFileActionRegistration>[];
|
|
2302
|
-
fileHooks: Owned<PluginFileHookRegistration>[];
|
|
2303
|
-
icons: Owned<PluginIconRegistration>[];
|
|
2304
|
-
i18n: Owned<PluginI18nRegistration>[];
|
|
2305
|
-
};
|
|
2306
|
-
|
|
2307
|
-
type EventMap = {
|
|
2308
|
-
[T in keyof EventPayload]: CustomEvent<EventPayload[T]>;
|
|
2309
|
-
};
|
|
2310
|
-
|
|
2311
|
-
interface UploadEntryData extends Record<string, unknown> {
|
|
2312
|
-
file: File | null;
|
|
2313
|
-
externalUrl: string | null;
|
|
2314
|
-
fileName: string | null;
|
|
2315
|
-
fileSize: number | null;
|
|
2316
|
-
lastModified: number;
|
|
2317
|
-
uploadProgress: number;
|
|
2318
|
-
uuid: string | null;
|
|
2319
|
-
isImage: boolean;
|
|
2320
|
-
mimeType: string | null;
|
|
2321
|
-
ctxName: string | null;
|
|
2322
|
-
cdnUrl: string | null;
|
|
2323
|
-
cdnUrlModifiers: string | null;
|
|
2324
|
-
fileInfo: UploadcareFile | null;
|
|
2325
|
-
isUploading: boolean;
|
|
2326
|
-
abortController: AbortController | null;
|
|
2327
|
-
thumbUrl: string | null;
|
|
2328
|
-
silent: boolean;
|
|
2329
|
-
source: string | null;
|
|
2330
|
-
fullPath: string | null;
|
|
2331
|
-
metadata: Metadata | null;
|
|
2332
|
-
errors: OutputErrorFile[];
|
|
2333
|
-
uploadError: Error | null;
|
|
2334
|
-
isRemoved: boolean;
|
|
2335
|
-
isQueuedForUploading: boolean;
|
|
2336
|
-
isValidationPending: boolean;
|
|
2337
|
-
isQueuedForValidation: boolean;
|
|
2338
|
-
}
|
|
2339
|
-
type UploadEntryTypedData = TypedData<UploadEntryData>;
|
|
2340
|
-
type UploadEntryKeys = keyof UploadEntryData;
|
|
2341
|
-
|
|
2342
|
-
declare class PluginRegistry {
|
|
2343
|
-
private _sources;
|
|
2344
|
-
private _activities;
|
|
2345
|
-
private _fileActions;
|
|
2346
|
-
private _fileHooks;
|
|
2347
|
-
private _icons;
|
|
2348
|
-
private _i18n;
|
|
2349
|
-
readonly config: CustomConfigRegistry;
|
|
2350
|
-
private _own;
|
|
2351
|
-
addSource(pluginId: string, item: PluginSourceRegistration): void;
|
|
2352
|
-
addActivity(pluginId: string, item: PluginActivityRegistration): void;
|
|
2353
|
-
addFileAction(pluginId: string, item: PluginFileActionRegistration): void;
|
|
2354
|
-
addFileHook(pluginId: string, item: PluginFileHookRegistration): void;
|
|
2355
|
-
addIcon(pluginId: string, item: PluginIconRegistration): void;
|
|
2356
|
-
addI18n(pluginId: string, item: PluginI18nRegistration): void;
|
|
2357
|
-
addConfig<T>(pluginId: string, definition: CustomConfigDefinition<T>): void;
|
|
2358
|
-
purge(pluginId: string): void;
|
|
2359
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
declare class PluginManager extends SharedInstance {
|
|
2363
|
-
private _plugins;
|
|
2364
|
-
private _subscribers;
|
|
2365
|
-
private _pluginsUpdate;
|
|
2366
|
-
private _lazyPluginLoader;
|
|
2367
|
-
readonly registry: PluginRegistry;
|
|
2368
|
-
get configRegistry(): CustomConfigRegistry;
|
|
2369
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2370
|
-
pluginsReady(): Promise<void>;
|
|
2371
|
-
onPluginsChange(callback: Unsubscriber): Unsubscriber;
|
|
2372
|
-
private _syncPlugins;
|
|
2373
|
-
private _registerPlugin;
|
|
2374
|
-
private _unregisterPlugin;
|
|
2375
|
-
snapshot(): PluginRegistrySnapshot;
|
|
2376
|
-
runOnAddHooks(entry: UploadEntryTypedData): Promise<void>;
|
|
2119
|
+
declare class SecureUploadsManager extends SharedInstance {
|
|
2120
|
+
private _secureToken;
|
|
2121
|
+
getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
|
|
2377
2122
|
destroy(): void;
|
|
2378
|
-
private _notifySubscribers;
|
|
2379
2123
|
}
|
|
2380
2124
|
|
|
2381
2125
|
type CommonEventType = InternalEventKey | EventKey;
|
|
@@ -2416,87 +2160,14 @@ declare class TelemetryManager extends SharedInstance {
|
|
|
2416
2160
|
private get _location();
|
|
2417
2161
|
}
|
|
2418
2162
|
|
|
2419
|
-
interface ISharedInstance {
|
|
2420
|
-
destroy?(): void;
|
|
2421
|
-
}
|
|
2422
|
-
declare class SharedInstance {
|
|
2423
|
-
protected _ctx: PubSub<SharedState>;
|
|
2424
|
-
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2425
|
-
private _subscriptions;
|
|
2426
|
-
private _cfgProxy;
|
|
2427
|
-
protected _debugPrint: (...args: unknown[]) => void;
|
|
2428
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2429
|
-
protected addSub(unsub: () => void): void;
|
|
2430
|
-
protected get _cfg(): Readonly<ConfigType>;
|
|
2431
|
-
destroy(): void;
|
|
2432
|
-
}
|
|
2433
|
-
declare const instanceKeyMap: {
|
|
2434
|
-
modalManager: "*modalManager";
|
|
2435
|
-
pluginManager: "*pluginManager";
|
|
2436
|
-
telemetryManager: "*telemetryManager";
|
|
2437
|
-
localeManager: "*localeManager";
|
|
2438
|
-
a11y: "*a11y";
|
|
2439
|
-
clipboard: "*clipboard";
|
|
2440
|
-
blocksRegistry: "*blocksRegistry";
|
|
2441
|
-
eventEmitter: "*eventEmitter";
|
|
2442
|
-
uploadCollection: "*uploadCollection";
|
|
2443
|
-
secureUploadsManager: "*secureUploadsManager";
|
|
2444
|
-
api: "*publicApi";
|
|
2445
|
-
validationManager: "*validationManager";
|
|
2446
|
-
};
|
|
2447
|
-
type InstanceTypeMap = {
|
|
2448
|
-
[key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
|
|
2449
|
-
};
|
|
2450
|
-
type InstanceName = keyof typeof instanceKeyMap;
|
|
2451
|
-
type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
|
|
2452
|
-
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2453
|
-
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2454
|
-
readonly ctx: PubSub<SharedState>;
|
|
2455
|
-
readonly modalManager: ModalManager | null;
|
|
2456
|
-
readonly pluginManager: PluginManager;
|
|
2457
|
-
readonly telemetryManager: TelemetryManager;
|
|
2458
|
-
readonly localeManager: LocaleManager;
|
|
2459
|
-
readonly a11y: A11y;
|
|
2460
|
-
readonly blocksRegistry: Set<LitBlock>;
|
|
2461
|
-
readonly eventEmitter: EventEmitter;
|
|
2462
|
-
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2463
|
-
readonly secureUploadsManager: SecureUploadsManager;
|
|
2464
|
-
readonly api: UploaderPublicApi;
|
|
2465
|
-
readonly validationManager: ValidationManager;
|
|
2466
|
-
when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
|
|
2467
|
-
wait<TName extends InstanceName>(name: TName): Promise<NonNullable<InstanceTypeMap[TName]>>;
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
type PasteScope = 'local' | 'global' | false;
|
|
2471
|
-
declare class ClipboardLayer extends SharedInstance {
|
|
2472
|
-
private scopes;
|
|
2473
|
-
private listener;
|
|
2474
|
-
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2475
|
-
private openUploadList;
|
|
2476
|
-
private _listener;
|
|
2477
|
-
private handlePaste;
|
|
2478
|
-
registerBlock(scope: Node): () => void;
|
|
2479
|
-
destroy(): void;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
type ConfigGetter = <K extends keyof ConfigType>(key: K) => ConfigType[K];
|
|
2483
|
-
type LazyPluginEntry = {
|
|
2484
|
-
configDeps: readonly (keyof ConfigType)[];
|
|
2485
|
-
isEnabled: (get: ConfigGetter) => boolean;
|
|
2486
|
-
load: () => UploaderPlugin | undefined | Promise<UploaderPlugin | undefined>;
|
|
2487
|
-
};
|
|
2488
|
-
|
|
2489
2163
|
type SharedConfigState = {
|
|
2490
2164
|
[K in keyof ConfigType as `*cfg/${K}`]: ConfigType[K];
|
|
2491
2165
|
};
|
|
2492
|
-
type SharedCustomConfigState = {
|
|
2493
|
-
[K in keyof CustomConfig as `*cfg/${K}`]: CustomConfig[K];
|
|
2494
|
-
};
|
|
2495
2166
|
type BlocksRegistry = Set<LitBlock>;
|
|
2496
2167
|
type ActivityBlockCtxState = {
|
|
2497
|
-
'*currentActivity':
|
|
2168
|
+
'*currentActivity': string | null;
|
|
2498
2169
|
'*currentActivityParams': Record<string, unknown>;
|
|
2499
|
-
'*history': (
|
|
2170
|
+
'*history': (string | null)[];
|
|
2500
2171
|
'*historyBack': (() => void) | null;
|
|
2501
2172
|
'*closeModal': () => void;
|
|
2502
2173
|
};
|
|
@@ -2513,7 +2184,6 @@ type UploaderBlockCtxState = ActivityBlockCtxState & {
|
|
|
2513
2184
|
};
|
|
2514
2185
|
type SolutionBlockCtxState = UploaderBlockCtxState & {
|
|
2515
2186
|
'*solution': string | null;
|
|
2516
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2517
2187
|
};
|
|
2518
2188
|
type CloudImageEditorState = {
|
|
2519
2189
|
'*originalUrl': string | null;
|
|
@@ -2564,9 +2234,7 @@ type EditorToolbarState = {
|
|
|
2564
2234
|
'*currentOperation': string | null;
|
|
2565
2235
|
'*operationTooltip': string | null;
|
|
2566
2236
|
};
|
|
2567
|
-
type SharedContextInstances = Map<string, ISharedInstance>;
|
|
2568
2237
|
type DynamicBlockState = {
|
|
2569
|
-
'*sharedContextInstances': SharedContextInstances;
|
|
2570
2238
|
'*blocksRegistry': BlocksRegistry;
|
|
2571
2239
|
'*eventEmitter': EventEmitter;
|
|
2572
2240
|
'*localeManager': LocaleManager;
|
|
@@ -2574,7 +2242,6 @@ type DynamicBlockState = {
|
|
|
2574
2242
|
'*a11y': A11y;
|
|
2575
2243
|
'*modalManager': ModalManager | null;
|
|
2576
2244
|
'*clipboard': ClipboardLayer;
|
|
2577
|
-
'*pluginManager': PluginManager;
|
|
2578
2245
|
};
|
|
2579
2246
|
type DynamicUploaderBlockState = {
|
|
2580
2247
|
'*uploadCollection': TypedCollection<UploadEntryData>;
|
|
@@ -2585,7 +2252,66 @@ type DynamicUploaderBlockState = {
|
|
|
2585
2252
|
type LocaleState = {
|
|
2586
2253
|
[K in keyof LocaleDefinition as `*l10n/${K}`]: string;
|
|
2587
2254
|
};
|
|
2588
|
-
type SharedState = SolutionBlockCtxState & SharedConfigState &
|
|
2255
|
+
type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
|
|
2256
|
+
|
|
2257
|
+
interface ISharedInstance {
|
|
2258
|
+
destroy?(): void;
|
|
2259
|
+
}
|
|
2260
|
+
declare class SharedInstance {
|
|
2261
|
+
protected _ctx: PubSub<SharedState>;
|
|
2262
|
+
protected _sharedInstancesBag: SharedInstancesBag;
|
|
2263
|
+
private _subscriptions;
|
|
2264
|
+
private _cfgProxy;
|
|
2265
|
+
protected _debugPrint: (...args: unknown[]) => void;
|
|
2266
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2267
|
+
protected addSub(unsub: () => void): void;
|
|
2268
|
+
protected get _cfg(): Readonly<ConfigType>;
|
|
2269
|
+
destroy(): void;
|
|
2270
|
+
}
|
|
2271
|
+
type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*clipboard' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
|
|
2272
|
+
type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
|
|
2273
|
+
declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
|
|
2274
|
+
readonly ctx: PubSub<SharedState>;
|
|
2275
|
+
readonly modalManager: ModalManager | null;
|
|
2276
|
+
readonly telemetryManager: TelemetryManager;
|
|
2277
|
+
readonly localeManager: LocaleManager;
|
|
2278
|
+
readonly a11y: A11y;
|
|
2279
|
+
readonly blocksRegistry: Set<LitBlock>;
|
|
2280
|
+
readonly eventEmitter: EventEmitter;
|
|
2281
|
+
readonly uploadCollection: TypedCollection<UploadEntryData>;
|
|
2282
|
+
readonly secureUploadsManager: SecureUploadsManager;
|
|
2283
|
+
readonly api: UploaderPublicApi;
|
|
2284
|
+
readonly validationManager: ValidationManager;
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2287
|
+
type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
|
|
2288
|
+
signal?: AbortSignal;
|
|
2289
|
+
}) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
|
|
2290
|
+
type FileValidatorDescriptor = {
|
|
2291
|
+
runOn: 'add' | 'upload' | 'change';
|
|
2292
|
+
validator: FuncFileValidator;
|
|
2293
|
+
};
|
|
2294
|
+
type FileValidator = FileValidatorDescriptor | FuncFileValidator;
|
|
2295
|
+
type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
|
|
2296
|
+
declare class ValidationManager extends SharedInstance {
|
|
2297
|
+
private get _uploadCollection();
|
|
2298
|
+
private _commonFileValidators;
|
|
2299
|
+
private _commonCollectionValidators;
|
|
2300
|
+
private _queue;
|
|
2301
|
+
private _runQueueDebounced;
|
|
2302
|
+
private _isDestroyed;
|
|
2303
|
+
private _entryValidationState;
|
|
2304
|
+
constructor(sharedInstancesBag: SharedInstancesBag);
|
|
2305
|
+
runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
|
|
2306
|
+
runCollectionValidators(): void;
|
|
2307
|
+
cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
|
|
2308
|
+
private _runFileValidatorsForEntry;
|
|
2309
|
+
private _addCustomTypeToValidationError;
|
|
2310
|
+
private _getEntryValidationState;
|
|
2311
|
+
private _getValidatorDescriptors;
|
|
2312
|
+
private _getValidatorDescriptorsForEntry;
|
|
2313
|
+
destroy(): void;
|
|
2314
|
+
}
|
|
2589
2315
|
|
|
2590
2316
|
declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
2591
2317
|
willYield: boolean;
|
|
@@ -2597,7 +2323,9 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
|
|
|
2597
2323
|
};
|
|
2598
2324
|
declare class LitBlock extends LitBlockBase {
|
|
2599
2325
|
private _cfgProxy;
|
|
2326
|
+
protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
|
|
2600
2327
|
static styleAttrs: string[];
|
|
2328
|
+
activityType: ActivityType;
|
|
2601
2329
|
init$: {};
|
|
2602
2330
|
constructor();
|
|
2603
2331
|
l10n: (str: string, variables?: Record<string, string | number>) => string;
|
|
@@ -2605,7 +2333,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2605
2333
|
protected _sharedInstancesBag: {
|
|
2606
2334
|
readonly ctx: PubSub<SharedState>;
|
|
2607
2335
|
readonly modalManager: ModalManager | null;
|
|
2608
|
-
readonly pluginManager: PluginManager;
|
|
2609
2336
|
readonly telemetryManager: TelemetryManager;
|
|
2610
2337
|
readonly localeManager: LocaleManager;
|
|
2611
2338
|
readonly a11y: A11y;
|
|
@@ -2615,34 +2342,6 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2615
2342
|
readonly secureUploadsManager: SecureUploadsManager;
|
|
2616
2343
|
readonly api: UploaderPublicApi;
|
|
2617
2344
|
readonly validationManager: ValidationManager;
|
|
2618
|
-
when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
|
|
2619
|
-
modalManager: ModalManager | null;
|
|
2620
|
-
pluginManager: PluginManager;
|
|
2621
|
-
telemetryManager: TelemetryManager;
|
|
2622
|
-
localeManager: LocaleManager;
|
|
2623
|
-
a11y: A11y;
|
|
2624
|
-
clipboard: ClipboardLayer;
|
|
2625
|
-
blocksRegistry: BlocksRegistry;
|
|
2626
|
-
eventEmitter: EventEmitter;
|
|
2627
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2628
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2629
|
-
api: UploaderPublicApi;
|
|
2630
|
-
validationManager: ValidationManager;
|
|
2631
|
-
}[TName]>) => void): () => void;
|
|
2632
|
-
wait<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "clipboard" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName): Promise<NonNullable<{
|
|
2633
|
-
modalManager: ModalManager | null;
|
|
2634
|
-
pluginManager: PluginManager;
|
|
2635
|
-
telemetryManager: TelemetryManager;
|
|
2636
|
-
localeManager: LocaleManager;
|
|
2637
|
-
a11y: A11y;
|
|
2638
|
-
clipboard: ClipboardLayer;
|
|
2639
|
-
blocksRegistry: BlocksRegistry;
|
|
2640
|
-
eventEmitter: EventEmitter;
|
|
2641
|
-
uploadCollection: TypedCollection<UploadEntryData>;
|
|
2642
|
-
secureUploadsManager: SecureUploadsManager;
|
|
2643
|
-
api: UploaderPublicApi;
|
|
2644
|
-
validationManager: ValidationManager;
|
|
2645
|
-
}[TName]>>;
|
|
2646
2345
|
};
|
|
2647
2346
|
emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
|
|
2648
2347
|
hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
|
|
@@ -2661,7 +2360,11 @@ declare class LitBlock extends LitBlockBase {
|
|
|
2661
2360
|
* Called when the last block is removed from the context. Note that inheritors must run their callback before that.
|
|
2662
2361
|
*/
|
|
2663
2362
|
private destroyCtxCallback;
|
|
2664
|
-
|
|
2363
|
+
/**
|
|
2364
|
+
* Adds a shared context instance if it does not exist yet.
|
|
2365
|
+
* @param key The shared state key.
|
|
2366
|
+
* @param resolver The resolver function that creates the instance.
|
|
2367
|
+
*/
|
|
2665
2368
|
protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
|
|
2666
2369
|
private _destroySharedContextInstances;
|
|
2667
2370
|
protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];
|
|
@@ -2688,7 +2391,7 @@ declare class Modal extends LitBlock {
|
|
|
2688
2391
|
private _handleDialogClose;
|
|
2689
2392
|
private _handleDialogMouseDown;
|
|
2690
2393
|
private _handleDialogMouseUp;
|
|
2691
|
-
show():
|
|
2394
|
+
show(): void;
|
|
2692
2395
|
hide(): void;
|
|
2693
2396
|
private _handleModalOpen;
|
|
2694
2397
|
private _handleModalClose;
|
|
@@ -2760,10 +2463,8 @@ declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
|
|
|
2760
2463
|
|
|
2761
2464
|
declare class LitSolutionBlock extends LitBlock {
|
|
2762
2465
|
static styleAttrs: string[];
|
|
2763
|
-
static lazyPlugins: LazyPluginEntry[] | null;
|
|
2764
2466
|
init$: {
|
|
2765
2467
|
'*solution': string | null;
|
|
2766
|
-
'*lazyPlugins': LazyPluginEntry[] | null;
|
|
2767
2468
|
'*commonProgress': number;
|
|
2768
2469
|
'*uploadList': never[];
|
|
2769
2470
|
'*uploadQueue': _uploadcare_upload_client.Queue;
|
|
@@ -2895,32 +2596,9 @@ declare global {
|
|
|
2895
2596
|
}
|
|
2896
2597
|
}
|
|
2897
2598
|
|
|
2898
|
-
|
|
2899
|
-
id: string;
|
|
2900
|
-
label: string;
|
|
2901
|
-
icon?: string;
|
|
2902
|
-
onClick: () => void | Promise<void>;
|
|
2903
|
-
};
|
|
2904
|
-
declare class SourceBtn extends LitUploaderBlock {
|
|
2905
|
-
couldBeCtxOwner: boolean;
|
|
2906
|
-
source?: SourceButtonConfig;
|
|
2907
|
-
private _iconName;
|
|
2908
|
-
private _srcTypeKey;
|
|
2909
|
-
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
2910
|
-
private _applySource;
|
|
2911
|
-
activate(): void;
|
|
2912
|
-
render(): lit_html.TemplateResult<1>;
|
|
2913
|
-
}
|
|
2914
|
-
declare global {
|
|
2915
|
-
interface HTMLElementTagNameMap {
|
|
2916
|
-
'uc-source-btn': SourceBtn;
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
declare class SourceList extends LitUploaderBlock {
|
|
2599
|
+
declare class SourceList extends LitBlock {
|
|
2921
2600
|
private _rawSourceList;
|
|
2922
|
-
private
|
|
2923
|
-
private _sources;
|
|
2601
|
+
private _cameraModes;
|
|
2924
2602
|
/**
|
|
2925
2603
|
* CSS-only attribute
|
|
2926
2604
|
*/
|
|
@@ -2928,10 +2606,8 @@ declare class SourceList extends LitUploaderBlock {
|
|
|
2928
2606
|
initCallback(): void;
|
|
2929
2607
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
2930
2608
|
private _updateSources;
|
|
2931
|
-
private
|
|
2932
|
-
private _makePluginSourceConfig;
|
|
2609
|
+
private _sources;
|
|
2933
2610
|
render(): lit_html.TemplateResult<1>;
|
|
2934
|
-
disconnectedCallback(): void;
|
|
2935
2611
|
}
|
|
2936
2612
|
declare global {
|
|
2937
2613
|
interface HTMLElementTagNameMap {
|
|
@@ -2986,8 +2662,6 @@ declare class UploadCtxProvider extends LitUploaderBlock {
|
|
|
2986
2662
|
interface UploadCtxProvider extends LitUploaderBlock {
|
|
2987
2663
|
addEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | AddEventListenerOptions): void;
|
|
2988
2664
|
removeEventListener<T extends keyof EventListenerMap>(type: T, listener: EventListenerMap[T], options?: boolean | EventListenerOptions): void;
|
|
2989
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2990
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
2991
2665
|
}
|
|
2992
2666
|
declare global {
|
|
2993
2667
|
interface HTMLElementTagNameMap {
|
|
@@ -2995,71 +2669,45 @@ declare global {
|
|
|
2995
2669
|
}
|
|
2996
2670
|
}
|
|
2997
2671
|
|
|
2998
|
-
declare class
|
|
2999
|
-
static styleAttrs: string[];
|
|
2672
|
+
declare class UrlSource extends LitUploaderBlock {
|
|
3000
2673
|
couldBeCtxOwner: boolean;
|
|
3001
|
-
|
|
3002
|
-
private
|
|
3003
|
-
private readonly _handleClick;
|
|
2674
|
+
activityType: ActivityType;
|
|
2675
|
+
private _formState;
|
|
3004
2676
|
initCallback(): void;
|
|
2677
|
+
private _inputRef;
|
|
2678
|
+
private _handleInput;
|
|
2679
|
+
private _handleUpload;
|
|
3005
2680
|
render(): lit_html.TemplateResult<1>;
|
|
3006
2681
|
}
|
|
3007
2682
|
declare global {
|
|
3008
2683
|
interface HTMLElementTagNameMap {
|
|
3009
|
-
'uc-
|
|
2684
|
+
'uc-url-source': UrlSource;
|
|
3010
2685
|
}
|
|
3011
2686
|
}
|
|
3012
2687
|
|
|
3013
|
-
declare class
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
private _ensureRegistered;
|
|
3020
|
-
private _renderActivity;
|
|
3021
|
-
private _disposeActivity;
|
|
3022
|
-
disconnectedCallback(): void;
|
|
3023
|
-
render(): lit_html.TemplateResult<1>;
|
|
3024
|
-
}
|
|
3025
|
-
declare class PluginActivityRenderer extends LitBlock {
|
|
3026
|
-
mode: 'modal' | 'inline';
|
|
3027
|
-
private _activities;
|
|
3028
|
-
private _unsubscribePlugins?;
|
|
2688
|
+
declare class SimpleBtn extends LitUploaderBlock {
|
|
2689
|
+
static styleAttrs: string[];
|
|
2690
|
+
couldBeCtxOwner: boolean;
|
|
2691
|
+
dropzone: boolean;
|
|
2692
|
+
private _buttonTextKey;
|
|
2693
|
+
private readonly _handleClick;
|
|
3029
2694
|
initCallback(): void;
|
|
3030
|
-
private _syncActivities;
|
|
3031
|
-
disconnectedCallback(): void;
|
|
3032
|
-
render(): lit_html.TemplateResult<1>;
|
|
3033
|
-
}
|
|
3034
|
-
declare global {
|
|
3035
|
-
interface HTMLElementTagNameMap {
|
|
3036
|
-
'uc-plugin-activity-host': PluginActivityHost;
|
|
3037
|
-
'uc-plugin-activity-renderer': PluginActivityRenderer;
|
|
3038
|
-
}
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
declare class UrlSource extends LitUploaderBlock {
|
|
3042
|
-
private _formState;
|
|
3043
|
-
private _inputRef;
|
|
3044
|
-
private _handleInput;
|
|
3045
|
-
private _handleUpload;
|
|
3046
|
-
firstUpdated(): void;
|
|
3047
2695
|
render(): lit_html.TemplateResult<1>;
|
|
3048
2696
|
}
|
|
3049
2697
|
declare global {
|
|
3050
2698
|
interface HTMLElementTagNameMap {
|
|
3051
|
-
'uc-
|
|
2699
|
+
'uc-simple-btn': SimpleBtn;
|
|
3052
2700
|
}
|
|
3053
2701
|
}
|
|
3054
2702
|
|
|
3055
2703
|
declare class FileUploaderRegular extends LitSolutionBlock {
|
|
3056
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3057
2704
|
attributesMeta: {
|
|
3058
2705
|
headless?: boolean;
|
|
3059
2706
|
'ctx-name': string;
|
|
3060
2707
|
};
|
|
3061
2708
|
static styleAttrs: string[];
|
|
3062
2709
|
headless: boolean;
|
|
2710
|
+
smart: boolean;
|
|
3063
2711
|
constructor();
|
|
3064
2712
|
initCallback(): void;
|
|
3065
2713
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -3071,7 +2719,6 @@ declare global {
|
|
|
3071
2719
|
}
|
|
3072
2720
|
|
|
3073
2721
|
declare class FileUploaderInline extends LitSolutionBlock {
|
|
3074
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3075
2722
|
attributesMeta: {
|
|
3076
2723
|
'ctx-name': string;
|
|
3077
2724
|
};
|
|
@@ -3092,7 +2739,6 @@ declare global {
|
|
|
3092
2739
|
}
|
|
3093
2740
|
|
|
3094
2741
|
declare class FileUploaderMinimal extends LitSolutionBlock {
|
|
3095
|
-
static lazyPlugins: LazyPluginEntry[];
|
|
3096
2742
|
attributesMeta: {
|
|
3097
2743
|
'ctx-name': string;
|
|
3098
2744
|
};
|
|
@@ -3116,4 +2762,4 @@ declare global {
|
|
|
3116
2762
|
}
|
|
3117
2763
|
}
|
|
3118
2764
|
|
|
3119
|
-
export { LitActivityBlock as ActivityBlock, ActivityHeader, type
|
|
2765
|
+
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, Dropdown, 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, SmartBtn, LitSolutionBlock as SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UID, UploadCtxProvider, UploadList, UploadSource, LitUploaderBlock as UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, toKebabCase };
|