Reference plugins for the portable cross-platform plugin runtime
(see the plugin system ADR in logseq/logseq, refactor/lui branch).
Every plugin here is a single-artifact QuickJS plugin: it runs in the
native desktop app today, and the same artifact is designed to run in
the web app (WASM runtime) and mobile without repackaging.
One directory per plugin, each self-contained:
<plugin>/
manifest.json — id, name, version, main, capabilities
main.ts — plugin source against the portable SDK surface
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, ... })).
The portable SDK lives in logseq/logseq libs/ (build:quickjs webpack
target). To build a plugin:
pnpm --dir <logseq>/libs run build:quickjs \
--env plugin=<this-repo>/<plugin>/main.ts \
--env output=<plugin>/main.mjs
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.
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>/.