vue-intlayer 5.3.13 → 5.4.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/dist/ContentSelector.vue_vue_type_script_setup_true_lang-Dfu1ALQx.mjs +71 -0
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-OSRmjq5b.js +1 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-BML9iRiS.mjs +45 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CE_1sBPk.js +1 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-CvPgk7Z3.mjs +39 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-Yqrgst_y.js +1 -0
- package/dist/cjs/UI/ContentSelector.cjs +1 -0
- package/dist/cjs/client/computedProxy.cjs +1 -0
- package/dist/cjs/client/index.cjs +1 -0
- package/dist/cjs/client/installIntlayer.cjs +1 -0
- package/dist/cjs/client/useDictionary.cjs +1 -0
- package/dist/cjs/client/useIntlayer.cjs +1 -0
- package/dist/cjs/client/useLocale.cjs +1 -0
- package/dist/cjs/client/useLocaleCookie.cjs +1 -0
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -0
- package/dist/cjs/editor/EditedContentRenderer.cjs +1 -0
- package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -0
- package/dist/cjs/editor/changedContent.cjs +1 -0
- package/dist/cjs/editor/communicator.cjs +1 -0
- package/dist/cjs/editor/configuration.cjs +1 -0
- package/dist/cjs/editor/createSharedComposable.cjs +1 -0
- package/dist/cjs/editor/dictionariesRecord.cjs +1 -0
- package/dist/cjs/editor/editedContent.cjs +1 -0
- package/dist/cjs/editor/editorEnabled.cjs +1 -0
- package/dist/cjs/editor/editorLocale.cjs +1 -0
- package/dist/cjs/editor/focusDictionary.cjs +1 -0
- package/dist/cjs/editor/index.cjs +1 -0
- package/dist/cjs/editor/installIntlayerEditor.cjs +1 -0
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -0
- package/dist/cjs/editor/useCrossFrameState.cjs +1 -0
- package/dist/cjs/editor/useCrossURLPathState.cjs +1 -0
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -0
- package/dist/cjs/editor/useEditor.cjs +1 -0
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -0
- package/dist/cjs/getDictionary.cjs +1 -0
- package/dist/cjs/getIntlayer.cjs +1 -0
- package/dist/cjs/index.cjs +1 -25
- package/dist/cjs/markdown/index.cjs +1 -0
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -0
- package/dist/cjs/plugins.cjs +1 -0
- package/dist/cjs/renderIntlayerNode.cjs +1 -0
- package/dist/cjs/server/IntlayerServerProvider.cjs +1 -0
- package/dist/cjs/server/index.cjs +1 -0
- package/dist/cjs/server/serverContext.cjs +1 -0
- package/dist/cjs/server/t.cjs +1 -0
- package/dist/cjs/server/useDictionary.cjs +1 -0
- package/dist/cjs/server/useIntlayer.cjs +1 -0
- package/dist/esm/UI/ContentSelector.mjs +4 -0
- package/dist/esm/client/computedProxy.mjs +24 -0
- package/dist/esm/client/index.mjs +12 -0
- package/dist/esm/client/installIntlayer.mjs +28 -0
- package/dist/esm/client/useDictionary.mjs +16 -0
- package/dist/esm/client/useIntlayer.mjs +14 -0
- package/dist/esm/client/useLocale.mjs +33 -0
- package/dist/esm/client/useLocaleCookie.mjs +19 -0
- package/dist/esm/editor/ContentSelectorWrapper.mjs +4 -0
- package/dist/esm/editor/EditedContentRenderer.mjs +4 -0
- package/dist/esm/editor/EditorSelectorRenderer.mjs +39 -0
- package/dist/esm/editor/changedContent.mjs +21 -0
- package/dist/esm/editor/communicator.mjs +37 -0
- package/dist/esm/editor/configuration.mjs +13 -0
- package/dist/esm/editor/createSharedComposable.mjs +15 -0
- package/dist/esm/editor/dictionariesRecord.mjs +49 -0
- package/dist/esm/editor/editedContent.mjs +43 -0
- package/dist/esm/editor/editorEnabled.mjs +36 -0
- package/dist/esm/editor/editorLocale.mjs +29 -0
- package/dist/esm/editor/focusDictionary.mjs +39 -0
- package/dist/esm/editor/index.mjs +6 -0
- package/dist/esm/editor/installIntlayerEditor.mjs +18 -0
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +31 -0
- package/dist/esm/editor/useCrossFrameState.mjs +44 -0
- package/dist/esm/editor/useCrossURLPathState.mjs +26 -0
- package/dist/esm/editor/useEditedContentRenderer.mjs +17 -0
- package/dist/esm/editor/useEditor.mjs +14 -0
- package/dist/esm/editor/useIframeClickInterceptor.mjs +23 -0
- package/dist/esm/getDictionary.mjs +17 -0
- package/dist/esm/getIntlayer.mjs +13 -0
- package/dist/esm/index.mjs +25 -3
- package/dist/esm/markdown/index.mjs +7 -0
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +25 -0
- package/dist/esm/plugins.mjs +90 -0
- package/dist/esm/renderIntlayerNode.mjs +12 -0
- package/dist/esm/server/IntlayerServerProvider.mjs +12 -0
- package/dist/esm/server/index.mjs +16 -0
- package/dist/esm/server/serverContext.mjs +34 -0
- package/dist/esm/server/t.mjs +10 -0
- package/dist/esm/server/useDictionary.mjs +10 -0
- package/dist/esm/server/useIntlayer.mjs +10 -0
- package/dist/types/UI/ContentSelector.vue.d.ts +33 -0
- package/dist/types/UI/ContentSelector.vue.d.ts.map +1 -0
- package/dist/types/client/computedProxy.d.ts +3 -0
- package/dist/types/client/computedProxy.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/installIntlayer.d.ts +16 -0
- package/dist/types/client/installIntlayer.d.ts.map +1 -0
- package/dist/types/client/useDictionary.d.ts +5 -0
- package/dist/types/client/useDictionary.d.ts.map +1 -0
- package/dist/types/client/useIntlayer.d.ts +11 -0
- package/dist/types/client/useIntlayer.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +16 -0
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useLocaleCookie.d.ts +17 -0
- package/dist/types/client/useLocaleCookie.d.ts.map +1 -0
- package/dist/types/editor/ContentSelectorWrapper.vue.d.ts +26 -0
- package/dist/types/editor/ContentSelectorWrapper.vue.d.ts.map +1 -0
- package/dist/types/editor/changedContent.d.ts +15 -0
- package/dist/types/editor/changedContent.d.ts.map +1 -0
- package/dist/types/editor/communicator.d.ts +28 -0
- package/dist/types/editor/communicator.d.ts.map +1 -0
- package/dist/types/editor/configuration.d.ts +2 -0
- package/dist/types/editor/configuration.d.ts.map +1 -0
- package/dist/types/editor/createSharedComposable.d.ts +13 -0
- package/dist/types/editor/createSharedComposable.d.ts.map +1 -0
- package/dist/types/editor/dictionariesRecord.d.ts +16 -0
- package/dist/types/editor/dictionariesRecord.d.ts.map +1 -0
- package/dist/types/editor/editedContent.d.ts +19 -0
- package/dist/types/editor/editedContent.d.ts.map +1 -0
- package/dist/types/editor/editorEnabled.d.ts +16 -0
- package/dist/types/editor/editorEnabled.d.ts.map +1 -0
- package/dist/types/editor/editorLocale.d.ts +3 -0
- package/dist/types/editor/editorLocale.d.ts.map +1 -0
- package/dist/types/editor/focusDictionary.d.ts +24 -0
- package/dist/types/editor/focusDictionary.d.ts.map +1 -0
- package/dist/types/editor/index.d.ts +3 -0
- package/dist/types/editor/index.d.ts.map +1 -0
- package/dist/types/editor/installIntlayerEditor.d.ts +15 -0
- package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -0
- package/dist/types/editor/useCrossFrameMessageListener.d.ts +11 -0
- package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -0
- package/dist/types/editor/useCrossFrameState.d.ts +24 -0
- package/dist/types/editor/useCrossFrameState.d.ts.map +1 -0
- package/dist/types/editor/useCrossURLPathState.d.ts +16 -0
- package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts +10 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -0
- package/dist/types/editor/useEditor.d.ts +2 -0
- package/dist/types/editor/useEditor.d.ts.map +1 -0
- package/dist/types/editor/useIframeClickInterceptor.d.ts +11 -0
- package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -0
- package/dist/types/getDictionary.d.ts +5 -0
- package/dist/types/getDictionary.d.ts.map +1 -0
- package/dist/types/getIntlayer.d.ts +5 -0
- package/dist/types/getIntlayer.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +2 -0
- package/dist/types/markdown/index.d.ts.map +1 -0
- package/dist/types/markdown/installIntlayerMarkdown.d.ts +17 -0
- package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +46 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/renderIntlayerNode.d.ts +36 -0
- package/dist/types/renderIntlayerNode.d.ts.map +1 -0
- package/dist/types/server/IntlayerServerProvider.d.ts +38 -0
- package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +6 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/serverContext.d.ts +35 -0
- package/dist/types/server/serverContext.d.ts.map +1 -0
- package/dist/types/server/t.d.ts +24 -0
- package/dist/types/server/t.d.ts.map +1 -0
- package/dist/types/server/useDictionary.d.ts +19 -0
- package/dist/types/server/useDictionary.d.ts.map +1 -0
- package/dist/types/server/useIntlayer.d.ts +16 -0
- package/dist/types/server/useIntlayer.d.ts.map +1 -0
- package/package.json +34 -14
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/intlayerMiddlewarePlugin.cjs +0 -224
- package/dist/cjs/intlayerMiddlewarePlugin.cjs.map +0 -1
- package/dist/cjs/intlayerPlugin.cjs +0 -76
- package/dist/cjs/intlayerPlugin.cjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/intlayerMiddlewarePlugin.mjs +0 -200
- package/dist/esm/intlayerMiddlewarePlugin.mjs.map +0 -1
- package/dist/esm/intlayerPlugin.mjs +0 -52
- package/dist/esm/intlayerPlugin.mjs.map +0 -1
- package/dist/types/intlayerMiddlewarePlugin.d.ts +0 -6
- package/dist/types/intlayerMiddlewarePlugin.d.ts.map +0 -1
- package/dist/types/intlayerPlugin.d.ts +0 -16
- package/dist/types/intlayerPlugin.d.ts.map +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import a from "@intlayer/config/built";
|
|
2
|
+
import { v4 as u } from "uuid";
|
|
3
|
+
import { reactive as l, inject as i } from "vue";
|
|
4
|
+
const { editor: n } = a, o = {
|
|
5
|
+
postMessage: () => null,
|
|
6
|
+
allowedOrigins: [
|
|
7
|
+
n == null ? void 0 : n.applicationURL,
|
|
8
|
+
n == null ? void 0 : n.editorURL,
|
|
9
|
+
n == null ? void 0 : n.cmsURL
|
|
10
|
+
],
|
|
11
|
+
senderId: ""
|
|
12
|
+
};
|
|
13
|
+
let t = null;
|
|
14
|
+
const r = Symbol("Communicator"), m = (e = { postMessage: () => null }) => t || (t = l({
|
|
15
|
+
...o,
|
|
16
|
+
...e,
|
|
17
|
+
senderId: u()
|
|
18
|
+
}), t), g = (e, s = { postMessage: () => null }) => {
|
|
19
|
+
const c = m(s);
|
|
20
|
+
e.provide(r, c);
|
|
21
|
+
}, C = () => {
|
|
22
|
+
try {
|
|
23
|
+
return i(r, o);
|
|
24
|
+
} catch {
|
|
25
|
+
return console.warn(
|
|
26
|
+
"useCommunicator: inject can only be used in setup(). Returning default communicator."
|
|
27
|
+
), {
|
|
28
|
+
postMessage: () => null,
|
|
29
|
+
senderId: ""
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
m as createCommunicator,
|
|
35
|
+
g as installCommunicator,
|
|
36
|
+
C as useCommunicator
|
|
37
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import t from "@intlayer/config/built";
|
|
2
|
+
import { MessageKey as i } from "@intlayer/editor";
|
|
3
|
+
import { onMounted as n } from "vue";
|
|
4
|
+
import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
|
|
5
|
+
const a = () => {
|
|
6
|
+
const [o, r] = e(i.INTLAYER_CONFIGURATION);
|
|
7
|
+
n(() => {
|
|
8
|
+
o && r(t);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
a as useConfiguration
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { effectScope as p, getCurrentScope as c, onScopeDispose as i } from "vue";
|
|
2
|
+
function u(t) {
|
|
3
|
+
return c() ? (i(t), !0) : !1;
|
|
4
|
+
}
|
|
5
|
+
const a = (t) => {
|
|
6
|
+
let r = 0, o, e;
|
|
7
|
+
const s = () => {
|
|
8
|
+
r -= 1, e && r <= 0 && (e.stop(), o = void 0, e = void 0);
|
|
9
|
+
};
|
|
10
|
+
return (...n) => (r += 1, e || (e = p(!0), o = e.run(() => t(...n))), u(s), o);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
a as createSharedComposable,
|
|
14
|
+
u as tryOnScopeDispose
|
|
15
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import n from "@intlayer/dictionaries-entry";
|
|
2
|
+
import { MessageKey as a } from "@intlayer/editor";
|
|
3
|
+
import { ref as s, readonly as l, inject as m, watch as D } from "vue";
|
|
4
|
+
import { createSharedComposable as d } from "./createSharedComposable.mjs";
|
|
5
|
+
import { useCrossFrameState as R } from "./useCrossFrameState.mjs";
|
|
6
|
+
let i = null;
|
|
7
|
+
const t = Symbol(
|
|
8
|
+
"intlayerDictionariesRecord"
|
|
9
|
+
), u = () => {
|
|
10
|
+
if (i) return i;
|
|
11
|
+
const e = s(n);
|
|
12
|
+
return i = {
|
|
13
|
+
localeDictionaries: l(e),
|
|
14
|
+
setLocaleDictionaries: (o) => {
|
|
15
|
+
e.value = o ?? {};
|
|
16
|
+
},
|
|
17
|
+
setLocaleDictionary(o) {
|
|
18
|
+
e.value = {
|
|
19
|
+
...e.value,
|
|
20
|
+
[o.key]: o
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, i;
|
|
24
|
+
}, L = (e) => {
|
|
25
|
+
const o = u();
|
|
26
|
+
e.provide(t, o);
|
|
27
|
+
}, _ = d(() => {
|
|
28
|
+
const e = m(
|
|
29
|
+
t
|
|
30
|
+
);
|
|
31
|
+
if (!e)
|
|
32
|
+
throw new Error("DictionariesRecord state not found");
|
|
33
|
+
const [o, r] = R(
|
|
34
|
+
a.INTLAYER_LOCALE_DICTIONARIES_CHANGED,
|
|
35
|
+
void 0
|
|
36
|
+
);
|
|
37
|
+
D(
|
|
38
|
+
e.localeDictionaries,
|
|
39
|
+
(c) => {
|
|
40
|
+
r(c);
|
|
41
|
+
},
|
|
42
|
+
{ immediate: !0 }
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
u as createDictionaryRecordClient,
|
|
47
|
+
L as installDictionariesRecord,
|
|
48
|
+
_ as useDictionariesRecord
|
|
49
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getContentNodeByKeyPath as c } from "@intlayer/core";
|
|
2
|
+
import { MessageKey as C } from "@intlayer/editor";
|
|
3
|
+
import { ref as E, readonly as l, inject as u, watch as s } from "vue";
|
|
4
|
+
import { createSharedComposable as m } from "./createSharedComposable.mjs";
|
|
5
|
+
import { useCrossFrameState as f } from "./useCrossFrameState.mjs";
|
|
6
|
+
let o = null;
|
|
7
|
+
const a = Symbol("EditedContent"), p = () => {
|
|
8
|
+
if (o) return o;
|
|
9
|
+
const t = E({});
|
|
10
|
+
return o = {
|
|
11
|
+
editedContent: l(t),
|
|
12
|
+
getEditedContentValue: (e, r) => {
|
|
13
|
+
var d, i;
|
|
14
|
+
const n = (i = (d = t.value) == null ? void 0 : d[e]) == null ? void 0 : i.content;
|
|
15
|
+
if (n)
|
|
16
|
+
return c(n, r);
|
|
17
|
+
},
|
|
18
|
+
setEditedContent: (e) => {
|
|
19
|
+
t.value = e;
|
|
20
|
+
}
|
|
21
|
+
}, o;
|
|
22
|
+
}, D = (t) => {
|
|
23
|
+
const e = p();
|
|
24
|
+
t.provide(a, e);
|
|
25
|
+
}, h = m(() => {
|
|
26
|
+
const t = u(a);
|
|
27
|
+
if (!t)
|
|
28
|
+
throw new Error("EditedContent state not found");
|
|
29
|
+
const [e, r] = f(
|
|
30
|
+
C.INTLAYER_EDITED_CONTENT_CHANGED,
|
|
31
|
+
{}
|
|
32
|
+
);
|
|
33
|
+
return s(e, (n) => {
|
|
34
|
+
t.editedContent.value = n ?? {};
|
|
35
|
+
}), s(t, (n) => {
|
|
36
|
+
r(n.editedContent.value);
|
|
37
|
+
}), t;
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
p as createEditedContentClient,
|
|
41
|
+
D as installEditedContent,
|
|
42
|
+
h as useEditedContent
|
|
43
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MessageKey as s } from "@intlayer/editor";
|
|
2
|
+
import { inject as l, onMounted as i, ref as n, computed as E } from "vue";
|
|
3
|
+
import { createSharedComposable as d } from "./createSharedComposable.mjs";
|
|
4
|
+
import { useCrossFrameMessageListener as c } from "./useCrossFrameMessageListener.mjs";
|
|
5
|
+
let o = null;
|
|
6
|
+
const r = Symbol("EditorEnabled"), m = () => {
|
|
7
|
+
if (o) return o;
|
|
8
|
+
const e = n(!1), t = n(!1), a = E(() => e.value && t.value);
|
|
9
|
+
return o = {
|
|
10
|
+
wrapperEnabled: e,
|
|
11
|
+
isInIframe: t,
|
|
12
|
+
enabled: a
|
|
13
|
+
}, o;
|
|
14
|
+
}, w = (e) => {
|
|
15
|
+
const t = m();
|
|
16
|
+
e.provide(r, t);
|
|
17
|
+
}, I = d(() => {
|
|
18
|
+
const e = l(
|
|
19
|
+
r
|
|
20
|
+
);
|
|
21
|
+
if (!e)
|
|
22
|
+
throw new Error("EditorEnabled state not found");
|
|
23
|
+
return c(
|
|
24
|
+
`${s.INTLAYER_EDITOR_ENABLED}/post`,
|
|
25
|
+
(t) => {
|
|
26
|
+
e.wrapperEnabled.value = t;
|
|
27
|
+
}
|
|
28
|
+
), i(() => {
|
|
29
|
+
e.isInIframe.value = window.self !== window.top;
|
|
30
|
+
}), e;
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
m as createEditorEnabledClient,
|
|
34
|
+
w as installEditorEnabled,
|
|
35
|
+
I as useEditorEnabled
|
|
36
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MessageKey as e } from "@intlayer/editor";
|
|
2
|
+
import { inject as m, watch as i } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as a } from "../client/installIntlayer.mjs";
|
|
4
|
+
import "@intlayer/core";
|
|
5
|
+
import { createSharedComposable as p } from "./createSharedComposable.mjs";
|
|
6
|
+
import "./communicator.mjs";
|
|
7
|
+
import { useCrossFrameState as s } from "./useCrossFrameState.mjs";
|
|
8
|
+
import "@intlayer/config/built";
|
|
9
|
+
import "@intlayer/dictionaries-entry";
|
|
10
|
+
import "./installIntlayerEditor.mjs";
|
|
11
|
+
import "../client/useLocaleCookie.mjs";
|
|
12
|
+
const w = p(() => {
|
|
13
|
+
const t = m(a);
|
|
14
|
+
if (!t)
|
|
15
|
+
throw new Error("IntlayerEditor state not found");
|
|
16
|
+
const [n, o] = s(
|
|
17
|
+
e.INTLAYER_CURRENT_LOCALE
|
|
18
|
+
);
|
|
19
|
+
return i(
|
|
20
|
+
t.locale,
|
|
21
|
+
(r) => {
|
|
22
|
+
o(r);
|
|
23
|
+
},
|
|
24
|
+
{ immediate: !0 }
|
|
25
|
+
), t;
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
w as useEditorLocale
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MessageKey as i } from "@intlayer/editor";
|
|
2
|
+
import { ref as u, readonly as a, inject as f, watch as r } from "vue";
|
|
3
|
+
import { createSharedComposable as l } from "./createSharedComposable.mjs";
|
|
4
|
+
import { useCrossFrameState as C } from "./useCrossFrameState.mjs";
|
|
5
|
+
let n = null;
|
|
6
|
+
const c = Symbol("FocusDictionary"), d = () => {
|
|
7
|
+
if (n) return n;
|
|
8
|
+
const t = u(null), e = (o) => {
|
|
9
|
+
t.value = o;
|
|
10
|
+
}, s = (o) => {
|
|
11
|
+
t.value && e({ ...t.value, keyPath: o });
|
|
12
|
+
};
|
|
13
|
+
return n = {
|
|
14
|
+
focusedContent: a(t),
|
|
15
|
+
setFocusedContent: e,
|
|
16
|
+
setFocusedContentKeyPath: s
|
|
17
|
+
}, n;
|
|
18
|
+
}, S = (t) => {
|
|
19
|
+
const e = d();
|
|
20
|
+
t.provide(c, e);
|
|
21
|
+
}, O = l(() => {
|
|
22
|
+
const t = f(
|
|
23
|
+
c
|
|
24
|
+
), [e, s] = C(
|
|
25
|
+
i.INTLAYER_FOCUSED_CONTENT_CHANGED
|
|
26
|
+
);
|
|
27
|
+
if (!t)
|
|
28
|
+
throw new Error("FocusDictionary state not found");
|
|
29
|
+
return r(t.focusedContent, (o) => {
|
|
30
|
+
JSON.stringify(o) !== JSON.stringify(e.value) && s(o);
|
|
31
|
+
}), r(e, (o) => {
|
|
32
|
+
JSON.stringify(o) !== JSON.stringify(t.focusedContent.value) && t.setFocusedContent(o ?? null);
|
|
33
|
+
}), t;
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
d as createFocusDictionaryClient,
|
|
37
|
+
S as installFocusDictionary,
|
|
38
|
+
O as useFocusDictionary
|
|
39
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import t from "@intlayer/config/built";
|
|
2
|
+
import { installChangedContent as n } from "./changedContent.mjs";
|
|
3
|
+
import { installCommunicator as r } from "./communicator.mjs";
|
|
4
|
+
import { installDictionariesRecord as e } from "./dictionariesRecord.mjs";
|
|
5
|
+
import { installEditedContent as s } from "./editedContent.mjs";
|
|
6
|
+
import { installEditorEnabled as l } from "./editorEnabled.mjs";
|
|
7
|
+
import { installFocusDictionary as m } from "./focusDictionary.mjs";
|
|
8
|
+
const { editor: i } = t, { applicationURL: a, editorURL: d, cmsURL: f } = i ?? {}, c = (o) => {
|
|
9
|
+
typeof window > "u" || !(window.self !== window.top) || (i.applicationURL.length > 0 && window.postMessage(o, i.applicationURL), i.editorURL.length > 0 && window.parent.postMessage(o, i.editorURL), i.cmsURL.length > 0 && window.parent.postMessage(o, i.cmsURL));
|
|
10
|
+
}, h = (o) => {
|
|
11
|
+
r(o, {
|
|
12
|
+
postMessage: c,
|
|
13
|
+
allowedOrigins: [a, d, f]
|
|
14
|
+
}), l(o), n(o), e(o), s(o), m(o);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
h as installIntlayerEditor
|
|
18
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { compareUrls as f } from "@intlayer/editor";
|
|
2
|
+
import { onScopeDispose as p, getCurrentInstance as d } from "vue";
|
|
3
|
+
import { useCommunicator as m } from "./communicator.mjs";
|
|
4
|
+
const r = /* @__PURE__ */ new Map();
|
|
5
|
+
let u = !1;
|
|
6
|
+
function l(e, t) {
|
|
7
|
+
let s = r.get(e);
|
|
8
|
+
s || (s = /* @__PURE__ */ new Set(), r.set(e, s)), s.add(t);
|
|
9
|
+
}
|
|
10
|
+
function b(e, t) {
|
|
11
|
+
const s = r.get(e);
|
|
12
|
+
s && (s.delete(t), s.size === 0 && r.delete(e));
|
|
13
|
+
}
|
|
14
|
+
function g(e, t) {
|
|
15
|
+
u || (window.addEventListener("message", (s) => {
|
|
16
|
+
var i;
|
|
17
|
+
const { type: o, data: n, senderId: c } = s.data ?? {};
|
|
18
|
+
o && c !== t && (!e || e.includes("*") || e.some((a) => f(a, s.origin))) && ((i = r.get(o)) == null || i.forEach((a) => a(n)));
|
|
19
|
+
}), u = !0);
|
|
20
|
+
}
|
|
21
|
+
const h = (e, t) => {
|
|
22
|
+
const { allowedOrigins: s, postMessage: o, senderId: n } = m();
|
|
23
|
+
return g(s, n), t ? (l(e, t), p(() => b(e, t))) : d() || console.warn(
|
|
24
|
+
"useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."
|
|
25
|
+
), (i) => {
|
|
26
|
+
o({ type: e, data: i, senderId: n });
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
h as useCrossFrameMessageListener
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getCurrentInstance as C, ref as y } from "vue";
|
|
2
|
+
import { useCommunicator as $ } from "./communicator.mjs";
|
|
3
|
+
import { useCrossFrameMessageListener as m } from "./useCrossFrameMessageListener.mjs";
|
|
4
|
+
const f = /* @__PURE__ */ new Map(), S = (t, i) => typeof t == "function" ? t(i) : t, F = (t) => t == null ? t : JSON.parse(JSON.stringify(t)), I = (t, i, v = { emit: !0, receive: !0 }) => {
|
|
5
|
+
if (f.has(t)) {
|
|
6
|
+
const { state: s, setState: r, postState: a } = f.get(t);
|
|
7
|
+
return [s, r, a];
|
|
8
|
+
}
|
|
9
|
+
C() || console.warn(
|
|
10
|
+
"useCrossFrameState called outside a component setup function - reactivity may be limited"
|
|
11
|
+
);
|
|
12
|
+
const { emit: u = !0, receive: p = !0 } = v, e = y(S(i)), { postMessage: n, senderId: o } = $(), c = (s) => {
|
|
13
|
+
!u || typeof n != "function" || typeof s > "u" || n({
|
|
14
|
+
type: `${t}/post`,
|
|
15
|
+
data: s,
|
|
16
|
+
senderId: o
|
|
17
|
+
});
|
|
18
|
+
}, d = (s) => {
|
|
19
|
+
const r = S(s, e.value), a = F(r);
|
|
20
|
+
e.value = a, c(a);
|
|
21
|
+
}, l = () => {
|
|
22
|
+
typeof n == "function" && n({
|
|
23
|
+
type: `${t}/post`,
|
|
24
|
+
data: e.value,
|
|
25
|
+
senderId: o
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
c(e.value), p && typeof n == "function" && typeof e.value > "u" && n({ type: `${t}/get`, senderId: o }), m(
|
|
29
|
+
`${t}/post`,
|
|
30
|
+
p ? (s) => {
|
|
31
|
+
e.value = s;
|
|
32
|
+
} : void 0
|
|
33
|
+
);
|
|
34
|
+
const g = (s, r) => {
|
|
35
|
+
u && r !== o && c(e.value);
|
|
36
|
+
};
|
|
37
|
+
return m(
|
|
38
|
+
`${t}/get`,
|
|
39
|
+
u ? g : void 0
|
|
40
|
+
), f.set(t, { state: e, setState: d, postState: l }), [e, d, l];
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
I as useCrossFrameState
|
|
44
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MessageKey as p } from "@intlayer/editor";
|
|
2
|
+
import { getCurrentInstance as w, onMounted as d, onBeforeUnmount as l } from "vue";
|
|
3
|
+
import { useCrossFrameState as u } from "./useCrossFrameState.mjs";
|
|
4
|
+
const m = (o, a) => u(p.INTLAYER_URL_CHANGE, o, a), E = (o) => {
|
|
5
|
+
const [a, s] = m(o, {
|
|
6
|
+
emit: !0,
|
|
7
|
+
receive: !1
|
|
8
|
+
}), i = w();
|
|
9
|
+
let t, n;
|
|
10
|
+
const e = () => s(window.location.pathname);
|
|
11
|
+
return i ? (d(() => {
|
|
12
|
+
t = history.pushState, n = history.replaceState;
|
|
13
|
+
const r = (c) => (...h) => {
|
|
14
|
+
c.apply(history, h), window.dispatchEvent(new Event("locationchange"));
|
|
15
|
+
};
|
|
16
|
+
history.pushState = r(t), history.replaceState = r(n), window.addEventListener("locationchange", e), window.addEventListener("popstate", e), window.addEventListener("hashchange", e), e();
|
|
17
|
+
}), l(() => {
|
|
18
|
+
window.removeEventListener("locationchange", e), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e), t && (history.pushState = t), n && (history.replaceState = n);
|
|
19
|
+
})) : console.warn(
|
|
20
|
+
"useCrossURLPathSetter must be called within a component setup function"
|
|
21
|
+
), [a, s];
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
E as useCrossURLPathSetter,
|
|
25
|
+
m as useCrossURLPathState
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { inject as n, computed as d } from "vue";
|
|
2
|
+
import { createSharedComposable as i } from "./createSharedComposable.mjs";
|
|
3
|
+
const u = i(
|
|
4
|
+
(t, o, r) => {
|
|
5
|
+
const e = n(
|
|
6
|
+
"editedContentActions",
|
|
7
|
+
null
|
|
8
|
+
);
|
|
9
|
+
return d(() => (e == null ? void 0 : e.getEditedContentValue(
|
|
10
|
+
t,
|
|
11
|
+
o
|
|
12
|
+
)) ?? r);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
export {
|
|
16
|
+
u as useEditedContentRenderer
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useConfiguration as r } from "./configuration.mjs";
|
|
2
|
+
import { createSharedComposable as e } from "./createSharedComposable.mjs";
|
|
3
|
+
import { useDictionariesRecord as t } from "./dictionariesRecord.mjs";
|
|
4
|
+
import { useEditorEnabled as i } from "./editorEnabled.mjs";
|
|
5
|
+
import { useEditorLocale as o } from "./editorLocale.mjs";
|
|
6
|
+
import { useFocusDictionary as m } from "./focusDictionary.mjs";
|
|
7
|
+
import { useCrossURLPathSetter as s } from "./useCrossURLPathState.mjs";
|
|
8
|
+
import { useIframeClickMerger as a } from "./useIframeClickInterceptor.mjs";
|
|
9
|
+
const E = e(() => {
|
|
10
|
+
r(), i(), m(), a(), s(), o(), t(), o();
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
E as useEditor
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MessageKey as o, mergeIframeClick as m } from "@intlayer/editor";
|
|
2
|
+
import { getCurrentInstance as a, onMounted as c, onBeforeUnmount as i } from "vue";
|
|
3
|
+
import { createSharedComposable as n } from "./createSharedComposable.mjs";
|
|
4
|
+
import { useCrossFrameMessageListener as r } from "./useCrossFrameMessageListener.mjs";
|
|
5
|
+
const I = n(() => {
|
|
6
|
+
const t = r(
|
|
7
|
+
o.INTLAYER_IFRAME_CLICKED
|
|
8
|
+
), s = a(), e = () => {
|
|
9
|
+
t();
|
|
10
|
+
};
|
|
11
|
+
s ? (c(() => window.addEventListener("mousedown", e)), i(() => window.removeEventListener("mousedown", e))) : console.warn(
|
|
12
|
+
"useIframeClickInterceptor must be called within a component setup function"
|
|
13
|
+
);
|
|
14
|
+
}), d = n(() => {
|
|
15
|
+
I(), r(
|
|
16
|
+
`${o.INTLAYER_IFRAME_CLICKED}/get`,
|
|
17
|
+
m
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
I as useIframeClickInterceptor,
|
|
22
|
+
d as useIframeClickMerger
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getDictionary as n } from "@intlayer/core";
|
|
2
|
+
import { intlayerNodePlugins as e, markdownPlugin as a } from "./plugins.mjs";
|
|
3
|
+
const m = (t, i, o) => {
|
|
4
|
+
const r = [
|
|
5
|
+
e,
|
|
6
|
+
a,
|
|
7
|
+
...o ?? []
|
|
8
|
+
];
|
|
9
|
+
return n(
|
|
10
|
+
t,
|
|
11
|
+
i,
|
|
12
|
+
r
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
m as getDictionary
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getIntlayer as o } from "@intlayer/core";
|
|
2
|
+
import { intlayerNodePlugins as l, markdownPlugin as a } from "./plugins.mjs";
|
|
3
|
+
const m = (t, r, n) => {
|
|
4
|
+
const e = [
|
|
5
|
+
l,
|
|
6
|
+
a,
|
|
7
|
+
...n ?? []
|
|
8
|
+
];
|
|
9
|
+
return o(t, r, e);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
m as getIntlayer
|
|
13
|
+
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { INTLAYER_SYMBOL as t, createIntlayerClient as o, installIntlayer as n } from "./client/installIntlayer.mjs";
|
|
2
|
+
import { useDictionary as l } from "./client/useDictionary.mjs";
|
|
3
|
+
import { useIntlayer as m } from "./client/useIntlayer.mjs";
|
|
4
|
+
import { useLocale as f } from "./client/useLocale.mjs";
|
|
5
|
+
import { getDictionary as x } from "./getDictionary.mjs";
|
|
6
|
+
import { getIntlayer as s } from "./getIntlayer.mjs";
|
|
7
|
+
import { INTLAYER_MARKDOWN_SYMBOL as d, createIntlayerMarkdownClient as g, installIntlayerMarkdown as M, useMarkdown as c } from "./markdown/installIntlayerMarkdown.mjs";
|
|
8
|
+
import { intlayerNodePlugins as w, markdownPlugin as L, markdownStringPlugin as N } from "./plugins.mjs";
|
|
9
|
+
export {
|
|
10
|
+
d as INTLAYER_MARKDOWN_SYMBOL,
|
|
11
|
+
t as INTLAYER_SYMBOL,
|
|
12
|
+
o as createIntlayerClient,
|
|
13
|
+
g as createIntlayerMarkdownClient,
|
|
14
|
+
x as getDictionary,
|
|
15
|
+
s as getIntlayer,
|
|
16
|
+
n as installIntlayer,
|
|
17
|
+
M as installIntlayerMarkdown,
|
|
18
|
+
w as intlayerNodePlugins,
|
|
19
|
+
L as markdownPlugin,
|
|
20
|
+
N as markdownStringPlugin,
|
|
21
|
+
l as useDictionary,
|
|
22
|
+
m as useIntlayer,
|
|
23
|
+
f as useLocale,
|
|
24
|
+
c as useMarkdown
|
|
25
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { INTLAYER_MARKDOWN_SYMBOL as e, createIntlayerMarkdownClient as n, installIntlayerMarkdown as t, useMarkdown as l } from "./installIntlayerMarkdown.mjs";
|
|
2
|
+
export {
|
|
3
|
+
e as INTLAYER_MARKDOWN_SYMBOL,
|
|
4
|
+
n as createIntlayerMarkdownClient,
|
|
5
|
+
t as installIntlayerMarkdown,
|
|
6
|
+
l as useMarkdown
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { inject as a } from "vue";
|
|
2
|
+
const t = Symbol("intlayerMarkdown");
|
|
3
|
+
let n = null;
|
|
4
|
+
const d = (r) => n || (n = {
|
|
5
|
+
renderMarkdown: r
|
|
6
|
+
}, n), s = (r, e) => {
|
|
7
|
+
const o = d(e);
|
|
8
|
+
r.provide(t, o);
|
|
9
|
+
}, l = () => {
|
|
10
|
+
const r = a(
|
|
11
|
+
t,
|
|
12
|
+
{
|
|
13
|
+
renderMarkdown: (e) => e
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
if (!r)
|
|
17
|
+
throw new Error("useMarkdown must be used within a MarkdownProvider");
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
t as INTLAYER_MARKDOWN_SYMBOL,
|
|
22
|
+
d as createIntlayerMarkdownClient,
|
|
23
|
+
s as installIntlayerMarkdown,
|
|
24
|
+
l as useMarkdown
|
|
25
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { getMarkdownMetadata as u, NodeType as i } from "@intlayer/core";
|
|
2
|
+
import { h as d } from "vue";
|
|
3
|
+
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-BML9iRiS.mjs";
|
|
4
|
+
import "./editor/installIntlayerEditor.mjs";
|
|
5
|
+
import { useMarkdown as p } from "./markdown/installIntlayerMarkdown.mjs";
|
|
6
|
+
import { renderIntlayerNode as o } from "./renderIntlayerNode.mjs";
|
|
7
|
+
const b = {
|
|
8
|
+
id: "intlayer-node-plugin",
|
|
9
|
+
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
10
|
+
transform: (n, { children: t, ...r }) => o({
|
|
11
|
+
...r,
|
|
12
|
+
value: t,
|
|
13
|
+
children: () => d(
|
|
14
|
+
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
15
|
+
l,
|
|
16
|
+
{
|
|
17
|
+
dictionaryKey: r.dictionaryKey,
|
|
18
|
+
keyPath: r.keyPath
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
default: () => t
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
})
|
|
25
|
+
}, f = {
|
|
26
|
+
id: "markdown-string-plugin",
|
|
27
|
+
canHandle: (n) => typeof n == "string",
|
|
28
|
+
transform: (n, t, r) => {
|
|
29
|
+
const {
|
|
30
|
+
plugins: y,
|
|
31
|
+
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
32
|
+
...e
|
|
33
|
+
} = t, m = u(n), s = r(m, {
|
|
34
|
+
plugins: [{
|
|
35
|
+
id: "markdown-metadata-plugin",
|
|
36
|
+
canHandle: (a) => typeof a == "string" || typeof a == "number" || typeof a == "boolean" || !a,
|
|
37
|
+
transform: (a, c) => o({
|
|
38
|
+
...c,
|
|
39
|
+
value: a,
|
|
40
|
+
children: n
|
|
41
|
+
})
|
|
42
|
+
}],
|
|
43
|
+
dictionaryKey: e.dictionaryKey,
|
|
44
|
+
keyPath: []
|
|
45
|
+
});
|
|
46
|
+
return o({
|
|
47
|
+
...t,
|
|
48
|
+
value: n,
|
|
49
|
+
children: d(
|
|
50
|
+
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
51
|
+
l,
|
|
52
|
+
{
|
|
53
|
+
dictionaryKey: e.dictionaryKey,
|
|
54
|
+
keyPath: e.keyPath
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
default: () => {
|
|
58
|
+
const { renderMarkdown: a } = p();
|
|
59
|
+
return a(n);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
additionalProps: {
|
|
64
|
+
metadata: s
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, H = {
|
|
69
|
+
id: "markdown-plugin",
|
|
70
|
+
canHandle: (n) => typeof n == "object" && (n == null ? void 0 : n.nodeType) === i.Markdown,
|
|
71
|
+
transform: (n, t, r) => {
|
|
72
|
+
const y = [
|
|
73
|
+
...t.keyPath,
|
|
74
|
+
{
|
|
75
|
+
type: i.Markdown
|
|
76
|
+
}
|
|
77
|
+
], e = n[i.Markdown];
|
|
78
|
+
return r(e, {
|
|
79
|
+
...t,
|
|
80
|
+
children: e,
|
|
81
|
+
keyPath: y,
|
|
82
|
+
plugins: [f, ...t.plugins ?? []]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
b as intlayerNodePlugins,
|
|
88
|
+
H as markdownPlugin,
|
|
89
|
+
f as markdownStringPlugin
|
|
90
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import n from "@intlayer/config/built";
|
|
2
|
+
import { createServerContext as a, getServerContext as c } from "./serverContext.mjs";
|
|
3
|
+
var o;
|
|
4
|
+
const { defaultLocale: r } = ((o = n) == null ? void 0 : o.internationalization) ?? {}, t = a(r), s = (e = r) => {
|
|
5
|
+
t.provide(e);
|
|
6
|
+
}, m = () => c(t), p = (e) => t.consume(e);
|
|
7
|
+
export {
|
|
8
|
+
t as IntlayerServerContext,
|
|
9
|
+
m as getIntlayerLocale,
|
|
10
|
+
s as provideIntlayerLocale,
|
|
11
|
+
p as withIntlayerLocale
|
|
12
|
+
};
|