@rmc-toolkit/vue
v0.2.4
Published
Vue adapter for [Runtime Module Composition](https://runtime-module-composition.dev). Wraps the same resolve/import/mount/unmount lifecycle as `@rmc-toolkit/react` in a Vue composable. Takes your app's own already-resolved `Vue` instance rather than impor
Downloads
88
Readme
@rmc-toolkit/vue
Vue adapter for Runtime Module Composition. Wraps the same resolve/import/mount/unmount lifecycle as @rmc-toolkit/react in a Vue composable. Takes your app's own already-resolved Vue instance rather than importing one itself, so this package never bundles a second, conflicting copy of Vue.
Install
npm install @rmc-toolkit/vue @rmc-toolkit/core vueQuick example
// src/rmc-adapter.ts
import * as Vue from "vue";
import { createVueAdapter } from "@rmc-toolkit/vue";
export const { useRuntimeHost } = createVueAdapter(Vue);// App.vue (render-function form)
import { useRoute } from "vue-router";
import { useRuntimeHost } from "./rmc-adapter";
import { manifest } from "./runtime-composition.manifest";
export default {
setup() {
const route = useRoute();
const { target, status } = useRuntimeHost(() => route.fullPath, { manifest });
return { target, status };
},
template: `<main ref="target"></main>`,
};path is a getter (() => route.fullPath), not a plain value, so the adapter can watch it reactively and re-resolve on navigation.
What's in here
createVueAdapter(Vue)→{ useRuntimeHost }— a composable wrappingcreateRuntimeHostObservable's resolve/import/mount/unmount lifecycle, exposingtarget(a ref to bind to your mount element) andstatus(a reactive ref).
Full signature and behavior: API Reference.
Documentation
- Getting Started — install and wire up a host + slice end to end
- API Reference
- Technical Implementation — the architecture and failure modes behind the pattern
- Multi-Framework Demo — a full, runnable reference implementation, including a Vue slice
