@kelta/plugin-sdk — API Reference
Every symbol exported from @kelta/plugin-sdk, the plugin toolkit, with its TypeScript signature and doc summary — generated from the package entry point.
Every symbol exported from @kelta/plugin-sdk, with its TypeScript signature and the first paragraph of its
doc comment — generated from kelta-web/packages/plugin-sdk/src/index.ts. For a guided tour with
examples, see @kelta/plugin-sdk.
10 exports, grouped by kind and sorted by name.
Classes#
BasePlugin#
Base plugin class that provides common functionality
abstract class BasePlugin implements Plugin {
abstract name: string;
abstract version: string;
init(context: PluginContext): void | Promise<void>;
abstract mount(container: HTMLElement): void | Promise<void>;
abstract unmount(): void | Promise<void>;
}
ComponentRegistry#
Registry for custom field renderers and page components
class ComponentRegistry {
static registerFieldRenderer(fieldType: string, renderer: FieldRendererComponent): void;
static getFieldRenderer(fieldType: string): FieldRendererComponent | undefined;
static hasFieldRenderer(fieldType: string): boolean;
static getFieldRendererTypes(): string[];
static listFieldRenderers(): string[];
static registerPageComponent(name: string, route: string, component: PageComponent): void;
static getPageComponent(name: string): RegisteredPageComponent | undefined;
static hasPageComponent(name: string): boolean;
static getAllPageComponents(): RegisteredPageComponent[];
static listPageComponents(): string[];
static clearFieldRenderers(): void;
static clearPageComponents(): void;
static clearAll(): void;
}
Interfaces#
FieldRendererProps#
Props passed to field renderer components
interface FieldRendererProps {
value: unknown;
field: FieldDefinition;
onChange?: (value: unknown) => void;
readOnly?: boolean;
}
PageComponentProps#
Props passed to page components
interface PageComponentProps {
client: KeltaClient;
params: Record<string, string>;
user: User | null;
}
Plugin#
Plugin interface that all plugins must implement
interface Plugin {
name: string;
version: string;
init(context: PluginContext): void | Promise<void>;
mount(container: HTMLElement): void | Promise<void>;
unmount(): void | Promise<void>;
}
PluginContext#
Context provided to plugins during initialization
interface PluginContext {
client: KeltaClient;
user: User | null;
router: Router;
}
RegisteredPageComponent#
Registered page component with route
interface RegisteredPageComponent {
name: string;
route: string;
component: PageComponent;
}
Router#
Router interface for plugin navigation
interface Router {
navigate(path: string): void;
getCurrentPath(): string;
}
Type aliases#
FieldRendererComponent#
Field renderer component type
type FieldRendererComponent = (props: FieldRendererProps) => ReactElement;
PageComponent#
Page component type
type PageComponent = (props: PageComponentProps) => ReactElement;