@voiceflow/base-types
Version:
Voiceflow base project types
55 lines • 1.65 kB
TypeScript
import type { BaseElement, BaseText } from 'slate';
export interface Color {
r: number;
g: number;
b: number;
a: number;
}
export declare enum TextProperty {
BACKGROUND_COLOR = "backgroundColor",
COLOR = "color",
ITALIC = "italic",
UNDERLINE = "underline",
FONT_WEIGHT = "fontWeight",
FONT_FAMILY = "fontFamily",
STRIKE_THROUGH = "strikeThrough"
}
export declare enum ElementType {
LINK = "link",
VARIABLE = "variable"
}
export declare enum ElementProperty {
TEXT_ALIGN = "textAlign"
}
export interface Text extends BaseText {
[TextProperty.BACKGROUND_COLOR]?: Color;
[TextProperty.COLOR]?: Color;
[TextProperty.ITALIC]?: boolean;
[TextProperty.UNDERLINE]?: boolean;
[TextProperty.FONT_WEIGHT]?: string;
[TextProperty.FONT_FAMILY]?: string;
[TextProperty.STRIKE_THROUGH]?: boolean;
}
export interface Element extends BaseElement {
type?: string;
children: Descendant[];
[ElementProperty.TEXT_ALIGN]?: string;
}
export interface LinkElement extends Element {
type: ElementType.LINK;
url?: string;
}
export interface VariableElement extends Element {
type: ElementType.VARIABLE;
id: string;
path?: string;
name: string;
isSlot?: boolean;
isSecret?: boolean;
}
export type AnyElement = Element | LinkElement | VariableElement;
export type Descendant = AnyElement | Text;
export type SlateTextValue = Descendant[];
export declare const isVariableElement: (element: Element) => element is VariableElement;
export declare const isLinkElement: (element: Element) => element is LinkElement;
//# sourceMappingURL=index.d.ts.map