vue-intlayer 8.6.0 → 8.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/plugins.mjs +37 -37
- package/package.json +7 -7
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`../ContentSelector-BbioElre.js`),n=require(`./html/HTMLRenderer.cjs`),r=require(`./markdown/installIntlayerMarkdown.cjs`),i=require(`./renderIntlayerNode.cjs`);let a=require(`@intlayer/core/interpreter`),o=require(`@intlayer/config/built`);o=e.t(o);let s=require(`@intlayer/core/markdown`),c=require(`@intlayer/types/nodeType`);c=e.t(c);let l=require(`vue`);var u={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:n,...r})=>{let a=e=>i.renderIntlayerNode({...r,value:e,children:o.default.editor.enabled?()=>(0,l.h)(t.t,{dictionaryKey:r.dictionaryKey,keyPath:r.keyPath},{default:()=>typeof e==`function`?e():e}):e}),s=a(n);if(typeof n!=`function`)return s;let c=(...e)=>a(n(...e));Object.setPrototypeOf(c,Object.getPrototypeOf(s));for(let e of Object.getOwnPropertyNames(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(c,e,t)}for(let e of Object.getOwnPropertySymbols(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(c,e,t)}return(0,l.markRaw)(c)}},d=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,a.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,l.h)(l.Fragment,null,...e)}else return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,l.h)(l.Fragment,null,...e)}return i.isSimple?i.parts:(0,l.h)(l.Fragment,null,i.parts)},f={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.INSERTION}],i=e[c.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=d(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}},p={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,a)=>{let{plugins:o,...c}=n,u=a((0,s.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>i.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),d=a=>i.renderIntlayerNode({...n,value:e,children:()=>(0,l.h)(t.t,{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath},{default:()=>{let{renderMarkdown:t,components:n}=r.useMarkdown();return t(e,void 0,{...n??{},...a??{}})}}),additionalProps:{metadata:u,use:e=>d(e)}});return d()}},m={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.MARKDOWN}],i=e[c.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[p,...t.plugins??[]]})}},h={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.HTML,transform:(e,t)=>{let r=e[c.HTML];e.tags;let a=(e={})=>{let o=n.renderHTML(r,{components:e});return i.renderIntlayerNode({...t,value:r,children:o,additionalProps:{use:e=>a(e)}})};return a()}},g=(e,t=!0)=>[(0,a.translationPlugin)(e??o.default.internationalization.defaultLocale,t?o.default.internationalization.defaultLocale:void 0),a.enumerationPlugin,a.conditionPlugin,(0,a.nestedPlugin)(e??o.default.internationalization.defaultLocale),a.filePlugin,a.genderPlugin,u,f,m,h];exports.getPlugins=g,exports.htmlPlugin=h,exports.insertionPlugin=f,exports.intlayerNodePlugins=u,exports.markdownPlugin=m,exports.markdownStringPlugin=p;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`../ContentSelector-BbioElre.js`),n=require(`./html/HTMLRenderer.cjs`),r=require(`./markdown/installIntlayerMarkdown.cjs`),i=require(`./renderIntlayerNode.cjs`);let a=require(`@intlayer/core/interpreter`),o=require(`@intlayer/config/built`);o=e.t(o);let s=require(`@intlayer/core/markdown`),c=require(`@intlayer/types/nodeType`);c=e.t(c);let l=require(`vue`);var u=process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE===`false`?a.fallbackPlugin:{id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:n,...r})=>{let a=e=>i.renderIntlayerNode({...r,value:e,children:o.default.editor.enabled?()=>(0,l.h)(t.t,{dictionaryKey:r.dictionaryKey,keyPath:r.keyPath},{default:()=>typeof e==`function`?e():e}):e}),s=a(n);if(typeof n!=`function`)return s;let c=(...e)=>a(n(...e));Object.setPrototypeOf(c,Object.getPrototypeOf(s));for(let e of Object.getOwnPropertyNames(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(c,e,t)}for(let e of Object.getOwnPropertySymbols(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(c,e,t)}return(0,l.markRaw)(c)}},d=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,a.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,l.h)(l.Fragment,null,...e)}else return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,l.h)(l.Fragment,null,...e)}return i.isSimple?i.parts:(0,l.h)(l.Fragment,null,i.parts)},f=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?a.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.INSERTION}],i=e[c.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=d(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}},p=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?a.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,a)=>{let{plugins:o,...c}=n,u=a((0,s.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>i.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),d=a=>i.renderIntlayerNode({...n,value:e,children:()=>(0,l.h)(t.t,{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath},{default:()=>{let{renderMarkdown:t,components:n}=r.useMarkdown();return t(e,void 0,{...n??{},...a??{}})}}),additionalProps:{metadata:u,use:e=>d(e)}});return d()}},m=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?a.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.MARKDOWN}],i=e[c.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[p,...t.plugins??[]]})}},h=process.env.INTLAYER_NODE_TYPE_HTML===`false`?a.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.HTML,transform:(e,t)=>{let r=e[c.HTML];e.tags;let a=(e={})=>{let o=n.renderHTML(r,{components:e});return i.renderIntlayerNode({...t,value:r,children:o,additionalProps:{use:e=>a(e)}})};return a()}},g=(e,t=!0)=>[(0,a.translationPlugin)(e??o.default.internationalization.defaultLocale,t?o.default.internationalization.defaultLocale:void 0),a.enumerationPlugin,a.conditionPlugin,(0,a.nestedPlugin)(e??o.default.internationalization.defaultLocale),a.filePlugin,a.genderPlugin,u,f,m,h].filter(Boolean);exports.getPlugins=g,exports.htmlPlugin=h,exports.insertionPlugin=f,exports.intlayerNodePlugins=u,exports.markdownPlugin=m,exports.markdownStringPlugin=p;
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -2,20 +2,20 @@ import { t as e } from "../ContentSelector-U91_pPOg.mjs";
|
|
|
2
2
|
import { renderHTML as t } from "./html/HTMLRenderer.mjs";
|
|
3
3
|
import { useMarkdown as n } from "./markdown/installIntlayerMarkdown.mjs";
|
|
4
4
|
import { renderIntlayerNode as r } from "./renderIntlayerNode.mjs";
|
|
5
|
-
import { conditionPlugin as i, enumerationPlugin as a,
|
|
6
|
-
import
|
|
7
|
-
import { getMarkdownMetadata as
|
|
8
|
-
import * as
|
|
9
|
-
import { Fragment as
|
|
5
|
+
import { conditionPlugin as i, enumerationPlugin as a, fallbackPlugin as o, filePlugin as s, genderPlugin as c, nestedPlugin as l, splitInsertionTemplate as u, translationPlugin as d } from "@intlayer/core/interpreter";
|
|
6
|
+
import f from "@intlayer/config/built";
|
|
7
|
+
import { getMarkdownMetadata as p } from "@intlayer/core/markdown";
|
|
8
|
+
import * as m from "@intlayer/types/nodeType";
|
|
9
|
+
import { Fragment as h, h as g, markRaw as _ } from "vue";
|
|
10
10
|
//#region src/plugins.ts
|
|
11
|
-
var
|
|
11
|
+
var v = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false" ? o : {
|
|
12
12
|
id: "intlayer-node-plugin",
|
|
13
13
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
14
14
|
transform: (t, { children: n, ...i }) => {
|
|
15
15
|
let a = (t) => r({
|
|
16
16
|
...i,
|
|
17
17
|
value: t,
|
|
18
|
-
children:
|
|
18
|
+
children: f.editor.enabled ? () => g(e, {
|
|
19
19
|
dictionaryKey: i.dictionaryKey,
|
|
20
20
|
keyPath: i.keyPath
|
|
21
21
|
}, { default: () => typeof t == "function" ? t() : t }) : t
|
|
@@ -31,12 +31,12 @@ var _ = {
|
|
|
31
31
|
let t = Object.getOwnPropertyDescriptor(o, e);
|
|
32
32
|
t && Object.defineProperty(s, e, t);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return _(s);
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, y = (e, t) => {
|
|
37
37
|
let n = /* @__PURE__ */ new Map(), r = {};
|
|
38
38
|
for (let [e, i] of Object.entries(t)) typeof i == "string" || typeof i == "number" ? r[e] = i : (n.set(e, i), r[e] = `__VNODE_${e}__`);
|
|
39
|
-
let i =
|
|
39
|
+
let i = u(e, r);
|
|
40
40
|
if (n.size > 0) {
|
|
41
41
|
let e = [];
|
|
42
42
|
if (i.isSimple) {
|
|
@@ -45,7 +45,7 @@ var _ = {
|
|
|
45
45
|
let a = `__VNODE_${i}__`, o = t.indexOf(a);
|
|
46
46
|
o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
|
|
47
47
|
}
|
|
48
|
-
return r < t.length && e.push(t.substring(r)), h
|
|
48
|
+
return r < t.length && e.push(t.substring(r)), g(h, null, ...e);
|
|
49
49
|
} else return i.parts.forEach((t) => {
|
|
50
50
|
if (typeof t == "string") {
|
|
51
51
|
let r = t;
|
|
@@ -55,14 +55,14 @@ var _ = {
|
|
|
55
55
|
}
|
|
56
56
|
r.length > 0 && e.push(r);
|
|
57
57
|
} else e.push(t);
|
|
58
|
-
}), h
|
|
58
|
+
}), g(h, null, ...e);
|
|
59
59
|
}
|
|
60
|
-
return i.isSimple ? i.parts : h
|
|
61
|
-
},
|
|
60
|
+
return i.isSimple ? i.parts : g(h, null, i.parts);
|
|
61
|
+
}, b = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? o : {
|
|
62
62
|
id: "insertion-plugin",
|
|
63
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
63
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === m.INSERTION,
|
|
64
64
|
transform: (e, t, n) => {
|
|
65
|
-
let r = [...t.keyPath, { type:
|
|
65
|
+
let r = [...t.keyPath, { type: m.INSERTION }], i = e[m.INSERTION], a = {
|
|
66
66
|
id: "insertion-string-plugin",
|
|
67
67
|
canHandle: (e) => typeof e == "string",
|
|
68
68
|
transform: (e, n, r) => {
|
|
@@ -72,7 +72,7 @@ var _ = {
|
|
|
72
72
|
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
73
73
|
});
|
|
74
74
|
return (e) => {
|
|
75
|
-
let a =
|
|
75
|
+
let a = y(i, e);
|
|
76
76
|
return r(a, {
|
|
77
77
|
...n,
|
|
78
78
|
plugins: t.plugins,
|
|
@@ -88,11 +88,11 @@ var _ = {
|
|
|
88
88
|
plugins: [a, ...t.plugins ?? []]
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
},
|
|
91
|
+
}, x = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
|
|
92
92
|
id: "markdown-string-plugin",
|
|
93
93
|
canHandle: (e) => typeof e == "string",
|
|
94
94
|
transform: (t, i, a) => {
|
|
95
|
-
let { plugins: o, ...s } = i, c = a(
|
|
95
|
+
let { plugins: o, ...s } = i, c = a(p(t) ?? {}, {
|
|
96
96
|
plugins: [{
|
|
97
97
|
id: "markdown-metadata-plugin",
|
|
98
98
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -107,7 +107,7 @@ var _ = {
|
|
|
107
107
|
}), l = (a) => r({
|
|
108
108
|
...i,
|
|
109
109
|
value: t,
|
|
110
|
-
children: () =>
|
|
110
|
+
children: () => g(e, {
|
|
111
111
|
dictionaryKey: s.dictionaryKey,
|
|
112
112
|
keyPath: s.keyPath
|
|
113
113
|
}, { default: () => {
|
|
@@ -124,23 +124,23 @@ var _ = {
|
|
|
124
124
|
});
|
|
125
125
|
return l();
|
|
126
126
|
}
|
|
127
|
-
},
|
|
127
|
+
}, S = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
|
|
128
128
|
id: "markdown-plugin",
|
|
129
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
129
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === m.MARKDOWN,
|
|
130
130
|
transform: (e, t, n) => {
|
|
131
|
-
let r = [...t.keyPath, { type:
|
|
131
|
+
let r = [...t.keyPath, { type: m.MARKDOWN }], i = e[m.MARKDOWN];
|
|
132
132
|
return n(i, {
|
|
133
133
|
...t,
|
|
134
134
|
children: i,
|
|
135
135
|
keyPath: r,
|
|
136
|
-
plugins: [
|
|
136
|
+
plugins: [x, ...t.plugins ?? []]
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
},
|
|
139
|
+
}, C = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? o : {
|
|
140
140
|
id: "html-plugin",
|
|
141
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
141
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === m.HTML,
|
|
142
142
|
transform: (e, n) => {
|
|
143
|
-
let i = e[
|
|
143
|
+
let i = e[m.HTML];
|
|
144
144
|
e.tags;
|
|
145
145
|
let a = (e = {}) => {
|
|
146
146
|
let o = t(i, { components: e });
|
|
@@ -153,17 +153,17 @@ var _ = {
|
|
|
153
153
|
};
|
|
154
154
|
return a();
|
|
155
155
|
}
|
|
156
|
-
},
|
|
157
|
-
|
|
156
|
+
}, w = (e, t = !0) => [
|
|
157
|
+
d(e ?? f.internationalization.defaultLocale, t ? f.internationalization.defaultLocale : void 0),
|
|
158
158
|
a,
|
|
159
159
|
i,
|
|
160
|
-
|
|
161
|
-
o,
|
|
160
|
+
l(e ?? f.internationalization.defaultLocale),
|
|
162
161
|
s,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
S
|
|
167
|
-
|
|
162
|
+
c,
|
|
163
|
+
v,
|
|
164
|
+
b,
|
|
165
|
+
S,
|
|
166
|
+
C
|
|
167
|
+
].filter(Boolean);
|
|
168
168
|
//#endregion
|
|
169
|
-
export {
|
|
169
|
+
export { w as getPlugins, C as htmlPlugin, b as insertionPlugin, v as intlayerNodePlugins, S as markdownPlugin, x as markdownStringPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@intlayer/api": "8.6.
|
|
106
|
-
"@intlayer/config": "8.6.
|
|
107
|
-
"@intlayer/core": "8.6.
|
|
108
|
-
"@intlayer/editor": "8.6.
|
|
109
|
-
"@intlayer/types": "8.6.
|
|
105
|
+
"@intlayer/api": "8.6.1",
|
|
106
|
+
"@intlayer/config": "8.6.1",
|
|
107
|
+
"@intlayer/core": "8.6.1",
|
|
108
|
+
"@intlayer/editor": "8.6.1",
|
|
109
|
+
"@intlayer/types": "8.6.1"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@types/node": "25.5.0",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"vue-tsc": "3.1.5"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "8.6.
|
|
128
|
+
"intlayer": "8.6.1",
|
|
129
129
|
"vue": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|