vanilla-intlayer 8.5.2 → 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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-C91j1N6u.js`);let e=require(`@intlayer/core/localization`),t=require(`@intlayer/core/utils`);var n=(0,t.getLocaleFromStorage)(e.localeStorageOptions),r=n,i=(n,r)=>(0,t.setLocaleInStorage)(n,{...e.localeStorageOptions,isCookieEnabled:r}),a=i,o=n=>{let r=(0,t.LocaleStorage)({...e.localeStorageOptions,isCookieEnabled:n});return{localeStorage:r.getLocale(),setLocaleStorage:r.setLocale}},s=e=>{let t=o(e);return{localeCookie:t.localeStorage,setLocaleCookie:t.setLocaleStorage}};exports.localeCookie=r,exports.localeInStorage=n,exports.setLocaleCookie=a,exports.setLocaleInStorage=i,exports.useLocaleCookie=s,exports.useLocaleStorage=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-C91j1N6u.js`);let e=require(`@intlayer/core/localization`),t=require(`@intlayer/core/utils`);var n=(0,t.getLocaleFromStorageClient)(e.localeStorageOptions),r=n,i=(n,r)=>(0,t.setLocaleInStorageClient)(n,{...e.localeStorageOptions,isCookieEnabled:r}),a=i,o=n=>{let r=(0,t.LocaleStorageClient)({...e.localeStorageOptions,isCookieEnabled:n});return{localeStorage:r.getLocale(),setLocaleStorage:r.setLocale}},s=e=>{let t=o(e);return{localeCookie:t.localeStorage,setLocaleCookie:t.setLocaleStorage}};exports.localeCookie=r,exports.localeInStorage=n,exports.setLocaleCookie=a,exports.setLocaleInStorage=i,exports.useLocaleCookie=s,exports.useLocaleStorage=o;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`./renderIntlayerNode.cjs`);let n=require(`@intlayer/core/interpreter`),r=require(`@intlayer/config/built`);r=e.t(r);let i=require(`@intlayer/core/markdown`),a=require(`@intlayer/editor/isEnabled`),o=require(`@intlayer/types/nodeType`);o=e.t(o);var s=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`),c=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),l={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:n,keyPath:r,dictionaryKey:i,...o})=>{if(a.isEnabled&&typeof document<`u`){let e=String(n??``),t=JSON.stringify(r??[]),a=String(i??``),o=`<intlayer-content-selector-wrapper key-path="${s(t)}" dictionary-key="${s(a)}">${c(e)}</intlayer-content-selector-wrapper>`,l={toString:()=>o,valueOf:()=>e,[Symbol.toPrimitive]:e=>o,toJSON:()=>e,get raw(){return e},get value(){return e},__update(e){},toElement:()=>{let n=document.createElement(`intlayer-content-selector-wrapper`);return n.setAttribute(`key-path`,t),n.setAttribute(`dictionary-key`,a),n.textContent=e,n}};return Object.setPrototypeOf(l,String.prototype),l}return t.renderIntlayerNode({...o,value:n,children:n})}},u={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.INSERTION,transform:(e,t,r)=>{let i=[...t.keyPath,{type:o.INSERTION}],a=e[o.INSERTION],s={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,r,i)=>{let a=i(e,{...r,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let o=(0,n.splitInsertionTemplate)(a,e),s=o.isSimple?o.parts:o.parts.join(``);return i(s,{...r,plugins:t.plugins,children:s})}}},c=r(a,{...t,children:a,keyPath:i,plugins:[s,...t.plugins??[]]});return typeof a==`object`&&a&&`nodeType`in a&&[o.ENUMERATION,o.CONDITION].includes(a.nodeType)?e=>t=>{let n=c(t);return typeof n==`function`?n(e):n}:c}},d={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let{plugins:a,...o}=n,s=r((0,i.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:e})}],dictionaryKey:o.dictionaryKey,keyPath:[]});return t.renderIntlayerNode({...n,value:e,children:e,additionalProps:{metadata:s,use:t=>e}})}},f={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:o.MARKDOWN}],i=e[o.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[d,...t.plugins??[]]})}},p={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.HTML,transform:(e,n)=>{let r=e[o.HTML];return t.renderIntlayerNode({...n,value:r,children:r,additionalProps:{use:e=>r}})}},m=(e,t=!0)=>[(0,n.translationPlugin)(e??r.default.internationalization.defaultLocale,t?r.default.internationalization.defaultLocale:void 0),n.enumerationPlugin,n.conditionPlugin,(0,n.nestedPlugin)(e??r.default.internationalization.defaultLocale),n.filePlugin,n.genderPlugin,l,u,f,p];exports.getPlugins=m,exports.htmlPlugin=p,exports.insertionPlugin=u,exports.intlayerNodePlugins=l,exports.markdownPlugin=f,exports.markdownStringPlugin=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-C91j1N6u.js`),t=require(`./renderIntlayerNode.cjs`);let n=require(`@intlayer/core/interpreter`),r=require(`@intlayer/config/built`);r=e.t(r);let i=require(`@intlayer/core/markdown`),a=require(`@intlayer/types/nodeType`);a=e.t(a);var o=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`),s=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),c=process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE===`false`?n.fallbackPlugin:{id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:n,keyPath:i,dictionaryKey:a,...c})=>{if(r.default.editor.enabled){let e=String(n??``),r=JSON.stringify(i??[]),l=String(a??``),u=`<intlayer-content-selector-wrapper key-path="${o(r)}" dictionary-key="${o(l)}">${s(e)}</intlayer-content-selector-wrapper>`;return t.renderIntlayerNode({...c,value:n,children:u,keyPath:i,dictionaryKey:a,additionalProps:{toElement:()=>{let t=document.createElement(`intlayer-content-selector-wrapper`);return t.setAttribute(`key-path`,r),t.setAttribute(`dictionary-key`,l),t.textContent=e,t}}})}return t.renderIntlayerNode({...c,value:n,children:n})}},l=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?n.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.INSERTION,transform:(e,t,r)=>{let i=[...t.keyPath,{type:a.INSERTION}],o=e[a.INSERTION],s={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,r,i)=>{let a=i(e,{...r,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let o=(0,n.splitInsertionTemplate)(a,e),s=o.isSimple?o.parts:o.parts.join(``);return i(s,{...r,plugins:t.plugins,children:s})}}},c=r(o,{...t,children:o,keyPath:i,plugins:[s,...t.plugins??[]]});return typeof o==`object`&&o&&`nodeType`in o&&[a.ENUMERATION,a.CONDITION].includes(o.nodeType)?e=>t=>{let n=c(t);return typeof n==`function`?n(e):n}:c}},u={createElement:(e,t,...n)=>{let r=Object.entries(t||{}).filter(([e])=>e!==`children`&&e!==`key`&&e!==`_innerHTML`).map(([e,t])=>`${e}="${t}"`).join(` `),i=t?._innerHTML,a=i===void 0?n.flat(1/0).join(``):i;return`<${e}${r?` ${r}`:``}>${a}</${e}>`},normalizeProps:(e,t)=>{let n={};for(let[e,r]of Object.entries(t))e===`className`?n.class=r:e===`htmlFor`?n.for=r:e===`dangerouslySetInnerHTML`&&r?.__html?n._innerHTML=r.__html:n[e]=r;return n}},d=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?n.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let{plugins:a,...o}=n,s=r((0,i.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:e})}],dictionaryKey:o.dictionaryKey,keyPath:[]}),c=(t={})=>(0,i.compileWithOptions)(e,{...u,createElement:(e,n,...r)=>{let i=t[e];return typeof i==`function`?i({...n,children:r.join(``)}):u.createElement(e,n,...r)}},{});return t.renderIntlayerNode({...n,value:c(),children:e,additionalProps:{metadata:s,use:e=>c(e)}})}},f=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?n.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:a.MARKDOWN}],i=e[a.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[d,...t.plugins??[]]})}},p=process.env.INTLAYER_NODE_TYPE_HTML===`false`?n.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.HTML,transform:(e,r)=>{let i=e[a.HTML],o=(e={})=>{let t=(0,n.getHTML)(i,new Proxy(e,{get(e,t){if(typeof t==`string`&&t in e){let n=e[t];return e=>{let t=Array.isArray(e.children)?e.children.join(``):e.children;return n({...e,children:t})}}if(typeof t==`string`&&/^[a-z][a-z0-9]*$/.test(t))return e=>{let n=Object.entries(e).filter(([e])=>e!==`children`&&e!==`key`).map(([e,t])=>`${e}="${t}"`).join(` `),r=Array.isArray(e.children)?e.children.join(``):e.children;return`<${t}${n?` ${n}`:``}>${r}</${t}>`}}}));return Array.isArray(t)?t.join(``):t};return t.renderIntlayerNode({...r,value:o(),children:i,additionalProps:{use:e=>o(e)}})}},m=(e,t=!0)=>[(0,n.translationPlugin)(e??r.default.internationalization.defaultLocale,t?r.default.internationalization.defaultLocale:void 0),n.enumerationPlugin,n.conditionPlugin,(0,n.nestedPlugin)(e??r.default.internationalization.defaultLocale),n.filePlugin,n.genderPlugin,c,l,f,p].filter(Boolean);exports.getPlugins=m,exports.htmlPlugin=p,exports.insertionPlugin=l,exports.intlayerNodePlugins=c,exports.markdownPlugin=f,exports.markdownStringPlugin=d;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=({value:e,additionalProps:t={}})=>{let n=e,r={toString:()=>String(n??``),valueOf:()=>n,[Symbol.toPrimitive]:()=>n,toJSON:()=>n,get raw(){return n},set raw(e){n=e},get value(){return n},__update(e){n=e?.raw??e?.value??e},...t};return Object.setPrototypeOf(r,String.prototype),r};exports.renderIntlayerNode=e;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=({value:e,children:t,additionalProps:n={}})=>{let r=e,i=typeof t==`string`&&t!==String(e??``)?t:null,a={toString:()=>i??String(r??``),valueOf:()=>r,[Symbol.toPrimitive]:()=>i??r,toJSON:()=>r,get raw(){return r},set raw(e){r=e},get value(){return r},__update(e){r=e?.raw??e?.value??e},...n};return Object.setPrototypeOf(a,String.prototype),a};exports.renderIntlayerNode=e;
@@ -1,5 +1,5 @@
1
1
  import { localeStorageOptions as e } from "@intlayer/core/localization";
2
- import { LocaleStorage as t, getLocaleFromStorage as n, setLocaleInStorage as r } from "@intlayer/core/utils";
2
+ import { LocaleStorageClient as t, getLocaleFromStorageClient as n, setLocaleInStorageClient as r } from "@intlayer/core/utils";
3
3
  //#region src/client/useLocaleStorage.ts
4
4
  var i = n(e), a = i, o = (t, n) => r(t, {
5
5
  ...e,
@@ -1,33 +1,26 @@
1
1
  import { renderIntlayerNode as e } from "./renderIntlayerNode.mjs";
2
- import { conditionPlugin as t, enumerationPlugin as n, filePlugin as r, genderPlugin as i, nestedPlugin as a, splitInsertionTemplate as o, translationPlugin as s } from "@intlayer/core/interpreter";
3
- import c from "@intlayer/config/built";
4
- import { getMarkdownMetadata as l } from "@intlayer/core/markdown";
5
- import { isEnabled as u } from "@intlayer/editor/isEnabled";
6
- import * as d from "@intlayer/types/nodeType";
2
+ import { conditionPlugin as t, enumerationPlugin as n, fallbackPlugin as r, filePlugin as i, genderPlugin as a, getHTML as o, nestedPlugin as s, splitInsertionTemplate as c, translationPlugin as l } from "@intlayer/core/interpreter";
3
+ import u from "@intlayer/config/built";
4
+ import { compileWithOptions as d, getMarkdownMetadata as f } from "@intlayer/core/markdown";
5
+ import * as p from "@intlayer/types/nodeType";
7
6
  //#region src/plugins.ts
8
- var f = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), p = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), m = {
7
+ var m = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), h = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), g = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false" ? r : {
9
8
  id: "intlayer-node-plugin",
10
9
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
11
10
  transform: (t, { children: n, keyPath: r, dictionaryKey: i, ...a }) => {
12
- if (u && typeof document < "u") {
13
- let e = String(n ?? ""), t = JSON.stringify(r ?? []), a = String(i ?? ""), o = `<intlayer-content-selector-wrapper key-path="${f(t)}" dictionary-key="${f(a)}">${p(e)}</intlayer-content-selector-wrapper>`, s = {
14
- toString: () => o,
15
- valueOf: () => e,
16
- [Symbol.toPrimitive]: (e) => o,
17
- toJSON: () => e,
18
- get raw() {
19
- return e;
20
- },
21
- get value() {
22
- return e;
23
- },
24
- __update(e) {},
25
- toElement: () => {
26
- let n = document.createElement("intlayer-content-selector-wrapper");
27
- return n.setAttribute("key-path", t), n.setAttribute("dictionary-key", a), n.textContent = e, n;
28
- }
29
- };
30
- return Object.setPrototypeOf(s, String.prototype), s;
11
+ if (u.editor.enabled) {
12
+ let t = String(n ?? ""), o = JSON.stringify(r ?? []), s = String(i ?? ""), c = `<intlayer-content-selector-wrapper key-path="${m(o)}" dictionary-key="${m(s)}">${h(t)}</intlayer-content-selector-wrapper>`;
13
+ return e({
14
+ ...a,
15
+ value: n,
16
+ children: c,
17
+ keyPath: r,
18
+ dictionaryKey: i,
19
+ additionalProps: { toElement: () => {
20
+ let e = document.createElement("intlayer-content-selector-wrapper");
21
+ return e.setAttribute("key-path", o), e.setAttribute("dictionary-key", s), e.textContent = t, e;
22
+ } }
23
+ });
31
24
  }
32
25
  return e({
33
26
  ...a,
@@ -35,11 +28,11 @@ var f = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), p = (e) => e.re
35
28
  children: n
36
29
  });
37
30
  }
38
- }, h = {
31
+ }, _ = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? r : {
39
32
  id: "insertion-plugin",
40
- canHandle: (e) => typeof e == "object" && e?.nodeType === d.INSERTION,
33
+ canHandle: (e) => typeof e == "object" && e?.nodeType === p.INSERTION,
41
34
  transform: (e, t, n) => {
42
- let r = [...t.keyPath, { type: d.INSERTION }], i = e[d.INSERTION], a = {
35
+ let r = [...t.keyPath, { type: p.INSERTION }], i = e[p.INSERTION], a = {
43
36
  id: "insertion-string-plugin",
44
37
  canHandle: (e) => typeof e == "string",
45
38
  transform: (e, n, r) => {
@@ -49,30 +42,40 @@ var f = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), p = (e) => e.re
49
42
  plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
50
43
  });
51
44
  return (e) => {
52
- let a = o(i, e), s = a.isSimple ? a.parts : a.parts.join("");
53
- return r(s, {
45
+ let a = c(i, e), o = a.isSimple ? a.parts : a.parts.join("");
46
+ return r(o, {
54
47
  ...n,
55
48
  plugins: t.plugins,
56
- children: s
49
+ children: o
57
50
  });
58
51
  };
59
52
  }
60
- }, s = n(i, {
53
+ }, o = n(i, {
61
54
  ...t,
62
55
  children: i,
63
56
  keyPath: r,
64
57
  plugins: [a, ...t.plugins ?? []]
65
58
  });
66
- return typeof i == "object" && i && "nodeType" in i && [d.ENUMERATION, d.CONDITION].includes(i.nodeType) ? (e) => (t) => {
67
- let n = s(t);
59
+ return typeof i == "object" && i && "nodeType" in i && [p.ENUMERATION, p.CONDITION].includes(i.nodeType) ? (e) => (t) => {
60
+ let n = o(t);
68
61
  return typeof n == "function" ? n(e) : n;
69
- } : s;
62
+ } : o;
63
+ }
64
+ }, v = {
65
+ createElement: (e, t, ...n) => {
66
+ let r = Object.entries(t || {}).filter(([e]) => e !== "children" && e !== "key" && e !== "_innerHTML").map(([e, t]) => `${e}="${t}"`).join(" "), i = t?._innerHTML, a = i === void 0 ? n.flat(Infinity).join("") : i;
67
+ return `<${e}${r ? ` ${r}` : ""}>${a}</${e}>`;
68
+ },
69
+ normalizeProps: (e, t) => {
70
+ let n = {};
71
+ for (let [e, r] of Object.entries(t)) e === "className" ? n.class = r : e === "htmlFor" ? n.for = r : e === "dangerouslySetInnerHTML" && r?.__html ? n._innerHTML = r.__html : n[e] = r;
72
+ return n;
70
73
  }
71
- }, g = {
74
+ }, y = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? r : {
72
75
  id: "markdown-string-plugin",
73
76
  canHandle: (e) => typeof e == "string",
74
77
  transform: (t, n, r) => {
75
- let { plugins: i, ...a } = n, o = r(l(t) ?? {}, {
78
+ let { plugins: i, ...a } = n, o = r(f(t) ?? {}, {
76
79
  plugins: [{
77
80
  id: "markdown-metadata-plugin",
78
81
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
@@ -84,52 +87,79 @@ var f = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), p = (e) => e.re
84
87
  }],
85
88
  dictionaryKey: a.dictionaryKey,
86
89
  keyPath: []
87
- });
90
+ }), s = (e = {}) => d(t, {
91
+ ...v,
92
+ createElement: (t, n, ...r) => {
93
+ let i = e[t];
94
+ return typeof i == "function" ? i({
95
+ ...n,
96
+ children: r.join("")
97
+ }) : v.createElement(t, n, ...r);
98
+ }
99
+ }, {});
88
100
  return e({
89
101
  ...n,
90
- value: t,
102
+ value: s(),
91
103
  children: t,
92
104
  additionalProps: {
93
105
  metadata: o,
94
- use: (e) => t
106
+ use: (e) => s(e)
95
107
  }
96
108
  });
97
109
  }
98
- }, _ = {
110
+ }, b = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? r : {
99
111
  id: "markdown-plugin",
100
- canHandle: (e) => typeof e == "object" && e?.nodeType === d.MARKDOWN,
112
+ canHandle: (e) => typeof e == "object" && e?.nodeType === p.MARKDOWN,
101
113
  transform: (e, t, n) => {
102
- let r = [...t.keyPath, { type: d.MARKDOWN }], i = e[d.MARKDOWN];
114
+ let r = [...t.keyPath, { type: p.MARKDOWN }], i = e[p.MARKDOWN];
103
115
  return n(i, {
104
116
  ...t,
105
117
  children: i,
106
118
  keyPath: r,
107
- plugins: [g, ...t.plugins ?? []]
119
+ plugins: [y, ...t.plugins ?? []]
108
120
  });
109
121
  }
110
- }, v = {
122
+ }, x = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? r : {
111
123
  id: "html-plugin",
112
- canHandle: (e) => typeof e == "object" && e?.nodeType === d.HTML,
124
+ canHandle: (e) => typeof e == "object" && e?.nodeType === p.HTML,
113
125
  transform: (t, n) => {
114
- let r = t[d.HTML];
126
+ let r = t[p.HTML], i = (e = {}) => {
127
+ let t = o(r, new Proxy(e, { get(e, t) {
128
+ if (typeof t == "string" && t in e) {
129
+ let n = e[t];
130
+ return (e) => {
131
+ let t = Array.isArray(e.children) ? e.children.join("") : e.children;
132
+ return n({
133
+ ...e,
134
+ children: t
135
+ });
136
+ };
137
+ }
138
+ if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => {
139
+ let n = Object.entries(e).filter(([e]) => e !== "children" && e !== "key").map(([e, t]) => `${e}="${t}"`).join(" "), r = Array.isArray(e.children) ? e.children.join("") : e.children;
140
+ return `<${t}${n ? ` ${n}` : ""}>${r}</${t}>`;
141
+ };
142
+ } }));
143
+ return Array.isArray(t) ? t.join("") : t;
144
+ };
115
145
  return e({
116
146
  ...n,
117
- value: r,
147
+ value: i(),
118
148
  children: r,
119
- additionalProps: { use: (e) => r }
149
+ additionalProps: { use: (e) => i(e) }
120
150
  });
121
151
  }
122
- }, y = (e, o = !0) => [
123
- s(e ?? c.internationalization.defaultLocale, o ? c.internationalization.defaultLocale : void 0),
152
+ }, S = (e, r = !0) => [
153
+ l(e ?? u.internationalization.defaultLocale, r ? u.internationalization.defaultLocale : void 0),
124
154
  n,
125
155
  t,
126
- a(e ?? c.internationalization.defaultLocale),
127
- r,
156
+ s(e ?? u.internationalization.defaultLocale),
128
157
  i,
129
- m,
130
- h,
158
+ a,
159
+ g,
131
160
  _,
132
- v
133
- ];
161
+ b,
162
+ x
163
+ ].filter(Boolean);
134
164
  //#endregion
135
- export { y as getPlugins, v as htmlPlugin, h as insertionPlugin, m as intlayerNodePlugins, _ as markdownPlugin, g as markdownStringPlugin };
165
+ export { S as getPlugins, x as htmlPlugin, _ as insertionPlugin, g as intlayerNodePlugins, b as markdownPlugin, y as markdownStringPlugin };
@@ -1,25 +1,25 @@
1
1
  //#region src/renderIntlayerNode.ts
2
- var e = ({ value: e, additionalProps: t = {} }) => {
3
- let n = e, r = {
4
- toString: () => String(n ?? ""),
5
- valueOf: () => n,
6
- [Symbol.toPrimitive]: () => n,
7
- toJSON: () => n,
2
+ var e = ({ value: e, children: t, additionalProps: n = {} }) => {
3
+ let r = e, i = typeof t == "string" && t !== String(e ?? "") ? t : null, a = {
4
+ toString: () => i ?? String(r ?? ""),
5
+ valueOf: () => r,
6
+ [Symbol.toPrimitive]: () => i ?? r,
7
+ toJSON: () => r,
8
8
  get raw() {
9
- return n;
9
+ return r;
10
10
  },
11
11
  set raw(e) {
12
- n = e;
12
+ r = e;
13
13
  },
14
14
  get value() {
15
- return n;
15
+ return r;
16
16
  },
17
17
  __update(e) {
18
- n = e?.raw ?? e?.value ?? e;
18
+ r = e?.raw ?? e?.value ?? e;
19
19
  },
20
- ...t
20
+ ...n
21
21
  };
22
- return Object.setPrototypeOf(r, String.prototype), r;
22
+ return Object.setPrototypeOf(a, String.prototype), a;
23
23
  };
24
24
  //#endregion
25
25
  export { e as renderIntlayerNode };
@@ -21,12 +21,9 @@ export type InsertionCond<T, _S, L extends LocalesValues> = T extends {
21
21
  [K in Extract<F, string>]: string | number;
22
22
  }>(values: V) => I extends string ? IntlayerNode<string> : DeepTransformContent<I, L> : never;
23
23
  export declare const insertionPlugin: Plugins;
24
- /** ---------------------------------------------
25
- * MARKDOWN PLUGIN
26
- * --------------------------------------------- */
27
24
  export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
28
25
  metadata: DeepTransformContent<string>;
29
- /** Returns the raw markdown string; render with compileMarkdown(). */
26
+ /** Returns the rendered markdown; render with .use(). */
30
27
  use: (components?: HTMLComponents<'permissive', {}>) => string;
31
28
  }> : never;
32
29
  export declare const markdownStringPlugin: Plugins;
@@ -48,7 +45,6 @@ export type HTMLPluginCond<T> = T extends {
48
45
  [NodeTypes.HTML]: infer I;
49
46
  tags?: infer U;
50
47
  } ? {
51
- /** Returns the raw HTML string. */
52
48
  use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
53
49
  } : never;
54
50
  export declare const htmlPlugin: Plugins;
@@ -68,4 +64,8 @@ export type IInterpreterPluginState = Omit<IInterpreterPluginStateCore, 'inserti
68
64
  vanillaHtml: true;
69
65
  };
70
66
  export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
67
+ /**
68
+ * Get the plugins array for Vanilla content transformation.
69
+ * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
70
+ */
71
71
  export declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[];
@@ -14,7 +14,7 @@ export type IntlayerNode<T = string> = ResolvedEditor<T & {
14
14
  toJSON: () => T;
15
15
  __update: (next: IntlayerNode<T>) => void;
16
16
  }>;
17
- export declare const renderIntlayerNode: <T extends string | number | boolean | null | undefined>({ value, additionalProps, }: {
17
+ export declare const renderIntlayerNode: <T extends string | number | boolean | null | undefined>({ value, children, additionalProps, }: {
18
18
  value: T;
19
19
  children?: any;
20
20
  additionalProps?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-intlayer",
3
- "version": "8.5.2",
3
+ "version": "8.6.1",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Vanilla JS, HTML, and PHP applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -101,11 +101,11 @@
101
101
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
102
102
  },
103
103
  "dependencies": {
104
- "@intlayer/api": "8.5.2",
105
- "@intlayer/config": "8.5.2",
106
- "@intlayer/core": "8.5.2",
107
- "@intlayer/editor": "8.5.2",
108
- "@intlayer/types": "8.5.2"
104
+ "@intlayer/api": "8.6.1",
105
+ "@intlayer/config": "8.6.1",
106
+ "@intlayer/core": "8.6.1",
107
+ "@intlayer/editor": "8.6.1",
108
+ "@intlayer/types": "8.6.1"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/node": "25.5.0",
@@ -114,14 +114,14 @@
114
114
  "@utils/tsdown-config": "1.0.4",
115
115
  "fast-glob": "3.3.3",
116
116
  "rimraf": "6.1.3",
117
- "tsdown": "0.21.4",
117
+ "tsdown": "0.21.7",
118
118
  "typescript": "6.0.2",
119
- "vite": "8.0.2",
119
+ "vite": "8.0.3",
120
120
  "vite-plugin-dts": "4.5.4",
121
- "vitest": "4.1.1"
121
+ "vitest": "4.1.2"
122
122
  },
123
123
  "peerDependencies": {
124
- "intlayer": "8.5.2"
124
+ "intlayer": "8.6.1"
125
125
  },
126
126
  "peerDependenciesMeta": {
127
127
  "intlayer": {