vue-intlayer 7.0.1 → 7.0.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/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-B4fMFrZy.js +1 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-BD8AzVI8.js +1 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-BkgFa1XU.mjs +63 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs +65 -0
- package/dist/EditorSelectorRenderer.vue_vue_type_script_setup_true_lang-BS6_0nfg.mjs +39 -0
- package/dist/EditorSelectorRenderer.vue_vue_type_script_setup_true_lang-BaAbbmXy.js +1 -0
- package/dist/cjs/client/installIntlayer.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs +1 -1
- package/dist/cjs/editor/editedContent.cjs +1 -1
- package/dist/cjs/editor/editorLocale.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/installIntlayerEditor.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/installIntlayer.mjs +9 -9
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/EditorSelectorRenderer.mjs +1 -1
- package/dist/esm/editor/dictionariesRecord.mjs +35 -33
- package/dist/esm/editor/editedContent.mjs +53 -41
- package/dist/esm/editor/editorLocale.mjs +1 -1
- package/dist/esm/editor/index.mjs +1 -1
- package/dist/esm/editor/installIntlayerEditor.mjs +12 -12
- package/dist/esm/editor/useEditor.mjs +7 -7
- package/dist/esm/plugins.mjs +1 -1
- package/dist/installIntlayerEditor-CFcdNmPy.mjs +112 -0
- package/dist/installIntlayerEditor-DmHeL-Bu.js +1 -0
- package/dist/types/editor/EditedContentRenderer.vue.d.ts +8 -0
- package/dist/types/editor/EditorSelectorRenderer.vue.d.ts +24 -0
- package/dist/types/editor/dictionariesRecord.d.ts +3 -3
- package/dist/types/editor/editedContent.d.ts +3 -2
- package/dist/types/editor/installIntlayerEditor.d.ts +1 -1
- package/package.json +17 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),_=require("@intlayer/core"),c=require("@intlayer/editor"),p=require("@intlayer/types"),h=require("./ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js"),E=require("./cjs/editor/communicator.cjs"),f=require("./cjs/editor/editorEnabled.cjs"),v=require("./cjs/editor/focusDictionary.cjs"),m=require("./cjs/editor/useEditor.cjs"),C=e.defineComponent({__name:"ContentSelectorWrapper",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(i){const t=i,o=v.useFocusDictionary(),a=f.useEditorEnabled(),s=E.useCommunicator();m.useEditor();const r=e.computed(()=>t.keyPath.filter(n=>n.type!==p.NodeType.Translation)),u=e.computed(()=>o?.focusedContent.value?.dictionaryKey===t.dictionaryKey&&(o?.focusedContent.value.keyPath?.length??0)>0&&_.isSameKeyPath(o?.focusedContent.value.keyPath??[],r.value)),d=()=>{o?.setFocusedContent({dictionaryKey:t.dictionaryKey,keyPath:r.value})},l=()=>{s?.postMessage({type:`${c.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:t.dictionaryKey,keyPath:r.value}})},y=()=>{s?.postMessage({type:`${c.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(n,K)=>e.unref(a)?.enabled.value?(e.openBlock(),e.createBlock(h._sfc_main,{key:0,onPress:d,isSelecting:u.value,onHover:l,onUnhover:y},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},8,["isSelecting"])):e.renderSlot(n.$slots,"default",{key:1})}});exports._sfc_main=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),_=require("@intlayer/core"),s=require("@intlayer/editor"),i=require("@intlayer/types"),p=require("./ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js"),h=require("./cjs/editor/communicator.cjs"),E=require("./cjs/editor/editorEnabled.cjs"),f=require("./cjs/editor/focusDictionary.cjs"),m=require("./cjs/editor/useEditor.cjs"),C=e.defineComponent({__name:"ContentSelectorWrapper",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(a){const t=a,n=f.useFocusDictionary(),c=E.useEditorEnabled(),r=h.useCommunicator();m.useEditor();const u=e.computed(()=>n?.focusedContent.value?.dictionaryKey===t.dictionaryKey&&(n?.focusedContent.value.keyPath?.length??0)>0&&_.isSameKeyPath(n?.focusedContent.value.keyPath??[],t.keyPath.filter(o=>o.type!==i.NodeType.Translation))),d=()=>{n?.setFocusedContent({dictionaryKey:t.dictionaryKey,keyPath:t.keyPath.filter(o=>o.type!==i.NodeType.Translation)})},l=()=>{r?.postMessage({type:`${s.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath}})},y=()=>{r?.postMessage({type:`${s.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(o,k)=>e.unref(c)?.enabled.value?(e.openBlock(),e.createBlock(p._sfc_main,{key:0,onPress:d,isSelecting:u.value,onHover:l,onUnhover:y},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["isSelecting"])):e.renderSlot(o.$slots,"default",{key:1})}});exports._sfc_main=C;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineComponent as m, computed as u, createBlock as f, renderSlot as a, unref as h, openBlock as _, withCtx as E } from "vue";
|
|
2
|
+
import { isSameKeyPath as k } from "@intlayer/core";
|
|
3
|
+
import { MessageKey as r } from "@intlayer/editor";
|
|
4
|
+
import { NodeType as i } from "@intlayer/types";
|
|
5
|
+
import { _ as C } from "./ContentSelector.vue_vue_type_script_setup_true_lang-pC3olEPG.mjs";
|
|
6
|
+
import { useCommunicator as P } from "./esm/editor/communicator.mjs";
|
|
7
|
+
import { useEditorEnabled as v } from "./esm/editor/editorEnabled.mjs";
|
|
8
|
+
import { useFocusDictionary as K } from "./esm/editor/focusDictionary.mjs";
|
|
9
|
+
import { useEditor as N } from "./esm/editor/useEditor.mjs";
|
|
10
|
+
const M = /* @__PURE__ */ m({
|
|
11
|
+
__name: "ContentSelectorWrapper",
|
|
12
|
+
props: {
|
|
13
|
+
dictionaryKey: {},
|
|
14
|
+
keyPath: {},
|
|
15
|
+
plugins: {},
|
|
16
|
+
locale: {},
|
|
17
|
+
dictionaryPath: {},
|
|
18
|
+
children: {}
|
|
19
|
+
},
|
|
20
|
+
setup(s) {
|
|
21
|
+
const e = s, o = K(), c = v(), n = P();
|
|
22
|
+
N();
|
|
23
|
+
const l = u(
|
|
24
|
+
() => o?.focusedContent.value?.dictionaryKey === e.dictionaryKey && (o?.focusedContent.value.keyPath?.length ?? 0) > 0 && k(
|
|
25
|
+
o?.focusedContent.value.keyPath ?? [],
|
|
26
|
+
e.keyPath.filter((t) => t.type !== i.Translation)
|
|
27
|
+
)
|
|
28
|
+
), y = () => {
|
|
29
|
+
o?.setFocusedContent({
|
|
30
|
+
dictionaryKey: e.dictionaryKey,
|
|
31
|
+
keyPath: e.keyPath.filter((t) => t.type !== i.Translation)
|
|
32
|
+
});
|
|
33
|
+
}, d = () => {
|
|
34
|
+
n?.postMessage({
|
|
35
|
+
type: `${r.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
36
|
+
data: {
|
|
37
|
+
dictionaryKey: e.dictionaryKey,
|
|
38
|
+
keyPath: e.keyPath
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}, p = () => {
|
|
42
|
+
n?.postMessage({
|
|
43
|
+
type: `${r.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
44
|
+
data: null
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return (t, T) => h(c)?.enabled.value ? (_(), f(C, {
|
|
48
|
+
key: 0,
|
|
49
|
+
onPress: y,
|
|
50
|
+
isSelecting: l.value,
|
|
51
|
+
onHover: d,
|
|
52
|
+
onUnhover: p
|
|
53
|
+
}, {
|
|
54
|
+
default: E(() => [
|
|
55
|
+
a(t.$slots, "default")
|
|
56
|
+
]),
|
|
57
|
+
_: 3
|
|
58
|
+
}, 8, ["isSelecting"])) : a(t.$slots, "default", { key: 1 });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
M as _
|
|
63
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineComponent as m, computed as r, createBlock as f, renderSlot as s, unref as h, openBlock as _, withCtx as E } from "vue";
|
|
2
|
+
import { isSameKeyPath as v } from "@intlayer/core";
|
|
3
|
+
import { MessageKey as i } from "@intlayer/editor";
|
|
4
|
+
import { NodeType as C } from "@intlayer/types";
|
|
5
|
+
import { _ as k } from "./ContentSelector.vue_vue_type_script_setup_true_lang-pC3olEPG.mjs";
|
|
6
|
+
import { useCommunicator as K } from "./esm/editor/communicator.mjs";
|
|
7
|
+
import { useEditorEnabled as P } from "./esm/editor/editorEnabled.mjs";
|
|
8
|
+
import { useFocusDictionary as N } from "./esm/editor/focusDictionary.mjs";
|
|
9
|
+
import { useEditor as T } from "./esm/editor/useEditor.mjs";
|
|
10
|
+
const B = /* @__PURE__ */ m({
|
|
11
|
+
__name: "ContentSelectorWrapper",
|
|
12
|
+
props: {
|
|
13
|
+
dictionaryKey: {},
|
|
14
|
+
keyPath: {},
|
|
15
|
+
plugins: {},
|
|
16
|
+
locale: {},
|
|
17
|
+
dictionaryPath: {},
|
|
18
|
+
children: {}
|
|
19
|
+
},
|
|
20
|
+
setup(c) {
|
|
21
|
+
const e = c, t = N(), l = P(), a = K();
|
|
22
|
+
T();
|
|
23
|
+
const n = r(
|
|
24
|
+
() => e.keyPath.filter((o) => o.type !== C.Translation)
|
|
25
|
+
), d = r(
|
|
26
|
+
() => t?.focusedContent.value?.dictionaryKey === e.dictionaryKey && (t?.focusedContent.value.keyPath?.length ?? 0) > 0 && v(
|
|
27
|
+
t?.focusedContent.value.keyPath ?? [],
|
|
28
|
+
n.value
|
|
29
|
+
)
|
|
30
|
+
), y = () => {
|
|
31
|
+
t?.setFocusedContent({
|
|
32
|
+
dictionaryKey: e.dictionaryKey,
|
|
33
|
+
keyPath: n.value
|
|
34
|
+
});
|
|
35
|
+
}, u = () => {
|
|
36
|
+
a?.postMessage({
|
|
37
|
+
type: `${i.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
38
|
+
data: {
|
|
39
|
+
dictionaryKey: e.dictionaryKey,
|
|
40
|
+
keyPath: n.value
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, p = () => {
|
|
44
|
+
a?.postMessage({
|
|
45
|
+
type: `${i.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
|
|
46
|
+
data: null
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return (o, g) => h(l)?.enabled.value ? (_(), f(k, {
|
|
50
|
+
key: 0,
|
|
51
|
+
onPress: y,
|
|
52
|
+
isSelecting: d.value,
|
|
53
|
+
onHover: u,
|
|
54
|
+
onUnhover: p
|
|
55
|
+
}, {
|
|
56
|
+
default: E(() => [
|
|
57
|
+
s(o.$slots, "default")
|
|
58
|
+
]),
|
|
59
|
+
_: 3
|
|
60
|
+
}, 8, ["isSelecting"])) : s(o.$slots, "default", { key: 1 });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
B as _
|
|
65
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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-HcQvp9bv.mjs";
|
|
3
|
+
import { _ as p } from "./EditedContentRenderer.vue_vue_type_script_setup_true_lang-GmacOkG4.mjs";
|
|
4
|
+
const P = /* @__PURE__ */ d({
|
|
5
|
+
__name: "EditorSelectorRenderer",
|
|
6
|
+
props: {
|
|
7
|
+
dictionaryKey: {},
|
|
8
|
+
keyPath: {},
|
|
9
|
+
plugins: {},
|
|
10
|
+
locale: {},
|
|
11
|
+
dictionaryPath: {},
|
|
12
|
+
children: {}
|
|
13
|
+
},
|
|
14
|
+
setup(o) {
|
|
15
|
+
const a = o, { keyPath: t, children: r, dictionaryKey: i } = a;
|
|
16
|
+
return (c, f) => (l(), y(_, {
|
|
17
|
+
dictionaryKey: e(i),
|
|
18
|
+
keyPath: e(t),
|
|
19
|
+
children: e(r)
|
|
20
|
+
}, {
|
|
21
|
+
default: n(() => [
|
|
22
|
+
h(p, {
|
|
23
|
+
dictionaryKey: e(i),
|
|
24
|
+
keyPath: e(t),
|
|
25
|
+
children: e(r)
|
|
26
|
+
}, {
|
|
27
|
+
default: n(() => [
|
|
28
|
+
s(c.$slots, "default")
|
|
29
|
+
]),
|
|
30
|
+
_: 3
|
|
31
|
+
}, 8, ["dictionaryKey", "keyPath", "children"])
|
|
32
|
+
]),
|
|
33
|
+
_: 3
|
|
34
|
+
}, 8, ["dictionaryKey", "keyPath", "children"]));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
P as _
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),o=require("./ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-B4fMFrZy.js"),_=require("./EditedContentRenderer.vue_vue_type_script_setup_true_lang-CilQuo_6.js"),u=e.defineComponent({__name:"EditorSelectorRenderer",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(i){const c=i,{keyPath:t,children:r,dictionaryKey:n}=c;return(a,d)=>(e.openBlock(),e.createBlock(o._sfc_main,{dictionaryKey:e.unref(n),keyPath:e.unref(t),children:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(_._sfc_main,{dictionaryKey:e.unref(n),keyPath:e.unref(t),children:e.unref(r)},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["dictionaryKey","keyPath","children"])]),_:3},8,["dictionaryKey","keyPath","children"]))}});exports._sfc_main=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@intlayer/config/built"),i=require("vue");require("@intlayer/core");require("@intlayer/editor");require("../editor/communicator.cjs");require("@intlayer/dictionaries-entry");require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@intlayer/config/built"),i=require("vue");require("@intlayer/core");require("@intlayer/editor");require("@intlayer/types");require("../editor/communicator.cjs");require("@intlayer/unmerged-dictionaries-entry");require("./useLocaleStorage.cjs");const y=require("../editor/installIntlayerEditor.cjs"),o=Symbol("intlayer");let r=null;const a=(t,n=!0)=>{if(r)return r;const{defaultLocale:l}=s.internationalization??{},e=i.ref(t??l),c=u=>{e.value=u};return r={locale:i.readonly(e),setLocale:c,isCookieEnabled:n},r},q=(t,n,l=!0)=>{const e=a(n,l);t.provide(o,e),y.installIntlayerEditor(t,e)};exports.INTLAYER_SYMBOL=o;exports.createIntlayerClient=a;exports.installIntlayer=q;
|
|
@@ -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-B4fMFrZy.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-B4fMFrZy.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 l=require("@intlayer/editor"),d=require("@intlayer/unmerged-dictionaries-entry"),o=require("vue"),u=require("./createSharedComposable.cjs"),D=require("./useCrossFrameState.cjs");let t=null;const s=Symbol("intlayerDictionariesRecord"),a=()=>{if(t)return t;const e=o.ref(void 0);return t={localeDictionaries:o.readonly(e),setLocaleDictionaries:i=>{e.value=i??{}},setLocaleDictionary(i){e.value={...e.value,[i.localId]:i}}},t},R=e=>{const i=a(),r=d.getUnmergedDictionaries(),c=Object.fromEntries(Object.values(r).flat().map(n=>[n.localId,n]));i.setLocaleDictionaries(c),e.provide(s,i)},m=u.createSharedComposable(()=>{const e=o.inject(s);if(!e)throw new Error("DictionariesRecord state not found");const[i,r]=D.useCrossFrameState(l.MessageKey.INTLAYER_LOCALE_DICTIONARIES_CHANGED,void 0);o.watch(e.localeDictionaries,c=>{r(c)},{immediate:!0})});exports.createDictionaryRecordClient=a;exports.installDictionariesRecord=R;exports.useDictionariesRecord=m;
|
|
@@ -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"),v=require("@intlayer/editor"),y=require("@intlayer/types"),d=require("vue"),h=require("./createSharedComposable.cjs"),S=require("./useCrossFrameState.cjs");let s=null;const E=Symbol("EditedContent"),f=t=>{if(s)return s;const n=d.ref({});return s={editedContent:d.readonly(n),getEditedContentValue:(e,r)=>{const i=n.value;if(!i)return;const c=r.filter(o=>o.type!==y.NodeType.Translation),N=e.includes(":local:")||e.includes(":remote:"),a=t?.locale.value;if(N){const o=i?.[e]?.content??{};return C.getContentNodeByKeyPath(o,c,a)}const T=Object.keys(i).filter(o=>o.startsWith(`${e}:`));for(const o of T){const u=i?.[o]?.content??{},l=C.getContentNodeByKeyPath(u,c,a);if(l)return l}},setEditedContent:e=>{n.value=e}},s},_=(t,n)=>{const e=f(n);t.provide(E,e)},m=h.createSharedComposable(()=>{const t=d.inject(E);if(!t)throw new Error("EditedContent state not found");const[n,e]=S.useCrossFrameState(v.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,{});return d.watch(n,r=>{t.editedContent.value=r??{}}),d.watch(t,r=>{e(r.editedContent.value)}),t});exports.createEditedContentClient=f;exports.installEditedContent=_;exports.useEditedContent=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/editor"),r=require("vue"),a=require("../client/installIntlayer.cjs");require("@intlayer/core");require("@intlayer/types");require("./communicator.cjs");require("@intlayer/config/built");const s=require("./createSharedComposable.cjs"),u=require("./useCrossFrameState.cjs");require("@intlayer/dictionaries-entry");require("./installIntlayerEditor.cjs");require("../client/useLocaleStorage.cjs");const n=s.createSharedComposable(()=>{const e=r.inject(a.INTLAYER_SYMBOL);if(!e)throw new Error("IntlayerEditor state not found");const[c,t]=u.useCrossFrameState(i.MessageKey.INTLAYER_CURRENT_LOCALE);return r.watch(e.locale,o=>{t(o)},{immediate:!0}),e});exports.useEditorLocale=n;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/editor"),r=require("vue"),a=require("../client/installIntlayer.cjs");require("@intlayer/core");require("@intlayer/types");require("./communicator.cjs");require("@intlayer/config/built");const s=require("./createSharedComposable.cjs"),u=require("./useCrossFrameState.cjs");require("@intlayer/unmerged-dictionaries-entry");require("./installIntlayerEditor.cjs");require("../client/useLocaleStorage.cjs");const n=s.createSharedComposable(()=>{const e=r.inject(a.INTLAYER_SYMBOL);if(!e)throw new Error("IntlayerEditor state not found");const[c,t]=u.useCrossFrameState(i.MessageKey.INTLAYER_CURRENT_LOCALE);return r.watch(e.locale,o=>{t(o)},{immediate:!0}),e});exports.useEditorLocale=n;
|
|
@@ -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-B4fMFrZy.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 o=require("@intlayer/config/built"),n=require("./communicator.cjs"),r=require("./dictionariesRecord.cjs"),s=require("./editedContent.cjs"),c=require("./editorEnabled.cjs"),d=require("./focusDictionary.cjs"),{editor:t}=o,{applicationURL:l,editorURL:a,cmsURL:u}=t??{},f=i=>{typeof window>"u"||!(window.self!==window.top)||(t.applicationURL.length>0&&window.postMessage(i,t.applicationURL),t.editorURL.length>0&&window.parent.postMessage(i,t.editorURL),t.cmsURL.length>0&&window.parent.postMessage(i,t.cmsURL))},w=(i,e)=>{n.installCommunicator(i,{postMessage:f,allowedOrigins:[l,a,u]}),c.installEditorEnabled(i),r.installDictionariesRecord(i),s.installEditedContent(i,e),d.installFocusDictionary(i)};exports.installIntlayerEditor=w;
|
|
@@ -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("./configuration.cjs"),r=require("./createSharedComposable.cjs"),o=require("./dictionariesRecord.cjs"),t=require("./editorEnabled.cjs"),i=require("./editorLocale.cjs"),s=require("./focusDictionary.cjs"),c=require("./useCrossURLPathState.cjs"),u=require("./useIframeClickInterceptor.cjs"),a=r.createSharedComposable(()=>{e.useConfiguration(),t.useEditorEnabled(),s.useFocusDictionary(),u.useIframeClickMerger(),c.useCrossURLPathSetter(),i.useEditorLocale(),o.useDictionariesRecord()});exports.useEditor=a;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@intlayer/core"),i=require("@intlayer/types"),l=require("vue"),y=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@intlayer/core"),i=require("@intlayer/types"),l=require("vue"),y=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-B4fMFrZy.js");require("./editor/installIntlayerEditor.cjs");const k=require("./markdown/installIntlayerMarkdown.cjs"),o=require("./renderIntlayerNode.cjs"),m={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=p.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}})}},P={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=m;exports.markdownPlugin=P;exports.markdownStringPlugin=u;
|
|
@@ -2,26 +2,26 @@ import a from "@intlayer/config/built";
|
|
|
2
2
|
import { ref as c, readonly as m } from "vue";
|
|
3
3
|
import "@intlayer/core";
|
|
4
4
|
import "@intlayer/editor";
|
|
5
|
-
import "../editor/communicator.mjs";
|
|
6
|
-
import "@intlayer/dictionaries-entry";
|
|
7
5
|
import "@intlayer/types";
|
|
6
|
+
import "../editor/communicator.mjs";
|
|
7
|
+
import "@intlayer/unmerged-dictionaries-entry";
|
|
8
8
|
import "./useLocaleStorage.mjs";
|
|
9
9
|
import { installIntlayerEditor as s } from "../editor/installIntlayerEditor.mjs";
|
|
10
10
|
const p = Symbol("intlayer");
|
|
11
11
|
let r = null;
|
|
12
|
-
const u = (
|
|
12
|
+
const u = (o, e = !0) => {
|
|
13
13
|
if (r) return r;
|
|
14
|
-
const { defaultLocale: n } = a.internationalization ?? {},
|
|
15
|
-
|
|
14
|
+
const { defaultLocale: n } = a.internationalization ?? {}, t = c(o ?? n), i = (l) => {
|
|
15
|
+
t.value = l;
|
|
16
16
|
};
|
|
17
17
|
return r = {
|
|
18
|
-
locale: m(
|
|
18
|
+
locale: m(t),
|
|
19
19
|
setLocale: i,
|
|
20
20
|
isCookieEnabled: e
|
|
21
21
|
}, r;
|
|
22
|
-
}, Y = (
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
}, Y = (o, e, n = !0) => {
|
|
23
|
+
const t = u(e, n);
|
|
24
|
+
o.provide(p, t), s(o, t);
|
|
25
25
|
};
|
|
26
26
|
export {
|
|
27
27
|
p as INTLAYER_SYMBOL,
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
+
import { _ } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
3
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",
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ref as
|
|
4
|
-
import { createSharedComposable as
|
|
5
|
-
import { useCrossFrameState as
|
|
6
|
-
let
|
|
7
|
-
const
|
|
1
|
+
import { MessageKey as n } from "@intlayer/editor";
|
|
2
|
+
import { getUnmergedDictionaries as s } from "@intlayer/unmerged-dictionaries-entry";
|
|
3
|
+
import { ref as l, readonly as m, inject as d, watch as D } from "vue";
|
|
4
|
+
import { createSharedComposable as R } from "./createSharedComposable.mjs";
|
|
5
|
+
import { useCrossFrameState as u } from "./useCrossFrameState.mjs";
|
|
6
|
+
let o = null;
|
|
7
|
+
const a = Symbol(
|
|
8
8
|
"intlayerDictionariesRecord"
|
|
9
|
-
),
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
localeDictionaries:
|
|
14
|
-
setLocaleDictionaries: (
|
|
15
|
-
e.value =
|
|
9
|
+
), f = () => {
|
|
10
|
+
if (o) return o;
|
|
11
|
+
const e = l(void 0);
|
|
12
|
+
return o = {
|
|
13
|
+
localeDictionaries: m(e),
|
|
14
|
+
setLocaleDictionaries: (i) => {
|
|
15
|
+
e.value = i ?? {};
|
|
16
16
|
},
|
|
17
|
-
setLocaleDictionary(
|
|
17
|
+
setLocaleDictionary(i) {
|
|
18
18
|
e.value = {
|
|
19
19
|
...e.value,
|
|
20
|
-
[
|
|
20
|
+
[i.localId]: i
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}, _ = d(() => {
|
|
28
|
-
const i = D(
|
|
29
|
-
r
|
|
23
|
+
}, o;
|
|
24
|
+
}, v = (e) => {
|
|
25
|
+
const i = f(), t = s(), r = Object.fromEntries(
|
|
26
|
+
Object.values(t).flat().map((c) => [c.localId, c])
|
|
30
27
|
);
|
|
31
|
-
|
|
28
|
+
i.setLocaleDictionaries(r), e.provide(a, i);
|
|
29
|
+
}, O = R(() => {
|
|
30
|
+
const e = d(
|
|
31
|
+
a
|
|
32
|
+
);
|
|
33
|
+
if (!e)
|
|
32
34
|
throw new Error("DictionariesRecord state not found");
|
|
33
|
-
const [
|
|
34
|
-
|
|
35
|
+
const [i, t] = u(
|
|
36
|
+
n.INTLAYER_LOCALE_DICTIONARIES_CHANGED,
|
|
35
37
|
void 0
|
|
36
38
|
);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
|
|
39
|
+
D(
|
|
40
|
+
e.localeDictionaries,
|
|
41
|
+
(r) => {
|
|
42
|
+
t(r);
|
|
41
43
|
},
|
|
42
44
|
{ immediate: !0 }
|
|
43
45
|
);
|
|
44
46
|
});
|
|
45
47
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
f as createDictionaryRecordClient,
|
|
49
|
+
v as installDictionariesRecord,
|
|
50
|
+
O as useDictionariesRecord
|
|
49
51
|
};
|
|
@@ -1,52 +1,64 @@
|
|
|
1
|
-
import { getContentNodeByKeyPath as
|
|
2
|
-
import { MessageKey as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { getContentNodeByKeyPath as u } from "@intlayer/core";
|
|
2
|
+
import { MessageKey as N } from "@intlayer/editor";
|
|
3
|
+
import { NodeType as p } from "@intlayer/types";
|
|
4
|
+
import { ref as T, readonly as v, inject as h, watch as C } from "vue";
|
|
5
|
+
import { createSharedComposable as _ } from "./createSharedComposable.mjs";
|
|
6
|
+
import { useCrossFrameState as y } from "./useCrossFrameState.mjs";
|
|
7
|
+
let d = null;
|
|
8
|
+
const f = Symbol("EditedContent"), D = (e) => {
|
|
9
|
+
if (d) return d;
|
|
10
|
+
const n = T({});
|
|
11
|
+
return d = {
|
|
12
|
+
editedContent: v(n),
|
|
13
|
+
getEditedContentValue: (t, r) => {
|
|
14
|
+
const i = n.value;
|
|
15
|
+
if (!i) return;
|
|
16
|
+
const c = r.filter(
|
|
17
|
+
(o) => o.type !== p.Translation
|
|
18
|
+
), E = t.includes(":local:") || t.includes(":remote:"), s = e?.locale.value;
|
|
19
|
+
if (E) {
|
|
20
|
+
const o = i?.[t]?.content ?? {};
|
|
21
|
+
return u(
|
|
22
|
+
o,
|
|
23
|
+
c,
|
|
24
|
+
s
|
|
25
|
+
);
|
|
18
26
|
}
|
|
19
|
-
const
|
|
20
|
-
(o) => o.startsWith(`${
|
|
27
|
+
const m = Object.keys(i).filter(
|
|
28
|
+
(o) => o.startsWith(`${t}:`)
|
|
21
29
|
);
|
|
22
|
-
for (const o of
|
|
23
|
-
const
|
|
24
|
-
|
|
30
|
+
for (const o of m) {
|
|
31
|
+
const l = i?.[o]?.content ?? {}, a = u(
|
|
32
|
+
l,
|
|
33
|
+
c,
|
|
34
|
+
s
|
|
35
|
+
);
|
|
36
|
+
if (a) return a;
|
|
25
37
|
}
|
|
26
38
|
},
|
|
27
|
-
setEditedContent: (
|
|
28
|
-
|
|
39
|
+
setEditedContent: (t) => {
|
|
40
|
+
n.value = t;
|
|
29
41
|
}
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
42
|
+
}, d;
|
|
43
|
+
}, A = (e, n) => {
|
|
44
|
+
const t = D(n);
|
|
45
|
+
e.provide(f, t);
|
|
46
|
+
}, R = _(() => {
|
|
47
|
+
const e = h(f);
|
|
48
|
+
if (!e)
|
|
37
49
|
throw new Error("EditedContent state not found");
|
|
38
|
-
const [
|
|
39
|
-
|
|
50
|
+
const [n, t] = y(
|
|
51
|
+
N.INTLAYER_EDITED_CONTENT_CHANGED,
|
|
40
52
|
{}
|
|
41
53
|
);
|
|
42
|
-
return C(
|
|
43
|
-
|
|
44
|
-
}), C(
|
|
45
|
-
r
|
|
46
|
-
}),
|
|
54
|
+
return C(n, (r) => {
|
|
55
|
+
e.editedContent.value = r ?? {};
|
|
56
|
+
}), C(e, (r) => {
|
|
57
|
+
t(r.editedContent.value);
|
|
58
|
+
}), e;
|
|
47
59
|
});
|
|
48
60
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
D as createEditedContentClient,
|
|
62
|
+
A as installEditedContent,
|
|
63
|
+
R as useEditedContent
|
|
52
64
|
};
|
|
@@ -7,7 +7,7 @@ import "./communicator.mjs";
|
|
|
7
7
|
import "@intlayer/config/built";
|
|
8
8
|
import { createSharedComposable as p } from "./createSharedComposable.mjs";
|
|
9
9
|
import { useCrossFrameState as s } from "./useCrossFrameState.mjs";
|
|
10
|
-
import "@intlayer/dictionaries-entry";
|
|
10
|
+
import "@intlayer/unmerged-dictionaries-entry";
|
|
11
11
|
import "./installIntlayerEditor.mjs";
|
|
12
12
|
import "../client/useLocaleStorage.mjs";
|
|
13
13
|
const A = p(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as e } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
2
2
|
import { installIntlayerEditor as a } from "./installIntlayerEditor.mjs";
|
|
3
3
|
export {
|
|
4
4
|
e as ContentSelectorWrapper,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { installCommunicator as
|
|
3
|
-
import { installDictionariesRecord as
|
|
4
|
-
import { installEditedContent as
|
|
5
|
-
import { installEditorEnabled as
|
|
6
|
-
import { installFocusDictionary as
|
|
7
|
-
const { editor: o } =
|
|
1
|
+
import n from "@intlayer/config/built";
|
|
2
|
+
import { installCommunicator as r } from "./communicator.mjs";
|
|
3
|
+
import { installDictionariesRecord as e } from "./dictionariesRecord.mjs";
|
|
4
|
+
import { installEditedContent as s } from "./editedContent.mjs";
|
|
5
|
+
import { installEditorEnabled as l } from "./editorEnabled.mjs";
|
|
6
|
+
import { installFocusDictionary as a } from "./focusDictionary.mjs";
|
|
7
|
+
const { editor: o } = n, { applicationURL: m, editorURL: c, cmsURL: d } = o ?? {}, f = (i) => {
|
|
8
8
|
typeof window > "u" || !(window.self !== window.top) || (o.applicationURL.length > 0 && window.postMessage(i, o.applicationURL), o.editorURL.length > 0 && window.parent.postMessage(i, o.editorURL), o.cmsURL.length > 0 && window.parent.postMessage(i, o.cmsURL));
|
|
9
|
-
}, u = (i) => {
|
|
10
|
-
|
|
11
|
-
postMessage:
|
|
12
|
-
allowedOrigins: [
|
|
13
|
-
}),
|
|
9
|
+
}, u = (i, t) => {
|
|
10
|
+
r(i, {
|
|
11
|
+
postMessage: f,
|
|
12
|
+
allowedOrigins: [m, c, d]
|
|
13
|
+
}), l(i), e(i), s(i, t), a(i);
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
16
|
u as installIntlayerEditor
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useConfiguration as
|
|
2
|
-
import { createSharedComposable as
|
|
3
|
-
import { useDictionariesRecord as
|
|
4
|
-
import { useEditorEnabled as
|
|
5
|
-
import { useEditorLocale as
|
|
1
|
+
import { useConfiguration as o } from "./configuration.mjs";
|
|
2
|
+
import { createSharedComposable as r } from "./createSharedComposable.mjs";
|
|
3
|
+
import { useDictionariesRecord as e } from "./dictionariesRecord.mjs";
|
|
4
|
+
import { useEditorEnabled as t } from "./editorEnabled.mjs";
|
|
5
|
+
import { useEditorLocale as i } from "./editorLocale.mjs";
|
|
6
6
|
import { useFocusDictionary as m } from "./focusDictionary.mjs";
|
|
7
7
|
import { useCrossURLPathSetter as s } from "./useCrossURLPathState.mjs";
|
|
8
8
|
import { useIframeClickMerger as a } from "./useIframeClickInterceptor.mjs";
|
|
9
|
-
const E =
|
|
10
|
-
|
|
9
|
+
const E = r(() => {
|
|
10
|
+
o(), t(), m(), a(), s(), i(), e();
|
|
11
11
|
});
|
|
12
12
|
export {
|
|
13
13
|
E as useEditor
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getMarkdownMetadata as u } from "@intlayer/core";
|
|
2
2
|
import { NodeType as o } from "@intlayer/types";
|
|
3
3
|
import { h as y } from "vue";
|
|
4
|
-
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
5
5
|
import "./editor/installIntlayerEditor.mjs";
|
|
6
6
|
import { useMarkdown as p } from "./markdown/installIntlayerMarkdown.mjs";
|
|
7
7
|
import { renderIntlayerNode as i } from "./renderIntlayerNode.mjs";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import E from "@intlayer/config/built";
|
|
2
|
+
import { installCommunicator as T } from "./esm/editor/communicator.mjs";
|
|
3
|
+
import { installDictionariesRecord as v } from "./esm/editor/dictionariesRecord.mjs";
|
|
4
|
+
import { getContentNodeByKeyPath as m } from "@intlayer/core";
|
|
5
|
+
import { MessageKey as C } from "@intlayer/editor";
|
|
6
|
+
import { NodeType as h } from "@intlayer/types";
|
|
7
|
+
import { ref as L, readonly as p, inject as w, watch as d } from "vue";
|
|
8
|
+
import { createSharedComposable as R } from "./esm/editor/createSharedComposable.mjs";
|
|
9
|
+
import "./esm/client/useLocaleStorage.mjs";
|
|
10
|
+
import { installEditorEnabled as U } from "./esm/editor/editorEnabled.mjs";
|
|
11
|
+
import { installFocusDictionary as _ } from "./esm/editor/focusDictionary.mjs";
|
|
12
|
+
import { useCrossFrameState as I } from "./esm/editor/useCrossFrameState.mjs";
|
|
13
|
+
const N = Symbol("intlayer");
|
|
14
|
+
let c = null;
|
|
15
|
+
const D = (t, n = !0) => {
|
|
16
|
+
if (c) return c;
|
|
17
|
+
const { defaultLocale: e } = E.internationalization ?? {}, o = L(t ?? e), s = (a) => {
|
|
18
|
+
o.value = a;
|
|
19
|
+
};
|
|
20
|
+
return c = {
|
|
21
|
+
locale: p(o),
|
|
22
|
+
setLocale: s,
|
|
23
|
+
isCookieEnabled: n
|
|
24
|
+
}, c;
|
|
25
|
+
}, Q = (t, n, e = !0) => {
|
|
26
|
+
const o = D(n, e);
|
|
27
|
+
t.provide(N, o), j(t);
|
|
28
|
+
}, M = R(() => {
|
|
29
|
+
const t = w(N);
|
|
30
|
+
if (!t)
|
|
31
|
+
throw new Error("IntlayerEditor state not found");
|
|
32
|
+
const [n, e] = I(
|
|
33
|
+
C.INTLAYER_CURRENT_LOCALE
|
|
34
|
+
);
|
|
35
|
+
return d(
|
|
36
|
+
t.locale,
|
|
37
|
+
(o) => {
|
|
38
|
+
e(o);
|
|
39
|
+
},
|
|
40
|
+
{ immediate: !0 }
|
|
41
|
+
), t;
|
|
42
|
+
});
|
|
43
|
+
let l = null;
|
|
44
|
+
const y = Symbol("EditedContent"), b = () => {
|
|
45
|
+
if (l) return l;
|
|
46
|
+
const t = M(), n = L({});
|
|
47
|
+
return l = {
|
|
48
|
+
editedContent: p(n),
|
|
49
|
+
getEditedContentValue: (e, o) => {
|
|
50
|
+
const s = n.value;
|
|
51
|
+
if (!s) return;
|
|
52
|
+
const a = o.filter(
|
|
53
|
+
(i) => i.type !== h.Translation
|
|
54
|
+
);
|
|
55
|
+
if (e.includes(":local:") || e.includes(":remote:")) {
|
|
56
|
+
const i = s?.[e]?.content ?? {};
|
|
57
|
+
return m(
|
|
58
|
+
i,
|
|
59
|
+
a,
|
|
60
|
+
t.locale.value
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const g = Object.keys(s).filter(
|
|
64
|
+
(i) => i.startsWith(`${e}:`)
|
|
65
|
+
);
|
|
66
|
+
for (const i of g) {
|
|
67
|
+
const u = s?.[i]?.content ?? {}, f = m(
|
|
68
|
+
u,
|
|
69
|
+
a,
|
|
70
|
+
t.locale.value
|
|
71
|
+
);
|
|
72
|
+
if (f) return f;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
setEditedContent: (e) => {
|
|
76
|
+
n.value = e;
|
|
77
|
+
}
|
|
78
|
+
}, l;
|
|
79
|
+
}, A = (t) => {
|
|
80
|
+
const n = b();
|
|
81
|
+
t.provide(y, n);
|
|
82
|
+
}, X = R(() => {
|
|
83
|
+
const t = w(y);
|
|
84
|
+
if (!t)
|
|
85
|
+
throw new Error("EditedContent state not found");
|
|
86
|
+
const [n, e] = I(
|
|
87
|
+
C.INTLAYER_EDITED_CONTENT_CHANGED,
|
|
88
|
+
{}
|
|
89
|
+
);
|
|
90
|
+
return d(n, (o) => {
|
|
91
|
+
t.editedContent.value = o ?? {};
|
|
92
|
+
}), d(t, (o) => {
|
|
93
|
+
e(o.editedContent.value);
|
|
94
|
+
}), t;
|
|
95
|
+
}), { editor: r } = E, { applicationURL: S, editorURL: Y, cmsURL: O } = r ?? {}, B = (t) => {
|
|
96
|
+
typeof window > "u" || !(window.self !== window.top) || (r.applicationURL.length > 0 && window.postMessage(t, r.applicationURL), r.editorURL.length > 0 && window.parent.postMessage(t, r.editorURL), r.cmsURL.length > 0 && window.parent.postMessage(t, r.cmsURL));
|
|
97
|
+
}, j = (t) => {
|
|
98
|
+
T(t, {
|
|
99
|
+
postMessage: B,
|
|
100
|
+
allowedOrigins: [S, Y, O]
|
|
101
|
+
}), U(t), v(t), A(t), _(t);
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
N as I,
|
|
105
|
+
j as a,
|
|
106
|
+
b,
|
|
107
|
+
D as c,
|
|
108
|
+
A as d,
|
|
109
|
+
X as e,
|
|
110
|
+
Q as i,
|
|
111
|
+
M as u
|
|
112
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const L=require("@intlayer/config/built"),p=require("./cjs/editor/communicator.cjs"),q=require("./cjs/editor/dictionariesRecord.cjs"),f=require("@intlayer/core"),y=require("@intlayer/editor"),v=require("@intlayer/types"),i=require("vue"),m=require("./cjs/editor/createSharedComposable.cjs");require("./cjs/client/useLocaleStorage.cjs");const S=require("./cjs/editor/editorEnabled.cjs"),D=require("./cjs/editor/focusDictionary.cjs"),w=require("./cjs/editor/useCrossFrameState.cjs"),u=Symbol("intlayer");let l=null;const I=(e,n=!0)=>{if(l)return l;const{defaultLocale:t}=L.internationalization??{},o=i.ref(e??t),c=a=>{o.value=a};return l={locale:i.readonly(o),setLocale:c,isCookieEnabled:n},l},U=(e,n,t=!0)=>{const o=I(n,t);e.provide(u,o),h(e)},R=m.createSharedComposable(()=>{const e=i.inject(u);if(!e)throw new Error("IntlayerEditor state not found");const[n,t]=w.useCrossFrameState(y.MessageKey.INTLAYER_CURRENT_LOCALE);return i.watch(e.locale,o=>{t(o)},{immediate:!0}),e});let d=null;const N=Symbol("EditedContent"),_=()=>{if(d)return d;const e=R(),n=i.ref({});return d={editedContent:i.readonly(n),getEditedContentValue:(t,o)=>{const c=n.value;if(!c)return;const a=o.filter(r=>r.type!==v.NodeType.Translation);if(t.includes(":local:")||t.includes(":remote:")){const r=c?.[t]?.content??{};return f.getContentNodeByKeyPath(r,a,e.locale.value)}const T=Object.keys(c).filter(r=>r.startsWith(`${t}:`));for(const r of T){const C=c?.[r]?.content??{},E=f.getContentNodeByKeyPath(C,a,e.locale.value);if(E)return E}},setEditedContent:t=>{n.value=t}},d},g=e=>{const n=_();e.provide(N,n)},M=m.createSharedComposable(()=>{const e=i.inject(N);if(!e)throw new Error("EditedContent state not found");const[n,t]=w.useCrossFrameState(y.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,{});return i.watch(n,o=>{e.editedContent.value=o??{}}),i.watch(e,o=>{t(o.editedContent.value)}),e}),{editor:s}=L,{applicationURL:b,editorURL:Y,cmsURL:A}=s??{},B=e=>{typeof window>"u"||!(window.self!==window.top)||(s.applicationURL.length>0&&window.postMessage(e,s.applicationURL),s.editorURL.length>0&&window.parent.postMessage(e,s.editorURL),s.cmsURL.length>0&&window.parent.postMessage(e,s.cmsURL))},h=e=>{p.installCommunicator(e,{postMessage:B,allowedOrigins:[b,Y,A]}),S.installEditorEnabled(e),q.installDictionariesRecord(e),g(e),D.installFocusDictionary(e)};exports.INTLAYER_SYMBOL=u;exports.createEditedContentClient=_;exports.createIntlayerClient=I;exports.installEditedContent=g;exports.installIntlayer=U;exports.installIntlayerEditor=h;exports.useEditedContent=M;exports.useEditorLocale=R;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KeyPath, Locale } from '@intlayer/types';
|
|
2
|
+
type Props = {
|
|
3
|
+
dictionaryKey: string;
|
|
4
|
+
keyPath: KeyPath[];
|
|
5
|
+
locale?: Locale;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
import { NodeProps } from '@intlayer/core';
|
|
3
|
+
/**
|
|
4
|
+
* Combine your NodeProps (which include dictionaryKey & keyPath)
|
|
5
|
+
* with any other div‐like attributes (omitting Vue's `children`).
|
|
6
|
+
*/
|
|
7
|
+
type Props = NodeProps & /* @vue-ignore */ Omit<HTMLAttributes, 'children'>;
|
|
8
|
+
declare function __VLS_template(): {
|
|
9
|
+
attrs: Partial<{}>;
|
|
10
|
+
slots: {
|
|
11
|
+
default?(_: {}): any;
|
|
12
|
+
};
|
|
13
|
+
refs: {};
|
|
14
|
+
rootEl: any;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Dictionary } from '@intlayer/types';
|
|
1
|
+
import { Dictionary, LocalDictionaryId } from '@intlayer/types';
|
|
2
2
|
import { App, Ref } from 'vue';
|
|
3
|
-
export type DictionaryContent = Record<
|
|
3
|
+
export type DictionaryContent = Record<LocalDictionaryId, Dictionary>;
|
|
4
4
|
type DictionariesRecordClient = {
|
|
5
5
|
localeDictionaries: Ref<DictionaryContent>;
|
|
6
6
|
setLocaleDictionaries: (newValue: DictionaryContent) => void;
|
|
7
|
-
setLocaleDictionary: (
|
|
7
|
+
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
8
8
|
};
|
|
9
9
|
export declare const createDictionaryRecordClient: () => DictionariesRecordClient;
|
|
10
10
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContentNode, Dictionary, KeyPath, LocalDictionaryId } from '@intlayer/types';
|
|
2
2
|
import { App, Ref } from 'vue';
|
|
3
|
+
import { IntlayerProvider } from '../client';
|
|
3
4
|
export type EditedContent = Record<Dictionary['key'], Dictionary>;
|
|
4
5
|
type EditedContentClient = {
|
|
5
6
|
editedContent: Ref<EditedContent>;
|
|
@@ -9,10 +10,10 @@ type EditedContentClient = {
|
|
|
9
10
|
/**
|
|
10
11
|
* Creates an edited content client
|
|
11
12
|
*/
|
|
12
|
-
export declare const createEditedContentClient: () => EditedContentClient;
|
|
13
|
+
export declare const createEditedContentClient: (localeProvider?: IntlayerProvider) => EditedContentClient;
|
|
13
14
|
/**
|
|
14
15
|
* Helper to install the edited content into the app
|
|
15
16
|
*/
|
|
16
|
-
export declare const installEditedContent: (app: App) => void;
|
|
17
|
+
export declare const installEditedContent: (app: App, localeProvider?: IntlayerProvider) => void;
|
|
17
18
|
export declare const useEditedContent: () => EditedContentClient;
|
|
18
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -83,21 +83,21 @@
|
|
|
83
83
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@intlayer/api": "7.0.
|
|
87
|
-
"@intlayer/config": "7.0.
|
|
88
|
-
"@intlayer/core": "7.0.
|
|
89
|
-
"@intlayer/
|
|
90
|
-
"@intlayer/
|
|
91
|
-
"@intlayer/
|
|
86
|
+
"@intlayer/api": "7.0.2",
|
|
87
|
+
"@intlayer/config": "7.0.2",
|
|
88
|
+
"@intlayer/core": "7.0.2",
|
|
89
|
+
"@intlayer/editor": "7.0.2",
|
|
90
|
+
"@intlayer/types": "7.0.2",
|
|
91
|
+
"@intlayer/unmerged-dictionaries-entry": "7.0.2",
|
|
92
92
|
"js-cookie": "3.0.5",
|
|
93
93
|
"uuid": "13.0.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/js-cookie": "3.0.6",
|
|
97
97
|
"@types/node": "24.9.1",
|
|
98
|
-
"@utils/ts-config": "7.0.
|
|
99
|
-
"@utils/ts-config-types": "7.0.
|
|
100
|
-
"@utils/tsdown-config": "7.0.
|
|
98
|
+
"@utils/ts-config": "7.0.2",
|
|
99
|
+
"@utils/ts-config-types": "7.0.2",
|
|
100
|
+
"@utils/tsdown-config": "7.0.2",
|
|
101
101
|
"@vitejs/plugin-vue": "6.0.1",
|
|
102
102
|
"ajv": "^8.17.1",
|
|
103
103
|
"fast-glob": "3.3.3",
|
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
"vue-tsc": "3.1.1"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
|
-
"@intlayer/api": "7.0.
|
|
114
|
-
"@intlayer/config": "7.0.
|
|
115
|
-
"@intlayer/core": "7.0.
|
|
116
|
-
"@intlayer/
|
|
117
|
-
"@intlayer/
|
|
118
|
-
"@intlayer/
|
|
119
|
-
"intlayer": "7.0.
|
|
113
|
+
"@intlayer/api": "7.0.2",
|
|
114
|
+
"@intlayer/config": "7.0.2",
|
|
115
|
+
"@intlayer/core": "7.0.2",
|
|
116
|
+
"@intlayer/editor": "7.0.2",
|
|
117
|
+
"@intlayer/types": "7.0.2",
|
|
118
|
+
"@intlayer/unmerged-dictionaries-entry": "7.0.2",
|
|
119
|
+
"intlayer": "7.0.2",
|
|
120
120
|
"vue": ">=3.0.0"
|
|
121
121
|
},
|
|
122
122
|
"peerDependenciesMeta": {
|