Reference plugins for the portable cross-platform plugin runtime
(see the plugin system ADR in logseq/logseq, refactor/lui branch).
Executable plugins here are single-artifact QuickJS plugins: they run in the
native desktop app today, and the same artifact is designed to run in
the web app (WASM runtime) and mobile without repackaging. Theme packages
are data-only token documents and never create a QuickJS runtime.
One directory per plugin, each self-contained:
<plugin>/
manifest.json — id, name, version, kind, entry points, capabilities
main.ts — executable plugin source against the portable SDK surface
theme.json — data-only token document for kind:"theme" packages
Plugins use only the portable logseq SDK surface (logseq.Editor,
logseq.DB, logseq.UI, logseq.Commands, logseq.Settings). No DOM,
no CSS injection, no iframe APIs.
Panels are reactive: create state with logseq.state(initial), bind a
panel once with logseq.UI.panel({ key, title }, view), and build trees
with the element constructors in ui (ui.column, ui.text,
ui.button, ...). Any state write re-runs the view and pushes the
update — there is no manual diffing, re-render call, or callback
management:
const count = logseq.state(0)
await logseq.UI.panel({ key: 'main', title: 'Demo' }, () =>
ui.column({ gap: 8 }, [
ui.text(`Pressed ${count.value}`),
ui.button({ label: 'inc', onPress: () => { count.value += 1 } }),
])
)Props accept state refs directly (ui.input({ value: name, ... })).
All plugins bundle with vite. The portable SDK lives in the logseq repo
(libs/src/LSPlugin.quickjs.ts); set LOGSEQ_LIBS to that directory
(default: a sibling logseq checkout). Once per clone:
npm install # root — provides vite to all plugins
Per plugin:
cd <plugin> && npx vite build # writes main.mjs in place
Installation in the native app: place manifest.json + the built
main.mjs in the plugin package directory, or install from a URL
serving both files.
hello-panel— exercises the full vertical slice: panel surface, declarative tree with live updates, editor command, settings schema with typed reads/writes.night-owl— data-only adaptive light/dark port of the reference Night Owl theme, expressed in the portable semantic token grammar.transparent— data-only glassmorphism port with scene, alpha-color and backdrop-material tokens.iawriter— data-only typography-centered port with bundled iA Writer font assets and license files.ai-assistant— OpenAI-compatible streaming chat over explicitly captured selected blocks or the current page, using the host-mediated network capability.
excalidraw/ and tldraw/ are webview-island plugins (see
2026-12-04-webview-island-plugins.md in logseq/logseq): self-contained
single-file HTML apps running in a sandboxed iframe/native webview,
talking to the host over the typed plugin protocol via
shared/logseq-webview-sdk.js. Both store scene files in the graph
assets/whiteboards/ directory and can embed logseq page/block cards
that navigate back into the host graph. Build with
./build-webview.sh, then copy */dist/ into the app's
static/plugins/<id>/.