vue-intlayer 9.6.0 → 9.7.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/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/analytics/useConversion.cjs +1 -1
- package/dist/cjs/analytics/useExperiment.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/devtools/editDictionaryContent.cjs +1 -0
- package/dist/cjs/devtools/editorServer.cjs +1 -0
- package/dist/cjs/devtools/formatDictionaryForInspector.cjs +1 -1
- package/dist/cjs/devtools/index.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/format/useCompact.cjs +1 -1
- package/dist/cjs/format/useCurrency.cjs +1 -1
- package/dist/cjs/format/useDate.cjs +1 -1
- package/dist/cjs/format/useIntl.cjs +1 -1
- package/dist/cjs/format/useList.cjs +1 -1
- package/dist/cjs/format/useNumber.cjs +1 -1
- package/dist/cjs/format/usePercentage.cjs +1 -1
- package/dist/cjs/format/useRelativeTime.cjs +1 -1
- package/dist/cjs/format/useUnit.cjs +1 -1
- package/dist/cjs/html/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/UI/ContentSelector.mjs +1 -2
- package/dist/esm/analytics/exposureSink.mjs +1 -2
- package/dist/esm/analytics/useAnalytics.mjs +19 -20
- package/dist/esm/analytics/useConversion.mjs +3 -4
- package/dist/esm/analytics/useExperiment.mjs +4 -5
- package/dist/esm/client/installIntlayer.mjs +1 -2
- package/dist/esm/client/useDictionary.mjs +1 -2
- package/dist/esm/client/useDictionaryAsync.mjs +1 -2
- package/dist/esm/client/useDictionaryDynamic.mjs +1 -2
- package/dist/esm/client/useIntlayer.mjs +1 -2
- package/dist/esm/client/useLoadDynamic.mjs +1 -2
- package/dist/esm/client/useLocale.mjs +6 -11
- package/dist/esm/client/useLocaleStorage.mjs +1 -2
- package/dist/esm/client/usePathname.mjs +1 -2
- package/dist/esm/client/useRewriteURL.mjs +1 -2
- package/dist/esm/devtools/buildLocalesInspectorNode.mjs +1 -2
- package/dist/esm/devtools/editDictionaryContent.mjs +28 -0
- package/dist/esm/devtools/editorServer.mjs +20 -0
- package/dist/esm/devtools/formatDictionaryForInspector.mjs +38 -29
- package/dist/esm/devtools/index.mjs +155 -57
- package/dist/esm/editor/ContentSelector.mjs +1 -3
- package/dist/esm/editor/useEditor.mjs +28 -26
- package/dist/esm/format/index.mjs +10 -10
- package/dist/esm/format/useCompact.mjs +3 -4
- package/dist/esm/format/useCurrency.mjs +3 -4
- package/dist/esm/format/useDate.mjs +3 -4
- package/dist/esm/format/useIntl.mjs +3 -4
- package/dist/esm/format/useList.mjs +3 -4
- package/dist/esm/format/useNumber.mjs +3 -4
- package/dist/esm/format/usePercentage.mjs +3 -4
- package/dist/esm/format/useRelativeTime.mjs +3 -4
- package/dist/esm/format/useUnit.mjs +3 -4
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getIntlayer.mjs +1 -2
- package/dist/esm/html/HTMLRenderer.mjs +1 -2
- package/dist/esm/html/index.mjs +3 -3
- package/dist/esm/html/installIntlayerHTML.mjs +1 -2
- package/dist/esm/index.mjs +17 -17
- package/dist/esm/markdown/MarkdownRenderer.mjs +1 -2
- package/dist/esm/markdown/compiler.mjs +1 -2
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -2
- package/dist/esm/markdown/runtime.mjs +1 -2
- package/dist/esm/plugins.mjs +63 -64
- package/dist/esm/renderIntlayerNode.mjs +1 -2
- package/dist/esm-BnFj8Txc.js +1 -0
- package/dist/{esm-CtrrRmRn.mjs → esm-hfQR-yiQ.mjs} +77 -82
- package/dist/{isEnabled-BbWU6Ox5.mjs → isEnabled-DVKEZ2He.mjs} +1 -2
- package/dist/rolldown-runtime-BocRIvOZ.js +1 -0
- package/dist/types/devtools/editDictionaryContent.d.ts +47 -0
- package/dist/types/devtools/editorServer.d.ts +26 -0
- package/dist/types/devtools/formatDictionaryForInspector.d.ts +20 -0
- package/dist/types/devtools/index.d.ts +7 -0
- package/package.json +14 -14
- package/dist/esm-CXlI80Tk.js +0 -1
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getIntlayer as t } from "@intlayer/core/interpreter";
|
|
3
|
-
|
|
3
|
+
// src/getIntlayer.ts
|
|
4
4
|
var n = (n, r) => {
|
|
5
5
|
let i = typeof r == "object" && r ? r.locale : r;
|
|
6
6
|
return t(n, r, e(i));
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { n as getIntlayer };
|
|
@@ -2,7 +2,7 @@ import { useHTML as e } from "./installIntlayerHTML.mjs";
|
|
|
2
2
|
import { getHTML as t } from "@intlayer/core/interpreter";
|
|
3
3
|
import { defineComponent as n, h as r } from "vue";
|
|
4
4
|
import { VOID_HTML_ELEMENTS as i } from "@intlayer/core/transpiler";
|
|
5
|
-
|
|
5
|
+
// src/html/HTMLRenderer.ts
|
|
6
6
|
var a = (e, { components: n = {} } = {}) => {
|
|
7
7
|
let a = Object.fromEntries(Object.entries(n).filter(([, e]) => e).map(([e, t]) => [e, (e) => r(t, e, e?.children)])), o = new Proxy(a, { get(e, t) {
|
|
8
8
|
if (typeof t == "string" && t in e) return e[t];
|
|
@@ -29,5 +29,4 @@ var a = (e, { components: n = {} } = {}) => {
|
|
|
29
29
|
return () => t(e.content);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
//#endregion
|
|
33
32
|
export { s as HTMLRenderer, a as renderHTML, o as useHTMLRenderer };
|
package/dist/esm/html/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import { HTMLRenderer as e, renderHTML as t, useHTMLRenderer as n } from "./HTMLRenderer.mjs";
|
|
2
|
+
import { installIntlayerHTML as r, intlayerHTML as i, useHTML as a } from "./installIntlayerHTML.mjs";
|
|
3
|
+
export { e as HTMLRenderer, r as installIntlayerHTML, i as intlayerHTML, t as renderHTML, a as useHTML, n as useHTMLRenderer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getHTML as e } from "@intlayer/core/interpreter";
|
|
2
2
|
import { inject as t, provide as n } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/html/installIntlayerHTML.ts
|
|
4
4
|
var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }, i), o = (t, i) => {
|
|
5
5
|
let o;
|
|
6
6
|
if (typeof i == "function") o = i;
|
|
@@ -19,5 +19,4 @@ var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }
|
|
|
19
19
|
} } : o(e, t));
|
|
20
20
|
t.provide(r, s);
|
|
21
21
|
}, s = { install: o }, c = () => t(r);
|
|
22
|
-
//#endregion
|
|
23
22
|
export { r as INTLAYER_HTML_SYMBOL, a as createIntlayerHTMLClient, o as installIntlayerHTML, s as intlayerHTML, c as useHTML };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useConversion as p } from "./analytics/useConversion.mjs";
|
|
7
|
-
import { useExperiment as m } from "./analytics/useExperiment.mjs";
|
|
1
|
+
import { useEditor as e } from "./editor/useEditor.mjs";
|
|
2
|
+
import { INTLAYER_SYMBOL as t, createIntlayerClient as n, installIntlayer as r, intlayer as i } from "./client/installIntlayer.mjs";
|
|
3
|
+
import { useAnalytics as a } from "./analytics/useAnalytics.mjs";
|
|
4
|
+
import { useConversion as o } from "./analytics/useConversion.mjs";
|
|
5
|
+
import { useExperiment as s } from "./analytics/useExperiment.mjs";
|
|
8
6
|
import "./analytics/index.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
7
|
+
import { getDictionary as c } from "./getDictionary.mjs";
|
|
8
|
+
import { atPath as l, createIntlayerLeafProxy as u, isComponentLike as d, isIntlayerNode as f, isObjectLike as p, toComponent as m, useDictionary as h } from "./client/useDictionary.mjs";
|
|
9
|
+
import { useDictionaryAsync as g } from "./client/useDictionaryAsync.mjs";
|
|
10
|
+
import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
|
|
11
|
+
import { getIntlayer as v } from "./getIntlayer.mjs";
|
|
12
|
+
import { useIntlayer as y } from "./client/useIntlayer.mjs";
|
|
13
|
+
import { useLoadDynamic as b } from "./client/useLoadDynamic.mjs";
|
|
14
|
+
import { useLocale as x } from "./client/useLocale.mjs";
|
|
15
|
+
import { usePathname as S } from "./client/usePathname.mjs";
|
|
16
|
+
import { useRewriteURL as C } from "./client/useRewriteURL.mjs";
|
|
17
17
|
import "./client/index.mjs";
|
|
18
|
-
import {
|
|
19
|
-
export {
|
|
18
|
+
import { getPlugins as w, htmlPlugin as T, insertionPlugin as E, intlayerNodePlugins as D, markdownPlugin as O, markdownStringPlugin as k } from "./plugins.mjs";
|
|
19
|
+
export { t as INTLAYER_SYMBOL, l as atPath, n as createIntlayerClient, u as createIntlayerLeafProxy, c as getDictionary, v as getIntlayer, w as getPlugins, T as htmlPlugin, E as insertionPlugin, r as installIntlayer, i as intlayer, D as intlayerNodePlugins, d as isComponentLike, f as isIntlayerNode, p as isObjectLike, O as markdownPlugin, k as markdownStringPlugin, m as toComponent, a as useAnalytics, o as useConversion, h as useDictionary, g as useDictionaryAsync, _ as useDictionaryDynamic, e as useEditor, s as useExperiment, y as useIntlayer, b as useLoadDynamic, x as useLocale, S as usePathname, C as useRewriteURL };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMarkdown as e } from "./installIntlayerMarkdown.mjs";
|
|
2
2
|
import { defineComponent as t } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/markdown/MarkdownRenderer.ts
|
|
4
4
|
var n = async (e, { components: t, wrapper: n, forceBlock: r, forceInline: i, preserveFrontmatter: a, tagfilter: o } = {}) => {
|
|
5
5
|
let s = {
|
|
6
6
|
components: t,
|
|
@@ -104,5 +104,4 @@ var n = async (e, { components: t, wrapper: n, forceBlock: r, forceInline: i, pr
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
//#endregion
|
|
108
107
|
export { i as MarkdownRenderer, n as renderMarkdown, r as useMarkdownRenderer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./runtime.mjs";
|
|
2
2
|
import { compileWithOptions as t, parseMarkdown as n, renderMarkdownAst as r } from "@intlayer/core/markdown";
|
|
3
|
-
|
|
3
|
+
// src/markdown/compiler.ts
|
|
4
4
|
var i = (t = "", r = {}) => {
|
|
5
5
|
let { components: i, namedCodesToUnicode: a, sanitizer: o, slugify: s, ...c } = r;
|
|
6
6
|
return n(t, {
|
|
@@ -21,5 +21,4 @@ var i = (t = "", r = {}) => {
|
|
|
21
21
|
slugify: c
|
|
22
22
|
}, l);
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { a as compileMarkdown, i as parseMarkdown };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
2
|
import { h as t, inject as n, provide as r, shallowRef as i } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/markdown/installIntlayerMarkdown.ts
|
|
4
4
|
var a = Symbol("intlayerMarkdown"), o = (e) => typeof e?.then == "function", s = null, c = (e, t) => s || (s = {
|
|
5
5
|
components: t,
|
|
6
6
|
renderMarkdown: e
|
|
@@ -51,5 +51,4 @@ var a = Symbol("intlayerMarkdown"), o = (e) => typeof e?.then == "function", s =
|
|
|
51
51
|
if (!e) throw Error("useMarkdown must be used within a MarkdownProvider");
|
|
52
52
|
return e;
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { a as INTLAYER_MARKDOWN_SYMBOL, c as createIntlayerMarkdownClient, l as installIntlayerMarkdown, u as intlayerMarkdown, d as useMarkdown };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as e, cloneVNode as t, h as n } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/markdown/runtime.ts
|
|
3
3
|
var r = (e) => typeof e == "string" || typeof e == "symbol" ? !1 : typeof e == "function" || typeof e == "object", i = {
|
|
4
4
|
createElement: (e, t, ...i) => i.length === 0 ? n(e, t) : r(e) ? n(e, t, { default: () => i }) : i.length === 1 ? n(e, t, i[0]) : n(e, t, i),
|
|
5
5
|
cloneElement: (e, n, ...r) => t(e, n),
|
|
@@ -16,5 +16,4 @@ var r = (e) => typeof e == "string" || typeof e == "symbol" ? !1 : typeof e == "
|
|
|
16
16
|
createElement: (e, n, ...r) => t(e, n, r)
|
|
17
17
|
} : i;
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { a as createVueRuntime, i as default, i as vueRuntime };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -2,50 +2,50 @@ import { reportExposure as e } from "./analytics/exposureSink.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 {
|
|
6
|
-
import {
|
|
5
|
+
import { editor as i, internationalization as a } from "@intlayer/config/built";
|
|
6
|
+
import { conditionPlugin as o, enumerationPlugin as s, fallbackPlugin as c, filePlugin as l, genderPlugin as u, isInterpolableWrapperNode as d, nestedPlugin as f, pluralPlugin as p, resolveInsertedSelector as m, resolveInterpreterLocale as h, selectPlugin as g, splitInsertionTemplate as _, transformInterpolableNode as v, translationPlugin as y } from "@intlayer/core/interpreter";
|
|
7
7
|
import { getMarkdownMetadata as b } from "@intlayer/core/markdown";
|
|
8
8
|
import * as x from "@intlayer/types/nodeType";
|
|
9
9
|
import { Fragment as S, defineAsyncComponent as C, h as w, markRaw as T } from "vue";
|
|
10
|
-
|
|
10
|
+
// src/plugins.ts
|
|
11
11
|
var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import("./editor/ContentSelector.mjs")), D = {
|
|
12
12
|
id: "intlayer-node-plugin",
|
|
13
13
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
14
14
|
transform: (t, n) => {
|
|
15
|
-
let { children:
|
|
15
|
+
let { children: a, dictionaryKey: o, keyPath: s } = n;
|
|
16
16
|
process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
17
|
-
dictionaryKey:
|
|
18
|
-
keyPath:
|
|
17
|
+
dictionaryKey: o,
|
|
18
|
+
keyPath: s,
|
|
19
19
|
locale: n.locale,
|
|
20
20
|
nodeType: "text"
|
|
21
21
|
});
|
|
22
|
-
let
|
|
22
|
+
let c = (e) => r({
|
|
23
23
|
value: e,
|
|
24
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
25
|
-
dictionaryKey:
|
|
26
|
-
keyPath:
|
|
24
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () => w(E, {
|
|
25
|
+
dictionaryKey: o,
|
|
26
|
+
keyPath: s
|
|
27
27
|
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
28
|
-
}),
|
|
29
|
-
if (typeof
|
|
30
|
-
let
|
|
31
|
-
let t =
|
|
32
|
-
return
|
|
28
|
+
}), l = c(a);
|
|
29
|
+
if (typeof a != "function") return l;
|
|
30
|
+
let u = (...e) => {
|
|
31
|
+
let t = a(...e);
|
|
32
|
+
return c(t);
|
|
33
33
|
};
|
|
34
|
-
Object.setPrototypeOf(
|
|
35
|
-
for (let e of Object.getOwnPropertyNames(
|
|
36
|
-
let t = Object.getOwnPropertyDescriptor(
|
|
37
|
-
t && Object.defineProperty(
|
|
34
|
+
Object.setPrototypeOf(u, Object.getPrototypeOf(l));
|
|
35
|
+
for (let e of Object.getOwnPropertyNames(l)) {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(l, e);
|
|
37
|
+
t && Object.defineProperty(u, e, t);
|
|
38
38
|
}
|
|
39
|
-
for (let e of Object.getOwnPropertySymbols(
|
|
40
|
-
let t = Object.getOwnPropertyDescriptor(
|
|
41
|
-
t && Object.defineProperty(
|
|
39
|
+
for (let e of Object.getOwnPropertySymbols(l)) {
|
|
40
|
+
let t = Object.getOwnPropertyDescriptor(l, e);
|
|
41
|
+
t && Object.defineProperty(u, e, t);
|
|
42
42
|
}
|
|
43
|
-
return T(
|
|
43
|
+
return T(u);
|
|
44
44
|
}
|
|
45
45
|
}, O = (e, t) => {
|
|
46
46
|
let n = /* @__PURE__ */ new Map(), r = {};
|
|
47
47
|
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}__`);
|
|
48
|
-
let i =
|
|
48
|
+
let i = _(e, r);
|
|
49
49
|
if (n.size > 0) {
|
|
50
50
|
let e = [];
|
|
51
51
|
if (i.isSimple) {
|
|
@@ -68,15 +68,15 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
68
68
|
}), w(S, null, ...e);
|
|
69
69
|
}
|
|
70
70
|
return i.isSimple ? i.parts : w(S, null, i.parts);
|
|
71
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
71
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? c : {
|
|
72
72
|
id: "insertion-plugin",
|
|
73
73
|
canHandle: (e) => typeof e == "object" && e?.nodeType === x.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
75
|
let r = [...t.keyPath, { type: x.INSERTION }], i = e[x.INSERTION], a = {
|
|
76
76
|
id: "insertion-string-plugin",
|
|
77
|
-
canHandle: (e) => typeof e == "string" ||
|
|
77
|
+
canHandle: (e) => typeof e == "string" || d(e),
|
|
78
78
|
transform: (e, n, r) => {
|
|
79
|
-
if (
|
|
79
|
+
if (d(e)) return (i) => v(e, i, n, t.plugins, r);
|
|
80
80
|
let i = r(e, {
|
|
81
81
|
...n,
|
|
82
82
|
children: e,
|
|
@@ -97,13 +97,13 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
97
97
|
keyPath: r,
|
|
98
98
|
plugins: [a, ...t.plugins ?? []]
|
|
99
99
|
});
|
|
100
|
-
return
|
|
100
|
+
return m(i, o);
|
|
101
101
|
}
|
|
102
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
102
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
|
|
103
103
|
id: "markdown-string-plugin",
|
|
104
104
|
canHandle: (e) => typeof e == "string",
|
|
105
|
-
transform: (e, t,
|
|
106
|
-
let { plugins:
|
|
105
|
+
transform: (e, t, a) => {
|
|
106
|
+
let { plugins: o, ...s } = t, c = a(b(e) ?? {}, {
|
|
107
107
|
plugins: [{
|
|
108
108
|
id: "markdown-metadata-plugin",
|
|
109
109
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -113,29 +113,29 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
113
113
|
children: e
|
|
114
114
|
})
|
|
115
115
|
}],
|
|
116
|
-
dictionaryKey:
|
|
116
|
+
dictionaryKey: s.dictionaryKey,
|
|
117
117
|
keyPath: []
|
|
118
|
-
}),
|
|
118
|
+
}), l = (a) => r({
|
|
119
119
|
...t,
|
|
120
120
|
value: e,
|
|
121
121
|
children: () => {
|
|
122
|
-
let { renderMarkdown: t, components: r } = n(),
|
|
122
|
+
let { renderMarkdown: t, components: r } = n(), o = t(e, void 0, {
|
|
123
123
|
...r ?? {},
|
|
124
|
-
...
|
|
124
|
+
...a ?? {}
|
|
125
125
|
});
|
|
126
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
127
|
-
dictionaryKey:
|
|
128
|
-
keyPath:
|
|
129
|
-
}, { default: () =>
|
|
126
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? w(E, {
|
|
127
|
+
dictionaryKey: s.dictionaryKey,
|
|
128
|
+
keyPath: s.keyPath
|
|
129
|
+
}, { default: () => o }) : o;
|
|
130
130
|
},
|
|
131
131
|
additionalProps: {
|
|
132
|
-
metadata:
|
|
133
|
-
use: (e) =>
|
|
132
|
+
metadata: c,
|
|
133
|
+
use: (e) => l(e)
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
-
return
|
|
136
|
+
return l();
|
|
137
137
|
}
|
|
138
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
138
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
|
|
139
139
|
id: "markdown-plugin",
|
|
140
140
|
canHandle: (e) => typeof e == "object" && e?.nodeType === x.MARKDOWN,
|
|
141
141
|
transform: (e, t, n) => {
|
|
@@ -147,45 +147,44 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
147
147
|
plugins: [A, ...t.plugins ?? []]
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ?
|
|
150
|
+
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? c : {
|
|
151
151
|
id: "html-plugin",
|
|
152
152
|
canHandle: (e) => typeof e == "object" && e?.nodeType === x.HTML,
|
|
153
153
|
transform: (e, n) => {
|
|
154
|
-
let
|
|
154
|
+
let a = e[x.HTML];
|
|
155
155
|
e.tags;
|
|
156
|
-
let
|
|
157
|
-
let
|
|
156
|
+
let o = (e = {}) => {
|
|
157
|
+
let s = t(a, { components: e });
|
|
158
158
|
return r({
|
|
159
159
|
...n,
|
|
160
|
-
value:
|
|
161
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
160
|
+
value: a,
|
|
161
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () => w(E, {
|
|
162
162
|
dictionaryKey: n.dictionaryKey,
|
|
163
163
|
keyPath: n.keyPath,
|
|
164
164
|
...e
|
|
165
|
-
}, { default: () =>
|
|
166
|
-
additionalProps: { use: (e) =>
|
|
165
|
+
}, { default: () => s }) : s,
|
|
166
|
+
additionalProps: { use: (e) => o(e) }
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
|
-
return
|
|
169
|
+
return o();
|
|
170
170
|
}
|
|
171
171
|
}, N = /* @__PURE__ */ new Map(), P = (e, t = !0) => {
|
|
172
|
-
let n =
|
|
172
|
+
let n = h(e), r = `${n}_${t}`;
|
|
173
173
|
if (N.has(r)) return N.get(r);
|
|
174
|
-
let
|
|
174
|
+
let i = [
|
|
175
175
|
D,
|
|
176
|
-
|
|
177
|
-
a,
|
|
178
|
-
d(n),
|
|
179
|
-
i,
|
|
180
|
-
u(n),
|
|
176
|
+
y(n, t ? a.defaultLocale : void 0),
|
|
181
177
|
s,
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
p(n),
|
|
179
|
+
o,
|
|
180
|
+
f(n),
|
|
181
|
+
l,
|
|
182
|
+
u,
|
|
183
|
+
g,
|
|
184
184
|
k,
|
|
185
185
|
j,
|
|
186
186
|
M
|
|
187
|
-
].filter((e) => e !==
|
|
188
|
-
return N.set(r,
|
|
187
|
+
].filter((e) => e !== c);
|
|
188
|
+
return N.set(r, i), i;
|
|
189
189
|
};
|
|
190
|
-
//#endregion
|
|
191
190
|
export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, D as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { markRaw as e, ref as t } from "vue";
|
|
2
2
|
import { getIntlayerNodePrototype as n } from "@intlayer/core/utils";
|
|
3
|
-
|
|
3
|
+
// src/renderIntlayerNode.ts
|
|
4
4
|
var r = ({ value: i, children: a, additionalProps: o = {} }) => {
|
|
5
5
|
let s = t(i), c = typeof a == "function" ? (e) => a(e) : () => a, l = (e) => (s.value, c(e)), u = ((e) => l(e));
|
|
6
6
|
return Object.assign(u, {
|
|
@@ -31,5 +31,4 @@ var r = ({ value: i, children: a, additionalProps: o = {} }) => {
|
|
|
31
31
|
...o
|
|
32
32
|
}), Object.setPrototypeOf(u, n(i, Function.prototype)), e(u);
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { r as renderIntlayerNode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isEnabled-CuTKz0YA.js");let t=require("@intlayer/config/built");var n=e=>e.map(e=>e.key===void 0?`*`:String(e.key)).join(`.`),r=e=>({dictionaryKey:e.dictionaryKey,keyPath:n(e.keyPath),locale:e.locale,nodeType:e.nodeType,experimentKey:e.experimentKey,variant:e.variant}),i=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0},a=(e,t,n,r)=>{if(n.length===0)throw Error(`assignVariant requires at least one variant`);if(n.length===1)return n[0];let a=i(`${e}:${t}`)/4294967296;if(!r||r.length!==n.length){let e=Math.floor(a*n.length);return n[Math.min(e,n.length-1)]}let o=r.reduce((e,t)=>e+t,0);if(o<=0)return n[Math.floor(a*n.length)];let s=0,c=a*o;for(let e=0;e<n.length;e++)if(s+=r[e],c<s)return n[e];return n[n.length-1]},o=``,s=e=>[e.url,e.dictionaryKey,e.keyPath,e.locale,e.experimentKey??``,e.variant??``].join(o),c=({max:e})=>{let t=[],n=new Map,r=()=>t.length+n.size,i=()=>{for(;r()>e&&n.size>0;){let e=n.keys().next().value;n.delete(e)}r()>e&&(t=t.slice(r()-e))};return{push:e=>{if(e.type===`content_exposure`){let t=s(e),r=n.get(t);r?(r.count=(r.count??1)+(e.count??1),r.t=e.t):n.set(t,{...e,count:e.count??1})}else t.push(e);return i(),r()},drain:()=>{let e=[...t,...n.values()];return t=[],n.clear(),e},size:r}},l=(e,t)=>t>=1?!0:t<=0?!1:i(e)/4294967295<t,u=`__intlayer_analytics_sid__`,d=()=>{let e=typeof globalThis<`u`?globalThis.crypto:void 0;return e?.randomUUID?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},f=()=>{if(typeof window>`u`||!window.sessionStorage)return d();try{let e=window.sessionStorage.getItem(u);if(e)return e;let t=d();return window.sessionStorage.setItem(u,t),t}catch{return d()}},p=(e,t,{useBeacon:n=!1,token:r}={})=>{try{let i=JSON.stringify(t);return n&&typeof navigator<`u`&&typeof navigator.sendBeacon==`function`?navigator.sendBeacon(e,i):typeof fetch==`function`&&(fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...r?{Authorization:`Bearer ${r}`}:{}},body:i,keepalive:!0,credentials:`omit`,mode:`cors`}).catch(()=>{}),!0)}catch{return!1}},m=e=>{if(typeof window>`u`)return;let t=window.requestIdleCallback;typeof t==`function`?t(()=>e()):setTimeout(e,1)},h=`__intlayer_public_token__`,g=6e4,_=()=>{try{let e=window.sessionStorage?.getItem(h);if(!e)return null;let t=JSON.parse(e);return typeof t?.token!=`string`||typeof t?.expiresAt!=`number`?null:t}catch{return null}},v=e=>{try{window.sessionStorage?.setItem(h,JSON.stringify(e))}catch{}},y=({backendURL:e,clientId:t})=>{let n=`${e.replace(/\/$/,``)}/api/public/token`,r=null,i=null,a=e=>e!==null&&e.expiresAt-g>Date.now(),o=()=>{if(a(r))return r.token;if(typeof window<`u`){let e=_();if(a(e))return r=e,e.token}},s=async()=>{try{let e=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t}),credentials:`omit`,mode:`cors`});if(!e.ok)return;let i=await e.json(),a=i?.data?.token,o=i?.data?.expiresIn??0;if(!a||o<=0)return;r={token:a,expiresAt:Date.now()+o*1e3},typeof window<`u`&&v(r)}catch{}finally{i=null}};return{getToken:o,prime:()=>{t&&typeof fetch==`function`&&(o()||(i||=s()))}}},b=`intlayer-analytics/1`,x=()=>typeof window>`u`||!window.location?``:window.location.pathname,S=()=>{if(typeof document<`u`&&document.referrer)try{return new URL(document.referrer).host}catch{return}},C=t=>{let n=f(),r=e.r(),i=!r&&l(n,t.sampleRate),o=c({max:t.maxBufferSize}),s=`${t.backendURL.replace(/\/$/,``)}/api/analytics/events`,u=y({backendURL:t.backendURL,clientId:t.clientId}),d=``,h=null,g=!1,_=null,v=null,C=new Set,w=(e=!1)=>{let r=o.drain(),i=u.getToken();for(let a=0;a<r.length;a+=200)p(s,{token:i,clientId:i?void 0:t.clientId,sessionId:n,sdkVersion:b,events:r.slice(a,a+200)},{useBeacon:e,token:i})},T=e=>{o.push(e)>=t.maxBufferSize&&w()},E=e=>{d=e},D=(e={})=>{if(!i)return;let t=e.url??x(),n=e.reason??`initial`;(n!==`route_change`||t!==v)&&(v=t,C=new Set,T({type:`page_view`,t:Date.now(),url:t,locale:e.locale??d,ref:e.ref??S(),vw:e.vw??(typeof window<`u`?window.innerWidth:void 0),vh:e.vh??(typeof window<`u`?window.innerHeight:void 0),reason:n}))},O=e=>{if(!i)return;let t=e.locale??d,n=[e.dictionaryKey,e.keyPath,t,e.experimentKey??``,e.variant??``].join(``);C.has(n)||(C.add(n),T({...e,type:`content_exposure`,t:Date.now(),url:x(),locale:t}))},k=e=>{r||(T({...e,type:`conversion`,t:Date.now(),url:x(),locale:e.locale??d}),w())},A=(e,t,r)=>a(n,e,t,r),j=()=>{if(typeof window>`u`)return;let e=()=>{document.visibilityState===`hidden`&&w(!0)},t=()=>w(!0),n=()=>D({reason:`route_change`});document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t,{capture:!0}),window.addEventListener(`popstate`,n);let r=window.history,i=r.pushState,a=function(...e){let t=i.apply(this,e);return D({reason:`route_change`}),t};r.pushState=a,_=()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t,{capture:!0}),window.removeEventListener(`popstate`,n),r.pushState===a&&(r.pushState=i)}};return{setLocale:E,trackPageView:D,trackContentExposure:O,trackConversion:k,getVariant:A,flush:w,start:()=>{g||r||(g=!0,u.prime(),h=setInterval(w,t.flushInterval),h?.unref?.(),m(j))},stop:()=>{g&&(g=!1,h&&=(clearInterval(h),null),_?.(),_=null,w(!0))}}},w=`__intlayer_analytics_client__`,T=`__intlayer_analytics_ref_count__`,E=()=>typeof window>`u`?null:window[w]??null,D=e=>{typeof window<`u`&&(window[w]=e)},O=()=>{if(typeof window>`u`)return 0;let e=window;return e[T]=(e[T]??0)+1,e[T]},k=()=>{if(typeof window>`u`)return 0;let e=window;return e[T]=Math.max(0,(e[T]??0)-1),e[T]},A=()=>{O();let e=E();if(e)return e;let n=C({backendURL:t.editor?.backendURL??``,clientId:t.editor?.clientId,flushInterval:t.analytics?.flushInterval??2e4,maxBufferSize:500,sampleRate:t.analytics?.sampleRate??1});return D(n),n.start(),n},j=()=>{k()>0||(E()?.stop(),D(null))};exports.buildContentExposure=r,exports.getGlobalAnalyticsClient=E,exports.initAnalyticsClient=A,exports.stopAnalyticsClient=j;
|