2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-08 17:22:26 +03:00
Files
bbob/packages/bbob-vue2/src/Component.ts
T
Long Nguyen 0edd490a24 fix: proper module resolution in all cases (Node CJS, Node ESM, bundler)
* Add extensions to all imports

* Set module resolution to `bundler` to avoid Node specific behavior

* Use `ts2mjs` to rename files to `mjs`

* Add extensions to `@bbob/types` imports

* Fix `package.json` for proper ESM extension and type separation

* More module resolution stuff change (`node16` for everything, `node` for Vue 2 plugin)

* Use `ts-jest-resolver` for `js` -> `ts` resolving in Jest

* Add changeset

* Add import extensions to frontend libs
2025-08-18 19:13:22 +02:00

41 lines
816 B
TypeScript

import { defineComponent } from 'vue';
import type { BBobCoreOptions, BBobPlugins } from '@bbob/types';
import { render } from './render.js';
export type BBobVueComponentProps = {
container: string
plugins?: BBobPlugins
options?: BBobCoreOptions
}
const Component = defineComponent<BBobVueComponentProps>({
props: {
container: {
type: String,
default: 'span',
},
plugins: {
type: Array,
},
options: {
type: Object,
},
},
render(createElement) {
if (this.$slots.default) {
const source = this.$slots.default.reduce((acc, vnode) => acc + vnode.text, '');
return createElement(
this.container,
render(createElement, source, this.plugins, this.options),
);
}
return null;
},
});
export default Component;