vue-intlayer 7.1.8 → 7.1.9
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-B3aaeQtq.mjs → ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs} +7 -4
- 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/communicator.cjs +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +1 -1
- package/dist/cjs/editor/editorLocale.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/installIntlayer.mjs +13 -11
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/EditorSelectorRenderer.mjs +1 -1
- package/dist/esm/editor/communicator.mjs +17 -20
- package/dist/esm/editor/createSharedComposable.mjs +3 -6
- package/dist/esm/editor/editorLocale.mjs +3 -2
- package/dist/esm/editor/index.mjs +6 -4
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +13 -14
- package/dist/esm/index.mjs +28 -22
- package/dist/esm/plugins.mjs +48 -43
- package/dist/types/editor/createSharedComposable.d.ts +1 -1
- package/dist/types/editor/index.d.ts +1 -0
- package/dist/types/editor/installIntlayerEditor.d.ts +2 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +8 -8
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CJxI24VF.js +0 -1
|
@@ -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;
|
|
@@ -6,7 +6,8 @@ import { _ as k } from "./ContentSelector.vue_vue_type_script_setup_true_lang-pC
|
|
|
6
6
|
import { useCommunicator as K } from "./esm/editor/communicator.mjs";
|
|
7
7
|
import { useEditorEnabled as P } from "./esm/editor/editorEnabled.mjs";
|
|
8
8
|
import { useFocusDictionary as N } from "./esm/editor/focusDictionary.mjs";
|
|
9
|
-
|
|
9
|
+
import { useEditor as T } from "./esm/editor/useEditor.mjs";
|
|
10
|
+
const B = /* @__PURE__ */ m({
|
|
10
11
|
__name: "ContentSelectorWrapper",
|
|
11
12
|
props: {
|
|
12
13
|
dictionaryKey: {},
|
|
@@ -17,7 +18,9 @@ const b = /* @__PURE__ */ m({
|
|
|
17
18
|
children: {}
|
|
18
19
|
},
|
|
19
20
|
setup(c) {
|
|
20
|
-
const e = c, t = N(), l = P(), a = K()
|
|
21
|
+
const e = c, t = N(), l = P(), a = K();
|
|
22
|
+
T();
|
|
23
|
+
const n = r(
|
|
21
24
|
() => e.keyPath.filter((o) => o.type !== C.Translation)
|
|
22
25
|
), d = r(
|
|
23
26
|
() => t?.focusedContent.value?.dictionaryKey === e.dictionaryKey && (t?.focusedContent.value.keyPath?.length ?? 0) > 0 && v(
|
|
@@ -43,7 +46,7 @@ const b = /* @__PURE__ */ m({
|
|
|
43
46
|
data: null
|
|
44
47
|
});
|
|
45
48
|
};
|
|
46
|
-
return (o,
|
|
49
|
+
return (o, g) => h(l)?.enabled.value ? (_(), f(k, {
|
|
47
50
|
key: 0,
|
|
48
51
|
onPress: y,
|
|
49
52
|
isSelecting: d.value,
|
|
@@ -58,5 +61,5 @@ const b = /* @__PURE__ */ m({
|
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
export {
|
|
61
|
-
|
|
64
|
+
B as _
|
|
62
65
|
};
|
|
@@ -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("@intlayer/types");require("../editor/communicator.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},
|
|
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 u=require("@intlayer/config/built"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@intlayer/config/built"),r=require("vue"),l=()=>Math.random().toString(36).slice(2),{editor:n}=u,o={postMessage:()=>null,allowedOrigins:[n?.applicationURL,n?.editorURL,n?.cmsURL],senderId:""};let e=null;const c=Symbol("Communicator"),i=(t={postMessage:()=>null})=>e||(e=r.reactive({...o,...t,senderId:l()}),e),m=(t,s={postMessage:()=>null})=>{const a=i(s);t.provide(c,a)},d=()=>{try{return r.inject(c,o)}catch{return console.warn("useCommunicator: inject can only be used in setup(). Returning default communicator."),o}};exports.createCommunicator=i;exports.installCommunicator=m;exports.useCommunicator=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),c=t=>s.getCurrentScope()?(s.onScopeDispose(t),!0):!1,p=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=p;exports.tryOnScopeDispose=c;
|
|
@@ -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("./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"),r=require("./useEditor.cjs");exports.ContentSelectorWrapper=e._sfc_main;exports.installIntlayerEditor=t.installIntlayerEditor;exports.useEditor=r.useEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@intlayer/editor"),c=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@intlayer/editor"),c=require("vue"),l=require("./communicator.cjs"),o=new Map;let u=!1;const p=(e,t)=>{let s=o.get(e);s||(s=new Set,o.set(e,s)),s.add(t)},f=(e,t)=>{const s=o.get(e);s&&(s.delete(t),s.size===0&&o.delete(e))},m=(e,t)=>{u||window&&(window.addEventListener("message",s=>{const{type:n,data:i,senderId:a}=s.data??{};n&&a!==t&&(!e||e.includes("*")||e.some(r=>d.compareUrls(r,s.origin)))&&o.get(n)?.forEach(r=>{r(i)})}),u=!0)},b=(e,t)=>{const{allowedOrigins:s,postMessage:n,senderId:i}=l.useCommunicator()??{};return m(s,i),t?(p(e,t),c.onScopeDispose(()=>f(e,t))):c.getCurrentInstance()||console.warn("useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."),r=>{n({type:e,data:r,senderId:i})}};exports.useCrossFrameMessageListener=b;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -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("./client/installIntlayer.cjs"),i=require("./client/useDictionary.cjs"),a=require("./client/useDictionaryAsync.cjs"),o=require("./client/useDictionaryDynamic.cjs"),e=require("./client/useIntlayer.cjs"),l=require("./client/useLoadDynamic.cjs"),s=require("./client/useLocale.cjs"),c=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-B4fMFrZy.js"),u=require("./editor/installIntlayerEditor.cjs"),y=require("./editor/useEditor.cjs"),d=require("./getDictionary.cjs"),_=require("./getIntlayer.cjs"),t=require("./markdown/installIntlayerMarkdown.cjs"),r=require("./plugins.cjs");exports.INTLAYER_SYMBOL=n.INTLAYER_SYMBOL;exports.createIntlayerClient=n.createIntlayerClient;exports.installIntlayer=n.installIntlayer;exports.useDictionary=i.useDictionary;exports.useDictionaryAsync=a.useDictionaryAsync;exports.useDictionaryDynamic=o.useDictionaryDynamic;exports.atPath=e.atPath;exports.isComponentLike=e.isComponentLike;exports.isObjectLike=e.isObjectLike;exports.toComponent=e.toComponent;exports.useIntlayer=e.useIntlayer;exports.useLoadDynamic=l.useLoadDynamic;exports.useLocale=s.useLocale;exports.ContentSelectorWrapper=c._sfc_main;exports.installIntlayerEditor=u.installIntlayerEditor;exports.useEditor=y.useEditor;exports.getDictionary=d.getDictionary;exports.getIntlayer=_.getIntlayer;exports.INTLAYER_MARKDOWN_SYMBOL=t.INTLAYER_MARKDOWN_SYMBOL;exports.createIntlayerMarkdownClient=t.createIntlayerMarkdownClient;exports.installIntlayerMarkdown=t.installIntlayerMarkdown;exports.useMarkdown=t.useMarkdown;exports.intlayerNodePlugins=r.intlayerNodePlugins;exports.markdownPlugin=r.markdownPlugin;exports.markdownStringPlugin=r.markdownStringPlugin;
|
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@intlayer/core"),i=require("@intlayer/types"),u=require("vue"),l=require("../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-B4fMFrZy.js");require("./editor/installIntlayerEditor.cjs");require("@intlayer/config/built");require("@intlayer/editor");require("./editor/communicator.cjs");require("@intlayer/unmerged-dictionaries-entry");require("./client/useLocaleStorage.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,...t})=>o.renderIntlayerNode({...t,value:n,children:()=>u.h(l._sfc_main,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath},{default:()=>n})})},y={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,t)=>{const{plugins:d,...a}=n,s=p.getMarkdownMetadata(e),c=t(s,{plugins:[{id:"markdown-metadata-plugin",canHandle:r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||!r,transform:(r,g)=>o.renderIntlayerNode({...g,value:r,children:e})}],dictionaryKey:a.dictionaryKey,keyPath:[]});return o.renderIntlayerNode({...n,value:e,children:()=>u.h(l._sfc_main,{dictionaryKey:a.dictionaryKey,keyPath:a.keyPath},{default:()=>{const{renderMarkdown:r}=k.useMarkdown();return r(e)}}),additionalProps:{metadata:c}})}},P={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===i.NodeType.Markdown,transform:(e,n,t)=>{const d=[...n.keyPath,{type:i.NodeType.Markdown}],a=e[i.NodeType.Markdown];return t(a,{...n,children:a,keyPath:d,plugins:[y,...n.plugins??[]]})}};exports.intlayerNodePlugins=m;exports.markdownPlugin=P;exports.markdownStringPlugin=y;
|
|
@@ -4,25 +4,27 @@ import "@intlayer/core";
|
|
|
4
4
|
import "@intlayer/editor";
|
|
5
5
|
import "@intlayer/types";
|
|
6
6
|
import "../editor/communicator.mjs";
|
|
7
|
+
import "@intlayer/unmerged-dictionaries-entry";
|
|
8
|
+
import "./useLocaleStorage.mjs";
|
|
7
9
|
import { installIntlayerEditor as s } from "../editor/installIntlayerEditor.mjs";
|
|
8
|
-
const
|
|
10
|
+
const p = Symbol("intlayer");
|
|
9
11
|
let r = null;
|
|
10
|
-
const
|
|
12
|
+
const u = (o, e = !0) => {
|
|
11
13
|
if (r) return r;
|
|
12
|
-
const { defaultLocale: n } = a.internationalization ?? {}, t = c(o ?? n),
|
|
13
|
-
t.value =
|
|
14
|
+
const { defaultLocale: n } = a.internationalization ?? {}, t = c(o ?? n), i = (l) => {
|
|
15
|
+
t.value = l;
|
|
14
16
|
};
|
|
15
17
|
return r = {
|
|
16
18
|
locale: m(t),
|
|
17
|
-
setLocale:
|
|
19
|
+
setLocale: i,
|
|
18
20
|
isCookieEnabled: e
|
|
19
21
|
}, r;
|
|
20
|
-
},
|
|
21
|
-
const t =
|
|
22
|
-
o.provide(
|
|
22
|
+
}, Y = (o, e, n = !0) => {
|
|
23
|
+
const t = u(e, n);
|
|
24
|
+
o.provide(p, t), s(o, t);
|
|
23
25
|
};
|
|
24
26
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
p as INTLAYER_SYMBOL,
|
|
28
|
+
u as createIntlayerClient,
|
|
29
|
+
Y as installIntlayer
|
|
28
30
|
};
|
|
@@ -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,36 +1,33 @@
|
|
|
1
1
|
import i from "@intlayer/config/built";
|
|
2
|
-
import { inject as a, reactive as
|
|
3
|
-
const
|
|
2
|
+
import { inject as a, reactive as u } from "vue";
|
|
3
|
+
const l = () => Math.random().toString(36).slice(2), { editor: o } = i, e = {
|
|
4
4
|
postMessage: () => null,
|
|
5
5
|
allowedOrigins: [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
o?.applicationURL,
|
|
7
|
+
o?.editorURL,
|
|
8
|
+
o?.cmsURL
|
|
9
9
|
],
|
|
10
10
|
senderId: ""
|
|
11
11
|
};
|
|
12
|
-
let
|
|
13
|
-
const r = Symbol("Communicator"), m = (
|
|
14
|
-
...
|
|
15
|
-
...
|
|
16
|
-
senderId:
|
|
17
|
-
}),
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
},
|
|
12
|
+
let n = null;
|
|
13
|
+
const r = Symbol("Communicator"), m = (t = { postMessage: () => null }) => n || (n = u({
|
|
14
|
+
...e,
|
|
15
|
+
...t,
|
|
16
|
+
senderId: l()
|
|
17
|
+
}), n), g = (t, c = { postMessage: () => null }) => {
|
|
18
|
+
const s = m(c);
|
|
19
|
+
t.provide(r, s);
|
|
20
|
+
}, C = () => {
|
|
21
21
|
try {
|
|
22
|
-
return a(r,
|
|
22
|
+
return a(r, e);
|
|
23
23
|
} catch {
|
|
24
24
|
return console.warn(
|
|
25
25
|
"useCommunicator: inject can only be used in setup(). Returning default communicator."
|
|
26
|
-
),
|
|
27
|
-
postMessage: () => null,
|
|
28
|
-
senderId: ""
|
|
29
|
-
};
|
|
26
|
+
), e;
|
|
30
27
|
}
|
|
31
28
|
};
|
|
32
29
|
export {
|
|
33
30
|
m as createCommunicator,
|
|
34
31
|
g as installCommunicator,
|
|
35
|
-
|
|
32
|
+
C as useCommunicator
|
|
36
33
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { effectScope as
|
|
2
|
-
|
|
3
|
-
return c() ? (i(t), !0) : !1;
|
|
4
|
-
}
|
|
5
|
-
const a = (t) => {
|
|
1
|
+
import { effectScope as c, getCurrentScope as n, onScopeDispose as i } from "vue";
|
|
2
|
+
const u = (t) => n() ? (i(t), !0) : !1, a = (t) => {
|
|
6
3
|
let r = 0, o, e;
|
|
7
4
|
const s = () => {
|
|
8
5
|
r -= 1, e && r <= 0 && (e.stop(), o = void 0, e = void 0);
|
|
9
6
|
};
|
|
10
|
-
return (...
|
|
7
|
+
return (...p) => (r += 1, e || (e = c(!0), o = e.run(() => t(...p))), u(s), o);
|
|
11
8
|
};
|
|
12
9
|
export {
|
|
13
10
|
a as createSharedComposable,
|
|
@@ -7,9 +7,10 @@ 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/unmerged-dictionaries-entry";
|
|
10
11
|
import "./installIntlayerEditor.mjs";
|
|
11
12
|
import "../client/useLocaleStorage.mjs";
|
|
12
|
-
const
|
|
13
|
+
const A = p(() => {
|
|
13
14
|
const t = m(a);
|
|
14
15
|
if (!t)
|
|
15
16
|
throw new Error("IntlayerEditor state not found");
|
|
@@ -25,5 +26,5 @@ const w = p(() => {
|
|
|
25
26
|
), t;
|
|
26
27
|
});
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
+
A as useEditorLocale
|
|
29
30
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { installIntlayerEditor as
|
|
1
|
+
import { _ as t } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
2
|
+
import { installIntlayerEditor as p } from "./installIntlayerEditor.mjs";
|
|
3
|
+
import { useEditor as l } from "./useEditor.mjs";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
t as ContentSelectorWrapper,
|
|
6
|
+
p as installIntlayerEditor,
|
|
7
|
+
l as useEditor
|
|
6
8
|
};
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { compareUrls as u } from "@intlayer/editor";
|
|
2
|
-
import { onScopeDispose as
|
|
3
|
-
import { useCommunicator as
|
|
2
|
+
import { onScopeDispose as d, getCurrentInstance as p } from "vue";
|
|
3
|
+
import { useCommunicator as f } from "./communicator.mjs";
|
|
4
4
|
const o = /* @__PURE__ */ new Map();
|
|
5
5
|
let c = !1;
|
|
6
|
-
|
|
6
|
+
const m = (e, t) => {
|
|
7
7
|
let s = o.get(e);
|
|
8
8
|
s || (s = /* @__PURE__ */ new Set(), o.set(e, s)), s.add(t);
|
|
9
|
-
}
|
|
10
|
-
function l(e, t) {
|
|
9
|
+
}, l = (e, t) => {
|
|
11
10
|
const s = o.get(e);
|
|
12
11
|
s && (s.delete(t), s.size === 0 && o.delete(e));
|
|
13
|
-
}
|
|
14
|
-
function w(e, t) {
|
|
12
|
+
}, w = (e, t) => {
|
|
15
13
|
c || window && (window.addEventListener("message", (s) => {
|
|
16
|
-
const { type: n, data:
|
|
17
|
-
n &&
|
|
14
|
+
const { type: n, data: a, senderId: i } = s.data ?? {};
|
|
15
|
+
n && i !== t && (!e || e.includes("*") || e.some((r) => u(r, s.origin))) && o.get(n)?.forEach((r) => {
|
|
16
|
+
r(a);
|
|
17
|
+
});
|
|
18
18
|
}), c = !0);
|
|
19
|
-
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return w(s, i), t ? (m(e, t), f(() => l(e, t))) : d() || console.warn(
|
|
19
|
+
}, L = (e, t) => {
|
|
20
|
+
const { allowedOrigins: s, postMessage: n, senderId: a } = f() ?? {};
|
|
21
|
+
return w(s, a), t ? (m(e, t), d(() => l(e, t))) : p() || console.warn(
|
|
23
22
|
"useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."
|
|
24
23
|
), (r) => {
|
|
25
|
-
n({ type: e, data: r, senderId:
|
|
24
|
+
n({ type: e, data: r, senderId: a });
|
|
26
25
|
};
|
|
27
26
|
};
|
|
28
27
|
export {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
import { INTLAYER_SYMBOL as o, createIntlayerClient as t, installIntlayer as n } from "./client/installIntlayer.mjs";
|
|
2
2
|
import { useDictionary as i } from "./client/useDictionary.mjs";
|
|
3
3
|
import { useDictionaryAsync as m } from "./client/useDictionaryAsync.mjs";
|
|
4
|
-
import { useDictionaryDynamic as
|
|
5
|
-
import { atPath as
|
|
6
|
-
import { useLoadDynamic as
|
|
4
|
+
import { useDictionaryDynamic as s } from "./client/useDictionaryDynamic.mjs";
|
|
5
|
+
import { atPath as f, isComponentLike as x, isObjectLike as c, toComponent as u, useIntlayer as d } from "./client/useIntlayer.mjs";
|
|
6
|
+
import { useLoadDynamic as L } from "./client/useLoadDynamic.mjs";
|
|
7
7
|
import { useLocale as D } from "./client/useLocale.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { _ as M } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
9
|
+
import { installIntlayerEditor as C } from "./editor/installIntlayerEditor.mjs";
|
|
10
|
+
import { useEditor as E } from "./editor/useEditor.mjs";
|
|
11
|
+
import { getDictionary as O } from "./getDictionary.mjs";
|
|
12
|
+
import { getIntlayer as S } from "./getIntlayer.mjs";
|
|
13
|
+
import { INTLAYER_MARKDOWN_SYMBOL as _, createIntlayerMarkdownClient as R, installIntlayerMarkdown as B, useMarkdown as T } from "./markdown/installIntlayerMarkdown.mjs";
|
|
14
|
+
import { intlayerNodePlugins as b, markdownPlugin as h, markdownStringPlugin as j } from "./plugins.mjs";
|
|
12
15
|
export {
|
|
13
|
-
|
|
16
|
+
M as ContentSelectorWrapper,
|
|
17
|
+
_ as INTLAYER_MARKDOWN_SYMBOL,
|
|
14
18
|
o as INTLAYER_SYMBOL,
|
|
15
|
-
|
|
19
|
+
f as atPath,
|
|
16
20
|
t as createIntlayerClient,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
R as createIntlayerMarkdownClient,
|
|
22
|
+
O as getDictionary,
|
|
23
|
+
S as getIntlayer,
|
|
20
24
|
n as installIntlayer,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
x as
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
C as installIntlayerEditor,
|
|
26
|
+
B as installIntlayerMarkdown,
|
|
27
|
+
b as intlayerNodePlugins,
|
|
28
|
+
x as isComponentLike,
|
|
29
|
+
c as isObjectLike,
|
|
30
|
+
h as markdownPlugin,
|
|
31
|
+
j as markdownStringPlugin,
|
|
27
32
|
u as toComponent,
|
|
28
33
|
i as useDictionary,
|
|
29
34
|
m as useDictionaryAsync,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
d as
|
|
35
|
+
s as useDictionaryDynamic,
|
|
36
|
+
E as useEditor,
|
|
37
|
+
d as useIntlayer,
|
|
38
|
+
L as useLoadDynamic,
|
|
33
39
|
D as useLocale,
|
|
34
|
-
|
|
40
|
+
T as useMarkdown
|
|
35
41
|
};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,91 +1,96 @@
|
|
|
1
|
-
import { getMarkdownMetadata as
|
|
2
|
-
import { NodeType as
|
|
1
|
+
import { getMarkdownMetadata as c } from "@intlayer/core";
|
|
2
|
+
import { NodeType as e } from "@intlayer/types";
|
|
3
3
|
import { h as y } from "vue";
|
|
4
|
-
import { _ as
|
|
4
|
+
import { _ as m } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-HcQvp9bv.mjs";
|
|
5
5
|
import "./editor/installIntlayerEditor.mjs";
|
|
6
|
-
import
|
|
6
|
+
import "@intlayer/config/built";
|
|
7
|
+
import "@intlayer/editor";
|
|
8
|
+
import "./editor/communicator.mjs";
|
|
9
|
+
import "@intlayer/unmerged-dictionaries-entry";
|
|
10
|
+
import "./client/useLocaleStorage.mjs";
|
|
11
|
+
import { useMarkdown as u } from "./markdown/installIntlayerMarkdown.mjs";
|
|
7
12
|
import { renderIntlayerNode as i } from "./renderIntlayerNode.mjs";
|
|
8
|
-
const
|
|
13
|
+
const x = {
|
|
9
14
|
id: "intlayer-node-plugin",
|
|
10
|
-
canHandle: (
|
|
11
|
-
transform: (
|
|
12
|
-
...
|
|
13
|
-
value:
|
|
15
|
+
canHandle: (t) => typeof t == "bigint" || typeof t == "string" || typeof t == "number",
|
|
16
|
+
transform: (t, { children: n, ...a }) => i({
|
|
17
|
+
...a,
|
|
18
|
+
value: n,
|
|
14
19
|
children: () => y(
|
|
15
20
|
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
16
|
-
|
|
21
|
+
m,
|
|
17
22
|
{
|
|
18
|
-
dictionaryKey:
|
|
19
|
-
keyPath:
|
|
23
|
+
dictionaryKey: a.dictionaryKey,
|
|
24
|
+
keyPath: a.keyPath
|
|
20
25
|
},
|
|
21
26
|
{
|
|
22
|
-
default: () =>
|
|
27
|
+
default: () => n
|
|
23
28
|
}
|
|
24
29
|
)
|
|
25
30
|
})
|
|
26
31
|
}, f = {
|
|
27
32
|
id: "markdown-string-plugin",
|
|
28
|
-
canHandle: (
|
|
29
|
-
transform: (
|
|
33
|
+
canHandle: (t) => typeof t == "string",
|
|
34
|
+
transform: (t, n, a) => {
|
|
30
35
|
const {
|
|
31
36
|
plugins: d,
|
|
32
37
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
33
|
-
...
|
|
34
|
-
} =
|
|
38
|
+
...o
|
|
39
|
+
} = n, l = c(t), p = a(l, {
|
|
35
40
|
plugins: [{
|
|
36
41
|
id: "markdown-metadata-plugin",
|
|
37
|
-
canHandle: (
|
|
38
|
-
transform: (
|
|
39
|
-
...
|
|
40
|
-
value:
|
|
41
|
-
children:
|
|
42
|
+
canHandle: (r) => typeof r == "string" || typeof r == "number" || typeof r == "boolean" || !r,
|
|
43
|
+
transform: (r, s) => i({
|
|
44
|
+
...s,
|
|
45
|
+
value: r,
|
|
46
|
+
children: t
|
|
42
47
|
})
|
|
43
48
|
}],
|
|
44
|
-
dictionaryKey:
|
|
49
|
+
dictionaryKey: o.dictionaryKey,
|
|
45
50
|
keyPath: []
|
|
46
51
|
});
|
|
47
52
|
return i({
|
|
48
|
-
...
|
|
49
|
-
value:
|
|
53
|
+
...n,
|
|
54
|
+
value: t,
|
|
50
55
|
children: () => y(
|
|
51
56
|
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
52
|
-
|
|
57
|
+
m,
|
|
53
58
|
{
|
|
54
|
-
dictionaryKey:
|
|
55
|
-
keyPath:
|
|
59
|
+
dictionaryKey: o.dictionaryKey,
|
|
60
|
+
keyPath: o.keyPath
|
|
56
61
|
},
|
|
57
62
|
{
|
|
58
63
|
default: () => {
|
|
59
|
-
const { renderMarkdown:
|
|
60
|
-
return
|
|
64
|
+
const { renderMarkdown: r } = u();
|
|
65
|
+
return r(t);
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
),
|
|
64
69
|
additionalProps: {
|
|
65
|
-
metadata:
|
|
70
|
+
metadata: p
|
|
66
71
|
}
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
|
-
},
|
|
74
|
+
}, I = {
|
|
70
75
|
id: "markdown-plugin",
|
|
71
|
-
canHandle: (
|
|
72
|
-
transform: (
|
|
76
|
+
canHandle: (t) => typeof t == "object" && t?.nodeType === e.Markdown,
|
|
77
|
+
transform: (t, n, a) => {
|
|
73
78
|
const d = [
|
|
74
|
-
...
|
|
79
|
+
...n.keyPath,
|
|
75
80
|
{
|
|
76
|
-
type:
|
|
81
|
+
type: e.Markdown
|
|
77
82
|
}
|
|
78
|
-
],
|
|
79
|
-
return
|
|
80
|
-
...
|
|
81
|
-
children:
|
|
83
|
+
], o = t[e.Markdown];
|
|
84
|
+
return a(o, {
|
|
85
|
+
...n,
|
|
86
|
+
children: o,
|
|
82
87
|
keyPath: d,
|
|
83
|
-
plugins: [f, ...
|
|
88
|
+
plugins: [f, ...n.plugins ?? []]
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
91
|
};
|
|
87
92
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
x as intlayerNodePlugins,
|
|
94
|
+
I as markdownPlugin,
|
|
90
95
|
f as markdownStringPlugin
|
|
91
96
|
};
|
|
@@ -4,7 +4,7 @@ export type SharedComposableReturn<T extends AnyFn = AnyFn> = T;
|
|
|
4
4
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
export declare
|
|
7
|
+
export declare const tryOnScopeDispose: (fn: () => void) => boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Make a composable function usable with multiple Vue instances.
|
|
10
10
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
+
import { IntlayerProvider } from '../client';
|
|
2
3
|
/**
|
|
3
4
|
* Vue-side replacement for the former <IntlayerEditorProvider> React component.
|
|
4
5
|
*
|
|
@@ -11,4 +12,4 @@ import { App } from 'vue';
|
|
|
11
12
|
* </script>
|
|
12
13
|
* ```
|
|
13
14
|
*/
|
|
14
|
-
export declare const installIntlayerEditor: (app: App, localeProvider?:
|
|
15
|
+
export declare const installIntlayerEditor: (app: App, localeProvider?: IntlayerProvider) => void;
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@intlayer/api": "7.1.
|
|
90
|
-
"@intlayer/config": "7.1.
|
|
91
|
-
"@intlayer/core": "7.1.
|
|
92
|
-
"@intlayer/editor": "7.1.
|
|
93
|
-
"@intlayer/types": "7.1.
|
|
94
|
-
"@intlayer/unmerged-dictionaries-entry": "7.1.
|
|
89
|
+
"@intlayer/api": "7.1.9",
|
|
90
|
+
"@intlayer/config": "7.1.9",
|
|
91
|
+
"@intlayer/core": "7.1.9",
|
|
92
|
+
"@intlayer/editor": "7.1.9",
|
|
93
|
+
"@intlayer/types": "7.1.9",
|
|
94
|
+
"@intlayer/unmerged-dictionaries-entry": "7.1.9"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@types/node": "24.10.1",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"vue-tsc": "3.1.1"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
|
-
"intlayer": "7.1.
|
|
113
|
+
"intlayer": "7.1.9",
|
|
114
114
|
"vue": ">=3.0.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),_=require("@intlayer/core"),a=require("@intlayer/editor"),p=require("@intlayer/types"),h=require("./ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js"),f=require("./cjs/editor/communicator.cjs"),v=require("./cjs/editor/editorEnabled.cjs"),m=require("./cjs/editor/focusDictionary.cjs"),E=e.defineComponent({__name:"ContentSelectorWrapper",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(c){const t=c,o=m.useFocusDictionary(),i=v.useEditorEnabled(),s=f.useCommunicator(),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)),l=()=>{o?.setFocusedContent({dictionaryKey:t.dictionaryKey,keyPath:r.value})},d=()=>{s?.postMessage({type:`${a.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:t.dictionaryKey,keyPath:r.value}})},y=()=>{s?.postMessage({type:`${a.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(n,C)=>e.unref(i)?.enabled.value?(e.openBlock(),e.createBlock(h._sfc_main,{key:0,onPress:l,isSelecting:u.value,onHover:d,onUnhover:y},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},8,["isSelecting"])):e.renderSlot(n.$slots,"default",{key:1})}});exports._sfc_main=E;
|