import { PropertyValueMap } from 'lit'; import { Ref } from 'lit/directives/ref.js'; import { BlobType, FileMutationContextType, FileType, CreateFileProps, ExternalBlobType } from '../types/files.types'; import { MutationStateController } from '../controllers/mutation-state-controller'; import { MutationState } from '@tanstack/query-core'; import { WyCloudFiles } from './wy-cloud-files'; import { WeavySubAppComponent } from '../classes/weavy-sub-app-component'; import { ShadowPartsController } from '../controllers/shadow-parts-controller'; import { CreateFilesController } from '../controllers/create-files-controller'; declare global { interface HTMLElementTagNameMap { "wy-file-create": WyFileCreate; } } /** * Button menu for creating or uploading files. * * **Used sub components:** * * - [``](./ui/wy-button.ts) * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-icon.ts) * - [``](./ui/wy-progress-circular.ts) * - [``](./ui/wy-overlay.ts) * - [``](./ui/wy-container.ts) * - [``](./wy-file-item.ts) * - [``](./wy-cloud-files.ts) * - [``](./wy-empty.ts) * - [``](./wy-filename-input.ts) * * @slot actions - Buttons placed in the toolbar. * * @csspart wy-files-create-buttons - Button group * * @fires {WyActionEventType} wy-action - Emitted when a file is created. Editable files use the `edit` action and should be opened in edit mode, other files use `select`. */ export declare class WyFileCreate extends WeavySubAppComponent { static styles: import('lit').CSSResult[]; /** @internal */ protected exportParts: ShadowPartsController; /** * Toggle for displaying the upload sheet. * @internal */ showUploadSheet: boolean; private filenameInputRef; /** * Name currently being created from the filename prompt. A conflict for this name is reported inline in the prompt * instead of opening the upload sheet, and is removed from the mutation cache by the controller. */ private promptedFilename?; protected whenFileUploadInput?: Promise<(FileType | undefined)[] | undefined>; protected resolveFileUploadInput?: (value: (FileType | undefined)[] | undefined | PromiseLike<(FileType | undefined)[] | undefined>) => void; protected whenCloudFileInput?: Promise<(FileType | undefined)[] | undefined>; protected resolveCloudFileInput?: (value: (FileType | undefined)[] | undefined | PromiseLike<(FileType | undefined)[] | undefined>) => void; /** * Handles file uploads, blobs and file creation. * @internal */ protected createFilesController: CreateFilesController; /** * Tracks active file mutations for uploads. * @internal */ protected mutatingFiles: MutationStateController; /** * Cached failed mutations to detect new errors. * @internal */ protected previousFailedFileMutations: MutationState[]; /** * Reference to the hidden file input. * @internal */ protected fileInputRef: Ref; /** * Reference to the cloud files picker element. * @internal */ protected cloudFilesRef: Ref; /** * Open the native file picker. * */ getFileInput(): Promise<(FileType | undefined)[] | undefined>; /** * Open the cloud files picker. * */ getCloudFiles(): Promise<(FileType | undefined)[] | undefined>; /** * Remove (or abort) an ongoing upload mutation. * * @internal * @param mutationState - Mutation state to remove. */ protected handleRemoveMutation(mutationState: MutationState): Promise; /** * Retry an upload by replacing the existing file. * * @internal * @param mutation - Failed mutation carrying the blob data. */ protected handleOverwriteUpload(mutation: MutationState): Promise; /** * Handle uploading of files. * * @param files - Files chosen from the native picker. */ protected handleUploadFiles(files: File[] | FileList | null): Promise<(FileType | undefined)[] | undefined>; /** * Handle adding blobs from the cloud picker. * * @param blobs - Blobs chosen from the cloud picker. */ protected handleExternalBlobs(blobs: ExternalBlobType[] | null): Promise<(FileType | undefined)[] | undefined>; /** * Prompt for a filename and create a file. The prompt stays open with an inline error when the name is already * taken in the app, so the user can choose a different name. * Emits `wy-action` with `edit` for editable text and code files, otherwise `select`. * @param ext - Suggested initial extension; the submitted filename is used unchanged. * @returns The created file, or undefined if the prompt is cancelled. */ createFile(ext?: string): Promise; willUpdate(changedProperties: PropertyValueMap): Promise; private renderFileMutation; render(): import('../../node_modules/lit-html/node/lit-html.js').TemplateResult<1>; updated(changedProperties: PropertyValueMap): void; } //# sourceMappingURL=wy-file-create.d.ts.map