@openawb/editor-core
v1.0.0
Published
AWB editable document model — commands, history, styles, motion, and compile helpers
Readme
@openawb/editor-core
Headless document engine for AWB: tree operations, commands, undo/redo, style resolution, motion/interaction helpers, and SEO compile utilities.
Shared TypeScript contracts (Page, BuilderNode, …) live in @openawb/types. This package provides the runtime functions that mutate and compile those documents.
Install
pnpm add @openawb/editor-core @openawb/typesImport rules
// Contracts — always from @openawb/types
import type { Page, BuilderNode, StyleProperties } from "@openawb/types";
// Runtime — from @openawb/editor-core
import {
createBlankPage,
applyCommand,
createHistory,
recordHistory,
flattenNodes,
toCss,
compileSiteMotionManifest,
} from "@openawb/editor-core";Avoid importing document types from @openawb/editor-core (they are no longer re-exported from the package root).
Capabilities
| Area | Examples |
| --- | --- |
| Document | createBlankPage, createSeedPage, createNode, flattenNodes |
| Commands / history | applyCommand, createHistory, recordHistory, popUndo |
| Styles | toCss, resolveStylesAtViewport, compilePageMediaCss, grid helpers |
| Motion | compileSiteMotionManifest, normalizePageMotion, GSAP catalogs |
| Interactions | parseNodeInteractions, event id helpers |
| SEO | buildPageHeadTags, resolvePageSeo (via @openawb/editor-core/seo/*) |
| Coordinates | preview viewport, iframe ↔ editor transforms |
Quick start
import type { Page } from "@openawb/types";
import { createBlankPage, applyCommand, createHistory, recordHistory } from "@openawb/editor-core";
let page: Page = createBlankPage({ name: "Home", slug: "index" });
let history = createHistory();
const result = applyCommand(page, {
type: "update-node",
nodeId: page.root.id,
patch: { /* ... */ },
});
if (result.ok) {
history = recordHistory(history, page, result.page);
page = result.page;
}Deep imports
Feature modules remain available for tree-shaking / clarity:
@openawb/editor-core/motion/compileMotionManifest@openawb/editor-core/events/compileInteractionManifest@openawb/editor-core/seo/pageHeadTags@openawb/editor-core/styles/*
Peer / dependencies
- Depends on:
@openawb/types - No React — safe for Node compilers and workers
Development
pnpm --filter @openawb/editor-core test
pnpm --filter @openawb/editor-core typecheck
pnpm --filter @openawb/editor-core buildSee Publishing.
