vue-intlayer 5.7.8 → 5.8.0-canary.0
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/README.md +1 -1
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js +1 -0
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-pC3olEPG.mjs +73 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs +62 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js +1 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-CilQuo_6.js +1 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-GmacOkG4.mjs +36 -0
- package/dist/cjs/UI/ContentSelector.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/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/EditedContentRenderer.cjs +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
- package/dist/cjs/editor/communicator.cjs +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +1 -1
- package/dist/cjs/editor/editedContent.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -0
- package/dist/cjs/format/useCompact.cjs +1 -0
- package/dist/cjs/format/useCurrency.cjs +1 -0
- package/dist/cjs/format/useDate.cjs +1 -0
- package/dist/cjs/format/useList.cjs +1 -0
- package/dist/cjs/format/useNumber.cjs +1 -0
- package/dist/cjs/format/usePercentage.cjs +1 -0
- package/dist/cjs/format/useRelativeTime.cjs +1 -0
- package/dist/cjs/format/useUnit.cjs +1 -0
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/UI/ContentSelector.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +13 -16
- package/dist/esm/client/useDictionaryAsync.mjs +10 -13
- package/dist/esm/client/useDictionaryDynamic.mjs +13 -16
- package/dist/esm/client/useIntlayer.mjs +12 -12
- package/dist/esm/client/useLocale.mjs +12 -16
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/EditedContentRenderer.mjs +1 -1
- package/dist/esm/editor/EditorSelectorRenderer.mjs +2 -2
- package/dist/esm/editor/communicator.mjs +10 -10
- package/dist/esm/editor/createSharedComposable.mjs +1 -1
- package/dist/esm/editor/editedContent.mjs +22 -23
- package/dist/esm/editor/index.mjs +1 -1
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +21 -22
- package/dist/esm/editor/useEditedContentRenderer.mjs +7 -7
- package/dist/esm/format/index.mjs +18 -0
- package/dist/esm/format/useCompact.mjs +16 -0
- package/dist/esm/format/useCurrency.mjs +16 -0
- package/dist/esm/format/useDate.mjs +16 -0
- package/dist/esm/format/useList.mjs +16 -0
- package/dist/esm/format/useNumber.mjs +16 -0
- package/dist/esm/format/usePercentage.mjs +16 -0
- package/dist/esm/format/useRelativeTime.mjs +16 -0
- package/dist/esm/format/useUnit.mjs +16 -0
- package/dist/esm/plugins.mjs +15 -15
- package/dist/types/format/index.d.ts +9 -0
- package/dist/types/format/index.d.ts.map +1 -0
- package/dist/types/format/useCompact.d.ts +14 -0
- package/dist/types/format/useCompact.d.ts.map +1 -0
- package/dist/types/format/useCurrency.d.ts +25 -0
- package/dist/types/format/useCurrency.d.ts.map +1 -0
- package/dist/types/format/useDate.d.ts +23 -0
- package/dist/types/format/useDate.d.ts.map +1 -0
- package/dist/types/format/useList.d.ts +22 -0
- package/dist/types/format/useList.d.ts.map +1 -0
- package/dist/types/format/useNumber.d.ts +23 -0
- package/dist/types/format/useNumber.d.ts.map +1 -0
- package/dist/types/format/usePercentage.d.ts +17 -0
- package/dist/types/format/usePercentage.d.ts.map +1 -0
- package/dist/types/format/useRelativeTime.d.ts +21 -0
- package/dist/types/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/format/useUnit.d.ts +19 -0
- package/dist/types/format/useUnit.d.ts.map +1 -0
- package/package.json +24 -29
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-Df1Nt4x_.mjs +0 -75
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-RwUsyBxL.js +0 -1
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CcDEyAOE.mjs +0 -68
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-DJRF1I6m.js +0 -1
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-CvPgk7Z3.mjs +0 -39
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-Yqrgst_y.js +0 -1
- package/dist/cjs/server/IntlayerServerProvider.cjs +0 -1
- package/dist/cjs/server/index.cjs +0 -1
- package/dist/cjs/server/serverContext.cjs +0 -1
- package/dist/cjs/server/t.cjs +0 -1
- package/dist/cjs/server/useDictionary.cjs +0 -1
- package/dist/cjs/server/useIntlayer.cjs +0 -1
- package/dist/esm/server/IntlayerServerProvider.mjs +0 -12
- package/dist/esm/server/index.mjs +0 -16
- package/dist/esm/server/serverContext.mjs +0 -34
- package/dist/esm/server/t.mjs +0 -10
- package/dist/esm/server/useDictionary.mjs +0 -10
- package/dist/esm/server/useIntlayer.mjs +0 -10
- package/dist/types/server/IntlayerServerProvider.d.ts +0 -38
- package/dist/types/server/IntlayerServerProvider.d.ts.map +0 -1
- package/dist/types/server/index.d.ts +0 -6
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/server/serverContext.d.ts +0 -35
- package/dist/types/server/serverContext.d.ts.map +0 -1
- package/dist/types/server/t.d.ts +0 -24
- package/dist/types/server/t.d.ts.map +0 -1
- package/dist/types/server/useDictionary.d.ts +0 -19
- package/dist/types/server/useDictionary.d.ts.map +0 -1
- package/dist/types/server/useIntlayer.d.ts +0 -16
- package/dist/types/server/useIntlayer.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),_=250,y=e.defineComponent({__name:"ContentSelector",props:{onClickOutside:{type:Function},pressDuration:{},isSelecting:{type:Boolean}},emits:["click","press","hover","unhover"],setup(m,{emit:h}){const o=m,s=h,i=e.ref(null),t=e.ref(!1),l=e.ref(o.isSelecting??!1),u=e.ref(null),a=e.computed(()=>o.isSelecting??l.value),S=e.computed(()=>{const n=e.useSlots().default?.();return n?.length===1&&typeof n[0].children=="string"}),T=()=>{l.value=!0,s("press")},g=()=>{u.value=setTimeout(()=>{T()},o.pressDuration??_)},r=()=>{u.value&&(clearTimeout(u.value),u.value=null)},c=()=>{r(),g()},d=()=>{t.value&&(t.value=!1,s("unhover")),r()},v=()=>{t.value&&(t.value=!1,s("unhover")),r()},f=n=>{i.value&&!i.value.contains(n.target)&&(l.value=!1,o.onClickOutside?.())},k=n=>{a.value&&(n.preventDefault(),n.stopPropagation())},C=()=>{l.value=!1};return e.onMounted(()=>{document.addEventListener("mousedown",f)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",f),r()}),(n,p)=>(e.openBlock(),e.createElementBlock("span",{ref_key:"containerRef",ref:i,role:"button",tabindex:"0",onClick:k,onMousedown:c,onMouseup:d,onMouseleave:v,onTouchstart:c,onTouchend:d,onTouchcancel:v,onBlur:C,onMouseenter:p[0]||(p[0]=()=>{t.value=!0,s("hover")}),style:e.normalizeStyle({display:S.value?"inline":"inline-block",cursor:"pointer",userSelect:"none",borderRadius:"0.375rem",outlineWidth:"2px",outlineOffset:"4px",outlineStyle:"solid",outlineColor:a.value||t.value?"inherit":"transparent",transition:"all 100ms 50ms ease-in-out"})},[e.renderSlot(n.$slots,"default")],36))}});exports._sfc_main=y;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defineComponent as M, ref as u, computed as m, useSlots as _, onMounted as D, onBeforeUnmount as E, createElementBlock as B, openBlock as O, normalizeStyle as R, renderSlot as L } from "vue";
|
|
2
|
+
const P = 250, w = /* @__PURE__ */ M({
|
|
3
|
+
__name: "ContentSelector",
|
|
4
|
+
props: {
|
|
5
|
+
onClickOutside: { type: Function },
|
|
6
|
+
pressDuration: {},
|
|
7
|
+
isSelecting: { type: Boolean }
|
|
8
|
+
},
|
|
9
|
+
emits: ["click", "press", "hover", "unhover"],
|
|
10
|
+
setup(h, { emit: S }) {
|
|
11
|
+
const o = h, t = S, i = u(null), n = u(!1), s = u(o.isSelecting ?? !1), l = u(null), a = m(() => o.isSelecting ?? s.value), T = m(() => {
|
|
12
|
+
const e = _().default?.();
|
|
13
|
+
return e?.length === 1 && typeof e[0].children == "string";
|
|
14
|
+
}), g = () => {
|
|
15
|
+
s.value = !0, t("press");
|
|
16
|
+
}, k = () => {
|
|
17
|
+
l.value = setTimeout(() => {
|
|
18
|
+
g();
|
|
19
|
+
}, o.pressDuration ?? P);
|
|
20
|
+
}, r = () => {
|
|
21
|
+
l.value && (clearTimeout(l.value), l.value = null);
|
|
22
|
+
}, c = () => {
|
|
23
|
+
r(), k();
|
|
24
|
+
}, d = () => {
|
|
25
|
+
n.value && (n.value = !1, t("unhover")), r();
|
|
26
|
+
}, v = () => {
|
|
27
|
+
n.value && (n.value = !1, t("unhover")), r();
|
|
28
|
+
}, p = (e) => {
|
|
29
|
+
i.value && !i.value.contains(e.target) && (s.value = !1, o.onClickOutside?.());
|
|
30
|
+
}, C = (e) => {
|
|
31
|
+
a.value && (e.preventDefault(), e.stopPropagation());
|
|
32
|
+
}, y = () => {
|
|
33
|
+
s.value = !1;
|
|
34
|
+
};
|
|
35
|
+
return D(() => {
|
|
36
|
+
document.addEventListener("mousedown", p);
|
|
37
|
+
}), E(() => {
|
|
38
|
+
document.removeEventListener("mousedown", p), r();
|
|
39
|
+
}), (e, f) => (O(), B("span", {
|
|
40
|
+
ref_key: "containerRef",
|
|
41
|
+
ref: i,
|
|
42
|
+
role: "button",
|
|
43
|
+
tabindex: "0",
|
|
44
|
+
onClick: C,
|
|
45
|
+
onMousedown: c,
|
|
46
|
+
onMouseup: d,
|
|
47
|
+
onMouseleave: v,
|
|
48
|
+
onTouchstart: c,
|
|
49
|
+
onTouchend: d,
|
|
50
|
+
onTouchcancel: v,
|
|
51
|
+
onBlur: y,
|
|
52
|
+
onMouseenter: f[0] || (f[0] = () => {
|
|
53
|
+
n.value = !0, t("hover");
|
|
54
|
+
}),
|
|
55
|
+
style: R({
|
|
56
|
+
display: T.value ? "inline" : "inline-block",
|
|
57
|
+
cursor: "pointer",
|
|
58
|
+
userSelect: "none",
|
|
59
|
+
borderRadius: "0.375rem",
|
|
60
|
+
outlineWidth: "2px",
|
|
61
|
+
outlineOffset: "4px",
|
|
62
|
+
outlineStyle: "solid",
|
|
63
|
+
outlineColor: a.value || n.value ? "inherit" : "transparent",
|
|
64
|
+
transition: "all 100ms 50ms ease-in-out"
|
|
65
|
+
})
|
|
66
|
+
}, [
|
|
67
|
+
L(e.$slots, "default")
|
|
68
|
+
], 36));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
export {
|
|
72
|
+
w as _
|
|
73
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineComponent as u, computed as m, createBlock as p, renderSlot as a, unref as f, openBlock as h, withCtx as _ } from "vue";
|
|
2
|
+
import { isSameKeyPath as E } from "@intlayer/core";
|
|
3
|
+
import { _ as k } from "./ContentSelector.vue_vue_type_script_setup_true_lang-pC3olEPG.mjs";
|
|
4
|
+
import { useEditorEnabled as C } from "./esm/editor/editorEnabled.mjs";
|
|
5
|
+
import { useFocusDictionary as P } from "./esm/editor/focusDictionary.mjs";
|
|
6
|
+
import { useEditor as v } from "./esm/editor/useEditor.mjs";
|
|
7
|
+
import { MessageKey as r } from "@intlayer/editor";
|
|
8
|
+
import { useCommunicator as K } from "./esm/editor/communicator.mjs";
|
|
9
|
+
const R = /* @__PURE__ */ u({
|
|
10
|
+
__name: "ContentSelectorWrapper",
|
|
11
|
+
props: {
|
|
12
|
+
dictionaryKey: {},
|
|
13
|
+
keyPath: {},
|
|
14
|
+
plugins: {},
|
|
15
|
+
locale: {},
|
|
16
|
+
dictionaryPath: {},
|
|
17
|
+
children: {}
|
|
18
|
+
},
|
|
19
|
+
setup(s) {
|
|
20
|
+
const e = s, t = P(), i = C(), o = K();
|
|
21
|
+
v();
|
|
22
|
+
const c = m(
|
|
23
|
+
() => t?.focusedContent.value?.dictionaryKey === e.dictionaryKey && (t?.focusedContent.value.keyPath?.length ?? 0) > 0 && E(
|
|
24
|
+
t?.focusedContent.value.keyPath ?? [],
|
|
25
|
+
e.keyPath
|
|
26
|
+
)
|
|
27
|
+
), d = () => {
|
|
28
|
+
t?.setFocusedContent({
|
|
29
|
+
dictionaryKey: e.dictionaryKey,
|
|
30
|
+
keyPath: e.keyPath
|
|
31
|
+
});
|
|
32
|
+
}, l = () => {
|
|
33
|
+
o?.postMessage({
|
|
34
|
+
type: `${r.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
35
|
+
data: {
|
|
36
|
+
dictionaryKey: e.dictionaryKey,
|
|
37
|
+
keyPath: e.keyPath
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}, y = () => {
|
|
41
|
+
o?.postMessage({
|
|
42
|
+
type: `${r.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
43
|
+
data: null
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return (n, N) => f(i)?.enabled.value ? (h(), p(k, {
|
|
47
|
+
key: 0,
|
|
48
|
+
onPress: d,
|
|
49
|
+
isSelecting: c.value,
|
|
50
|
+
onHover: l,
|
|
51
|
+
onUnhover: y
|
|
52
|
+
}, {
|
|
53
|
+
default: _(() => [
|
|
54
|
+
a(n.$slots, "default")
|
|
55
|
+
]),
|
|
56
|
+
_: 3
|
|
57
|
+
}, 8, ["isSelecting"])) : a(n.$slots, "default", { key: 1 });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
R as _
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),y=require("@intlayer/core"),_=require("./ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js"),p=require("./cjs/editor/editorEnabled.cjs"),h=require("./cjs/editor/focusDictionary.cjs"),E=require("./cjs/editor/useEditor.cjs"),s=require("@intlayer/editor"),f=require("./cjs/editor/communicator.cjs"),m=e.defineComponent({__name:"ContentSelectorWrapper",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(c){const t=c,o=h.useFocusDictionary(),i=p.useEditorEnabled(),n=f.useCommunicator();E.useEditor();const a=e.computed(()=>o?.focusedContent.value?.dictionaryKey===t.dictionaryKey&&(o?.focusedContent.value.keyPath?.length??0)>0&&y.isSameKeyPath(o?.focusedContent.value.keyPath??[],t.keyPath)),u=()=>{o?.setFocusedContent({dictionaryKey:t.dictionaryKey,keyPath:t.keyPath})},d=()=>{n?.postMessage({type:`${s.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath}})},l=()=>{n?.postMessage({type:`${s.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(r,C)=>e.unref(i)?.enabled.value?(e.openBlock(),e.createBlock(_._sfc_main,{key:0,onPress:u,isSelecting:a.value,onHover:d,onUnhover:l},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3},8,["isSelecting"])):e.renderSlot(r.$slots,"default",{key:1})}});exports._sfc_main=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),u=require("@intlayer/core"),a=require("./cjs/editor/useEditedContentRenderer.cjs"),l=e.defineComponent({__name:"EditedContentRenderer",props:{dictionaryKey:{},keyPath:{},locale:{}},setup(s){const n=s,d=e.useSlots(),c=e.computed(()=>(d.default?.()??[]).map(r=>typeof r.children=="string"?r.children:"").join("")),o=a.useEditedContentRenderer(n.dictionaryKey,n.keyPath,c),i=e.computed(()=>{if(typeof o.value=="object"&&o.value!==null){const t=u.getContent(o.value,n,n.locale);return typeof t!="string"?(console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`),c.value):t}return o.value});return(t,r)=>(e.openBlock(),e.createBlock(e.unref(i)))}});exports._sfc_main=l;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineComponent as l, useSlots as d, computed as c, createBlock as p, openBlock as u, unref as f } from "vue";
|
|
2
|
+
import { getContent as m } from "@intlayer/core";
|
|
3
|
+
import { useEditedContentRenderer as y } from "./esm/editor/useEditedContentRenderer.mjs";
|
|
4
|
+
const g = /* @__PURE__ */ l({
|
|
5
|
+
__name: "EditedContentRenderer",
|
|
6
|
+
props: {
|
|
7
|
+
dictionaryKey: {},
|
|
8
|
+
keyPath: {},
|
|
9
|
+
locale: {}
|
|
10
|
+
},
|
|
11
|
+
setup(s) {
|
|
12
|
+
const t = s, a = d(), r = c(() => (a.default?.() ?? []).map((o) => typeof o.children == "string" ? o.children : "").join("")), n = y(
|
|
13
|
+
t.dictionaryKey,
|
|
14
|
+
t.keyPath,
|
|
15
|
+
r
|
|
16
|
+
), i = c(() => {
|
|
17
|
+
if (typeof n.value == "object" && n.value !== null) {
|
|
18
|
+
const e = m(
|
|
19
|
+
n.value,
|
|
20
|
+
t,
|
|
21
|
+
t.locale
|
|
22
|
+
);
|
|
23
|
+
return typeof e != "string" ? (console.error(
|
|
24
|
+
`Incorrect edited content format. Content type: ${typeof e}. Expected string. Value ${JSON.stringify(
|
|
25
|
+
e
|
|
26
|
+
)}`
|
|
27
|
+
), r.value) : e;
|
|
28
|
+
}
|
|
29
|
+
return n.value;
|
|
30
|
+
});
|
|
31
|
+
return (e, o) => (u(), p(f(i)));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
g as _
|
|
36
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../ContentSelector.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js");exports.default=e._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),u=require("../getDictionary.cjs"),y=require("./installIntlayer.cjs"),p=require("./useIntlayer.cjs"),d=(r,s)=>{const a=n.inject(y.INTLAYER_SYMBOL),l=n.computed(()=>s??a?.locale?.value),t=n.reactive({});return n.watchEffect(()=>{const c=u.getDictionary(r,l.value);for(const e in c){const o=t[e],i=c[e];e in t&&p.isUpdatableNode(o)?o.__update(i):t[e]=i}for(const e in t)e in c||delete t[e]}),t};exports.useDictionary=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@intlayer/config/built"),t=require("vue"),r=require("./installIntlayer.cjs"),l=require("./useDictionary.cjs"),s=async(n,i)=>{const c=t.inject(r.INTLAYER_SYMBOL),e=t.computed(()=>i??c?.locale?.value??a?.internationalization.defaultLocale),o=await n[e.value]();return l.useDictionary(o,e)};exports.useDictionaryAsync=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@intlayer/config/built"),t=require("vue"),u=require("./installIntlayer.cjs"),l=require("./useDictionary.cjs"),s=require("./useLoadDynamic.cjs"),y=(i,n,c)=>{const a=t.inject(u.INTLAYER_SYMBOL),e=t.computed(()=>c??a?.locale?.value??r?.internationalization.defaultLocale),o=s.useLoadDynamic(`${String(n)}.${e.value}`,i[e.value]());return l.useDictionary(o,e)};exports.useDictionaryDynamic=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),p=require("../getIntlayer.cjs"),d=require("./installIntlayer.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),p=require("../getIntlayer.cjs"),d=require("./installIntlayer.cjs"),s=n=>!!n&&typeof n=="object"&&typeof n.__update=="function",f=(n,a)=>{const l=o.inject(d.INTLAYER_SYMBOL),u=o.computed(()=>a??l?.locale.value),t=o.reactive({});return o.watchEffect(()=>{const c=p.getIntlayer(n,u.value);for(const e in c){const r=t[e],i=c[e];e in t&&s(r)?r.__update(i):t[e]=i}for(const e in t)e in c||delete t[e]}),t};exports.isUpdatableNode=s;exports.useIntlayer=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@intlayer/config/built"),c=require("vue"),s=require("./installIntlayer.cjs"),r=require("./useLocaleCookie.cjs"),u=({onLocaleChange:a}={})=>{const{defaultLocale:t,locales:l}=n?.internationalization??{},o=c.inject(s.INTLAYER_SYMBOL),{setLocaleCookie:i}=r.useLocaleCookie();return{locale:c.computed(()=>o?.locale?.value??t),defaultLocale:t,availableLocales:l,setLocale:e=>{if(!l?.map(String).includes(e)){console.error(`Locale ${e} is not available`);return}o&&o.setLocale(e),i(e),a?.(e)}}};exports.useLocale=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js");exports.default=e._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../EditedContentRenderer.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../EditedContentRenderer.vue_vue_type_script_setup_true_lang-CilQuo_6.js");exports.default=e._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js"),u=require("../../EditedContentRenderer.vue_vue_type_script_setup_true_lang-CilQuo_6.js"),d=e.defineComponent({__name:"EditorSelectorRenderer",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(i){const c=i,{keyPath:t,children:r,dictionaryKey:n}=c;return(o,_)=>(e.openBlock(),e.createBlock(a._sfc_main,{dictionaryKey:e.unref(n),keyPath:e.unref(t),children:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(u._sfc_main,{dictionaryKey:e.unref(n),keyPath:e.unref(t),children:e.unref(r)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["dictionaryKey","keyPath","children"])]),_:3},8,["dictionaryKey","keyPath","children"]))}});exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@intlayer/config/built"),l=require("uuid"),o=require("vue"),{editor:n}=a,r={postMessage:()=>null,allowedOrigins:[n?.applicationURL,n?.editorURL,n?.cmsURL],senderId:""};let t=null;const s=Symbol("Communicator"),u=(e={postMessage:()=>null})=>t||(t=o.reactive({...r,...e,senderId:l.v4()}),t),m=(e,c={postMessage:()=>null})=>{const i=u(c);e.provide(s,i)},d=()=>{try{return o.inject(s,r)}catch{return console.warn("useCommunicator: inject can only be used in setup(). Returning default communicator."),{postMessage:()=>null,senderId:""}}};exports.createCommunicator=u;exports.installCommunicator=m;exports.useCommunicator=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue");function c(t){return s.getCurrentScope()?(s.onScopeDispose(t),!0):!1}const u=t=>{let r=0,o,e;const n=()=>{r-=1,e&&r<=0&&(e.stop(),o=void 0,e=void 0)};return(...i)=>(r+=1,e||(e=s.effectScope(!0),o=e.run(()=>t(...i))),c(n),o)};exports.createSharedComposable=u;exports.tryOnScopeDispose=c;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue");function c(t){return s.getCurrentScope()?(s.onScopeDispose(t),!0):!1}const u=t=>{let r=0,o,e;const n=()=>{r-=1,e&&r<=0&&(e.stop(),o=void 0,e=void 0)};return((...i)=>(r+=1,e||(e=s.effectScope(!0),o=e.run(()=>t(...i))),c(n),o))};exports.createSharedComposable=u;exports.tryOnScopeDispose=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@intlayer/core"),a=require("@intlayer/editor"),o=require("vue"),u=require("./createSharedComposable.cjs"),C=require("./useCrossFrameState.cjs");let r=null;const i=Symbol("EditedContent"),s=()=>{if(r)return r;const e=o.ref({});return r={editedContent:o.readonly(e),getEditedContentValue:(t,d)=>{const n=e.value?.[t]?.content;if(n)return c.getContentNodeByKeyPath(n,d)},setEditedContent:t=>{e.value=t}},r},l=e=>{const t=s();e.provide(i,t)},E=u.createSharedComposable(()=>{const e=o.inject(i);if(!e)throw new Error("EditedContent state not found");const[t,d]=C.useCrossFrameState(a.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,{});return o.watch(t,n=>{e.editedContent.value=n??{}}),o.watch(e,n=>{d(n.editedContent.value)}),e});exports.createEditedContentClient=s;exports.installEditedContent=l;exports.useEditedContent=E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js"),t=require("./installIntlayerEditor.cjs");exports.ContentSelectorWrapper=e._sfc_main;exports.installIntlayerEditor=t.installIntlayerEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@intlayer/editor"),c=require("vue"),f=require("./communicator.cjs"),n=new Map;let u=!1;function l(e,t){let s=n.get(e);s||(s=new Set,n.set(e,s)),s.add(t)}function p(e,t){const s=n.get(e);s&&(s.delete(t),s.size===0&&n.delete(e))}function m(e,t){u||window&&(window.addEventListener("message",s=>{const{type:o,data:i,senderId:a}=s.data??{};o&&a!==t&&(!e||e.includes("*")||e.some(r=>d.compareUrls(r,s.origin)))&&n.get(o)?.forEach(r=>r(i))}),u=!0)}const b=(e,t)=>{const{allowedOrigins:s,postMessage:o,senderId:i}=f.useCommunicator();return m(s,i),t?(l(e,t),c.onScopeDispose(()=>p(e,t))):c.getCurrentInstance()||console.warn("useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."),r=>{o({type:e,data:r,senderId:i})}};exports.useCrossFrameMessageListener=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./createSharedComposable.cjs"),i=r.createSharedComposable((t,n,d)=>{const o=e.inject("editedContentActions",null);return e.computed(()=>o?.getEditedContentValue(t,n)??d)});exports.useEditedContentRenderer=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useCompact.cjs"),u=require("./useCurrency.cjs"),r=require("./useDate.cjs"),t=require("./useList.cjs"),s=require("./useNumber.cjs"),i=require("./usePercentage.cjs"),o=require("./useRelativeTime.cjs"),a=require("./useUnit.cjs");exports.useCompact=e.useCompact;exports.useCurrency=u.useCurrency;exports.useDate=r.useDate;exports.useList=t.useList;exports.useNumber=s.useNumber;exports.usePercentage=i.usePercentage;exports.useRelativeTime=o.useRelativeTime;exports.useUnit=a.useUnit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/core"),t=require("vue"),n=require("../client/installIntlayer.cjs"),r=()=>{const c=t.inject(n.INTLAYER_SYMBOL);return t.computed(()=>{const o=c.locale.value;return(...e)=>l.compact(e[0],{...e[1],locale:e[1]?.locale??o})}).value};exports.useCompact=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@intlayer/core"),r=require("vue"),n=require("../client/installIntlayer.cjs"),u=()=>{const c=r.inject(n.INTLAYER_SYMBOL);return r.computed(()=>{const t=c.locale.value;return(...e)=>l.currency(e[0],{...e[1],locale:e[1]?.locale??t})}).value};exports.useCurrency=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core"),t=require("vue"),n=require("../client/installIntlayer.cjs"),r=()=>{const l=t.inject(n.INTLAYER_SYMBOL);return t.computed(()=>{const c=l.locale.value;return(...e)=>o.date(e[0],{...e[1],locale:e[1]?.locale??c})}).value};exports.useDate=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core"),t=require("vue"),n=require("../client/installIntlayer.cjs"),r=()=>{const l=t.inject(n.INTLAYER_SYMBOL);return t.computed(()=>{const c=l.locale.value;return(...e)=>o.list(e[0],{...e[1],locale:e[1]?.locale??c})}).value};exports.useList=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@intlayer/core"),t=require("vue"),c=require("../client/installIntlayer.cjs"),n=()=>{const l=t.inject(c.INTLAYER_SYMBOL);return t.computed(()=>{const r=l.locale.value;return(...e)=>u.number(e[0],{...e[1],locale:e[1]?.locale??r})}).value};exports.useNumber=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@intlayer/core"),t=require("vue"),r=require("../client/installIntlayer.cjs"),o=()=>{const c=t.inject(r.INTLAYER_SYMBOL);return t.computed(()=>{const l=c.locale.value;return(...e)=>n.percentage(e[0],{...e[1],locale:e[1]?.locale??l})}).value};exports.usePercentage=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/core"),t=require("vue"),o=require("../client/installIntlayer.cjs"),n=()=>{const l=t.inject(o.INTLAYER_SYMBOL);return t.computed(()=>{const c=l.locale.value;return(...e)=>i.relativeTime(e[0],e[1],{...e[2],locale:e[2]?.locale??c})}).value};exports.useRelativeTime=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@intlayer/core"),t=require("vue"),o=require("../client/installIntlayer.cjs"),r=()=>{const l=t.inject(o.INTLAYER_SYMBOL);return t.computed(()=>{const n=l.locale.value;return(...e)=>c.units(e[0],{...e[1],locale:e[1]?.locale??n})}).value};exports.useUnit=r;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/core"),l=require("vue"),y=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/core"),l=require("vue"),y=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js");require("./editor/installIntlayerEditor.cjs");const k=require("./markdown/installIntlayerMarkdown.cjs"),o=require("./renderIntlayerNode.cjs"),p={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{children:n,...r})=>o.renderIntlayerNode({...r,value:n,children:()=>l.h(y._sfc_main,{dictionaryKey:r.dictionaryKey,keyPath:r.keyPath},{default:()=>n})})},u={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,r)=>{const{plugins:d,...a}=n,s=i.getMarkdownMetadata(e),c=r(s,{plugins:[{id:"markdown-metadata-plugin",canHandle:t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"||!t,transform:(t,g)=>o.renderIntlayerNode({...g,value:t,children:e})}],dictionaryKey:a.dictionaryKey,keyPath:[]});return o.renderIntlayerNode({...n,value:e,children:()=>l.h(y._sfc_main,{dictionaryKey:a.dictionaryKey,keyPath:a.keyPath},{default:()=>{const{renderMarkdown:t}=k.useMarkdown();return t(e)}}),additionalProps:{metadata:c}})}},m={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===i.NodeType.Markdown,transform:(e,n,r)=>{const d=[...n.keyPath,{type:i.NodeType.Markdown}],a=e[i.NodeType.Markdown];return r(a,{...n,children:a,keyPath:d,plugins:[u,...n.plugins??[]]})}};exports.intlayerNodePlugins=p;exports.markdownPlugin=m;exports.markdownStringPlugin=u;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { inject as
|
|
1
|
+
import { inject as s, computed as f, reactive as l, watchEffect as m } from "vue";
|
|
2
2
|
import { getDictionary as u } from "../getDictionary.mjs";
|
|
3
3
|
import { INTLAYER_SYMBOL as d } from "./installIntlayer.mjs";
|
|
4
4
|
import { isUpdatableNode as g } from "./useIntlayer.mjs";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
return p ?? ((e = n == null ? void 0 : n.locale) == null ? void 0 : e.value);
|
|
9
|
-
}), t = m({});
|
|
10
|
-
return l(() => {
|
|
5
|
+
const D = (c, i) => {
|
|
6
|
+
const a = s(d), p = f(() => i ?? a?.locale?.value), o = l({});
|
|
7
|
+
return m(() => {
|
|
11
8
|
const e = u(
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
c,
|
|
10
|
+
p.value
|
|
14
11
|
);
|
|
15
|
-
for (const
|
|
16
|
-
const
|
|
17
|
-
|
|
12
|
+
for (const t in e) {
|
|
13
|
+
const n = o[t], r = e[t];
|
|
14
|
+
t in o && g(n) ? n.__update(r) : o[t] = r;
|
|
18
15
|
}
|
|
19
|
-
for (const
|
|
20
|
-
|
|
21
|
-
}),
|
|
16
|
+
for (const t in o)
|
|
17
|
+
t in e || delete o[t];
|
|
18
|
+
}), o;
|
|
22
19
|
};
|
|
23
20
|
export {
|
|
24
|
-
|
|
21
|
+
D as useDictionary
|
|
25
22
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { inject as
|
|
3
|
-
import { INTLAYER_SYMBOL as
|
|
4
|
-
import { useDictionary as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
() =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
), c = await n[t.value]();
|
|
12
|
-
return u(c, t);
|
|
1
|
+
import r from "@intlayer/config/built";
|
|
2
|
+
import { inject as c, computed as e } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as l } from "./installIntlayer.mjs";
|
|
4
|
+
import { useDictionary as m } from "./useDictionary.mjs";
|
|
5
|
+
const y = async (t, i) => {
|
|
6
|
+
const a = c(l), o = e(
|
|
7
|
+
() => i ?? a?.locale?.value ?? r?.internationalization.defaultLocale
|
|
8
|
+
), n = await t[o.value]();
|
|
9
|
+
return m(n, o);
|
|
13
10
|
};
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
y as useDictionaryAsync
|
|
16
13
|
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { inject as
|
|
3
|
-
import { INTLAYER_SYMBOL as
|
|
4
|
-
import { useDictionary as
|
|
5
|
-
import { useLoadDynamic as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
() =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
), e = s(
|
|
13
|
-
`${String(n)}.${t.value}`,
|
|
14
|
-
a[t.value]()
|
|
1
|
+
import e from "@intlayer/config/built";
|
|
2
|
+
import { inject as c, computed as m } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as l } from "./installIntlayer.mjs";
|
|
4
|
+
import { useDictionary as u } from "./useDictionary.mjs";
|
|
5
|
+
import { useLoadDynamic as f } from "./useLoadDynamic.mjs";
|
|
6
|
+
const L = (t, i, r) => {
|
|
7
|
+
const a = c(l), o = m(
|
|
8
|
+
() => r ?? a?.locale?.value ?? e?.internationalization.defaultLocale
|
|
9
|
+
), n = f(
|
|
10
|
+
`${String(i)}.${o.value}`,
|
|
11
|
+
t[o.value]()
|
|
15
12
|
);
|
|
16
|
-
return
|
|
13
|
+
return u(n, o);
|
|
17
14
|
};
|
|
18
15
|
export {
|
|
19
|
-
|
|
16
|
+
L as useDictionaryDynamic
|
|
20
17
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { inject as
|
|
1
|
+
import { inject as a, computed as f, reactive as l, watchEffect as u } from "vue";
|
|
2
2
|
import { getIntlayer as m } from "../getIntlayer.mjs";
|
|
3
3
|
import { INTLAYER_SYMBOL as d } from "./installIntlayer.mjs";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
const
|
|
8
|
-
for (const t in
|
|
9
|
-
const
|
|
10
|
-
t in
|
|
4
|
+
const y = (o) => !!o && typeof o == "object" && typeof o.__update == "function", b = (o, i) => {
|
|
5
|
+
const p = a(d), s = f(() => i ?? p?.locale.value), e = l({});
|
|
6
|
+
return u(() => {
|
|
7
|
+
const n = m(o, s.value);
|
|
8
|
+
for (const t in n) {
|
|
9
|
+
const c = e[t], r = n[t];
|
|
10
|
+
t in e && y(c) ? c.__update(r) : e[t] = r;
|
|
11
11
|
}
|
|
12
|
-
for (const t in
|
|
13
|
-
t in
|
|
14
|
-
}),
|
|
12
|
+
for (const t in e)
|
|
13
|
+
t in n || delete e[t];
|
|
14
|
+
}), e;
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
y as isUpdatableNode,
|
|
18
18
|
b as useIntlayer
|
|
19
19
|
};
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { inject as
|
|
3
|
-
import { INTLAYER_SYMBOL as
|
|
4
|
-
import { useLocaleCookie as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const { defaultLocale: s, locales: r } = ((c = l) == null ? void 0 : c.internationalization) ?? {}, t = m(f), { setLocaleCookie: e } = p();
|
|
1
|
+
import c from "@intlayer/config/built";
|
|
2
|
+
import { inject as r, computed as s } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as n } from "./installIntlayer.mjs";
|
|
4
|
+
import { useLocaleCookie as m } from "./useLocaleCookie.mjs";
|
|
5
|
+
const b = ({ onLocaleChange: l } = {}) => {
|
|
6
|
+
const { defaultLocale: t, locales: a } = c?.internationalization ?? {}, e = r(n), { setLocaleCookie: i } = m();
|
|
8
7
|
return {
|
|
9
|
-
locale:
|
|
10
|
-
var o;
|
|
11
|
-
return ((o = t == null ? void 0 : t.locale) == null ? void 0 : o.value) ?? s;
|
|
12
|
-
}),
|
|
8
|
+
locale: s(() => e?.locale?.value ?? t),
|
|
13
9
|
// Current locale
|
|
14
|
-
defaultLocale:
|
|
10
|
+
defaultLocale: t,
|
|
15
11
|
// Principal locale defined in config
|
|
16
|
-
availableLocales:
|
|
12
|
+
availableLocales: a,
|
|
17
13
|
// List of the available locales defined in config
|
|
18
14
|
setLocale: (o) => {
|
|
19
|
-
if (!
|
|
15
|
+
if (!a?.map(String).includes(o)) {
|
|
20
16
|
console.error(`Locale ${o} is not available`);
|
|
21
17
|
return;
|
|
22
18
|
}
|
|
23
|
-
|
|
19
|
+
e && e.setLocale(o), i(o), l?.(o);
|
|
24
20
|
}
|
|
25
21
|
// Function to set the locale
|
|
26
22
|
};
|
|
27
23
|
};
|
|
28
24
|
export {
|
|
29
|
-
|
|
25
|
+
b as useLocale
|
|
30
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as d, createBlock as y, openBlock as l, unref as e, withCtx as n, createVNode as h, renderSlot as s } from "vue";
|
|
2
|
-
import { _ } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { _ as f } from "../../EditedContentRenderer.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { _ } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs";
|
|
3
|
+
import { _ as f } from "../../EditedContentRenderer.vue_vue_type_script_setup_true_lang-GmacOkG4.mjs";
|
|
4
4
|
const P = /* @__PURE__ */ d({
|
|
5
5
|
__name: "EditorSelectorRenderer",
|
|
6
6
|
props: {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { v4 as
|
|
3
|
-
import { inject as
|
|
4
|
-
const { editor: n } =
|
|
1
|
+
import i from "@intlayer/config/built";
|
|
2
|
+
import { v4 as a } from "uuid";
|
|
3
|
+
import { inject as u, reactive as l } from "vue";
|
|
4
|
+
const { editor: n } = i, o = {
|
|
5
5
|
postMessage: () => null,
|
|
6
6
|
allowedOrigins: [
|
|
7
|
-
n
|
|
8
|
-
n
|
|
9
|
-
n
|
|
7
|
+
n?.applicationURL,
|
|
8
|
+
n?.editorURL,
|
|
9
|
+
n?.cmsURL
|
|
10
10
|
],
|
|
11
11
|
senderId: ""
|
|
12
12
|
};
|
|
13
13
|
let t = null;
|
|
14
|
-
const r = Symbol("Communicator"), m = (e = { postMessage: () => null }) => t || (t =
|
|
14
|
+
const r = Symbol("Communicator"), m = (e = { postMessage: () => null }) => t || (t = l({
|
|
15
15
|
...o,
|
|
16
16
|
...e,
|
|
17
|
-
senderId:
|
|
17
|
+
senderId: a()
|
|
18
18
|
}), t), g = (e, s = { postMessage: () => null }) => {
|
|
19
19
|
const c = m(s);
|
|
20
20
|
e.provide(r, c);
|
|
21
21
|
}, C = () => {
|
|
22
22
|
try {
|
|
23
|
-
return
|
|
23
|
+
return u(r, o);
|
|
24
24
|
} catch {
|
|
25
25
|
return console.warn(
|
|
26
26
|
"useCommunicator: inject can only be used in setup(). Returning default communicator."
|
|
@@ -7,7 +7,7 @@ const a = (t) => {
|
|
|
7
7
|
const s = () => {
|
|
8
8
|
r -= 1, e && r <= 0 && (e.stop(), o = void 0, e = void 0);
|
|
9
9
|
};
|
|
10
|
-
return (...n) => (r += 1, e || (e = p(!0), o = e.run(() => t(...n))), u(s), o);
|
|
10
|
+
return ((...n) => (r += 1, e || (e = p(!0), o = e.run(() => t(...n))), u(s), o));
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
13
|
a as createSharedComposable,
|