@doxi/core
v0.11.0
Published
Doxiva core: engine, model, view, plugins.
Maintainers
Readme
@doxi/core
The Doxiva editor engine: schema, transactions, state, view, plugins, commands, layout, and styles. Zero runtime dependencies.
Status: v0.10.x preview. The v0.9.x public API surface is the candidate for the v1.0 freeze — see
STABILITY.md.
Install
pnpm add @doxi/coreQuickstart (vanilla DOM)
import {
defaultSchema,
defaultRenderer,
EditorState,
EditorView,
historyPlugin,
} from '@doxi/core'
import '@doxi/core/styles/base.css'
import '@doxi/core/styles/light.css'
const state = EditorState.create({
schema: defaultSchema,
plugins: [historyPlugin().plugin],
})
const view = new EditorView({
mount: document.getElementById('editor')!,
state,
renderer: defaultRenderer,
ariaLabel: 'Document editor',
})
// Dispatch a transaction
view.dispatch(view.state.tr.insertText('Hello, world.'))Subpath exports
@doxi/core exposes layered subpaths so consumers can import only what they need:
| Subpath | What's there |
|---|---|
| @doxi/core | Top-level re-exports of the most common API |
| @doxi/core/model | Schema, nodes, marks, positions, fragments |
| @doxi/core/transform | Transform steps (ReplaceStep, AttrStep, SetPageMetaStep, …) |
| @doxi/core/state | EditorState, Selection, TextSelection, NodeSelection, CellSelection |
| @doxi/core/plugin | Plugin API and built-ins |
| @doxi/core/history | Undo/redo plugin |
| @doxi/core/commands | Headless commands (text, lists, tables, images, links, page break, …) |
| @doxi/core/view | EditorView, input pipeline, decorations, printDocument, setPrintPageSize |
| @doxi/core/layout | Paginator, page boxes, header/footer slot controller |
| @doxi/core/schema | defaultSchema and its node/mark definitions |
| @doxi/core/serialize | JSON ↔ document tree |
| @doxi/core/html | HTML ↔ document tree with paste sanitization |
| @doxi/core/collab | Collaboration port (used by @doxi/collab) |
Stylesheets
CSS lives under @doxi/core/styles/. Import the ones you need:
import '@doxi/core/styles/base.css' // structural styles (required)
import '@doxi/core/styles/light.css' // light theme
import '@doxi/core/styles/dark.css' // dark theme
import '@doxi/core/styles/page.css' // paginated mode chrome
import '@doxi/core/styles/print.css' // @media print
import '@doxi/core/styles/print-a4.css' // optional A4 @page sizeBundle size
Tracked per release in docs/bundle-budget.md. Run pnpm bundle-size from the repo root.
