vue-intlayer
Version:
Easily internationalize i18n your Vue applications with type-safe multilingual content management.
91 lines (90 loc) • 2.34 kB
JavaScript
import { getMarkdownMetadata as u, NodeType as o } from "@intlayer/core";
import { h as y } from "vue";
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs";
import "./editor/installIntlayerEditor.mjs";
import { useMarkdown as p } from "./markdown/installIntlayerMarkdown.mjs";
import { renderIntlayerNode as i } from "./renderIntlayerNode.mjs";
const b = {
id: "intlayer-node-plugin",
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
transform: (n, { children: t, ...r }) => i({
...r,
value: t,
children: () => y(
// EditorSelectorRenderer, // Maximum stack size exceeded
l,
{
dictionaryKey: r.dictionaryKey,
keyPath: r.keyPath
},
{
default: () => t
}
)
})
}, f = {
id: "markdown-string-plugin",
canHandle: (n) => typeof n == "string",
transform: (n, t, r) => {
const {
plugins: d,
// Removed to avoid next error - Functions cannot be passed directly to Client Components
...e
} = t, m = u(n), s = r(m, {
plugins: [{
id: "markdown-metadata-plugin",
canHandle: (a) => typeof a == "string" || typeof a == "number" || typeof a == "boolean" || !a,
transform: (a, c) => i({
...c,
value: a,
children: n
})
}],
dictionaryKey: e.dictionaryKey,
keyPath: []
});
return i({
...t,
value: n,
children: () => y(
// EditorSelectorRenderer, // Maximum stack size exceeded
l,
{
dictionaryKey: e.dictionaryKey,
keyPath: e.keyPath
},
{
default: () => {
const { renderMarkdown: a } = p();
return a(n);
}
}
),
additionalProps: {
metadata: s
}
});
}
}, H = {
id: "markdown-plugin",
canHandle: (n) => typeof n == "object" && n?.nodeType === o.Markdown,
transform: (n, t, r) => {
const d = [
...t.keyPath,
{
type: o.Markdown
}
], e = n[o.Markdown];
return r(e, {
...t,
children: e,
keyPath: d,
plugins: [f, ...t.plugins ?? []]
});
}
};
export {
b as intlayerNodePlugins,
H as markdownPlugin,
f as markdownStringPlugin
};