vue-intlayer 9.7.0 → 9.7.2
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/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/devtools/editDictionaryContent.cjs +1 -1
- 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/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/html/index.cjs +1 -1
- package/dist/cjs/html/installIntlayerHTML.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 +26 -27
- package/dist/esm/client/useDictionaryAsync.mjs +6 -7
- package/dist/esm/client/useDictionaryDynamic.mjs +9 -10
- package/dist/esm/client/useIntlayer.mjs +19 -20
- 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 +14 -15
- package/dist/esm/devtools/editorServer.mjs +1 -2
- package/dist/esm/devtools/formatDictionaryForInspector.mjs +20 -33
- package/dist/esm/devtools/index.mjs +57 -58
- package/dist/esm/editor/ContentSelector.mjs +1 -3
- package/dist/esm/editor/useEditor.mjs +11 -12
- package/dist/esm/format/index.mjs +10 -10
- package/dist/esm/format/useCompact.mjs +1 -2
- package/dist/esm/format/useCurrency.mjs +1 -2
- package/dist/esm/format/useDate.mjs +1 -2
- package/dist/esm/format/useIntl.mjs +1 -2
- package/dist/esm/format/useList.mjs +1 -2
- package/dist/esm/format/useNumber.mjs +1 -2
- package/dist/esm/format/usePercentage.mjs +1 -2
- package/dist/esm/format/useRelativeTime.mjs +1 -2
- package/dist/esm/format/useUnit.mjs +1 -2
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getIntlayer.mjs +1 -2
- package/dist/esm/html/HTMLRenderer.mjs +8 -9
- package/dist/esm/html/index.mjs +3 -3
- package/dist/esm/html/installIntlayerHTML.mjs +13 -14
- 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 +76 -77
- 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/package.json +51 -51
- package/dist/esm-CXlI80Tk.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INTLAYER_SYMBOL as e } from "../client/installIntlayer.mjs";
|
|
2
2
|
import { computed as t, inject as n } from "vue";
|
|
3
3
|
import { relativeTime as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useRelativeTime.ts
|
|
5
5
|
var i = () => {
|
|
6
6
|
let i = n(e, null);
|
|
7
7
|
return t(() => {
|
|
@@ -12,5 +12,4 @@ var i = () => {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { i as useRelativeTime };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INTLAYER_SYMBOL as e } from "../client/installIntlayer.mjs";
|
|
2
2
|
import { computed as t, inject as n } from "vue";
|
|
3
3
|
import { units as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useUnit.ts
|
|
5
5
|
var i = () => {
|
|
6
6
|
let i = n(e, null);
|
|
7
7
|
return t(() => {
|
|
@@ -12,5 +12,4 @@ var i = () => {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { i as useUnit };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getDictionary as t } from "@intlayer/core/interpreter";
|
|
3
|
-
|
|
3
|
+
// src/getDictionary.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 getDictionary };
|
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 };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useHTML as e } from "./installIntlayerHTML.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { defineComponent as t, h as n } from "vue";
|
|
3
|
+
import { getHTML as r } from "@intlayer/core/interpreter";
|
|
4
4
|
import { VOID_HTML_ELEMENTS as i } from "@intlayer/core/transpiler";
|
|
5
|
-
|
|
6
|
-
var a = (e, { components:
|
|
7
|
-
let a = Object.fromEntries(Object.entries(
|
|
5
|
+
// src/html/HTMLRenderer.ts
|
|
6
|
+
var a = (e, { components: t = {} } = {}) => {
|
|
7
|
+
let a = Object.fromEntries(Object.entries(t).filter(([, e]) => e).map(([e, t]) => [e, (e) => n(t, e, e?.children)])), o = new Proxy(a, { get(e, t) {
|
|
8
8
|
if (typeof t == "string" && t in e) return e[t];
|
|
9
|
-
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return i.has(t) ? ({ children: e, ...
|
|
9
|
+
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return i.has(t) ? ({ children: e, ...r }) => n(t, r) : (e) => n(t, e, e?.children);
|
|
10
10
|
} });
|
|
11
|
-
return
|
|
11
|
+
return r(e, o);
|
|
12
12
|
}, o = ({ components: t } = {}) => {
|
|
13
13
|
let n = e();
|
|
14
14
|
return (e) => n ? n.renderHTML(e, { components: t }) : a(e, { components: t });
|
|
15
|
-
}, s =
|
|
15
|
+
}, s = t({
|
|
16
16
|
name: "HTMLRenderer",
|
|
17
17
|
props: {
|
|
18
18
|
content: {
|
|
@@ -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,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }, i), o = (
|
|
1
|
+
import { inject as e, provide as t } from "vue";
|
|
2
|
+
import { getHTML as n } from "@intlayer/core/interpreter";
|
|
3
|
+
// src/html/installIntlayerHTML.ts
|
|
4
|
+
var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }, i), o = (e, i) => {
|
|
5
5
|
let o;
|
|
6
6
|
if (typeof i == "function") o = i;
|
|
7
7
|
else {
|
|
8
|
-
let { components:
|
|
9
|
-
o =
|
|
8
|
+
let { components: e, renderHTML: t } = i ?? {};
|
|
9
|
+
o = t || ((t, r) => {
|
|
10
10
|
let { components: i, ...a } = r && typeof r == "object" && "components" in r ? r : { components: r }, o = i || a, s = {
|
|
11
|
-
...
|
|
11
|
+
...e,
|
|
12
12
|
...o
|
|
13
13
|
};
|
|
14
|
-
return
|
|
14
|
+
return n(t, s);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
let s = a((e,
|
|
18
|
-
return
|
|
19
|
-
} } : o(e,
|
|
20
|
-
|
|
21
|
-
}, s = { install: o }, c = () =>
|
|
22
|
-
//#endregion
|
|
17
|
+
let s = a((e, n) => typeof i == "function" || typeof i == "object" && i?.renderHTML ? { setup() {
|
|
18
|
+
return t(r, { renderHTML: void 0 }), () => o(e, n);
|
|
19
|
+
} } : o(e, n));
|
|
20
|
+
e.provide(r, s);
|
|
21
|
+
}, s = { install: o }, c = () => e(r);
|
|
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 { useAnalytics as f } from "./analytics/useAnalytics.mjs";
|
|
6
|
-
import { useConversion as p } from "./analytics/useConversion.mjs";
|
|
7
|
-
import { useExperiment as m } from "./analytics/useExperiment.mjs";
|
|
1
|
+
import { INTLAYER_SYMBOL as e, createIntlayerClient as t, installIntlayer as n, intlayer as r } from "./client/installIntlayer.mjs";
|
|
2
|
+
import { useAnalytics as i } from "./analytics/useAnalytics.mjs";
|
|
3
|
+
import { useConversion as a } from "./analytics/useConversion.mjs";
|
|
4
|
+
import { useExperiment as o } from "./analytics/useExperiment.mjs";
|
|
8
5
|
import "./analytics/index.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
6
|
+
import { useEditor as s } from "./editor/useEditor.mjs";
|
|
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 { e as INTLAYER_SYMBOL, l as atPath, t as createIntlayerClient, u as createIntlayerLeafProxy, c as getDictionary, v as getIntlayer, w as getPlugins, T as htmlPlugin, E as insertionPlugin, n as installIntlayer, r as intlayer, D as intlayerNodePlugins, d as isComponentLike, f as isIntlayerNode, p as isObjectLike, O as markdownPlugin, k as markdownStringPlugin, m as toComponent, i as useAnalytics, a as useConversion, h as useDictionary, g as useDictionaryAsync, _ as useDictionaryDynamic, s as useEditor, o 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 {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null :
|
|
5
|
+
import { editor as i, internationalization as a } from "@intlayer/config/built";
|
|
6
|
+
import { Fragment as o, defineAsyncComponent as s, h as c, markRaw as l } from "vue";
|
|
7
|
+
import { conditionPlugin as u, enumerationPlugin as d, fallbackPlugin as f, filePlugin as p, genderPlugin as m, isInterpolableWrapperNode as h, nestedPlugin as g, pluralPlugin as _, resolveInsertedSelector as v, resolveInterpreterLocale as y, selectPlugin as b, splitInsertionTemplate as x, transformInterpolableNode as S, translationPlugin as C } from "@intlayer/core/interpreter";
|
|
8
|
+
import { getMarkdownMetadata as w } from "@intlayer/core/markdown";
|
|
9
|
+
import * as T from "@intlayer/types/nodeType";
|
|
10
|
+
// src/plugins.ts
|
|
11
|
+
var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : s(() => 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 u = (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 ? () => c(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
|
+
}), d = u(a);
|
|
29
|
+
if (typeof a != "function") return d;
|
|
30
|
+
let f = (...e) => {
|
|
31
|
+
let t = a(...e);
|
|
32
|
+
return u(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(f, Object.getPrototypeOf(d));
|
|
35
|
+
for (let e of Object.getOwnPropertyNames(d)) {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(d, e);
|
|
37
|
+
t && Object.defineProperty(f, 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(d)) {
|
|
40
|
+
let t = Object.getOwnPropertyDescriptor(d, e);
|
|
41
|
+
t && Object.defineProperty(f, e, t);
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return l(f);
|
|
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 = x(e, r);
|
|
49
49
|
if (n.size > 0) {
|
|
50
50
|
let e = [];
|
|
51
51
|
if (i.isSimple) {
|
|
@@ -54,7 +54,7 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
54
54
|
let a = `__VNODE_${i}__`, o = t.indexOf(a);
|
|
55
55
|
o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
|
|
56
56
|
}
|
|
57
|
-
return r < t.length && e.push(t.substring(r)),
|
|
57
|
+
return r < t.length && e.push(t.substring(r)), c(o, null, ...e);
|
|
58
58
|
}
|
|
59
59
|
return i.parts.forEach((t) => {
|
|
60
60
|
if (typeof t == "string") {
|
|
@@ -65,22 +65,22 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
65
65
|
}
|
|
66
66
|
r.length > 0 && e.push(r);
|
|
67
67
|
} else e.push(t);
|
|
68
|
-
}),
|
|
68
|
+
}), c(o, null, ...e);
|
|
69
69
|
}
|
|
70
|
-
return i.isSimple ? i.parts :
|
|
71
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
70
|
+
return i.isSimple ? i.parts : c(o, null, i.parts);
|
|
71
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? f : {
|
|
72
72
|
id: "insertion-plugin",
|
|
73
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
73
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
|
-
let r = [...t.keyPath, { type:
|
|
75
|
+
let r = [...t.keyPath, { type: T.INSERTION }], i = e[T.INSERTION], a = {
|
|
76
76
|
id: "insertion-string-plugin",
|
|
77
|
-
canHandle: (e) => typeof e == "string" ||
|
|
77
|
+
canHandle: (e) => typeof e == "string" || h(e),
|
|
78
78
|
transform: (e, n, r) => {
|
|
79
|
-
if (
|
|
79
|
+
if (h(e)) return (i) => S(e, i, n, t.plugins, r);
|
|
80
80
|
let i = r(e, {
|
|
81
81
|
...n,
|
|
82
82
|
children: e,
|
|
83
|
-
plugins:
|
|
83
|
+
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
84
84
|
});
|
|
85
85
|
return (e) => {
|
|
86
86
|
let a = O(i, 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 v(i, o);
|
|
101
101
|
}
|
|
102
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
102
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
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, l = a(w(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,33 +113,33 @@ 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
|
+
}), u = (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 ? c(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: l,
|
|
133
|
+
use: (e) => u(e)
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
-
return
|
|
136
|
+
return u();
|
|
137
137
|
}
|
|
138
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
138
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
139
139
|
id: "markdown-plugin",
|
|
140
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
140
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.MARKDOWN,
|
|
141
141
|
transform: (e, t, n) => {
|
|
142
|
-
let r = [...t.keyPath, { type:
|
|
142
|
+
let r = [...t.keyPath, { type: T.MARKDOWN }], i = e[T.MARKDOWN];
|
|
143
143
|
return n(i, {
|
|
144
144
|
...t,
|
|
145
145
|
children: i,
|
|
@@ -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" ? f : {
|
|
151
151
|
id: "html-plugin",
|
|
152
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
152
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.HTML,
|
|
153
153
|
transform: (e, n) => {
|
|
154
|
-
let
|
|
154
|
+
let a = e[T.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 ? () => c(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 = y(e), r = `${n}_${t}`;
|
|
173
173
|
if (N.has(r)) return N.get(r);
|
|
174
|
-
let
|
|
174
|
+
let i = [
|
|
175
175
|
D,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
c,
|
|
176
|
+
C(n, t ? a.defaultLocale : void 0),
|
|
177
|
+
d,
|
|
178
|
+
_(n),
|
|
179
|
+
u,
|
|
180
|
+
g(n),
|
|
181
|
+
p,
|
|
183
182
|
m,
|
|
183
|
+
b,
|
|
184
184
|
k,
|
|
185
185
|
j,
|
|
186
186
|
M
|
|
187
|
-
].filter((e) => e !==
|
|
188
|
-
return N.set(r,
|
|
187
|
+
].filter((e) => e !== f);
|
|
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;
|