@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
35 lines (34 loc) • 1.19 kB
TypeScript
import type { BuilderBlock } from '../types/builder-block';
import type { DeepPartial } from '../types/deep-partial';
import type { Input } from '../types/input';
export interface Action {
name: string;
inputs?: readonly Input[];
returnType?: Input;
action: (options: Record<string, any>) => string;
/**
* Is an action for expression (e.g. calculating a binding like a formula
* to fill a value based on locale) or a function (e.g. something to trigger
* on an event like add to cart) or either (e.g. a custom code block)
*/
kind: 'expression' | 'function' | 'any';
/**
* Globally unique ID for an action, e.g. "@builder.io:setState"
*/
id: string;
}
export interface InsertMenuItem {
name: string;
icon?: string;
item: DeepPartial<BuilderBlock>;
}
export interface InsertMenuConfig {
name: string;
priority?: number;
persist?: boolean;
advanced?: boolean;
items: InsertMenuItem[];
}
export declare function register(type: 'insertMenu', info: InsertMenuConfig): void;
export declare function register(type: string, info: any): void;
export declare function registerAction(action: Action): void;