# Recent activity (/activity) **In short:** the most recent commits across all paged repositories, interleaved into one timeline. It is pulled from GitHub when this site is built — nightly, when the deploy succeeds — so it shows where the system stood at the last deploy, and the date below says when that was. It is a record of commits, not a hand-kept changelog. # Architecture (/architecture) **In short:** one **Rust render engine** reads and renders IDML. Everything else consumes it across its wasm interface: the **editor** (full editing) and the **viewer** (read-only) use its wasm; the **server** syncs and shares the editor's documents; the **content plugins** add new kinds of content; and a **capability registry** tracks what works across all of it. All of these but the registry live in one repository, [`paged-media/paged`](/docs/paged/repos). ## The render pipeline [#the-render-pipeline] The engine ([core](/docs/paged/repos/core)) turns an IDML package into pixels through a fixed pipeline: ``` IDML parse → scene → text layout → compose → GPU/CPU raster ``` Parse reads the ZIP + XML into a model; scene resolves spreads, frames, and story threading; text layout sets the lines with an InDesign-calibrated Knuth–Plass composer; compose emits a display list; and the raster stage turns that list into pixels, on the CPU or on the GPU, from one rendering model. The CPU lane, `vello_cpu`, is the default: the command line, CPU snapshots and the fidelity gate draw with it. The GPU lane, Vello on **WebGPU**, draws the viewer and the live preview in the browser. The [renderer reference](/docs/paged/engine/the-renderer) covers this in depth. ## Who consumes the engine [#who-consumes-the-engine] The engine's wasm packages are built in the monorepo, and its components build against them at the same revision; outside it, the engine ships as the npm packages `@paged-media/paged` (the engine and the `paged` command) and `@paged-media/viewer` (the read-only viewer). None of its consumers reaches into the engine's Rust source: * **[Editor](/docs/paged/repos/editor)** (`apps/editor`) — the app: full canvas, mutation, gestures, panels, and the `paged.*` [scripting](/docs/paged/scripting) layer, running the engine in a Web Worker on an `OffscreenCanvas`. * **[Viewer](/docs/paged/repos/viewer)** (`engine/core/web/idml-viewer`) — a slim, read-only WebGPU viewer (renderer-core only). It's both the community viewer and the docs live preview. * **[paged.server](/docs/paged/repos/editor-server)** (`apps/server`) — the optional remote: sync and sharing of document repositories, an MCP endpoint, and a relay to an open editor tab. It replaces the earlier editor-server. ## Extending the system [#extending-the-system] Content beyond IDML's native constructs comes from **[plugins](/docs/paged/plugins)** — vector drawing, web (HTML/CSS), raster images, spreadsheets, database publishing, Word, presentations, IDML and PDF — built on the **[Plugin SDK](/docs/paged/plugin-sdk)** contract (`platform/extensions`). The first-party ones are the monorepo's built-in modules (`modules/*`). ## Keeping everyone honest [#keeping-everyone-honest] The **[capability registry](/docs/paged/state)** holds one row per capability with a per-layer status and a test-evidence overlay. Every component's tests publish against it; this documentation reads from it. That's why the support badges throughout the [IDML reference](/docs/idml/overview) are live, not hand-kept. ## The repositories [#the-repositories] See **[Repositories](/docs/paged/repos)** for where each component lives, and **[How it's tested](/docs/paged/testing)** for the verification system. # Live demos (/demos) **In short:** these aren't screencasts or recordings — each one is **the actual editor**, embedded live and driven by a paged script. Press play and the script runs the real app: opening panels, drawing and filling frames, narrating each step. You can pause, single-step, scrub by chapter, change speed, and read (or edit) the very script that's driving it. ## How it works [#how-it-works] Every demo is a script over paged's own automation surface — `paged.*` for the document, `editor.*` for the UI, `demo.*` to narrate and pace. The [playground](https://play.paged.media) runs that script against the real editor and shows the source alongside; this page embeds it in an ` ``` ```ts import { connectEditor } from './embed/connect'; // the host's copy const iframe = document.getElementById('editor') as HTMLIFrameElement; const editor = await connectEditor(iframe, { profile: { extends: 'template-fill', regions: { 'actions-bar': { items: [{ kind: 'spacer' }, 'paged.host.submit'] } }, }, locale: 'de', actions: { save: async ({ bytes, name }) => upload(name, bytes), submit: async () => finish(await editor.getFieldValues()), }, }); await editor.load({ bytes: templateBytes, name: 'card.paged' }); await editor.setRole('filler'); await editor.setFieldValues({ name: 'Mary Example' }); editor.on((e) => { if (e.type === 'fieldChange') renderSummary(e.fields); }); ``` ### `ConnectConfig` [#connectconfig] Everything of `createEditor`'s [config](/docs/paged/embedding/create-editor#editorconfig) that is data — `profile`, `role`, `document`, `seed`, `sample`, `values`, `locale`, `messages`, `assetBase` — plus: | Field | Meaning | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `actions` | The host actions, as functions on the host page. The frame learns only their names; when the user saves or presses submit, the frame asks the host page, which runs the function and answers. | | `origin` | The frame's origin; by default the origin of the iframe's `src`. | | `timeout` | How long to wait for the frame to become ready, in milliseconds (default 60 000). | ### The remote handle [#the-remote-handle] Over the frame, the handle has the methods whose arguments and answers are data: `load`, `newDocument`, `save`, `exportPdf`, `fields`, `getFieldValues`, `setFieldValues`, `setRole` and `setTheme`, each returning a promise, and `on` and `dispose`. The members that are live objects in the frame — `features`, `hostSlot` and `client` — are not reachable from the host page. Bytes (a document, a saved `.paged`, a PDF) travel as transferred `ArrayBuffer`s, not copies. `dispose()` stops listening and rejects pending calls; removing the iframe releases the editor. ## Cross-origin isolation [#cross-origin-isolation] The editor's engine needs a cross-origin-isolated page, and a frame is isolated only when its top page is. The host page sends: ```text Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embedder-Policy: credentialless ``` `credentialless`, unlike `require-corp`, asks nothing of the host page's other resources. The iframe needs `allow="cross-origin-isolated"`; `connectEditor` adds it when it is missing, which takes effect only if the frame has not loaded yet, so put it in the markup or call `connectEditor` before the iframe loads. A frame that is not isolated answers the host's first message with a failure that names these headers, and `connectEditor` rejects with it. ## Who may frame the editor [#who-may-frame-the-editor] Which pages may embed `embed.html` is fixed when the editor is built and deployed: * `VITE_EMBED_ORIGINS` (comma-separated `https` origins) at build time lists them, beside the editor's own origin; * the build writes the same list into `embed.html`'s `Content-Security-Policy: frame-ancestors`, so a browser refuses to frame it anywhere else; * the frame checks every message's origin against the list, and the first host to initialise it fixes the origin every later message must come from. A message from another origin is ignored. The [playground](https://play.paged.media)'s `embed.html` can be framed only by the playground itself (its own demos). To embed the editor in your product, build and serve it with your origins in `VITE_EMBED_ORIGINS`. ## The messages [#the-messages] The bridge is plain `postMessage`; `connectEditor` speaks it for you. | Message | Direction | Meaning | | ------------------------------------- | -------------------- | ------------------------------------------------------- | | `paged:loaded` | frame → host | The frame listens; the host may initialise it. | | `paged:init` | host → frame | The config, with the names of the host's actions. | | `paged:ready` / `paged:failed` | frame → host | The editor is up, or why it is not. | | `paged:call` / `paged:reply` | host → frame → host | A handle method and its answer, by call id. | | `paged:event` | frame → host | A handle event (`ready`, `change`, `fieldChange`). | | `paged:action` / `paged:action-reply` | frame → host → frame | A host action the frame needs (save carries the bytes). | In development and demo builds of the editor, the handle `connectEditor` returns also has `runScript(source)`, which runs a [`paged.*` script](/docs/paged/scripting) in the frame and resolves to `{ output, error }`. A production build refuses it ("scripts run in dev and demo builds only"), and the in-page `createEditor` handle has no such method. A live example is the iframe demo of the [demo gallery](https://play.paged.media/demos/). ## Related [#related] * On paged.media: [the embeddable editor](https://paged.media/embeddable-editor/). # Embedding the editor (/embedding) **One editor, many shapes, chosen by the product that embeds it.** **In short:** the paged editor can be composed. A product that embeds it — a web-to-print shop, a marketing tool, an asset manager, any app with a "design this" button — decides which bundles load, which parts of the chrome exist and what each holds (a **profile**), which single commands, panels and tools are offered (**features**), and who the session is (a **role**: author, editor, filler or viewer). Roles are enforced by the engine against the document's [template policy](/docs/paged/templates); profiles and features shape only the UI. ## The shapes [#the-shapes] | Shape | What the end user sees | How | | ----------- | ------------------------------------------------------------------------------ | ----------------------------------------- | | **Full** | The whole editor. | the `full` preset | | **Focused** | One module's application: a drawing program, a word processor, a sheet. | the `solo:` presets | | **Fill in** | A template with its open fields and a form beside it; nothing else can change. | the `template-fill` preset, role `filler` | | **View** | The pages, with pan and zoom; nothing can change. | the `viewer` preset, role `viewer` | All four are the same application and the same document model. A preset is a named profile; a host can extend one and adjust it entry by entry. ## The three layers [#the-three-layers] 1. **[Profiles and presets](/docs/paged/embedding/profiles-and-presets)** — what the editor *registers*: bundles, host panels, modes, and the regions of the chrome with their ordered contents. Data, resolved once at start. 2. **[Features](/docs/paged/embedding/features)** — what the editor *offers* while it runs: switch a command, panel, tool, menu path, keybinding or piece of canvas furniture off and on, by id, glob or predicate. Not a security boundary. 3. **Roles and the template policy** — what may *happen to the document*. Checked by the engine for every caller — UI, script, plugin or automation surface. See [Permissions and roles](/docs/paged/templates/permissions-and-roles). A host mounts the editor and drives it through a handle: [mountEditor and createEditor](/docs/paged/embedding/create-editor), or, from another origin, [the editor in an iframe](/docs/paged/embedding/iframe) with `connectEditor`. The host also chooses the editor's look ([Theming](/docs/paged/embedding/theming)) and its language ([Languages](/docs/paged/embedding/languages)). ## What ships and what is planned [#what-ships-and-what-is-planned] Available in the editor (in `apps/editor` of the public [`paged-media/paged`](https://github.com/paged-media/paged) repository): * editor profiles, the presets `full`, `solo:`, `template-fill` and `viewer`, and `?profile=` / `?solo=` in the editor's URL; * every chrome region optional, region contents as ordered lists, open mode ids, and host slots (`{ kind: "host", id }`) the host renders its own component into; * the feature store and the generated feature-id inventory; * the session role, the template form (module fields included), field outlines on the canvas, typed refusals, and the author's [Template panel](/docs/paged/templates#making-a-template) with preview as filler; * `mountEditor` with host actions (save, submit, close, back), and the `createEditor` handle over it, with `setTheme` and a `locale`; * the iframe page (`embed.html`) and `connectEditor`, the same handle across an `