GlyphfieldDocs
Documentation/System reference

Editor systems and plugins

Reuse the stateful color, canvas, source, layer, select, material, and persistence primitives that keep Studio tools consistent.

Maintained with source

Glyphfield tools are composed from shared editor systems. A generator should not invent its own color field, zoom bar, layer behavior, select menu, or draft-storage scheme. Reusing these components keeps interaction state, accessibility, and exports consistent across the Studio.

Design Lab showing shared library, canvas viewport, inspector, and layer dock systems
Layered editor systemsSelection · zoom · source · persistence
Brand Elements showing identity-aware artifact controls
Identity-aware systemsShared assets · color · output

Component map

ComponentResponsibilityState ownerReused by
ColorControlNative swatch, HEX, OKLCH, and optional opacityParent owns color; component validates and converts editsBrand identity, Color tokens, Animation, Design Lab, Brand elements, finishes
CanvasViewportZoom, reset, fit, clipping, pan, and scrollable stagePersists view state per project and toolMoodboards, Brand elements, OpenGraph, templates, Design Lab
EditableCanvasLayerSelection, drag, resize, keyboard nudge, and selection handlesParent owns the transform; component owns the active pointer sessionSlide, partnership, blog, and expression canvases
CanvasLayerPanelLayer selection, order, alignment, disabled actions, and resetControlled by the host tool; emits semantic layer operationsTemplate and slide systems, ready for any layered generator
SourceCodeDrawerRight-side source editing, validation feedback, apply, reset, and closeHost supplies the current serialized source and an apply functionIdentity, boards, motion, surfaces, templates, foundations, and components
sourceCode helpersParse JSON objects and read constrained strings, numbers, booleans, arrays, and nested objectsStateless validation helpersEvery source-enabled Studio tool
canvasDocumentVersioned pages, elements, constraints, resources, history, checkpoints, and export preflightImmutable scene graph and command historyMigration target for every editable artifact and agent operation
StudioSelectConsistent select trigger, popover, keyboard navigation, and value changesControlled valueFonts, assets, materials, layouts, sizes, languages, presets
MaterialFinishControlsReflection, shadow, border, glass, and finish presetsControlled finish objectAnimation and logo-material surfaces
LogoAppearanceControlsInversion, ordered dither, alpha-aware SVG outline, shadow color, blur, opacity, and offsetsControlled logo appearance objectDesign Lab, OpenGraph, and Brand elements
useStudioDraftProject-and-tool-scoped browser persistencelocalStorage through one shared hookTool fields, zoom, layers, surfaces, layout, and export settings
usePortableCanvasWorkspaceCanvas serialization and exact autosave lifecycleCanvasDocument plus IndexedDB/recovery adapterDesign Lab and portable layered workspaces
studioAutomationAccessible controls, source round trips, tool actions, and Blob downloadActive tool adapterEvery navigable Studio tool

Color control

ColorControl is one component with optional capabilities rather than separate pickers for every tool.

States

StateBehavior
RestingShows the current swatch, normalized HEX, and equivalent OKLCH value
Native picker openUses the browser color input and publishes the selected HEX value immediately
HEX editingCommits on blur or Enter; invalid input leaves the current color unchanged
OKLCH editingParses perceptual color input and converts it to the shared HEX storage format
With opacityAdds a zero-to-100-percent range while keeping color and opacity independently controlled

The conversion functions live in src/lib/color.ts, so the inspector, generated token CSS, and exported graphics use the same normalization rules.

Canvas viewport

CanvasViewport wraps the artifact without changing its intrinsic aspect ratio. The stage scales visually; the export still uses the artifact's declared pixel dimensions.

States

  • Default — 100-percent zoom with the artifact centered in a scrollable stage.
  • Zoomed out — down to 40 percent for complete-board inspection.
  • Zoomed in — up to 200 percent for alignment and edge inspection.
  • Reset — selecting the percentage restores 100 percent.
  • Fit — restores the stable whole-canvas view.
  • Persisted — zoom is stored independently for each brand project and Studio tool.

The shared viewport also supports wheel/trackpad zoom, drag-to-pan on empty workspace, and an explicit original-view reset. These gestures change only the view transform; the artifact document and export geometry remain unchanged.

Source code drawer

SourceCodeDrawer keeps exact source editing adjacent to the canvas instead of moving users into a separate editor route. The component is intentionally controlled:

  • source is the host tool's current serialized document.
  • onApply parses and validates edits, then updates the host state.
  • Apply errors appear inside the drawer and do not replace the visual document.
  • Reset reloads the current visual snapshot.
  • Closing the drawer preserves the active tool and canvas position.

The drawer is a shared interaction shell, not a universal schema. Each tool owns its field constraints and converts valid source into the same state used by its visual controls. Raw Lottie JSON remains a Lottie document; material configuration can carry custom GLSL; template and component drawers expose their own configuration objects.

See Source code editing, Source format reference, and Studio Browser API.

Layers and direct manipulation

EditableCanvasLayer renders the object on the artifact. CanvasLayerPanel renders the corresponding inspector controls. They read and write the same CanvasLayerTransform, so the canvas and inspector never maintain competing position data.

Layer states

