vue-intlayer 8.7.11 → 8.7.12

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.
Files changed (60) hide show
  1. package/dist/cjs/UI/ContentSelector.cjs +1 -1
  2. package/dist/cjs/client/index.cjs +1 -1
  3. package/dist/cjs/client/installIntlayer.cjs +1 -1
  4. package/dist/cjs/client/useDictionary.cjs +1 -1
  5. package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
  6. package/dist/cjs/client/useIntlayer.cjs +1 -1
  7. package/dist/cjs/client/useLoadDynamic.cjs +1 -1
  8. package/dist/cjs/client/useLocale.cjs +1 -1
  9. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  10. package/dist/cjs/client/useRewriteURL.cjs +1 -1
  11. package/dist/cjs/editor/ContentSelector.cjs +1 -1
  12. package/dist/cjs/editor/useEditor.cjs +1 -1
  13. package/dist/cjs/format/useCompact.cjs +1 -1
  14. package/dist/cjs/format/useCurrency.cjs +1 -1
  15. package/dist/cjs/format/useDate.cjs +1 -1
  16. package/dist/cjs/format/useIntl.cjs +1 -1
  17. package/dist/cjs/format/useList.cjs +1 -1
  18. package/dist/cjs/format/useNumber.cjs +1 -1
  19. package/dist/cjs/format/usePercentage.cjs +1 -1
  20. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  21. package/dist/cjs/format/useUnit.cjs +1 -1
  22. package/dist/cjs/getDictionary.cjs +1 -1
  23. package/dist/cjs/getIntlayer.cjs +1 -1
  24. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  25. package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
  26. package/dist/cjs/index.cjs +1 -1
  27. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  28. package/dist/cjs/markdown/compiler.cjs +1 -1
  29. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -1
  30. package/dist/cjs/markdown/runtime.cjs +1 -1
  31. package/dist/cjs/plugins.cjs +1 -1
  32. package/dist/cjs/renderIntlayerNode.cjs +1 -1
  33. package/dist/esm/client/index.mjs +2 -2
  34. package/dist/esm/client/installIntlayer.mjs +23 -2
  35. package/dist/esm/client/useDictionary.mjs +1 -1
  36. package/dist/esm/client/useDictionaryAsync.mjs +1 -1
  37. package/dist/esm/client/useIntlayer.mjs +1 -1
  38. package/dist/esm/client/useLocale.mjs +1 -1
  39. package/dist/esm/editor/ContentSelector.mjs +25 -2
  40. package/dist/esm/editor/useEditor.mjs +47 -2
  41. package/dist/esm/format/useCompact.mjs +1 -1
  42. package/dist/esm/format/useCurrency.mjs +1 -1
  43. package/dist/esm/format/useDate.mjs +1 -1
  44. package/dist/esm/format/useIntl.mjs +1 -1
  45. package/dist/esm/format/useList.mjs +1 -1
  46. package/dist/esm/format/useNumber.mjs +1 -1
  47. package/dist/esm/format/usePercentage.mjs +1 -1
  48. package/dist/esm/format/useRelativeTime.mjs +1 -1
  49. package/dist/esm/format/useUnit.mjs +1 -1
  50. package/dist/esm/index.mjs +10 -9
  51. package/dist/esm/plugins.mjs +80 -81
  52. package/dist/plugins-DCpi7fYK.js +1 -0
  53. package/dist/types/html/HTMLRenderer.d.ts +98 -98
  54. package/dist/types/markdown/MarkdownRenderer.d.ts +98 -98
  55. package/package.json +7 -7
  56. package/dist/ContentSelector-BUs8zVld.js +0 -1
  57. package/dist/ContentSelector-CJ8wOzKS.mjs +0 -24
  58. package/dist/installIntlayer-BkiEiexB.mjs +0 -62
  59. package/dist/installIntlayer-mdeEN-3u.js +0 -1
  60. package/dist/plugins-DqGu9jRk.js +0 -1
@@ -1,51 +1,50 @@
1
1
  import { renderIntlayerNode as e } from "./renderIntlayerNode.mjs";
