vue-intlayer 8.4.5 → 8.4.7
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 +27 -24
- package/package.json +8 -8
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-CAg85Zo3.js`),n=require(`./markdown/installIntlayerMarkdown.cjs`),r=require(`./renderIntlayerNode.cjs`);let i=require(`@intlayer/core/interpreter`),a=require(`@intlayer/config/built`);a=e.t(a);let o=require(`@intlayer/core/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`../ContentSelector-CAg85Zo3.js`),n=require(`./markdown/installIntlayerMarkdown.cjs`),r=require(`./renderIntlayerNode.cjs`);let i=require(`@intlayer/core/interpreter`),a=require(`@intlayer/config/built`);a=e.t(a);let o=require(`@intlayer/core/transpiler`),s=require(`@intlayer/types/nodeType`);s=e.t(s);let c=require(`vue`);var l=null;import(`@intlayer/core/markdown`).then(e=>{l=e.getMarkdownMetadata});var u={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:n,...i})=>{let o=e=>r.renderIntlayerNode({...i,value:e,children:a.default?.editor.enabled?()=>(0,c.h)(t.t,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>typeof e==`function`?e():e}):e}),s=o(n);if(typeof n!=`function`)return s;let l=(...e)=>o(n(...e));Object.setPrototypeOf(l,Object.getPrototypeOf(s));for(let e of Object.getOwnPropertyNames(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(l,e,t)}for(let e of Object.getOwnPropertySymbols(s)){let t=Object.getOwnPropertyDescriptor(s,e);t&&Object.defineProperty(l,e,t)}return(0,c.markRaw)(l)}},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 a=(0,i.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(a.isSimple){let t=a.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,c.h)(c.Fragment,null,...e)}else return a.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,c.h)(c.Fragment,null,...e)}return a.isSimple?a.parts:(0,c.h)(c.Fragment,null,a.parts)},f={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:s.INSERTION}],i=e[s.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,i,a)=>{let{plugins:o,...s}=i,u=a(l?.(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>r.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:s.dictionaryKey,keyPath:[]}),d=a=>r.renderIntlayerNode({...i,value:e,children:()=>(0,c.h)(t.t,{dictionaryKey:s.dictionaryKey,keyPath:s.keyPath},{default:()=>{let{renderMarkdown:t,components:r}=n.useMarkdown();return t(e,void 0,{...r??{},...a??{}})}}),additionalProps:{metadata:u}}),f=d();return new Proxy(f,{get(t,n,r){return n===`value`?e:n===`metadata`?u:n===`use`?e=>d(e):Reflect.get(t,n,r)}})}},m={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:s.MARKDOWN}],i=e[s.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[p,...t.plugins??[]]})}},h=()=>{let e={};for(let t of o.HTML_TAGS)e[t]=({children:e,...n})=>(0,c.h)(t,n,e);return e},g=null,_=()=>(g||=h(),g),v={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.HTML,transform:(e,t)=>{let n=e[s.HTML];e.tags;let a=e=>(0,i.getHTML)(n,{..._(),...e});return r.renderIntlayerNode({...t,value:n,children:e=>a(e)})}},y=(e,t=!0)=>[(0,i.translationPlugin)(e??a.default.internationalization.defaultLocale,t?a.default.internationalization.defaultLocale:void 0),i.enumerationPlugin,i.conditionPlugin,(0,i.nestedPlugin)(e??a.default.internationalization.defaultLocale),i.filePlugin,i.genderPlugin,u,f,m,v];exports.getPlugins=y,exports.htmlPlugin=v,exports.insertionPlugin=f,exports.intlayerNodePlugins=u,exports.markdownPlugin=m,exports.markdownStringPlugin=p;
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -3,11 +3,14 @@ import { useMarkdown as t } from "./markdown/installIntlayerMarkdown.mjs";
|
|
|
3
3
|
import { renderIntlayerNode as n } from "./renderIntlayerNode.mjs";
|
|
4
4
|
import { conditionPlugin as r, enumerationPlugin as i, filePlugin as a, genderPlugin as o, getHTML as s, nestedPlugin as c, splitInsertionTemplate as l, translationPlugin as u } from "@intlayer/core/interpreter";
|
|
5
5
|
import d from "@intlayer/config/built";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Fragment as h, h as g, markRaw as _ } from "vue";
|
|
6
|
+
import { HTML_TAGS as f } from "@intlayer/core/transpiler";
|
|
7
|
+
import * as p from "@intlayer/types/nodeType";
|
|
8
|
+
import { Fragment as m, h, markRaw as g } from "vue";
|
|
10
9
|
//#region src/plugins.ts
|
|
10
|
+
var _ = null;
|
|
11
|
+
import("@intlayer/core/markdown").then((e) => {
|
|
12
|
+
_ = e.getMarkdownMetadata;
|
|
13
|
+
});
|
|
11
14
|
var v = {
|
|
12
15
|
id: "intlayer-node-plugin",
|
|
13
16
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
@@ -15,7 +18,7 @@ var v = {
|
|
|
15
18
|
let a = (t) => n({
|
|
16
19
|
...i,
|
|
17
20
|
value: t,
|
|
18
|
-
children: d?.editor.enabled ? () =>
|
|
21
|
+
children: d?.editor.enabled ? () => h(e, {
|
|
19
22
|
dictionaryKey: i.dictionaryKey,
|
|
20
23
|
keyPath: i.keyPath
|
|
21
24
|
}, { default: () => typeof t == "function" ? t() : t }) : t
|
|
@@ -31,7 +34,7 @@ var v = {
|
|
|
31
34
|
let t = Object.getOwnPropertyDescriptor(o, e);
|
|
32
35
|
t && Object.defineProperty(s, e, t);
|
|
33
36
|
}
|
|
34
|
-
return
|
|
37
|
+
return g(s);
|
|
35
38
|
}
|
|
36
39
|
}, y = (e, t) => {
|
|
37
40
|
let n = /* @__PURE__ */ new Map(), r = {};
|
|
@@ -45,7 +48,7 @@ var v = {
|
|
|
45
48
|
let a = `__VNODE_${i}__`, o = t.indexOf(a);
|
|
46
49
|
o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
|
|
47
50
|
}
|
|
48
|
-
return r < t.length && e.push(t.substring(r)),
|
|
51
|
+
return r < t.length && e.push(t.substring(r)), h(m, null, ...e);
|
|
49
52
|
} else return i.parts.forEach((t) => {
|
|
50
53
|
if (typeof t == "string") {
|
|
51
54
|
let r = t;
|
|
@@ -55,14 +58,14 @@ var v = {
|
|
|
55
58
|
}
|
|
56
59
|
r.length > 0 && e.push(r);
|
|
57
60
|
} else e.push(t);
|
|
58
|
-
}),
|
|
61
|
+
}), h(m, null, ...e);
|
|
59
62
|
}
|
|
60
|
-
return i.isSimple ? i.parts :
|
|
63
|
+
return i.isSimple ? i.parts : h(m, null, i.parts);
|
|
61
64
|
}, b = {
|
|
62
65
|
id: "insertion-plugin",
|
|
63
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
66
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === p.INSERTION,
|
|
64
67
|
transform: (e, t, n) => {
|
|
65
|
-
let r = [...t.keyPath, { type:
|
|
68
|
+
let r = [...t.keyPath, { type: p.INSERTION }], i = e[p.INSERTION], a = {
|
|
66
69
|
id: "insertion-string-plugin",
|
|
67
70
|
canHandle: (e) => typeof e == "string",
|
|
68
71
|
transform: (e, n, r) => {
|
|
@@ -92,7 +95,7 @@ var v = {
|
|
|
92
95
|
id: "markdown-string-plugin",
|
|
93
96
|
canHandle: (e) => typeof e == "string",
|
|
94
97
|
transform: (r, i, a) => {
|
|
95
|
-
let { plugins: o, ...s } = i, c = a(
|
|
98
|
+
let { plugins: o, ...s } = i, c = a(_?.(r) ?? {}, {
|
|
96
99
|
plugins: [{
|
|
97
100
|
id: "markdown-metadata-plugin",
|
|
98
101
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -107,7 +110,7 @@ var v = {
|
|
|
107
110
|
}), l = (a) => n({
|
|
108
111
|
...i,
|
|
109
112
|
value: r,
|
|
110
|
-
children: () =>
|
|
113
|
+
children: () => h(e, {
|
|
111
114
|
dictionaryKey: s.dictionaryKey,
|
|
112
115
|
keyPath: s.keyPath
|
|
113
116
|
}, { default: () => {
|
|
@@ -125,9 +128,9 @@ var v = {
|
|
|
125
128
|
}
|
|
126
129
|
}, S = {
|
|
127
130
|
id: "markdown-plugin",
|
|
128
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
131
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === p.MARKDOWN,
|
|
129
132
|
transform: (e, t, n) => {
|
|
130
|
-
let r = [...t.keyPath, { type:
|
|
133
|
+
let r = [...t.keyPath, { type: p.MARKDOWN }], i = e[p.MARKDOWN];
|
|
131
134
|
return n(i, {
|
|
132
135
|
...t,
|
|
133
136
|
children: i,
|
|
@@ -135,18 +138,18 @@ var v = {
|
|
|
135
138
|
plugins: [x, ...t.plugins ?? []]
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
|
-
}, C = (
|
|
141
|
+
}, C = () => {
|
|
139
142
|
let e = {};
|
|
140
|
-
for (let t of
|
|
143
|
+
for (let t of f) e[t] = ({ children: e, ...n }) => h(t, n, e);
|
|
141
144
|
return e;
|
|
142
|
-
})(), w = {
|
|
145
|
+
}, w = null, T = () => (w ||= C(), w), E = {
|
|
143
146
|
id: "html-plugin",
|
|
144
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
147
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === p.HTML,
|
|
145
148
|
transform: (e, t) => {
|
|
146
|
-
let r = e[
|
|
149
|
+
let r = e[p.HTML];
|
|
147
150
|
e.tags;
|
|
148
151
|
let i = (e) => s(r, {
|
|
149
|
-
...
|
|
152
|
+
...T(),
|
|
150
153
|
...e
|
|
151
154
|
});
|
|
152
155
|
return n({
|
|
@@ -155,7 +158,7 @@ var v = {
|
|
|
155
158
|
children: (e) => i(e)
|
|
156
159
|
});
|
|
157
160
|
}
|
|
158
|
-
},
|
|
161
|
+
}, D = (e, t = !0) => [
|
|
159
162
|
u(e ?? d.internationalization.defaultLocale, t ? d.internationalization.defaultLocale : void 0),
|
|
160
163
|
i,
|
|
161
164
|
r,
|
|
@@ -165,7 +168,7 @@ var v = {
|
|
|
165
168
|
v,
|
|
166
169
|
b,
|
|
167
170
|
S,
|
|
168
|
-
|
|
171
|
+
E
|
|
169
172
|
];
|
|
170
173
|
//#endregion
|
|
171
|
-
export {
|
|
174
|
+
export { D as getPlugins, E 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.4.
|
|
3
|
+
"version": "8.4.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@intlayer/api": "8.4.
|
|
98
|
-
"@intlayer/config": "8.4.
|
|
99
|
-
"@intlayer/core": "8.4.
|
|
100
|
-
"@intlayer/editor": "8.4.
|
|
101
|
-
"@intlayer/types": "8.4.
|
|
97
|
+
"@intlayer/api": "8.4.7",
|
|
98
|
+
"@intlayer/config": "8.4.7",
|
|
99
|
+
"@intlayer/core": "8.4.7",
|
|
100
|
+
"@intlayer/editor": "8.4.7",
|
|
101
|
+
"@intlayer/types": "8.4.7"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@types/node": "25.5.0",
|
|
@@ -111,13 +111,13 @@
|
|
|
111
111
|
"rimraf": "6.1.3",
|
|
112
112
|
"tsdown": "0.21.4",
|
|
113
113
|
"typescript": "5.9.3",
|
|
114
|
-
"vite": "8.0.
|
|
114
|
+
"vite": "8.0.1",
|
|
115
115
|
"vite-plugin-dts": "4.5.4",
|
|
116
116
|
"vitest": "4.1.0",
|
|
117
117
|
"vue-tsc": "3.1.5"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
|
-
"intlayer": "8.4.
|
|
120
|
+
"intlayer": "8.4.7",
|
|
121
121
|
"vue": ">=3.0.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|