Skip to content

Document & element schema

Ezyreka designs are plain JSON documents — portable, diffable and safe to persist anywhere.

Document

ts
interface DesignDocument {
  version: number
  pages: DesignPage[]
}

interface DesignPage {
  width: number   // px
  height: number  // px
  background: PageBackground
  elements: DesignElement[]
}

interface PageBackground {
  type: 'solid' | 'gradient' | 'image'
  color?: string
  from?: string
  to?: string
  angle?: number
  src?: string
}
js
{
  version: 1,
  pages: [
    {
      width: 1080,
      height: 1080,
      background: { type: 'solid', color: '#ffffff' },
      elements: [/* … */]
    }
  ]
}

Element

ts
interface DesignElement {
  id?: string
  type: 'text' | 'rect' | 'ellipse' | 'triangle' | 'star' | 'hexagon'
      | 'diamond' | 'heart' | 'line' | 'image' | 'icon' | 'shape' | 'chart'
  x: number
  y: number
  w: number
  h: number
  rotation?: number
  opacity?: number
  locked?: boolean
  hidden?: boolean
  flipX?: boolean
  flipY?: boolean
}
FieldDescription
x, yTop-left position (unrotated)
w, hWidth and height
rotationDegrees, rotates around center
opacity0–1
locked / hiddenRead-only / invisible (also excluded from exports)
flipX / flipYFlips around the center

Text fields

FieldTypeNotes
textstringContent, wraps at box width
fontSizenumberpx
fontFamilystringAny registered family
fontWeightnumber100–900
italic / underlineboolean
align'left' | 'center' | 'right'
colorstringText color
lineHeightnumberMultiplier
letterSpacingnumberpx

Shape fields

FieldTypeNotes
fillstring | GradientFillsolid hex, 'none', or gradient object
strokestringhex, empty = none
strokeWidthnumberpx
radiusnumberrect only
ts
interface GradientFill {
  type: 'gradient'
  from?: string
  to?: string
  /** Multi-stop gradient; when present it overrides from/to. */
  stops?: { color: string, offset: number }[]
  /** Degrees clockwise from left-to-right (0); defaults to 135. */
  angle?: number
}

Angles run clockwise: 0 is left to right, 90 is top to bottom.

Line / arrow fields

FieldTypeNotes
stroke / strokeWidthLine color and thickness
arrowbooleanRenders an arrow head

Image fields

FieldType
srcstring — data URL or remote URL

Icon fields

FieldTypeNotes
iconstringIcon registry name
iconStyle'solid' | 'outline'Outline falls back to solid when missing
fillstringIcon color in both styles

Documents without iconStyle keep their solid appearance.

Vector shape fields

FieldTypeNotes
shapestringe.g. pentagon, burst, ring, blob, speech-bubble

Rendered through the shapes registry; custom entries are added with registerShapes().

Chart fields

FieldTypeNotes
chartChartConfigFull chart configuration
ts
interface ChartConfig {
  type: 'bar' | 'row' | 'grouped-bar' | 'line' | 'multi-line'
      | 'pie' | 'donut' | 'area' | 'stacked-area'
  categories: string[]
  series: { name: string, values: (number | null)[], color?: string }[]
  categoryColors?: string[]
  title?: string
  showLegend?: boolean
  showValues?: boolean
  showAxes?: boolean
  showGrid?: boolean
  fontSize?: number
  textColor?: string
}
  • null values represent missing data
  • Pie/donut values must be non-negative
  • Invalid non-finite values normalize to missing values

Round-tripping

  • getJSON() deep-clones the document
  • loadJSON(doc) normalizes the input and assigns fresh ids
  • downloadJSON() saves the document as a file
  • PNG/JPEG exports render gradients, charts and custom renderers

Released under the MIT License.