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,5 +1,5 @@
|
|
|
1
1
|
import { reactive as e } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/client/useLoadDynamic.ts
|
|
3
3
|
var t = (n, r) => {
|
|
4
4
|
let i = t._cache ??= /* @__PURE__ */ new Map(), a = e({});
|
|
5
5
|
if (i.has(n)) i.get(n)?.then((e) => {
|
|
@@ -11,5 +11,4 @@ var t = (n, r) => {
|
|
|
11
11
|
}
|
|
12
12
|
return a;
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { t as useLoadDynamic };
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { INTLAYER_SYMBOL as e } from "./installIntlayer.mjs";
|
|
2
|
+
import { setLocaleInStorage as t } from "./useLocaleStorage.mjs";
|
|
3
3
|
import { internationalization as n } from "@intlayer/config/built";
|
|
4
4
|
import { computed as r, inject as i } from "vue";
|
|
5
|
-
|
|
5
|
+
// src/client/useLocale.ts
|
|
6
6
|
var { defaultLocale: a, locales: o } = n ?? {}, s = ({ isCookieEnabled: n, onLocaleChange: s } = {}) => {
|
|
7
|
-
let c = i(
|
|
7
|
+
let c = i(e);
|
|
8
8
|
return {
|
|
9
9
|
locale: r(() => c?.locale?.value ?? a),
|
|
10
10
|
defaultLocale: a,
|
|
11
11
|
availableLocales: o,
|
|
12
|
-
setLocale: (
|
|
13
|
-
|
|
14
|
-
console.error(`Locale ${t} is not available`);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
c && c.setLocale(t), e(t, n ?? c?.isCookieEnabled ?? !0), s?.(t);
|
|
12
|
+
setLocale: (e) => {
|
|
13
|
+
o?.map(String).includes(e) ? (c && c.setLocale(e), t(e, n ?? c?.isCookieEnabled ?? !0), s?.(e)) : console.error(`Locale ${e} is not available`);
|
|
18
14
|
}
|
|
19
15
|
};
|
|
20
16
|
};
|
|
21
|
-
//#endregion
|
|
22
17
|
export { s as useLocale };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed as e } from "vue";
|
|
2
2
|
import { LocaleStorageClient as t, getCachedLocaleFromStorageClient as n, getLocaleFromStorageClient as r, localeStorageOptions as i, setLocaleInStorageClient as a } from "@intlayer/core/utils";
|
|
3
|
-
|
|
3
|
+
// src/client/useLocaleStorage.ts
|
|
4
4
|
var o = n, s = /* @__PURE__ */ r(i), c = s, l = (e, t) => a(e, {
|
|
5
5
|
...i,
|
|
6
6
|
isCookieEnabled: t
|
|
@@ -14,5 +14,4 @@ var o = n, s = /* @__PURE__ */ r(i), c = s, l = (e, t) => a(e, {
|
|
|
14
14
|
setLocaleStorage: r.setLocale
|
|
15
15
|
};
|
|
16
16
|
}, f = d;
|
|
17
|
-
//#endregion
|
|
18
17
|
export { o as getLocaleInStorage, c as localeCookie, s as localeInStorage, u as setLocaleCookie, l as setLocaleInStorage, f as useLocaleCookie, d as useLocaleStorage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed as e, onMounted as t, onUnmounted as n, ref as r } from "vue";
|
|
2
2
|
import { getPathWithoutLocale as i } from "@intlayer/core/localization";
|
|
3
|
-
|
|
3
|
+
// src/client/usePathname.ts
|
|
4
4
|
var a = () => {
|
|
5
5
|
let a = r(typeof window < "u" ? window.location.pathname : ""), o = () => {
|
|
6
6
|
a.value = window.location.pathname;
|
|
@@ -11,5 +11,4 @@ var a = () => {
|
|
|
11
11
|
window.removeEventListener("popstate", o);
|
|
12
12
|
}), e(() => i(a.value));
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { a as usePathname };
|
|
@@ -2,7 +2,7 @@ import { useLocale as e } from "./useLocale.mjs";
|
|
|
2
2
|
import { routing as t } from "@intlayer/config/built";
|
|
3
3
|
import { watch as n } from "vue";
|
|
4
4
|
import { getRewritePath as r } from "@intlayer/core/localization";
|
|
5
|
-
|
|
5
|
+
// src/client/useRewriteURL.ts
|
|
6
6
|
var i = () => {
|
|
7
7
|
let { locale: i } = e(), a = t?.rewrite;
|
|
8
8
|
n(i, (e) => {
|
|
@@ -11,5 +11,4 @@ var i = () => {
|
|
|
11
11
|
n && n !== t && window.history.replaceState(window.history.state, "", n + window.location.search + window.location.hash);
|
|
12
12
|
}, { immediate: !0 });
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { i as useRewriteURL };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { internationalization as e } from "@intlayer/config/built";
|
|
2
|
-
|
|
2
|
+
// src/devtools/buildLocalesInspectorNode.ts
|
|
3
3
|
var t = "intlayer-locales", n = "locale:", r = ":current", { locales: i } = e ?? {}, a = (e) => e.startsWith(n), o = (e) => e.slice(7).replace(r, ""), s = (e) => {
|
|
4
4
|
let a = i ?? [];
|
|
5
5
|
return {
|
|
@@ -16,5 +16,4 @@ var t = "intlayer-locales", n = "locale:", r = ":current", { locales: i } = e ??
|
|
|
16
16
|
}))
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { r as CURRENT_LOCALE_NODE_ID_SUFFIX, t as LOCALES_GROUP_NODE_ID, n as LOCALE_NODE_ID_PREFIX, s as buildLocalesInspectorNode, o as getLocaleFromNodeId, a as isLocaleNodeId };
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import { listInspectorEntries as e } from "./formatDictionaryForInspector.mjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = (e,
|
|
6
|
-
let a =
|
|
7
|
-
return typeof a == "string" ? "plain-string" : i(a) && a.nodeType ===
|
|
2
|
+
import { editDictionaryByKeyPath as t, getContentNodeByKeyPath as n } from "@intlayer/core/dictionaryManipulator";
|
|
3
|
+
import * as r from "@intlayer/types/nodeType";
|
|
4
|
+
// src/devtools/editDictionaryContent.ts
|
|
5
|
+
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = (e, t) => {
|
|
6
|
+
let a = n(e.content, t);
|
|
7
|
+
return typeof a == "string" ? "plain-string" : i(a) && a.nodeType === r.TRANSLATION && i(a[r.TRANSLATION]) && Object.values(a[r.TRANSLATION]).every((e) => typeof e == "string") ? "translation" : null;
|
|
8
8
|
}, o = (e, t = "Translations") => {
|
|
9
9
|
let [n, r, ...i] = e[0] === t ? e.slice(1) : e;
|
|
10
10
|
return !n || i.length > 0 ? null : r ? {
|
|
11
11
|
label: n,
|
|
12
12
|
locale: r
|
|
13
13
|
} : { label: n };
|
|
14
|
-
}, s = (
|
|
15
|
-
let i = e(
|
|
16
|
-
return i ?
|
|
17
|
-
type:
|
|
18
|
-
key:
|
|
14
|
+
}, s = (t, n) => {
|
|
15
|
+
let i = e(t).find(({ label: e }) => e === n.label);
|
|
16
|
+
return i ? n.locale ? [...i.keyPath, {
|
|
17
|
+
type: r.TRANSLATION,
|
|
18
|
+
key: n.locale
|
|
19
19
|
}] : i.keyPath : null;
|
|
20
|
-
}, c = (e,
|
|
21
|
-
if (typeof
|
|
22
|
-
let a =
|
|
20
|
+
}, c = (e, r, i) => {
|
|
21
|
+
if (typeof n(e.content, r) != "string") return null;
|
|
22
|
+
let a = t(structuredClone(e.content), r, i);
|
|
23
23
|
return {
|
|
24
24
|
...e,
|
|
25
25
|
content: a
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { c as applyDictionaryEdit, s as getEditKeyPath, a as getEditability, o as parseEditPath };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getEditorAPI as e } from "@intlayer/api/editor";
|
|
2
|
-
|
|
2
|
+
// src/devtools/editorServer.ts
|
|
3
3
|
var t = () => {
|
|
4
4
|
let t = e({ credentials: "omit" }), n = !1;
|
|
5
5
|
return {
|
|
@@ -17,5 +17,4 @@ var t = () => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { t as createEditorServerSession };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as e from "@intlayer/types/nodeType";
|
|
2
|
-
|
|
2
|
+
// src/devtools/formatDictionaryForInspector.ts
|
|
3
3
|
var t = "(root)", n = (e) => typeof e == "object" && !!e && !Array.isArray(e), r = (t) => n(t) && t.nodeType === e.TRANSLATION && n(t.translation), i = (e) => {
|
|
4
4
|
if (typeof e == "string") return e;
|
|
5
5
|
try {
|
|
@@ -12,39 +12,27 @@ var t = "(root)", n = (e) => typeof e == "object" && !!e && !Array.isArray(e), r
|
|
|
12
12
|
return t.includes(".") ? JSON.stringify(t) : t;
|
|
13
13
|
}).join("."), o = (t, s, c) => {
|
|
14
14
|
let l = a(s);
|
|
15
|
-
if (r(t)) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (Array.isArray(t)) {
|
|
32
|
-
t.forEach((t, n) => {
|
|
33
|
-
o(t, [...s, {
|
|
34
|
-
type: e.ARRAY,
|
|
35
|
-
key: n
|
|
36
|
-
}], c);
|
|
37
|
-
});
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (n(t)) {
|
|
41
|
-
for (let [n, r] of Object.entries(t)) o(r, [...s, {
|
|
42
|
-
type: e.OBJECT,
|
|
15
|
+
if (r(t)) c.push({
|
|
16
|
+
label: l,
|
|
17
|
+
keyPath: s,
|
|
18
|
+
value: t.translation
|
|
19
|
+
});
|
|
20
|
+
else if (n(t) && typeof t.nodeType == "string") c.push({
|
|
21
|
+
label: l,
|
|
22
|
+
keyPath: s,
|
|
23
|
+
value: i(t[t.nodeType])
|
|
24
|
+
});
|
|
25
|
+
else if (Array.isArray(t)) t.forEach((t, n) => {
|
|
26
|
+
o(t, [...s, {
|
|
27
|
+
type: e.ARRAY,
|
|
43
28
|
key: n
|
|
44
29
|
}], c);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
});
|
|
31
|
+
else if (n(t)) for (let [n, r] of Object.entries(t)) o(r, [...s, {
|
|
32
|
+
type: e.OBJECT,
|
|
33
|
+
key: n
|
|
34
|
+
}], c);
|
|
35
|
+
else s.length > 0 && c.push({
|
|
48
36
|
label: l,
|
|
49
37
|
keyPath: s,
|
|
50
38
|
value: i(t)
|
|
@@ -53,5 +41,4 @@ var t = "(root)", n = (e) => typeof e == "object" && !!e && !Array.isArray(e), r
|
|
|
53
41
|
let t = [];
|
|
54
42
|
return o(e.content, [], t), t;
|
|
55
43
|
}, c = (e) => Object.fromEntries(s(e).map(({ label: e, value: t }) => [e, t]));
|
|
56
|
-
//#endregion
|
|
57
44
|
export { t as ROOT_PATH, c as formatDictionaryForInspector, s as listInspectorEntries };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { applyDictionaryEdit as
|
|
5
|
-
import { createEditorServerSession as
|
|
6
|
-
import {
|
|
1
|
+
import { createIntlayerClient as e } from "../client/installIntlayer.mjs";
|
|
2
|
+
import { setLocaleInStorage as t } from "../client/useLocaleStorage.mjs";
|
|
3
|
+
import { buildLocalesInspectorNode as n, getLocaleFromNodeId as r, isLocaleNodeId as i } from "./buildLocalesInspectorNode.mjs";
|
|
4
|
+
import { applyDictionaryEdit as a, getEditKeyPath as o, getEditability as s, parseEditPath as c } from "./editDictionaryContent.mjs";
|
|
5
|
+
import { createEditorServerSession as l } from "./editorServer.mjs";
|
|
6
|
+
import { formatDictionaryForInspector as u, listInspectorEntries as d } from "./formatDictionaryForInspector.mjs";
|
|
7
7
|
import { internationalization as f } from "@intlayer/config/built";
|
|
8
8
|
import { watch as p } from "vue";
|
|
9
9
|
import { getDictionaries as m } from "@intlayer/dictionaries-entry";
|
|
10
10
|
import { setupDevtoolsPlugin as h } from "@vue/devtools-api";
|
|
11
|
-
|
|
11
|
+
// src/devtools/index.ts
|
|
12
12
|
var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-offline", { defaultLocale: y, locales: b } = f ?? {}, x = h, S = (e) => e.localId ?? e.key, C = (e, t) => Object.values(e).flat().find((e) => S(e) === t), w = (e) => e.locale ?? e.filePath?.split("/").pop() ?? "declaration", T = (f) => {
|
|
13
13
|
x({
|
|
14
14
|
id: g,
|
|
@@ -18,7 +18,7 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
18
18
|
componentStateTypes: [g],
|
|
19
19
|
app: f
|
|
20
20
|
}, (f) => {
|
|
21
|
-
let h =
|
|
21
|
+
let h = l();
|
|
22
22
|
h.fetchUnmergedDictionaries().then((e) => {
|
|
23
23
|
e && f.sendInspectorTree(_);
|
|
24
24
|
}), f.addInspector({
|
|
@@ -30,23 +30,23 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
30
30
|
icon: "check",
|
|
31
31
|
tooltip: "Set as current locale",
|
|
32
32
|
action: (n) => {
|
|
33
|
-
if (!
|
|
34
|
-
let
|
|
35
|
-
if (!b?.map(String).includes(
|
|
36
|
-
console.error(`Locale ${
|
|
33
|
+
if (!i(n)) return;
|
|
34
|
+
let a = r(n);
|
|
35
|
+
if (!b?.map(String).includes(a)) {
|
|
36
|
+
console.error(`Locale ${a} is not available`);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
|
|
39
|
+
let o = e();
|
|
40
|
+
o.setLocale(a), t(a, o.isCookieEnabled ?? !0), f.sendInspectorTree(_), f.sendInspectorState(_);
|
|
41
41
|
}
|
|
42
42
|
}]
|
|
43
|
-
}), p(() =>
|
|
43
|
+
}), p(() => e().locale.value, () => {
|
|
44
44
|
f.sendInspectorTree(_), f.sendInspectorState(_);
|
|
45
|
-
}), f.on.getInspectorTree(async (
|
|
46
|
-
if (
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
|
|
45
|
+
}), f.on.getInspectorTree(async (t) => {
|
|
46
|
+
if (t.inspectorId !== "intlayer-dictionaries-inspector") return;
|
|
47
|
+
let r = e().locale.value ?? y, i = await h.fetchUnmergedDictionaries();
|
|
48
|
+
if (i) {
|
|
49
|
+
t.rootNodes = [...Object.entries(i).flatMap(([e, t]) => t.map((n) => ({
|
|
50
50
|
id: S(n),
|
|
51
51
|
label: t.length > 1 ? `${e} (${w(n)})` : e,
|
|
52
52
|
tags: [{
|
|
@@ -54,15 +54,15 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
54
54
|
textColor: 16777215,
|
|
55
55
|
backgroundColor: 4372611
|
|
56
56
|
}]
|
|
57
|
-
}))),
|
|
57
|
+
}))), n(r)];
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
...
|
|
60
|
+
let a = m(), o = Object.keys(a);
|
|
61
|
+
t.rootNodes = [
|
|
62
|
+
...o.length === 0 ? [{
|
|
63
63
|
id: "intlayer-no-dictionaries",
|
|
64
64
|
label: "No dictionaries loaded. Add an Intlayer build plugin (e.g. vite-intlayer) to generate them."
|
|
65
|
-
}] :
|
|
65
|
+
}] : o.map((e) => ({
|
|
66
66
|
id: e,
|
|
67
67
|
label: e
|
|
68
68
|
})),
|
|
@@ -70,34 +70,34 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
70
70
|
id: v,
|
|
71
71
|
label: "Enable live editing (editor server)"
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
n(r)
|
|
74
74
|
];
|
|
75
|
-
}), f.on.getInspectorState(async (
|
|
76
|
-
if (
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
79
|
-
|
|
75
|
+
}), f.on.getInspectorState(async (t) => {
|
|
76
|
+
if (t.inspectorId !== "intlayer-dictionaries-inspector") return;
|
|
77
|
+
let n = e().locale.value ?? y;
|
|
78
|
+
if (t.nodeId === "intlayer-locales") {
|
|
79
|
+
t.state = { Locales: (b ?? []).map((e) => ({
|
|
80
80
|
key: e,
|
|
81
|
-
value: e ===
|
|
81
|
+
value: e === n ? "current" : "",
|
|
82
82
|
editable: !1
|
|
83
83
|
})) };
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
let
|
|
88
|
-
|
|
86
|
+
if (i(t.nodeId)) {
|
|
87
|
+
let e = r(t.nodeId);
|
|
88
|
+
t.state = { Locale: [{
|
|
89
89
|
key: "locale",
|
|
90
|
-
value:
|
|
90
|
+
value: e,
|
|
91
91
|
editable: !1
|
|
92
92
|
}, {
|
|
93
93
|
key: "current",
|
|
94
|
-
value:
|
|
94
|
+
value: e === n,
|
|
95
95
|
editable: !1
|
|
96
96
|
}] };
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
99
|
+
if (t.nodeId === "intlayer-editor-offline") {
|
|
100
|
+
t.state = { "Live editing": [
|
|
101
101
|
{
|
|
102
102
|
key: "status",
|
|
103
103
|
value: "Intlayer editor server not detected",
|
|
@@ -116,46 +116,46 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
116
116
|
] };
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
let a = await h.fetchUnmergedDictionaries(),
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
Translations:
|
|
119
|
+
let a = await h.fetchUnmergedDictionaries(), o = a ? C(a, t.nodeId) : void 0;
|
|
120
|
+
if (o) {
|
|
121
|
+
t.state = {
|
|
122
|
+
Translations: d(o).map(({ label: e, keyPath: t, value: n }) => ({
|
|
123
123
|
key: e,
|
|
124
124
|
value: n,
|
|
125
|
-
editable: o
|
|
125
|
+
editable: s(o, t) !== null
|
|
126
126
|
})),
|
|
127
127
|
Metadata: [
|
|
128
128
|
{
|
|
129
129
|
key: "key",
|
|
130
|
-
value:
|
|
130
|
+
value: o.key,
|
|
131
131
|
editable: !1
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
key: "title",
|
|
135
|
-
value:
|
|
135
|
+
value: o.title ?? "",
|
|
136
136
|
editable: !1
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
key: "description",
|
|
140
|
-
value:
|
|
140
|
+
value: o.description ?? "",
|
|
141
141
|
editable: !1
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
key: "file",
|
|
145
|
-
value:
|
|
145
|
+
value: o.filePath ?? "",
|
|
146
146
|
editable: !1
|
|
147
147
|
}
|
|
148
148
|
]
|
|
149
149
|
};
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
let c = m()[
|
|
152
|
+
let c = m()[t.nodeId];
|
|
153
153
|
if (!c) {
|
|
154
|
-
|
|
154
|
+
t.state = {};
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
let l =
|
|
158
|
-
|
|
157
|
+
let l = u(c);
|
|
158
|
+
t.state = {
|
|
159
159
|
Translations: Object.entries(l).map(([e, t]) => ({
|
|
160
160
|
key: e,
|
|
161
161
|
value: t,
|
|
@@ -183,15 +183,15 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
183
183
|
let g = Promise.resolve();
|
|
184
184
|
f.on.editInspectorState((e) => {
|
|
185
185
|
if (e.inspectorId !== "intlayer-dictionaries-inspector" || e.state.remove) return;
|
|
186
|
-
let t =
|
|
186
|
+
let t = c(e.path), n = e.state.value;
|
|
187
187
|
if (t && typeof n == "string") return g = g.catch(() => {}).then(async () => {
|
|
188
188
|
let r = await h.fetchUnmergedDictionaries();
|
|
189
189
|
if (!r) return;
|
|
190
|
-
let
|
|
191
|
-
if (!
|
|
192
|
-
let s =
|
|
190
|
+
let i = C(r, e.nodeId);
|
|
191
|
+
if (!i) return;
|
|
192
|
+
let s = o(i, t);
|
|
193
193
|
if (!s) return;
|
|
194
|
-
let c = i
|
|
194
|
+
let c = a(i, s, n);
|
|
195
195
|
if (c) try {
|
|
196
196
|
await h.writeDictionary(c);
|
|
197
197
|
} catch (e) {
|
|
@@ -203,5 +203,4 @@ var g = "intlayer", _ = "intlayer-dictionaries-inspector", v = "intlayer-editor-
|
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
|
-
//#endregion
|
|
207
206
|
export { v as EDITOR_OFFLINE_NODE_ID, g as INTLAYER_DEVTOOLS_PLUGIN_ID, _ as INTLAYER_DICTIONARIES_INSPECTOR_ID, T as enableIntlayerDevtools };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineComponent as e, h as t } from "vue";
|
|
2
2
|
import { isEnabled as n } from "@intlayer/editor/isEnabled";
|
|
3
|
-
|
|
4
|
-
//#region src/editor/ContentSelector.vue
|
|
3
|
+
// src/editor/ContentSelector.vue
|
|
5
4
|
var r = e({
|
|
6
5
|
name: "ContentSelector",
|
|
7
6
|
props: {
|
|
@@ -21,5 +20,4 @@ var r = e({
|
|
|
21
20
|
}, r.default?.());
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
//#endregion
|
|
25
23
|
export { r as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { INTLAYER_SYMBOL as e } from "../client/installIntlayer.mjs";
|
|
2
|
+
import { setLocaleInStorage as t } from "../client/useLocaleStorage.mjs";
|
|
3
3
|
import { inject as n, onMounted as r, onUnmounted as i, watchEffect as a } from "vue";
|
|
4
4
|
import { isEnabled as o } from "@intlayer/editor/isEnabled";
|
|
5
|
-
|
|
6
|
-
var s = (
|
|
7
|
-
let n =
|
|
5
|
+
// src/editor/useEditor.ts
|
|
6
|
+
var s = (e) => {
|
|
7
|
+
let n = e?.locale, r = null, i = null, o = !1;
|
|
8
8
|
return import("@intlayer/editor").then(({ initEditorClient: s }) => {
|
|
9
9
|
if (o) return;
|
|
10
10
|
let c = s();
|
|
@@ -12,20 +12,20 @@ var s = (t) => {
|
|
|
12
12
|
let e = n.value;
|
|
13
13
|
e && c.currentLocale.set(e);
|
|
14
14
|
})), i = c.onLocaleChangeRequested((n) => {
|
|
15
|
-
|
|
15
|
+
e?.setLocale(n), t(n, !0);
|
|
16
16
|
});
|
|
17
17
|
}).catch(() => {}), () => {
|
|
18
18
|
o = !0, r?.(), i?.(), import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
19
19
|
e();
|
|
20
20
|
}).catch(() => {});
|
|
21
21
|
};
|
|
22
|
-
}, c = (
|
|
22
|
+
}, c = (t) => {
|
|
23
23
|
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !o) return;
|
|
24
|
-
if (
|
|
24
|
+
if (t) {
|
|
25
25
|
let n = null;
|
|
26
|
-
|
|
26
|
+
t.mixin({
|
|
27
27
|
inject: { _intlayerClient: {
|
|
28
|
-
from:
|
|
28
|
+
from: e,
|
|
29
29
|
default: null
|
|
30
30
|
} },
|
|
31
31
|
mounted() {
|
|
@@ -39,12 +39,11 @@ var s = (t) => {
|
|
|
39
39
|
});
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
let a = n(
|
|
42
|
+
let a = n(e), c = null;
|
|
43
43
|
r(() => {
|
|
44
44
|
c = s(a);
|
|
45
45
|
}), i(() => {
|
|
46
46
|
c?.();
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
|
-
//#endregion
|
|
50
49
|
export { c as useEditor };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
export {
|
|
1
|
+
import { useCompact as e } from "./useCompact.mjs";
|
|
2
|
+
import { useCurrency as t } from "./useCurrency.mjs";
|
|
3
|
+
import { useDate as n } from "./useDate.mjs";
|
|
4
|
+
import { useIntl as r } from "./useIntl.mjs";
|
|
5
|
+
import { useList as i } from "./useList.mjs";
|
|
6
|
+
import { useNumber as a } from "./useNumber.mjs";
|
|
7
|
+
import { usePercentage as o } from "./usePercentage.mjs";
|
|
8
|
+
import { useRelativeTime as s } from "./useRelativeTime.mjs";
|
|
9
|
+
import { useUnit as c } from "./useUnit.mjs";
|
|
10
|
+
export { e as useCompact, t as useCurrency, n as useDate, r as useIntl, i as useList, a as useNumber, o as usePercentage, s as useRelativeTime, c as useUnit };
|
|
@@ -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 { compact as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useCompact.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 useCompact };
|
|
@@ -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 { currency as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useCurrency.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 useCurrency };
|
|
@@ -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 { date as r, presets as i } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useDate.ts
|
|
5
5
|
var a = () => {
|
|
6
6
|
let a = n(e, null);
|
|
7
7
|
return t(() => {
|
|
@@ -18,5 +18,4 @@ var a = () => {
|
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { a as useDate };
|
|
@@ -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 { bindIntl as r } from "@intlayer/core/utils";
|
|
4
|
-
|
|
4
|
+
// src/format/useIntl.ts
|
|
5
5
|
var i = (i) => {
|
|
6
6
|
let a = n(e, null);
|
|
7
7
|
return t(() => {
|
|
@@ -9,5 +9,4 @@ var i = (i) => {
|
|
|
9
9
|
return r(e);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { i as useIntl };
|
|
@@ -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 { list as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useList.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 useList };
|
|
@@ -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 { number as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useNumber.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 useNumber };
|
|
@@ -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 { percentage as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/usePercentage.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 usePercentage };
|