Skip to content
D
Documentation

Types — interfaces t–v

reference
2 min readUpdated

Interfaces T–V

Import these from @grafloria/renderer.

Interfaces

TextStyle

Text styling for measurement.

ts
interface TextStyle

Properties

NameTypeDefaultDescription
fontFamily?string
fontSize?number
fontWeight?string | number
fontStyle?string
letterSpacing?number
lineHeight?number

Theme

Complete theme definition Supports both CSS Variables (SVG+HTML) and Programmatic (Canvas)

ts
interface Theme

Properties

NameTypeDefaultDescription
namestringTheme name (e.g., "Light", "Dark", "High Contrast")
versionstringTheme version
colorsColorPaletteColor palette
typographyTypographyTypography settings
spacingSpacingSpacing scale
effectsEffectsVisual effects (shadows, border radius, opacity)
nodes{ default: NodeStyleTheme; [nodeType: string]: Partial<NodeStyleTheme>; }Node type defaults - default: Base styles for all nodes - [nodeType]: Type-specific overrides
links{ default: LinkStyleTheme; [linkType: string]: Partial<LinkStyleTheme>; }Link type defaults - default: Base styles for all links - [linkType]: Type-specific overrides
portsPortThemeConfigPort configuration
categories?SemanticPaletteSEMANTIC / CATEGORY PALETTE — the caller's OWN vocabulary of colours.
numbers?NumberScaleNAMED NUMERIC SCALE — the numeric analogue of {@link categories}.

Typography

Typography theme

ts
interface Typography

Properties

NameTypeDefaultDescription
fontFamily{ default: string; mono: string; }Font families
fontSize{ xs: number; sm: number; md: number; lg: number; xl: number; }Font sizes (in pixels)
fontWeight{ normal: number; medium: number; bold: number; }Font weights
lineHeight{ tight: number; normal: number; relaxed: number; }Line heights

ValidationError

Validation error returned from validation functions

ts
interface ValidationError

Properties

NameTypeDefaultDescription
messagestringHuman-readable error message
code?stringOptional error code for programmatic handling

Example

typescript
const error: ValidationError = {
  message: 'Value must be positive',
  code: 'POSITIVE_VALUE_REQUIRED'
};

ValidationResult

Result of running validation on a property value

ts
interface ValidationResult

Properties

NameTypeDefaultDescription
validbooleanWhether the value is valid
errorsValidationError[]Array of validation errors (empty if valid)

Example

typescript
const result: ValidationResult = {
  valid: false,
  errors: [{ message: 'Required field is missing' }]
};

VNode

Virtual Node - Abstract representation of visual element Framework-agnostic, serializable, diffable

Supports both SVG and Canvas rendering modes, as well as HTML content via foreignObject for embedding rich components.

ts
interface VNode

Properties

NameTypeDefaultDescription
typeVNodeTypeElement type: 'svg', 'g', 'rect', 'circle', 'path', 'text', 'foreignObject', etc.
propsVNodePropsElement properties (attributes, styles, event handlers)
children?VNode[]Optional children VNodes (for hierarchical structures)
key?stringOptional unique key for diffing optimization Used by renderers to efficiently update only changed nodes

Was this page helpful?

Types — interfaces t–v — Grafloria