import { nothing, PropertyValueMap } from 'lit'; import { AppTypeGuid } from './types/app.types'; import { FileType } from './types/files.types'; import { FileVersionSelectEventType } from './types/files.events'; import { ThemeController } from './controllers/theme-controller'; import { WeavyAppComponent } from './classes/weavy-app-component'; import { ComponentFeatures } from './contexts/features-context'; import { CreateFilesController } from './controllers/create-files-controller'; import { Ref } from 'lit/directives/ref.js'; import { QueryController } from './controllers/query-controller'; import { WyFileView } from './components/wy-file-view'; import { AppearanceModeType, OverlayAppearanceType } from './types/ui.types'; import { RenameFileMutationType } from './data/file-edit'; import { SubscribeFileMutationType } from './data/file-subscribe'; declare global { interface HTMLElementTagNameMap { "wy-file": WyFile; } } /** * @import { WyAppEventType } from "./types/app.events" * @import { WyActionEventType } from "./types/action.events" * @import { WyPreviewOpenEventType } from "./types/files.events" * @import { WyPreviewCloseEventType } from "./types/files.events" */ /** * Weavy file component to render a view or editor for a specific file. * * Supports viewing files from cloud providers such as Google Drive, Dropbox, Box and Microsoft OneDrive. * Files can be viewed for 100+ formats including streamed audio/video, PDF, Office and Google Drive. * * Each file can be discussed with rich comments with support for attachments, mentions, embedded links and more. * Files can also be accessed via versions, with possibility to preview all versions and rollback to a specific version. * Office documents and spreadsheets can be opened and edited directly in Office using built-in [WebDAV](https://www.weavy.com/docs/learn/integrations/webdav) integration to automatically save new version back to the app. * * Each file component requires the file identifier (`fileId`) of the file you want to view or edit. It also requires an app identifier (`uid`), which automatically creates a [corresponding app](https://www.weavy.com/docs/concepts#app) on your Weavy environment when the component is first initialized. * The app identifier must correspond to the app of the file you want to open. It's also recommended to specify a readable `name` of the files app, to get better readable notifications from the app. * * > It's often useful to base the `uid` on something that identifies the location where the component is rendered. * > Typically you would use something like a product id, page id or path. * * **Component Layout** * * The component is [block-level](https://developer.mozilla.org/en-US/docs/Glossary/Block-level_content) with pre-defined CSS styling to adapt to flex- and grid-layouts as well as traditional flow-layouts. * It's usually recommended to use a proper flex-layout for the container you are placing the component in for a smooth layout integration. * * The height grows with the content per default. Content is automatically loaded during scrolling when the last content becomes visible (aka infinite scrolling). * If placed in a flex- or grid-layout or if an explicit height is set, the component becomes scrollable. * * The content within the components is per default aligned to the edges of it's own _box_ and designed to not be placed next to a edge or border. * It's recommended to adjust the layout with your default padding. Setting the `--wy-padding-outer` to your default padding will allow the component to still fill the are where it's placed, * but with proper padding within the scrollable area of the component. * If you want to make the component go all the way to the edges without padding or any outermost roundness instead, * set `--wy-padding-outer: 0;` and `--wy-border-radius-outer: 0;` to make the component fit nicely with the edge. * * You can add additional styling using _CSS Custom Properties_ and _CSS Shadow Parts_ and further customization using _slots_. * * **Used sub components:** * * - [``](./components/wy-titlebar.ts) * - [``](./components/wy-file-title.ts) * - [``](./components/wy-file-menu.ts) * - [``](./components/ui/wy-overlay.ts) * - [``](./components/ui/wy-button.ts) * - [``](./components/ui/wy-icon.ts) * - [``](./components/ui/wy-icon.ts) * - [``](./components/wy-comment-list.ts) * - [``](./components/wy-file-versions.ts) * - [``](./components/ui/wy-progress-circular.ts) * - [``](./components/wy-file-view.ts) * - [``](./components/wy-empty.ts) * - [``](./components/wy-user-card.ts) * - [``](./components/wy-filename-input.ts) * * @tagname wy-file * @csspart wy-dragging - Modifier for the main layout when dragging over. * @csspart wy-pane - Part of the tab content area. * @csspart wy-scroll-y - Part of the tab content area. * @csspart wy-pane-body - Part of the version tab. * @csspart wy-meta-sm - Small metadata in the header. * @slot actions - Buttons placed in the toolbar. * @slot empty - Empty state content. * @slot title - Empty state title. * @fires {WyAppEventType} wy-app - Fired whenever the app property changes. * @fires {WyActionEventType} wy-action - Emitted when an action is performed on an embed. * @fires {WyPreviewOpenEventType} wy-preview-open - Fired when a preview overlay is about to open. * @fires {WyPreviewCloseEventType} wy-preview-close - Fired when a preview overlay is closed. * * @example Standard file preview with comments * * Displays a file preview with integrated comments and versioning. * * Specifying the app identifier (`uid`) is required, and automatically creates a [corresponding app](https://www.weavy.com/docs/concepts#app) on your Weavy environment when the component is first initialized. * * ```html * * ``` * * @example File preview with edit mode * * Displays a file preview in edit mode. * * ```html * * ``` */ export declare class WyFile extends WeavyAppComponent { static styles: import('lit').CSSResult[]; /** @internal */ appType: AppTypeGuid; /** @internal */ componentFeatures: ComponentFeatures; /** @internal */ protected theme: ThemeController; protected createFilesController: CreateFilesController; /** * Query controller tracking the file. * @internal */ fileQuery: QueryController; /** * Mutation handling rename requests. * @internal */ protected renameFileMutation?: RenameFileMutationType; /** * Mutation handling subscribe/unsubscribe actions. * @internal */ protected subscribeFileMutation?: SubscribeFileMutationType; /** * Placeholder text for the comment editor input. */ placeholder?: string; /** * The ID of the file to be displayed. */ fileId?: number | null; /** * Whether the component is in edit mode. Sidebars are hidden while editing. */ edit: boolean; /** * Whether the name of the file is being edited. */ editName: boolean; /** * The currently selected tab. */ tab?: "comments" | "versions"; /** * Appearance of the file list header. * * @type {"interactive" | "empty" | "none"} * @default "interactive" */ header: AppearanceModeType; /** * Whether the component is maximized. * @internal */ maximized: boolean; /** * Overlay appearance used for the conversation list. * * @type {"modal" | "sheet" | "drawer" | "full" | "none"} * @default "drawer" */ overlay: OverlayAppearanceType; /** * Selected file version rendered in the main area. * * @internal */ currentVersionFile?: FileType; /** * Whether the unsaved draft of the file is shown instead of a stored version. * * @internal */ showDraft: boolean; /** * The file data last seen from the file query, used to detect when the file (re)loads. * @internal */ private loadedFile?; /** * Draft key of the loaded file, used to detect when the draft query must be retargeted. * @internal */ private draftKey?; /** * Query for the unsaved draft of the file. A file that has a draft opens on the draft, so Edit and Discard are * available right away, and falls back to the current version when the draft is published or discarded. * @internal */ private draftQuery; /** * Whether the user explicitly picked a version or the draft. A draft that appears after that (e.g. from another * tab) must not replace what the user chose to view. * @internal */ private versionSelected; /** * Open a file in preview/edit. * * @param fileId - The id of the file to open. * @param edit - Whether to open in edit mode. */ open(fileId: number, edit?: boolean): void; /** * Saves the current file view and returns to preview after a successful save. */ save(): Promise; /** * Prompt for a filename, create a new file and open it. 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. * * @param ext - Suggested initial extension; the submitted filename is used unchanged. * @returns Data for the created file, or undefined if the prompt is cancelled. */ createFile(ext?: string): Promise; /** * Upload a file and open it. * * @param files - Files to upload. * @returns An array of data for the created files. */ uploadFile(file: File): Promise; /** * Whether the component is acting as an attachment. */ get isAttachment(): boolean; /** * Reference to the current view element. * * @internal */ protected fileViewRef: Ref; private filenameInputRef; /** * Handles file version selection events. * * @internal * @param e - Version selection event. */ handleVersionFile(e: FileVersionSelectEventType): void; protected willUpdate(changedProperties: PropertyValueMap): Promise; /** * Renders the preview header for the active file. * * @internal * @param activeFile - File displayed in the main pane. */ renderHeader(activeFile?: FileType): import('../node_modules/lit-html/node/lit-html.js').TemplateResult<1>; /** * Renders the sidebar panels. * * @internal * @param file - The file to render tabs for * @returns */ renderTabs(file?: FileType): import('../node_modules/lit-html/node/lit-html.js').TemplateResult<1> | typeof nothing; protected render(): import('../node_modules/lit-html/node/lit-html.js').TemplateResult<1>; protected updated(changedProperties: PropertyValueMap): void; } //# sourceMappingURL=wy-file.d.ts.map