UNPKG

1.4 kBTypeScriptView Raw
1import { BaseComponent, BaseProps } from './view/base';
2import { Component, ComponentProps } from 'preact';
3export interface PluginBaseProps<T extends PluginBaseComponentCtor> {
4 plugin: Plugin<T>;
5}
6export declare abstract class PluginBaseComponent<P extends PluginBaseProps<any> = any, S = unknown> extends BaseComponent<P, S> {
7}
8export interface PluginBaseComponentCtor<P extends PluginBaseProps<any> = any, S = unknown> {
9 new (props: P, context?: any): Component<P, S>;
10}
11export declare enum PluginPosition {
12 Header = 0,
13 Footer = 1,
14 Cell = 2
15}
16export interface Plugin<T extends PluginBaseComponentCtor> {
17 id: string;
18 position: PluginPosition;
19 component: T;
20 props?: Partial<ComponentProps<T>>;
21 order?: number;
22}
23export declare class PluginManager {
24 private readonly plugins;
25 constructor();
26 get<T extends PluginBaseComponentCtor>(id: string): Plugin<T> | null;
27 add<T extends PluginBaseComponentCtor>(plugin: Plugin<T>): this;
28 remove(id: string): this;
29 list<T extends PluginBaseComponentCtor>(position?: PluginPosition): Plugin<T>[];
30}
31export interface PluginRendererProps extends BaseProps {
32 props?: any;
33 pluginId?: string;
34 position?: PluginPosition;
35}
36export declare class PluginRenderer extends BaseComponent<PluginRendererProps> {
37 render(): import("preact").VNode<any>;
38}