@pptx-editor.dev/core
v0.9.1
Published
Framework-agnostic core for PPTX Editor: PresentationML parse and serialize, the canonical document tree, the property cascade, layout, paint, and the Editor contract the adapters render.
Downloads
22,727
Readme
@pptx-editor.dev/core
The PPTX Editor engine. It reads a .pptx into one document store, resolves PresentationML inheritance (master, layout, and slide), lays out slides without the DOM, paints them as SVG, applies edits as serializable ops, and saves the package.
Install
npm install @pptx-editor.dev/coreEntry points
| Entry | What it holds |
| --- | --- |
| @pptx-editor.dev/core/editor | createPptxEditor, the editor facade, commands, and the chrome registry |
| @pptx-editor.dev/core/store | Bounded OPC read and write, the canonical tree, ops, and the store |
| @pptx-editor.dev/core/cascade | Master, layout, and slide inheritance, theme colors and fonts |
| @pptx-editor.dev/core/layout | DOM-free geometry and text layout |
| @pptx-editor.dev/core/output | SVG paint |
| @pptx-editor.dev/core/contracts | Shared types |
| @pptx-editor.dev/core/styles/editor.css | Chrome tokens and styles |
Use
import { createPptxEditor } from '@pptx-editor.dev/core/editor';
const editor = createPptxEditor();
await editor.load(bytes);
editor.exec({ type: 'toggleBold' });
const saved = editor.save(); // Uint8Array, or null when no document is openFor a React UI, use @pptx-editor.dev/react.
Fonts
createPptxEditor({ fonts }) takes a FontConfiguration, a fragment, or a FontResolver, with the names and shapes of DOCX Editor's API: loadFonts, createFontSource, customFonts, composeFontConfiguration, defineFontResolver, and deferFonts. editor.setFonts() replaces the host faces in place, and onFontError receives each failure. Without fonts, the editor uses the deck's embedded fonts and the packaged substitutes, and makes no network request. See Fonts.
Bundlers
Vite, webpack, and Turbopack emit the text shaper's harfbuzz.wasm with no configuration. Bun and esbuild do not. With them, serve @pptx-editor.dev/core/harfbuzz.wasm as a static file, and set its URL before you create the first editor:
import { setHarfBuzzWasmUrl } from '@pptx-editor.dev/core/layout';
setHarfBuzzWasmUrl('/static/harfbuzz.wasm');License
Apache-2.0. See LICENSE. The bundled ECMA-376 preset shape geometry is used under the Ecma copyright notice, not Apache-2.0. Other third-party material keeps its own terms. See THIRD_PARTY_NOTICES.md.
