Docs Plugin (@lapis-notes/docs)
Source: packages/plugins/plugin-docs/src/
Manifest: id lapis-docs, version 0.1.0, min app version 0.20.0.
The docs package owns Univer-backed editing for native .lapisdoc and
.lapissheet files. It ships as the official installable lapis-docs registry
plugin instead of through the bundled workspace bootstrap.
Runtime Surface
- View types:
docs-document,docs-sheet. - Extensions:
.lapisdoc,.lapissheet. - Commands:
lapis-docs:create-document,lapis-docs:create-sheet. - Package exports: plugin runtime entry at
@lapis-notes/docs, app stylesheet at@lapis-notes/docs/app.css, and standalone stylesheet artifact at@lapis-notes/docs/styles.css. - Official registry entry:
lapis-docsin the lockedlapis-officialsource, advertising.lapisdocand.lapissheeteditor-view contributions.
File Format
Both native file types store plain JSON wrappers in the vault:
{
"kind": "univer-doc | univer-sheet",
"version": 1,
"snapshot": {},
"meta": {}
}
kindselects the matching Univer runtime and view.versiongates future migrations.snapshotpreserves Univer-owned document or workbook state without normalizing its schema inside Lapis.metais optional provenance space for future import/export workflows.
Key Behaviors
- Registers dedicated editor views for
.lapisdocand.lapissheetafter the officiallapis-docsplugin is installed and enabled. Before installation, the workspace on-demand install prompt can offerInstall and openfrom the signed official registry contribution summary. - Parses native snapshot wrappers, rejects malformed JSON and wrong file kinds, and shows explicit in-view error states instead of falling back to raw text.
- Bootstraps Univer Docs and Sheets lazily through the documented
@univerjs/presetscreateUniver()entry point, with directly composed OSS Univer plugin lists for each editor type. The runtime keeps preset CSS and locale assets but avoids preset JS facade side effects that register sheet-only observers against document sessions. - Waits for the mounted editor pane to have usable dimensions before creating Univer, so sheets do not initialize against zero-width panes.
- Keeps the Univer runtime lazy-loaded, but browser builds must still load the
runtime dependency shim before Univer so
async-lock, React, and related CommonJS dependencies initialize without ESM interop failures. - Mirrors the app light/dark state into Univer and bridges app theme tokens into the embedded surface so sheet borders, buttons, and other chrome remain visible under the workspace design system.
- Persists snapshot changes back to the vault as debounced JSON writes and surfaces save failures with reload and retry actions.
- Creates new native document and sheet files at the vault root through plugin-scoped commands.
- Seeds the demo vault with representative
.lapisdocand.lapissheetfixtures that render visible document and sheet content for smoke verification and workspace e2e coverage. - Workspace e2e coverage verifies editor readiness and rendered Univer output, not only shell mount, and fails on unexpected page errors or console warnings/errors from the docs runtime.
Deferred Scope
.lapisslideis reserved conceptually but not registered because Univer Slides is still outside the repo’s production-ready target..xlsx,.docx,.pptx,.csv, and.tsvremain out of scope for this plugin. CSV/TSV stays with the CSV plugin, and Office exchange work remains a future server-backed follow-up.- Existing vaults that have data under the old bundled
docsID are migrated by the workspace startup path by copying that data tolapis-docswhen the new target ID has no data yet. The sourcedocsdata is preserved during this release.
CSS Ownership
The package ships a standalone stylesheet artifact that combines Univer preset
CSS with package-local shell styling. Registry installation stores that
styles.css artifact under /.obsidian/plugins/lapis-docs/, and the plugin
manager injects it when the installed plugin is enabled. Package selectors stay
under the docs-view__ namespace and follow the shared
Plugin CSS Contract.