2
- import { t } from "../ContentSelector-CJ8wOzKS.mjs";
3
- import { renderHTML as n } from "./html/HTMLRenderer.mjs";
4
- import { useMarkdown as r } from "./markdown/installIntlayerMarkdown.mjs";
5
- import { Fragment as i, h as a, markRaw as o } from "vue";
2
+ import { renderHTML as t } from "./html/HTMLRenderer.mjs";
3
+ import { useMarkdown as n } from "./markdown/installIntlayerMarkdown.mjs";
4
+ import { Fragment as r, defineAsyncComponent as i, h as a, markRaw as o } from "vue";
6
5
  import { conditionPlugin as s, enumerationPlugin as c, fallbackPlugin as l, filePlugin as u, genderPlugin as d, nestedPlugin as f, splitInsertionTemplate as p, translationPlugin as m } from "@intlayer/core/interpreter";
7
6
  import { editor as h, internationalization as g } from "@intlayer/config/built";
8
7
  import { getMarkdownMetadata as _ } from "@intlayer/core/markdown";
9
8
  import * as v from "@intlayer/types/nodeType";
10
9
  //#region src/plugins.ts
11
- var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false", x = process.env.INTLAYER_NODE_TYPE_HTML === "false", S = process.env.INTLAYER_NODE_TYPE_INSERTION === "false", C = process.env.INTLAYER_EDITOR_ENABLED === "false", w = y ? l : {
10
+ var y = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : i(() => import("./editor/ContentSelector.mjs")), b = {
12
11
  id: "intlayer-node-plugin",
13
12
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
14
- transform: (n, { children: r, ...i }) => {
15
- let s = (n) => e({
16
- ...i,
17
- value: n,
18
- children: !C && h.enabled ? () => a(t, {
19
- dictionaryKey: i.dictionaryKey,
20
- keyPath: i.keyPath
21
- }, { default: () => typeof n == "function" ? n() : n }) : n
22
- }), c = s(r);
23
- if (typeof r != "function") return c;
24
- let l = (...e) => s(r(...e));
25
- Object.setPrototypeOf(l, Object.getPrototypeOf(c));
26
- for (let e of Object.getOwnPropertyNames(c)) {
27
- let t = Object.getOwnPropertyDescriptor(c, e);
28
- t && Object.defineProperty(l, e, t);
13
+ transform: (t, { children: n, ...r }) => {
14
+ let i = (t) => e({
15
+ ...r,
16
+ value: t,
17
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && h.enabled ? () => a(y, {
18
+ dictionaryKey: r.dictionaryKey,
19
+ keyPath: r.keyPath
20
+ }, { default: () => typeof t == "function" ? t() : t }) : t
21
+ }), s = i(n);
22
+ if (typeof n != "function") return s;
23
+ let c = (...e) => i(n(...e));
24
+ Object.setPrototypeOf(c, Object.getPrototypeOf(s));
25
+ for (let e of Object.getOwnPropertyNames(s)) {
26
+ let t = Object.getOwnPropertyDescriptor(s, e);
27
+ t && Object.defineProperty(c, e, t);
29
28
  }
30
- for (let e of Object.getOwnPropertySymbols(c)) {
31
- let t = Object.getOwnPropertyDescriptor(c, e);
32
- t && Object.defineProperty(l, e, t);
29
+ for (let e of Object.getOwnPropertySymbols(s)) {
30
+ let t = Object.getOwnPropertyDescriptor(s, e);
31
+ t && Object.defineProperty(c, e, t);
33
32
  }
34
- return o(l);
33
+ return o(c);
35
34
  }
36
- }, T = (e, t) => {
37
- let n = /* @__PURE__ */ new Map(), r = {};
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 o = p(e, r);
35
+ }, x = (e, t) => {
36
+ let n = /* @__PURE__ */ new Map(), i = {};
37
+ for (let [e, r] of Object.entries(t)) typeof r == "string" || typeof r == "number" ? i[e] = r : (n.set(e, r), i[e] = `__VNODE_${e}__`);
38
+ let o = p(e, i);
40
39
  if (n.size > 0) {
41
40
  let e = [];
42
41
  if (o.isSimple) {
43
- let t = o.parts, r = 0;
44
- for (let [i] of n) {
45
- let a = `__VNODE_${i}__`, o = t.indexOf(a);
46
- o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
42
+ let t = o.parts, i = 0;
43
+ for (let [r] of n) {
44
+ let a = `__VNODE_${r}__`, o = t.indexOf(a);
45
+ o !== -1 && (o > i && e.push(t.substring(i, o)), e.push(n.get(r)), i = o + a.length);
47
46
  }
48
- return r < t.length && e.push(t.substring(r)), a(i, null, ...e);
47
+ return i < t.length && e.push(t.substring(i)), a(r, null, ...e);
49
48
  } else return o.parts.forEach((t) => {
50
49
  if (typeof t == "string") {
51
50
  let r = t;
@@ -55,10 +54,10 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
55
54
  }
56
55
  r.length > 0 && e.push(r);
57
56
  } else e.push(t);
58
- }), a(i, null, ...e);
57
+ }), a(r, null, ...e);
59
58
  }
60
- return o.isSimple ? o.parts : a(i, null, o.parts);
61
- }, E = S ? l : {
59
+ return o.isSimple ? o.parts : a(r, null, o.parts);
60
+ }, S = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? l : {
62
61
  id: "insertion-plugin",
63
62
  canHandle: (e) => typeof e == "object" && e?.nodeType === v.INSERTION,
64
63
  transform: (e, t, n) => {
@@ -72,7 +71,7 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
72
71
  plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
73
72
  });
74
73
  return (e) => {
75
- let a = T(i, e);
74
+ let a = x(i, e);
76
75
  return r(a, {
77
76
  ...n,
78
77
  plugins: t.plugins,
@@ -88,43 +87,43 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
88
87
  plugins: [a, ...t.plugins ?? []]
89
88
  });
90
89
  }
91
- }, D = b ? l : {
90
+ }, C = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? l : {
92
91
  id: "markdown-string-plugin",
93
92
  canHandle: (e) => typeof e == "string",
94
- transform: (n, i, o) => {
95
- let { plugins: s, ...c } = i, l = o(_(n) ?? {}, {
93
+ transform: (t, r, i) => {
94
+ let { plugins: o, ...s } = r, c = i(_(t) ?? {}, {
96
95
  plugins: [{
97
96
  id: "markdown-metadata-plugin",
98
97
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
99
- transform: (t, r) => e({
98
+ transform: (n, r) => e({
100
99
  ...r,
101
- value: t,
102
- children: n
100
+ value: n,
101
+ children: t
103
102
  })
104
103
  }],
105
- dictionaryKey: c.dictionaryKey,
104
+ dictionaryKey: s.dictionaryKey,
106
105
  keyPath: []
107
- }), u = (o) => e({
108
- ...i,
109
- value: n,
106
+ }), l = (i) => e({
107
+ ...r,
108
+ value: t,
110
109
  children: () => {
111
- let { renderMarkdown: e, components: i } = r(), s = e(n, void 0, {
112
- ...i ?? {},
113
- ...o ?? {}
110
+ let { renderMarkdown: e, components: r } = n(), o = e(t, void 0, {
111
+ ...r ?? {},
112
+ ...i ?? {}
114
113
  });
115
- return !C && h.enabled ? a(t, {
116
- dictionaryKey: c.dictionaryKey,
117
- keyPath: c.keyPath
118
- }, { default: () => s }) : s;
114
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && h.enabled ? a(y, {
115
+ dictionaryKey: s.dictionaryKey,
116
+ keyPath: s.keyPath
117
+ }, { default: () => o }) : o;
119
118
  },
120
119
  additionalProps: {
121
- metadata: l,
122
- use: (e) => u(e)
120
+ metadata: c,
121
+ use: (e) => l(e)
123
122
  }
124
123
  });
125
- return u();
124
+ return l();
126
125
  }
127
- }, O = b ? l : {
126
+ }, w = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? l : {
128
127
  id: "markdown-plugin",
129
128
  canHandle: (e) => typeof e == "object" && e?.nodeType === v.MARKDOWN,
130
129
  transform: (e, t, n) => {
@@ -133,33 +132,33 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
133
132
  ...t,
134
133
  children: i,
135
134
  keyPath: r,
136
- plugins: [D, ...t.plugins ?? []]
135
+ plugins: [C, ...t.plugins ?? []]
137
136
  });
138
137
  }
139
- }, k = x ? l : {
138
+ }, T = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? l : {
140
139
  id: "html-plugin",
141
140
  canHandle: (e) => typeof e == "object" && e?.nodeType === v.HTML,
142
- transform: (r, i) => {
143
- let o = r[v.HTML];
144
- r.tags;
145
- let s = (r = {}) => {
146
- let c = n(o, { components: r });
141
+ transform: (n, r) => {
142
+ let i = n[v.HTML];
143
+ n.tags;
144
+ let o = (n = {}) => {
145
+ let s = t(i, { components: n });
147
146
  return e({
148
- ...i,
149
- value: o,
150
- children: !C && h.enabled ? () => a(t, {
151
- dictionaryKey: i.dictionaryKey,
152
- keyPath: i.keyPath,
153
- ...r
154
- }, { default: () => c }) : c,
155
- additionalProps: { use: (e) => s(e) }
147
+ ...r,
148
+ value: i,
149
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && h.enabled ? () => a(y, {
150
+ dictionaryKey: r.dictionaryKey,
151
+ keyPath: r.keyPath,
152
+ ...n
153
+ }, { default: () => s }) : s,
154
+ additionalProps: { use: (e) => o(e) }
156
155
  });
157
156
  };
158
- return s();
157
+ return o();
159
158
  }
160
- }, A = /* @__PURE__ */ new Map(), j = (e, t = !0) => {
159
+ }, E = /* @__PURE__ */ new Map(), D = (e, t = !0) => {
161
160
  let n = `${e ?? g.defaultLocale}_${t}`;
162
- if (A.has(n)) return A.get(n);
161
+ if (E.has(n)) return E.get(n);
163
162
  let r = [
164
163
  m(e ?? g.defaultLocale, t ? g.defaultLocale : void 0),
165
164
  c,
@@ -167,12 +166,12 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
167
166
  f(e ?? g.defaultLocale),
168
167
  u,
169
168
  d,
169
+ b,
170
+ S,
170
171
  w,
171
- E,
172
- O,
173
- k
172
+ T
174
173
  ];
175
- return A.set(n, r), r;
174
+ return E.set(n, r), r;
176
175
  };
177
176
  //#endregion
178
- export { j as getPlugins, k as htmlPlugin, E as insertionPlugin, w as intlayerNodePlugins, O as markdownPlugin, D as markdownStringPlugin };
177
+ export { D as getPlugins, T as htmlPlugin, S as insertionPlugin, b as intlayerNodePlugins, w as markdownPlugin, C as markdownStringPlugin };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./cjs/renderIntlayerNode.cjs`),l=require(`./cjs/html/HTMLRenderer.cjs`),u=require(`./cjs/markdown/installIntlayerMarkdown.cjs`);let d=require(`vue`),f=require(`@intlayer/core/interpreter`),p=require(`@intlayer/config/built`),m=require(`@intlayer/core/markdown`),h=require(`@intlayer/types/nodeType`);h=s(h);var g=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,d.defineAsyncComponent)(()=>Promise.resolve().then(()=>require(`./cjs/editor/ContentSelector.cjs`))),_={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,...n})=>{let r=e=>c.renderIntlayerNode({...n,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,d.h)(g,{dictionaryKey:n.dictionaryKey,keyPath:n.keyPath},{default:()=>typeof e==`function`?e():e}):e}),i=r(t);if(typeof t!=`function`)return i;let a=(...e)=>r(t(...e));Object.setPrototypeOf(a,Object.getPrototypeOf(i));for(let e of Object.getOwnPropertyNames(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}for(let e of Object.getOwnPropertySymbols(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}return(0,d.markRaw)(a)}},v=(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,f.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,d.h)(d.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,d.h)(d.Fragment,null,...e)}return i.isSimple?i.parts:(0,d.h)(d.Fragment,null,i.parts)},y=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.INSERTION}],i=e[h.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=v(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}},b=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,m.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>c.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>c.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:r}=u.useMarkdown(),a=t(e,void 0,{...r??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?(0,d.h)(g,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>a}):a},additionalProps:{metadata:a,use:e=>o(e)}});return o()}},x=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.MARKDOWN}],i=e[h.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[b,...t.plugins??[]]})}},S=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML];e.tags;let r=(e={})=>{let i=l.renderHTML(n,{components:e});return c.renderIntlayerNode({...t,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,d.h)(g,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>i}):i,additionalProps:{use:e=>r(e)}})};return r()}},C=new Map,w=(e,t=!0)=>{let n=`${e??p.internationalization.defaultLocale}_${t}`;if(C.has(n))return C.get(n);let r=[(0,f.translationPlugin)(e??p.internationalization.defaultLocale,t?p.internationalization.defaultLocale:void 0),f.enumerationPlugin,f.conditionPlugin,(0,f.nestedPlugin)(e??p.internationalization.defaultLocale),f.filePlugin,f.genderPlugin,_,y,x,S];return C.set(n,r),r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return w}});