import type { PanelUpdateEvent } from "dockview-core"; import { type Component } from "svelte"; import { PropsUpdater, type PropsPostProcessor } from "./PropsUpdater.svelte.js"; import type { RecordLike, Mounted } from "./types.js"; import { MountMechanism, type IdentifierRecipe } from "./MountMechanism.js"; export type PanelRendererBaseConfig = { /** * Function to be invoked when the panel's `init` method is called, * which is responsible for converting the first argument ("options") of `init` * into the props ultimately passed to the Svelte component. * @param options * @returns */ initOptionsToProps: (options: InitOptions) => Props; /** * The Svelte component to be rendered in the panel. */ svelteComponent: Component; /** * An optional function to be invoked after the props are updated. * @param props */ propsPostProcessor?: PropsPostProcessor; /** * Whether the props have a `params` property. * TODO: investigate if this is necessary. * * @default true */ propsHasParams?: boolean; element?: HTMLElement; } & IdentifierRecipe; export default class PanelRendererBase { static Mount: MountMechanism; protected readonly mountID: ReturnType; protected readonly svelteComponent: Component; protected readonly _element: HTMLElement; protected instance?: Mounted; protected readonly initOptionsToProps: (options: InitOptions) => Props; protected readonly propsPostProcessor?: PropsPostProcessor; protected readonly propsHasParams: boolean; propsUpdater?: PropsUpdater; get element(): HTMLElement; constructor(config: PanelRendererBaseConfig); init(options: InitOptions): void; dispose(): void; update({ params }: PanelUpdateEvent): void; private static ReadableIdentifier; } export type ConstructorConfigWithout = "panelTarget" | "initOptionsToProps"> = Omit, K>;