import { PropertyValueMap, nothing } from 'lit'; import { FileLoadingState, FilesResultType, FileType } from '../types/files.types'; import { FileVersionSelectEventType } from '../types/files.events'; import { InfiniteData, InfiniteQueryObserverResult, QueryObserverResult } from '@tanstack/query-core'; import { UserType } from '../types/users.types'; import { Ref } from 'lit/directives/ref.js'; import { WeavySubAppComponent } from '../classes/weavy-sub-app-component'; import { ShadowPartsController } from '../controllers/shadow-parts-controller'; import { RenameFileMutationType } from '../data/file-edit'; import { SubscribeFileMutationType } from '../data/file-subscribe'; import { WyFileView } from './wy-file-view'; import { WyOverlay } from './ui/wy-overlay'; declare global { interface HTMLElementTagNameMap { "wy-preview": WyPreview; } } /** * Preview component. * Consumes WeavyComponent contexts. * * **Used sub components:** * * - [``](./ui/wy-button.ts) * - [``](./ui/wy-container.ts) * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-icon.ts) * - [``](./ui/wy-item.ts) * - [``](./ui/wy-overlay.ts) * - [``](./ui/wy-progress-circular.ts) * - [``](./ui/wy-titlebar.ts) * - [``](./wy-file-view.ts) * - [``](./wy-file-menu.ts) * - [``](./wy-comment-list.ts) * - [``](./wy-file-versions.ts) * - [``](./wy-user-card.ts) * - [``](./wy-file-title.ts) * - [``](./wy-file-view.ts) * * @csspart wy-dark - Overlay dark/root modifier. * @csspart wy-preview-layout - Layout wrapper for the preview. * @csspart wy-preview-main - Main preview content area. * @csspart wy-sidebar - Sidebar container for comments/versions. * @csspart wy-pane - Pane wrapper inside sidebars. * @csspart wy-preview - Preview container for content. * @csspart wy-preview-swiper - Swiper container for multiple preview panes. * @csspart wy-preview-area - Individual preview area for a single file. * @csspart wy-nav-prev - Previous navigation control. * @csspart wy-nav-next - Next navigation control. * * @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. * @fires {WyActionEventType} wy-action - Emitted when an embed action button is triggered. */ export declare class WyPreview extends WeavySubAppComponent { static styles: import('lit').CSSResult[]; /** * Controller for exporting named shadow parts. * * @internal */ protected exportParts: ShadowPartsController; /** * Placeholder text for the comment editor input. */ placeholder?: string; /** * Files available to render inside the preview carousel. */ files?: FileType[]; /** * Query result used to hydrate {@link files}. * * @internal */ queryResult?: QueryObserverResult; /** * Infinite query result backing the preview list. * * @internal */ infiniteQueryResult?: InfiniteQueryObserverResult>; /** * Mutation handling rename requests. * @internal */ protected renameFileMutation?: RenameFileMutationType; /** * Mutation handling subscribe/unsubscribe actions. * @internal */ protected subscribeFileMutation?: SubscribeFileMutationType; /** * Authenticated user context used for sidebar content. * * @internal */ user: UserType | undefined; /** * Identifier of the file currently displayed in the overlay. * * @attr */ currentId: number; /** * Treat provided files as attachments, disabling contextual sidebars. * * @attr */ isAttachment: boolean; /** * Forces the overlay to use the full-screen layout. * * @attr */ filled: boolean; /** * Puts the current file in edit mode if available. * * @attr */ edit: boolean; /** * Puts the current file in edit filename mode if available. * * @attr */ editName: boolean; /** * File currently selected in the carousel. * * @internal */ currentFile?: FileType; /** * Selected file version rendered in the main area. * * @internal */ currentVersionFile?: FileType; /** * Previous file candidate for navigation. * * @internal */ previousFile?: FileType; /** * Next file candidate for navigation. * * @internal */ nextFile?: FileType; /** * Overlay visibility flag. * * @internal */ showOverlay: boolean; /** * Comments sidebar visibility flag. * * @internal */ commentsOpen: boolean; /** * Versions sidebar visibility flag. * * @internal */ versionsOpen: boolean; /** * Whether the main area shows the unsaved draft of the current file instead of a stored version. * * @internal */ showDraft: boolean; /** * Draft key of the current file, used to detect when the draft query must be retargeted. * @internal */ private draftKey?; /** * Query for the unsaved draft of the current 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 for the current file. A draft that appears after that * (e.g. from another tab) must not replace what the user chose to view. * @internal */ private versionSelected; /** * Whether the active sidebar occupies extra width. * * @internal */ protected sidePanelMaximized: boolean; /** * Persists sidebar state per app/user combination. * * @internal */ private persistState; /** * Handles swipe navigation between preview panes. * * @internal */ private swipeScroller; /** * Reference to the current view element. * * @internal */ protected currentViewRef: Ref; /** * Reference to the next preview element. * * @internal */ protected nextRef: Ref; /** * Reference to the previous preview element. * * @internal */ protected prevRef: Ref; /** * Reference to the overlay. * * @internal */ protected overlayRef: Ref; /** * Element monitored for swipe intersection changes. * * @internal */ swipeScrollElement?: Element; /** * Loading states and queue order for preview items. Make sure to update it with immutable states. * @internal */ loadingQueue: FileLoadingState[]; /** * Prevents swipe navigation while programmatic scrolling is in progress. * * @internal */ protected disableSwipeScroll: boolean; /** * Timeout id used to re-enable swipe scrolling. * * @internal */ private disableSwipeScrollTimeout?; /** * Disable swipe scroll while resizing. * Needed by Safari. * @internal */ resizeObserver: ResizeObserver; /** * Moves a file to the front of the loading queue. * * @internal * @param file - File to prioritize. * @param state - Optional state override. */ moveFirstInQueue(file: FileType, state?: Omit): void; /** * Updates loading metadata for the supplied file. * * @internal * @param file - File whose state should change. * @param state - State patch to merge. */ updateLoadingState(file?: FileType, state?: Omit): void; /** * Marks the next unloaded item as loading. * * @internal */ loadNextInQueue(): void; /** * Emits `wy-preview-open` with the current preview context. * * @internal */ dispatchOpen(): Promise; /** * Emits the `wy-preview-close` event. * * @internal */ dispatchClose(): void; /** * Opens the overlay for the provided file identifier. * * @param fileId - File to display. * @param showTab - Optional sidebar tab to activate. */ open(fileId: number, options?: { edit?: boolean; tab?: "comments" | "versions"; }): Promise; /** * Closes the preview overlay. */ close(): void; /** * Saves the current document and returns to preview after a successful save. */ save(): Promise; setFocus(): void; /** * Toggles sidebar visibility for comments or versions. * * @internal * @param tab - Sidebar to affect. * @param state - Forced open state; toggles when omitted. */ toggleSidebarTab(tab?: "comments" | "versions", state?: boolean): void; /** * Handles file version selection events. * * @internal * @param e - Version selection event. */ handleVersionFile(e: FileVersionSelectEventType): void; /** * Keyboard navigation handler for the overlay. * * @internal */ handleKeys: (e: KeyboardEvent) => void; /** * Scrolls to the previous preview area. * * @internal */ scrollToPrev(): void; /** * Scrolls to the next preview area. * * @internal */ scrollToNext(): void; /** * Disables swipe scrolling for a short duration. * * @internal * @param duration - Milliseconds before re-enabling. */ blockSwipeScroll(duration?: number): void; /** * Re-enables swipe scrolling immediately. * * @internal */ unblockSwipeScroll(): void; /** * Selects the previous file when available. * * @internal */ setPrev(): void; /** * Selects the next file when available. * * @internal */ setNext(): void; /** * Registers swipe observers on the active scroll element. * * @internal */ registerSwipeScroller(): void; 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>; render(): import('../../node_modules/lit-html/node/lit-html.js').TemplateResult<1> | typeof nothing; updated(changedProperties: PropertyValueMap): void; } //# sourceMappingURL=wy-preview.d.ts.map