API 参考 · Vue 编辑桥接
@oriatheme/vue-editor
为本地源码 ThemeEditor 提供 Vue provide、Composable 与自动预览协调;不导出可视 UI。包与运行环境
Vue 3.5 的客户端桥接;使用本地 CLI 安装的 ThemeEditor 作为可视根。
bash
pnpm add @oriatheme/editor-core @oriatheme/vue-editorbash
npm install @oriatheme/editor-core @oriatheme/vue-editorbash
yarn add @oriatheme/editor-core @oriatheme/vue-editorbash
bun add @oriatheme/editor-core @oriatheme/vue-editor选择使用方项目已有的一种包管理器和 lockfile;示例只使用 package root export,不要从 src、dist 或 registry template 深层导入。
Exports
| Export | Signature | Description |
|---|---|---|
provideThemeEditor | (options | session) => ThemeEditorSession | Provides a caller session or creates an owned session. |
useThemeEditor | () => { session, snapshot } | Exposes a readonly shallow editor snapshot ref. |
useThemeEditorAutoPreview | (runtime, mode?) => Readonly<ShallowRef<ThemeEditorAutoPreviewState>> | Coalesces valid revisions and preserves the last valid preview. |
re-exported editor-core types | ThemeEditorOptions, ThemeEditorSession, … | Convenience type/domain re-exports; behavior remains in editor-core. |
ts
import { provideThemeEditor, useThemeEditorAutoPreview } from "@oriatheme/vue-editor";
const session = provideThemeEditor(options);
const preview = useThemeEditorAutoPreview(runtime);可视 UI 位于你的项目
此包不导出完整编辑器或默认 CSS。使用 CLI 安装多文件 Vue 源码组件,并保留 editor-core/runtime 的草稿与原子预览边界。