import type { ISlideDocumentData } from '@univerjs-pro/slides'; import type { ICommandInfo, ICreateUnitOptions, Nullable } from '@univerjs/core'; import type { FSlide } from './f-slide'; import { FUniver } from '@univerjs/core/facade'; import { FPresentation } from './f-presentation'; export interface IFUniverSlideMixin { /** * Creates a new presentation unit. * @param {Partial} [data] The initial presentation snapshot data. * @param {ICreateUnitOptions} [options] The unit creation options. * @returns {FPresentation} The created presentation facade. * * @example * ```ts * const fPresentation = univerAPI.createPresentation({ * id: 'presentation-1', * name: 'Quarterly Review', * }); * console.log(fPresentation.getId()); * ``` */ createPresentation(data?: Partial, options?: ICreateUnitOptions): FPresentation; /** * Get the active presentation. * @returns {FPresentation|null} The active presentation, or `null` if no presentation is active. * * @example * ```ts * const fPresentation = univerAPI.getActivePresentation(); * console.log(fPresentation?.getName()); * ``` */ getActivePresentation(): FPresentation | null; /** * Get a presentation by id. * @param {string} id The presentation id. * @returns {FPresentation|null} The presentation, or `null` if it does not exist. * * @example * ```ts * const fPresentation = univerAPI.getPresentation('presentation-1'); * console.log(fPresentation?.getId()); * ``` */ getPresentation(id: string): FPresentation | null; /** * Get all presentation units. * @returns {FPresentation[]} All presentation facades. * * @example * ```ts * const presentations = univerAPI.getPresentations(); * console.log(presentations.length); * ``` */ getPresentations(): FPresentation[]; /** * Resolve a presentation and slide pair by ids. * @param {string} unitId The presentation id. * @param {string} slideId The slide id. * @returns {Nullable<{ presentation: FPresentation; slide: FSlide }>} The resolved presentation and slide, or `null`. * * @example * ```ts * const target = univerAPI.getSlideTarget('presentation-1', 'slide-1'); * console.log(target?.slide.getName()); * ``` */ getSlideTarget(unitId: string, slideId: string): Nullable<{ presentation: FPresentation; slide: FSlide; }>; /** * Resolve the presentation and slide target from a command info object. * @param {ICommandInfo} commandInfo The command info containing `unitId`, `subUnitId`, or `slideId` in params. * @param {object} commandInfo.params The command params. * @returns {Nullable<{ presentation: FPresentation; slide: FSlide }>} The resolved presentation and slide, or `null`. * * @example * ```ts * univerAPI.onCommandExecuted((commandInfo) => { * const target = univerAPI.getCommandSlideTarget(commandInfo); * console.log(target?.slide.getId()); * }); * ``` */ getCommandSlideTarget(commandInfo: ICommandInfo): Nullable<{ presentation: FPresentation; slide: FSlide; }>; } /** * The slide facade mixin on `FUniver`. * @ignore */ export declare class FUniverSlideMixin extends FUniver implements IFUniverSlideMixin { /** @inheritdoc */ createPresentation(data?: Partial, options?: ICreateUnitOptions): FPresentation; /** @inheritdoc */ getActivePresentation(): FPresentation | null; /** @inheritdoc */ getPresentation(id: string): FPresentation | null; /** @inheritdoc */ getPresentations(): FPresentation[]; /** @inheritdoc */ getSlideTarget(unitId: string, slideId: string): Nullable<{ presentation: FPresentation; slide: FSlide; }>; /** @inheritdoc */ getCommandSlideTarget(commandInfo: ICommandInfo): Nullable<{ presentation: FPresentation; slide: FSlide; }>; } declare module '@univerjs/core/facade' { interface FUniver extends IFUniverSlideMixin { } }