Skip to content
D
Documentation

Types — types

reference
1 min readUpdated

Types

Import these from @grafloria/renderer.

Types

ConditionOperator

Also has every member of String, listed on its own entry.

Comparison operators for property conditions

ts
type ConditionOperator =
  | '=='
  | '!='
  | '>'
  | '<'
  | '>='
  | '<='
  | 'contains'
  | 'in'
  | 'notIn'
  | 'matches';

Example

typescript
// Equality check
const condition: PropertyCondition = {
  property: 'type',
  operator: '==',
  value: 'table'
};

ExportFormat

Also has every member of String, listed on its own entry.

Export format types.

It is no longer absent. It IS a true vector PDF — paths stay paths and text stays text, so it is selectable and searchable — written directly from the VNode tree, with no dependency; see export/pdf/ for how, and for the honest list of what a base-14-font PDF cannot do. The glyph pipeline was sidestepped by using the fonts every PDF reader already has, rather than embedding one.)

Because IRenderer.export is string-typed, 'pdf' comes back as a data:application/pdf;base64,… URL. SVGRenderer.exportPdf() hands you the bytes and the fidelity warnings instead.

ts
type ExportFormat = 'png' | 'svg' | 'jpeg' | 'webp' | 'pdf';

LinkConnection

Also has every member of String, listed on its own entry.

A line's part in the selection's neighbourhood, as highlightConnected draws it: 'in' ends at a selected node (or upstream of one), 'out' starts at one (or downstream), 'both' runs between two, 'dim' is every other line. Emitted as data-connected on the line's group.

ts
type LinkConnection = 'in' | 'out' | 'both' | 'dim';

PropertyEditorType

Also has every member of String, listed on its own entry.

Base property editor type (imported from editor-types to avoid circular dependency)

ts
type PropertyEditorType =
  | 'string'
  | 'number'
  | 'boolean'
  | 'select'
  | 'multiselect'
  | 'color'
  | 'textarea'
  | 'json'
  | 'date'
  | 'datetime'
  | 'slider'
  | 'file';

VNodeType

Also has every member of String, listed on its own entry.

VNode element type

Discriminated union of all supported SVG and HTML element types. Using a union type enables better TypeScript type checking and autocomplete.

ts
type VNodeType =
  | 'rect'
  | 'circle'
  | 'ellipse'
  | 'line'
  | 'polyline'
  | 'polygon'
  | 'path'
  | 'text'
  | 'g'
  | 'svg'
  | 'foreignObject'
  | 'div'
  | 'span'
  | string;

Was this page helpful?

Types — types — Grafloria