genart.dev
Packages

@genart-dev/core

Renderer adapters, compiler, compositor, and registries — version 0.6.1

@genart-dev/core

Version 0.6.1. The runtime engine that compiles sketches, manages rendering, and provides the plugin and skill registries.

Installation

npm install @genart-dev/core

Renderer Adapters

5 renderer adapters implement the RendererAdapter interface:

AdapterRendererUse Case
P5Adapterp5.js (instance mode)General-purpose 2D creative coding
Canvas2DAdapterHTML Canvas 2DLightweight 2D, no dependencies
ThreeAdapterThree.js3D scenes, WebGL
GLSLAdapterRaw GLSL shadersFragment shader art, GPU-intensive effects
SVGAdapterSVG DOMVector output, scalable graphics

Each adapter handles:

  • Algorithm compilation and validation
  • Instance creation with canvas, params, colors, and seed
  • State injection (WIDTH, HEIGHT, SEED, PARAMS, COLORS)
  • Component and symbol data extraction

Compiler

The compiler transforms a SketchDefinition into a runnable sketch instance:

import { compile } from '@genart-dev/core';

const instance = await compile(sketchDefinition, container);
instance.initializeSystem();

Compositor

The iframe compositor renders design layers as overlays on the sketch canvas. It handles:

  • Layer ordering and visibility
  • Blend modes and opacity
  • Transform controls (position, rotation, scale, anchor)
  • Filter application (filter: CSS property with filters: alias fallback)

SkillRegistry

24 built-in skills covering artistic knowledge:

CategorySkills
CompositionRule of thirds, golden ratio, visual balance, focal points
Color TheoryColor harmonies, palettes, contrast, temperature
ProcessCreative workflow, iteration, critique
PaintingBrush techniques, fills, shading
DrawingSVG paths, canvas math, symbol design

Skills are loaded on demand via SkillRegistry.load(skillId).

PluginRegistry

Manages design plugins and their layer types:

import { PluginRegistry } from '@genart-dev/core';

const registry = new PluginRegistry();
registry.register(typographyPlugin);

const layerType = registry.resolveLayerType('typography:text');

The registry provides:

  • Plugin registration and discovery
  • Layer type resolution by type ID
  • Property schema lookup for SchemaPropertyEditor
  • MCP tool registration for each plugin