Extension points
Custom components, registries, formatters and the library port. Advanced topics in the DocStudio developer reference.
DocStudio is extended through values you pass in, not through global registration.
Custom components
A component definition has a type name, a category (leaf, container or data), the names of its child slots and optional schema and resolve facets. Register it in a registry and pass the registry to validation, compile and the designer. A server render never imports editor code, so the facets are separate: schema and resolve in core, HTML in render, editor in the designer. Custom host components are trusted code that runs in your trust domain.
See Registry, reusable components, formatters and migrations and Registry and formatters.
Formatters
Add a function with registerFormatter. A formatter must be total: return undefined for input it cannot format. A throwing formatter becomes a diagnostic.
Validators
validateTemplate accepts a SchemaValidator through the validator option. The default uses @cfworker/json-schema. A host that permits code generation can inject a faster validator.
Component library
The designer talks to a ComponentLibrary port with list, get and publish. createMemoryLibrary is the reference implementation. Back it with your own storage and cache.
Storage ports
TemplateStore, ComponentStorage and AssetStore are the three storage ports. Adapters must pass the conformance suite used for the built-in adapters.
Host callbacks
The designer calls onChange, onSampleDataChange and onPublish, and accepts messages, locks, formatterDescriptors, catalog and migrations.
Not extension points
The expression function set is closed and the template schema cannot be extended with new properties.