Reference
Integration options
Everything visualEditor() accepts, the optional parts it can add, and the package's exports.
visualEditor({
config: './src/visual-editor.config.ts', // the defaults
server: './src/visual-editor.server.ts',
siteTools: {
design: './src/lib/design-tokens.ts', // the website design editor
brand: './src/lib/brand.ts', // CMS styling (needs design)
siteSettings: 'site', // Navigation & footer preview
},
cmsModules: ['./src/cms/my-module.ts'],
accounts: false,
service: false,
})
Everything optional is off unless you turn it on. A site with visualEditor() alone gets the visual editor and its preview, and none of the optional code in its /admin.
| Option | What it adds |
|---|---|
config, server |
Other paths for the two site config files. |
siteTools.design |
Website design: a design-token editor with the real site as the preview. See Design tokens. |
siteTools.brand |
CMS styling: the CMS’s name, logo, sign-in text and theme. Needs design. |
siteTools.siteSettings |
The name of a collection or file. Sveltia’s preview pane for it shows the home page with the unsaved navigation and footer. |
cmsModules |
Your own additions to /admin (below). |
accounts |
The package’s own file backend, for sites without Git: email sign-in, accounts and roles, saving as files, publishing, and tools for AI assistants. It will become its own package, @vamped/accounts. Leave it off when Sveltia’s backend signs people in. |
service |
Build the preview service as a standalone Node server (needs @astrojs/node), for editing on a deployed site. See Deployment. |
CMS modules
A CMS module is a file that default-exports defineCmsModule({...}) from @vamped/editor/cms. Each of its parts is optional:
// src/cms/my-module.ts
import { defineCmsModule } from '@vamped/editor/cms';
export default defineCmsModule({
name: 'my-module',
// Before Sveltia loads. Don't import anything that loads Sveltia here.
prepare: async (ctx) => {},
// The CMS's name on its tab and sign-in screen. The last module that names it wins.
identity: () => ({ name: 'Night Shift CMS' }),
// Add to the configuration Sveltia starts with.
config: (config) => ({ ...config }),
// Once Sveltia is loaded: register field types, preview templates and the like.
register: async () => ({
default: (CMS, ctx) => {
// CMS.registerPreviewTemplate('posts', PostPreview);
},
}),
});
ctx tells a module whether accounts is on, and lets prepare set light or dark for everyone with ctx.setColorScheme('dark').
Exports
| Import | What it is |
|---|---|
@vamped/editor, @vamped/editor/astro |
The Astro integration (default export). |
@vamped/editor/blocks |
defineBlock, createRegistry, defineVisualEditorConfig, the field types, shared schemas (linkSchema, imageSchema, colorSchema, markdownSchema), renderMarkdown, and the page file format (stringifyPage, parsePage). |
@vamped/editor/cms |
defineCmsModule and its types. Also registerVisualEditor(CMS), for a site that starts Sveltia itself; the integration does this for you. |
Limits
- The page collection must be named
pages. - The site must be served from the root (
base: '/'). - The live preview needs the preview service:
astro dev, or the standalone service. - Astro is the only supported framework, and Node.js 22.23.4 or later is required.