import { AbstractDependentWraplet, Constructable } from "wraplet"; import { ExhibitionPreviewOptions } from "./ExhibitionPreview"; import { ExhibitionMonacoEditorOptions } from "./ExhibitionMonacoEditor"; import { DocumentAltererProviderWraplet } from "./types/DocumentAltererProviderWraplet"; import { KeyValueStorage } from "wraplet/storage"; import { PreviewWraplet } from "./types/PreviewWraplet"; import { ExhibitionUpdater } from "./ExhibitionUpdater"; export type ExhibitionOptions = {}; export type ExhibitionInitOptions = { init?: boolean; updatePreview?: boolean; }; export type MapConfiguration = { editors: { selector?: string; Class: Constructable; args?: unknown[]; }; preview: { selector?: string; Class: Constructable; args?: unknown[]; }; updaters: { selector?: string; Class: Constructable; args?: unknown[]; }; }; export type DefaultMapConfiguration = { editors: { selector?: string; options: ExhibitionMonacoEditorOptions; optionsStorage?: KeyValueStorage>; }; preview?: { selector?: string; options?: ExhibitionPreviewOptions; optionsStorage?: KeyValueStorage; }; updaters?: { selector?: string; }; }; export type DisabledEditorsDefaultMapConfiguration = Omit, "editors">; type GetMapArgs = { configuration: DefaultMapConfiguration; deferEditors?: false; } | { configuration?: DisabledEditorsDefaultMapConfiguration; deferEditors: true; }; /** * This is a factory function that creates a new map each time it's run. */ declare function createMap(configuration: MapConfiguration): { editors: { selector: string | undefined; multiple: true; required: false; Class: Constructable; args: unknown[]; }; preview: { selector: string | undefined; multiple: false; required: true; Class: Constructable; args: unknown[]; }; updaters: { selector: string | undefined; Class: Constructable; multiple: true; required: false; args: unknown[]; }; }; export declare class Exhibition extends AbstractDependentWraplet> { protected supportedNodeTypes(): readonly Constructable[]; initialize(): Promise; destroy(): Promise; protected onInitialize(): Promise; /** * Adds DocumentAltererProviderWraplet instance to the list of editors. */ addEditor(editor: DocumentAltererProviderWraplet): void; /** * Removes DocumentAltererProviderWraplet instance from the list of editors. */ removeEditor(editor: DocumentAltererProviderWraplet): void; /** * Checks if the given editor is present in the list of editors. */ hasEditor(editor: DocumentAltererProviderWraplet): boolean; /** * Adds a simple DocumentAlterer to the preview. */ private addPreviewAlterer; getPreview(): PreviewWraplet; /** * If Preview becomes unresponsive, you can replace it with a new one. * * Remember to destroy the old one afterward. */ replacePreview(preview: PreviewWraplet): void; updatePreview(): Promise; /** * Create multiple Exhibitions. * * @param node Node to create Exhibitions on. * @param map Map of dependencies for each Exhibition instance. * @param options Options for Exhibition instances. * @param initOptions Options related to the creation process of the Exhibitions. * @param attribute Attribute to use for Exhibition instances. * * @returns Array of Exhibition instances. */ static createMultiple = ReturnType>(node: ParentNode, map: M, options?: ExhibitionOptions, initOptions?: ExhibitionInitOptions, attribute?: string): Promise; /** * Create a single Exhibition instance wrapping a given element. * * @param element Element to wrap. * @param map Map of dependencies for the Exhibition instance. * @param initOptions Options related to the creation process of the Exhibitions. */ static create = ReturnType>(element: HTMLElement, map: M, initOptions?: ExhibitionInitOptions): Promise; private static fillCreateOptionsWithDefaults; /** * Validate create options. */ private static validateInitOptions; /** * Create options. */ private static applyCreateOptions; /** * Creates a default, preconfigured, map for Exhibition. */ static getMap(args: GetMapArgs): ReturnType; static getCustomizedMap(configuration: MapConfiguration): ReturnType; } export {};