StateCanvasInspector
IdleNo selection box or handlesAlignment and reset are disabled
SelectedSelection outline, label, and resize handleActive row and current scale are visible
MovingPointer capture updates X and Y in canvas coordinatesThe same transform remains the source of truth
ResizingCorner drag updates scale from 0.2× to 3×Scale percentage updates immediately
KeyboardArrow keys nudge one pixel; Shift + arrow nudges tenSelection remains active
ReorderedZ-index follows the layer orderForward/backward controls disable at stack boundaries
AlignedLeft, center, right, top, middle, or bottom resolves from artifact geometryOne alignment action updates the selected transform
ResetReturns to the generator's default transformRow returns to 100 percent

Nothing is selected automatically. Selection begins only from the layer list or the canvas, matching presentation-editor behavior.

Versioned scene graph

src/lib/canvasDocument.ts defines the portable document model shared by people and agents. It is separate from React component state and records:

  • Document schema version, brand binding, capabilities, and revision.
  • Pages with dimensions, safe area, bleed, background, notes, and ordered layers.
  • Text, image, logo, shape, frame, gradient, texture, shader, video, and reusable-component elements.
  • Bounds, rotation, responsive anchors, position/dimension/aspect/rotation locks, visibility, blend mode, border, radius, opacity, and shadow.
  • Brand font bindings and text roles.
  • Non-destructive image crop, focal point, fit, saturation, dither, grain, blur, posterization, and halation.
  • Asset and font references rather than browser-only paths hidden inside component state.

The shared mutation layer currently supports grouped movement, resizing, locking, deletion, direct layer ordering, element updates, and asset replacement. Asset replacement changes only the source reference, preserving geometry, crop, image treatment, effects, and constraints.

History and preflight

commitCanvasChange accepts one mutation or a batch. A batch produces one undo checkpoint, so distribute, align, or multi-select moves reverse as a single action. undoCanvasChange and redoCanvasChange restore cloned documents rather than reconstructing UI state.

Named versions store author, time, note, thumbnail-ready document state, and revision. Restoring a version returns the same scene graph without sharing mutable references.

Export preflight reports:

  • Missing asset records.
  • Missing font files.
  • Elements clipped beyond their page.
  • Text exceeding a declared maximum line count.

Direct-manipulation components adapt tool state to this model. Design Lab already serializes the portable scene graph for source, saved designs, autosave, recovery, and agent round trips; other editors can migrate incrementally while preserving their public formats.

Logo appearance

LogoAppearanceControls and src/lib/logoAppearance.ts keep logo treatment consistent across every generator. Preview filters, SVG export filters, and Canvas exports resolve from the same values.

  • Invert reverses the current resolved mark without requiring a second uploaded asset.
  • Dither applies a non-destructive ordered print field with editable amount, cell size, and direction.
  • Outline follows the alpha of the SVG or transparent image instead of drawing a box around its bounds.
  • Shadow exposes color, opacity, blur, and X/Y offset.
  • Custom color always uses ColorControl, so HEX and OKLCH stay interchangeable.

These settings are stored per brand and tool. Brand elements apply the same appearance to every logo instance in the selected application.

Shared plugin and provider layer

Third-party packages sit behind local components so individual Studio tools do not need to know each library's API.

ProviderLocal boundaryUsed for
Radix SelectStudioSelectAccessible popovers, keyboard navigation, focus management
Radix SlotButtonPolymorphic actions and links with one visual system
Three.js + React Three FiberLiveMaterialCanvasLive GPU materials and shader rendering
@shadergradient/reactLive-material adapterEditable ShaderGradient sphere presets
@paper-design/shaders-reactLiveMaterialCanvas Paper adapter29 Paper shader families and 120 licensed presets in the shared gallery
PavelDoGreat WebGL Fluid SimulationLocal fluid adapterMIT-licensed GPU advection model used by Fluid Energy
gifencGIF export pipelineDeterministic browser GIF encoding and palette control
mediabunnyBrowser video/audio muxingMP4 export and Animation audio mixing
@lottiefiles/dotlottie-webAnimation source adapterLocal .lottie and Lottie JSON playback and exact frame seeking
PrismJSCode-highlighting adapterTypeScript, Python, Bash, JSON, and shell token color
LucideComponent-local iconsConsistent semantic control icons
gt-next<T> and useGTTranslatable Studio labels and accessible names
FumadocsDocs shell and MDX sourceThis documentation system, search, navigation, and generated pages

GSAP and Lenis are reserved for the marketing experience; editor manipulation uses pointer events and deterministic transforms so canvas behavior stays direct and exportable.

Building another generator

  1. Store tool fields with useStudioDraft(identity.id, tool.id, field, initialValue).
  2. Use ColorControl for all editable colors and opacity.
  3. Wrap the artifact in CanvasViewport and preserve its declared aspect ratio.
  4. Represent every movable object with a CanvasLayerTransform.
  5. Pair EditableCanvasLayer with CanvasLayerPanel when an artifact has multiple selectable objects.
  6. Use StudioSelect, shared buttons, upload fields, and range controls instead of native one-off styling.
  7. Build exports from the same resolved settings that drive the preview.
  8. Serialize the editable state and mount SourceCodeDrawer so advanced edits round-trip through the same validators and state setters.

This boundary keeps a new tool visually native to Glyphfield while leaving its artifact renderer free to be SVG, Canvas, HTML, or WebGL.

On this page