vue-intlayer 8.3.2 → 8.3.4

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.
Files changed (121) hide show
  1. package/dist/ContentSelectorWrapper-B7p44V28.mjs +52 -0
  2. package/dist/ContentSelectorWrapper-DpyRYcE8.js +1 -0
  3. package/dist/EditedContentRenderer-BFVoITDN.js +1 -0
  4. package/dist/EditedContentRenderer-DNBqpZpl.mjs +28 -0
  5. package/dist/cjs/UI/ContentSelector.cjs +1 -1
  6. package/dist/cjs/client/index.cjs +1 -1
  7. package/dist/cjs/client/installIntlayer.cjs +1 -1
  8. package/dist/cjs/client/useDictionary.cjs +1 -1
  9. package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
  10. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
  11. package/dist/cjs/client/useIntlayer.cjs +1 -1
  12. package/dist/cjs/client/useLoadDynamic.cjs +1 -1
  13. package/dist/cjs/client/useLocale.cjs +1 -1
  14. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  15. package/dist/cjs/client/useRewriteURL.cjs +1 -1
  16. package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
  17. package/dist/cjs/editor/EditedContentRenderer.cjs +1 -1
  18. package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
  19. package/dist/cjs/editor/communicator.cjs +1 -1
  20. package/dist/cjs/editor/configuration.cjs +1 -1
  21. package/dist/cjs/editor/createSharedComposable.cjs +1 -1
  22. package/dist/cjs/editor/dictionariesRecord.cjs +1 -1
  23. package/dist/cjs/editor/editedContent.cjs +1 -1
  24. package/dist/cjs/editor/editorEnabled.cjs +1 -1
  25. package/dist/cjs/editor/editorLocale.cjs +1 -1
  26. package/dist/cjs/editor/focusDictionary.cjs +1 -1
  27. package/dist/cjs/editor/index.cjs +1 -1
  28. package/dist/cjs/editor/installIntlayerEditor.cjs +1 -1
  29. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
  30. package/dist/cjs/editor/useCrossFrameState.cjs +1 -1
  31. package/dist/cjs/editor/useCrossURLPathState.cjs +1 -1
  32. package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
  33. package/dist/cjs/editor/useEditor.cjs +1 -1
  34. package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -1
  35. package/dist/cjs/format/useCompact.cjs +1 -1
  36. package/dist/cjs/format/useCurrency.cjs +1 -1
  37. package/dist/cjs/format/useDate.cjs +1 -1
  38. package/dist/cjs/format/useIntl.cjs +1 -1
  39. package/dist/cjs/format/useList.cjs +1 -1
  40. package/dist/cjs/format/useNumber.cjs +1 -1
  41. package/dist/cjs/format/usePercentage.cjs +1 -1
  42. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  43. package/dist/cjs/format/useUnit.cjs +1 -1
  44. package/dist/cjs/getDictionary.cjs +1 -1
  45. package/dist/cjs/getIntlayer.cjs +1 -1
  46. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  47. package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
  48. package/dist/cjs/index.cjs +1 -1
  49. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  50. package/dist/cjs/markdown/compiler.cjs +1 -1
  51. package/dist/cjs/markdown/index.cjs +1 -1
  52. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -1
  53. package/dist/cjs/markdown/runtime.cjs +1 -1
  54. package/dist/cjs/plugins.cjs +1 -1
  55. package/dist/cjs/renderIntlayerNode.cjs +1 -1
  56. package/dist/esm/UI/ContentSelector.mjs +76 -2
  57. package/dist/esm/client/index.mjs +2 -2
  58. package/dist/esm/client/installIntlayer.mjs +2 -2
  59. package/dist/esm/client/useDictionary.mjs +2 -2
  60. package/dist/esm/client/useDictionaryAsync.mjs +1 -1
  61. package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
  62. package/dist/esm/client/useIntlayer.mjs +1 -1
  63. package/dist/esm/client/useLocale.mjs +1 -1
  64. package/dist/esm/client/useRewriteURL.mjs +1 -1
  65. package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
  66. package/dist/esm/editor/EditedContentRenderer.mjs +1 -1
  67. package/dist/esm/editor/EditorSelectorRenderer.mjs +2 -2
  68. package/dist/esm/editor/communicator.mjs +9 -24
  69. package/dist/esm/editor/configuration.mjs +12 -10
  70. package/dist/esm/editor/dictionariesRecord.mjs +17 -34
  71. package/dist/esm/editor/editedContent.mjs +24 -40
  72. package/dist/esm/editor/editorEnabled.mjs +13 -36
  73. package/dist/esm/editor/editorLocale.mjs +1 -1
  74. package/dist/esm/editor/focusDictionary.mjs +16 -31
  75. package/dist/esm/editor/index.mjs +12 -3
  76. package/dist/esm/editor/installIntlayerEditor.mjs +20 -19
  77. package/dist/esm/editor/useCrossFrameMessageListener.mjs +6 -26
  78. package/dist/esm/editor/useCrossFrameState.mjs +29 -42
  79. package/dist/esm/editor/useCrossURLPathState.mjs +5 -18
  80. package/dist/esm/editor/useEditor.mjs +1 -1
  81. package/dist/esm/editor/useIframeClickInterceptor.mjs +8 -13
  82. package/dist/esm/format/useCompact.mjs +1 -1
  83. package/dist/esm/format/useCurrency.mjs +1 -1
  84. package/dist/esm/format/useDate.mjs +1 -1
  85. package/dist/esm/format/useIntl.mjs +1 -1
  86. package/dist/esm/format/useList.mjs +1 -1
  87. package/dist/esm/format/useNumber.mjs +1 -1
  88. package/dist/esm/format/usePercentage.mjs +1 -1
  89. package/dist/esm/format/useRelativeTime.mjs +1 -1
  90. package/dist/esm/format/useUnit.mjs +1 -1
  91. package/dist/esm/getDictionary.mjs +1 -1
  92. package/dist/esm/getIntlayer.mjs +1 -1
  93. package/dist/esm/index.mjs +20 -11
  94. package/dist/esm/plugins.mjs +1 -1
  95. package/dist/{getDictionary-BE4ZLuzI.mjs → getDictionary-5DAguynf.mjs} +88 -143
  96. package/dist/getDictionary-yKxg53ez.js +1 -0
  97. package/dist/installIntlayerEditor-BpsBr4EN.js +1 -0
  98. package/dist/types/editor/ContentSelectorWrapper.vue.d.ts +0 -4
  99. package/dist/types/editor/communicator.d.ts +3 -26
  100. package/dist/types/editor/editorEnabled.d.ts +2 -15
  101. package/dist/types/editor/editorLocale.d.ts +1 -1
  102. package/dist/types/editor/focusDictionary.d.ts +86 -21
  103. package/dist/types/editor/index.d.ts +9 -0
  104. package/dist/types/editor/installIntlayerEditor.d.ts +4 -14
  105. package/dist/types/editor/useCrossFrameMessageListener.d.ts +1 -9
  106. package/dist/types/editor/useCrossFrameState.d.ts +1 -17
  107. package/dist/types/editor/useCrossURLPathState.d.ts +1 -15
  108. package/dist/types/editor/useIframeClickInterceptor.d.ts +0 -8
  109. package/dist/types/html/HTMLRenderer.d.ts +40 -40
  110. package/dist/types/markdown/MarkdownRenderer.d.ts +40 -40
  111. package/package.json +8 -9
  112. package/dist/ContentSelector-BaMG67_z.js +0 -1
  113. package/dist/ContentSelector-D9fc9D1G.mjs +0 -76
  114. package/dist/EditedContentRenderer-CXoF8k9R.mjs +0 -25
  115. package/dist/EditedContentRenderer-S0zWbUak.js +0 -1
  116. package/dist/communicator-1rnoOTtT.js +0 -1
  117. package/dist/getDictionary-DMdOvXMh.js +0 -1
  118. package/dist/types/UI/ContentSelector.vue.d.ts +0 -36
  119. package/dist/types/editor/configuration.d.ts +0 -1
  120. package/dist/types/editor/dictionariesRecord.d.ts +0 -15
  121. package/dist/types/editor/editedContent.d.ts +0 -20
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../EditedContentRenderer-CXoF8k9R.mjs";
1
+ import { t as e } from "../../EditedContentRenderer-DNBqpZpl.mjs";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
- import { c as e } from "../../getDictionary-BE4ZLuzI.mjs";
2
- import { t } from "../../EditedContentRenderer-CXoF8k9R.mjs";
1
+ import { t as e } from "../../ContentSelectorWrapper-B7p44V28.mjs";
2
+ import { t } from "../../EditedContentRenderer-DNBqpZpl.mjs";
3
3
  import { createBlock as n, createVNode as r, defineComponent as i, openBlock as a, renderSlot as o, unref as s, withCtx as c } from "vue";
4
4
  //#endregion
5
5
  //#region src/editor/EditorSelectorRenderer.vue
@@ -1,27 +1,12 @@
1
- import e from "@intlayer/config/built";
2
- import { inject as t, reactive as n } from "vue";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n } from "vue";
3
3
  //#region src/editor/communicator.ts
4
- var r = () => Math.random().toString(36).slice(2), { editor: i } = e, a = {
5
- postMessage: () => null,
6
- allowedOrigins: [
7
- i?.applicationURL,
8
- i?.editorURL,
9
- i?.cmsURL
10
- ],
11
- senderId: ""
12
- }, o = null, s = Symbol("Communicator"), c = (e = { postMessage: () => null }) => o || (o = n({
13
- ...a,
14
- ...e,
15
- senderId: r()
16
- }), o), l = (e, t = { postMessage: () => null }) => {
17
- let n = c(t);
18
- e.provide(s, n);
19
- }, u = () => {
20
- try {
21
- return t(s, a);
22
- } catch {
23
- return console.warn("useCommunicator: inject can only be used in setup(). Returning default communicator."), a;
24
- }
4
+ var r = () => {
5
+ let r = n(e) ?? t();
6
+ return r ? {
7
+ postMessage: (e) => r.messenger.send(e.type, e.data),
8
+ senderId: r.messenger.senderId
9
+ } : null;
25
10
  };
26
11
  //#endregion
27
- export { c as createCommunicator, l as installCommunicator, u as useCommunicator };
12
+ export { r as useCommunicator };
@@ -1,13 +1,15 @@
1
- import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
2
- import t from "@intlayer/config/built";
3
- import { onMounted as n } from "vue";
4
- import { MessageKey as r } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onBeforeUnmount as r, onMounted as i, ref as a } from "vue";
5
3
  //#region src/editor/configuration.ts
6
- var i = () => {
7
- let [i, a] = e(r.INTLAYER_CONFIGURATION);
8
- n(() => {
9
- i && a(t);
10
- });
4
+ var o = () => {
5
+ let o = n(e) ?? t(), s = a(o?.configuration.value), c = (e) => {
6
+ s.value = e.detail;
7
+ };
8
+ return i(() => {
9
+ o?.configuration.addEventListener("change", c);
10
+ }), r(() => {
11
+ o?.configuration.removeEventListener("change", c);
12
+ }), s;
11
13
  };
12
14
  //#endregion
13
- export { i as useConfiguration };
15
+ export { o as useConfiguration };
@@ -1,36 +1,19 @@
1
- import { createSharedComposable as e } from "./createSharedComposable.mjs";
2
- import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
3
- import { inject as n, readonly as r, ref as i, watch as a } from "vue";
4
- import { MessageKey as o } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onBeforeUnmount as r, onMounted as i, readonly as a, ref as o } from "vue";
5
3
  //#region src/editor/dictionariesRecord.ts
6
- var s = null, c = Symbol("intlayerDictionariesRecord"), l = () => {
7
- if (s) return s;
8
- let e = i(void 0);
9
- return s = {
10
- localeDictionaries: r(e),
11
- setLocaleDictionaries: (t) => {
12
- e.value = t ?? {};
13
- },
14
- setLocaleDictionary(t) {
15
- e.value = {
16
- ...e.value,
17
- [t.localId]: t
18
- };
19
- }
20
- }, s;
21
- }, u = (e) => {
22
- let t = l();
23
- import("@intlayer/unmerged-dictionaries-entry").then((e) => {
24
- let n = e.getUnmergedDictionaries(), r = Object.fromEntries(Object.values(n).flat().map((e) => [e.localId, e]));
25
- t.setLocaleDictionaries(r);
26
- }), e.provide(c, t);
27
- }, d = e(() => {
28
- let e = n(c);
29
- if (!e) throw Error("DictionariesRecord state not found");
30
- let [r, i] = t(o.INTLAYER_LOCALE_DICTIONARIES_CHANGED, void 0);
31
- a(e.localeDictionaries, (e) => {
32
- i(e);
33
- }, { immediate: !0 });
34
- });
4
+ var s = () => {
5
+ let s = n(e) ?? t(), c = o(s?.localeDictionaries.value ?? {}), l = (e) => {
6
+ c.value = e.detail ?? {};
7
+ };
8
+ return i(() => {
9
+ s?.localeDictionaries.addEventListener("change", l);
10
+ }), r(() => {
11
+ s?.localeDictionaries.removeEventListener("change", l);
12
+ }), {
13
+ localeDictionaries: a(c),
14
+ setLocaleDictionaries: (e) => s?.localeDictionaries.set(e),
15
+ setLocaleDictionary: (e) => s?.setLocaleDictionary(e)
16
+ };
17
+ };
35
18
  //#endregion
36
- export { l as createDictionaryRecordClient, u as installDictionariesRecord, d as useDictionariesRecord };
19
+ export { s as useDictionariesRecord };
@@ -1,42 +1,26 @@
1
- import { createSharedComposable as e } from "./createSharedComposable.mjs";
2
- import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
3
- import { NodeType as n } from "@intlayer/types/nodeType";
4
- import { inject as r, readonly as i, ref as a, watch as o } from "vue";
5
- import { MessageKey as s } from "@intlayer/editor";
6
- import { getContentNodeByKeyPath as c } from "@intlayer/core/dictionaryManipulator";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onBeforeUnmount as r, onMounted as i, readonly as a, ref as o } from "vue";
7
3
  //#region src/editor/editedContent.ts
8
- var l = null, u = Symbol("EditedContent"), d = (e) => {
9
- if (l) return l;
10
- let t = a({});
11
- return l = {
12
- editedContent: i(t),
13
- getEditedContentValue: (r, i) => {
14
- let a = t.value;
15
- if (!a) return;
16
- let o = i.filter((e) => e.type !== n.Translation), s = r.includes(":local:") || r.includes(":remote:"), l = e?.locale.value;
17
- if (s) return c(a?.[r]?.content ?? {}, o, l);
18
- let u = Object.keys(a).filter((e) => e.startsWith(`${r}:`));
19
- for (let e of u) {
20
- let t = c(a?.[e]?.content ?? {}, o, l);
21
- if (t) return t;
22
- }
23
- },
24
- setEditedContent: (e) => {
25
- t.value = e;
26
- }
27
- }, l;
28
- }, f = (e, t) => {
29
- let n = d(t);
30
- e.provide(u, n);
31
- }, p = e(() => {
32
- let e = r(u);
33
- if (!e) throw Error("EditedContent state not found");
34
- let [n, i] = t(s.INTLAYER_EDITED_CONTENT_CHANGED, {});
35
- return o(n, (t) => {
36
- e.editedContent.value = t ?? {};
37
- }), o(e, (e) => {
38
- i(e.editedContent.value);
39
- }), e;
40
- });
4
+ var s = () => {
5
+ let s = n(e) ?? t(), c = o(s?.editedContent.value ?? {}), l = (e) => {
6
+ c.value = e.detail ?? {};
7
+ };
8
+ return i(() => {
9
+ s?.editedContent.addEventListener("change", l);
10
+ }), r(() => {
11
+ s?.editedContent.removeEventListener("change", l);
12
+ }), {
13
+ editedContent: a(c),
14
+ setEditedContent: (e, t) => s?.setEditedContent(e, t),
15
+ setEditedDictionary: (e) => s?.setEditedDictionary(e),
16
+ addEditedContent: (e, t, n, r) => s?.addContent(e, t, n, r),
17
+ renameEditedContent: (e, t, n) => s?.renameContent(e, t, n),
18
+ removeEditedContent: (e, t) => s?.removeContent(e, t),
19
+ restoreEditedContent: (e) => s?.restoreContent(e),
20
+ clearEditedDictionaryContent: (e) => s?.clearContent(e),
21
+ clearEditedContent: () => s?.clearAllContent(),
22
+ getEditedContentValue: (e, t) => s?.getContentValue(e, t)
23
+ };
24
+ };
41
25
  //#endregion
42
- export { d as createEditedContentClient, f as installEditedContent, p as useEditedContent };
26
+ export { s as useEditedContent };
@@ -1,38 +1,15 @@
1
- import { createSharedComposable as e } from "./createSharedComposable.mjs";
2
- import { useCrossFrameMessageListener as t } from "./useCrossFrameMessageListener.mjs";
3
- import n from "@intlayer/config/built";
4
- import { computed as r, inject as i, nextTick as a, onMounted as o, ref as s, watch as c } from "vue";
5
- import { MessageKey as l } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onBeforeUnmount as r, onMounted as i, ref as a } from "vue";
6
3
  //#region src/editor/editorEnabled.ts
7
- var u = null, d = Symbol("EditorEnabled"), f = () => typeof window > "u" ? !1 : window.self !== window.top, p = () => {
8
- if (u) return u;
9
- let e = s(n.editor.enabled), t = s(!1), i = s(!1);
10
- return u = {
11
- settingEnabled: e,
12
- wrapperEnabled: t,
13
- isInIframe: i,
14
- enabled: r(() => e.value && t.value && i.value)
15
- }, u;
16
- }, m = (e) => {
17
- let t = p();
18
- typeof window < "u" && (t.isInIframe.value = f()), e.provide(d, t);
19
- }, h = e(() => {
20
- let e = i(d);
21
- if (!e) throw Error("EditorEnabled state not found");
22
- t(`${l.INTLAYER_EDITOR_ENABLED}/post`, (t) => {
23
- e.wrapperEnabled.value = t;
24
- });
25
- let n = t(`${l.INTLAYER_EDITOR_ENABLED}/get`, (t) => {
26
- e.wrapperEnabled.value = t;
27
- });
28
- return c(() => e.isInIframe.value && e.settingEnabled.value, (e) => {
29
- n();
30
- }, { immediate: !0 }), o(() => {
31
- a(() => {
32
- let t = f();
33
- e.isInIframe.value = t;
34
- });
35
- }), e;
36
- });
4
+ var o = () => {
5
+ let o = n(e) ?? t(), s = a(o?.editorEnabled.value ?? !1), c = (e) => {
6
+ s.value = e.detail;
7
+ };
8
+ return i(() => {
9
+ o?.editorEnabled.addEventListener("change", c);
10
+ }), r(() => {
11
+ o?.editorEnabled.removeEventListener("change", c);
12
+ }), { enabled: s };
13
+ };
37
14
  //#endregion
38
- export { p as createEditorEnabledClient, m as installEditorEnabled, h as useEditorEnabled };
15
+ export { o as useEditorEnabled };
@@ -1,2 +1,2 @@
1
- import { u as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { l as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  export { e as useEditorLocale };
@@ -1,34 +1,19 @@
1
- import { createSharedComposable as e } from "./createSharedComposable.mjs";
2
- import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
3
- import { inject as n, readonly as r, ref as i, watch as a } from "vue";
4
- import { MessageKey as o } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onBeforeUnmount as r, onMounted as i, readonly as a, ref as o } from "vue";
5
3
  //#region src/editor/focusDictionary.ts
6
- var s = null, c = Symbol("FocusDictionary"), l = () => {
7
- if (s) return s;
8
- let e = i(null), t = (t) => {
9
- e.value = t;
4
+ var s = () => {
5
+ let s = n(e) ?? t(), c = o(s?.focusedContent.value ?? null), l = (e) => {
6
+ c.value = e.detail;
10
7
  };
11
- return s = {
12
- focusedContent: r(e),
13
- setFocusedContent: t,
14
- setFocusedContentKeyPath: (n) => {
15
- e.value && t({
16
- ...e.value,
17
- keyPath: n
18
- });
19
- }
20
- }, s;
21
- }, u = (e) => {
22
- let t = l();
23
- e.provide(c, t);
24
- }, d = e(() => {
25
- let e = n(c), [r, i] = t(o.INTLAYER_FOCUSED_CONTENT_CHANGED);
26
- if (!e) throw Error("FocusDictionary state not found");
27
- return a(e.focusedContent, (e) => {
28
- JSON.stringify(e) !== JSON.stringify(r.value) && i(e);
29
- }), a(r, (t) => {
30
- JSON.stringify(t) !== JSON.stringify(e.focusedContent.value) && e.setFocusedContent(t ?? null);
31
- }), e;
32
- });
8
+ return i(() => {
9
+ s?.focusedContent.addEventListener("change", l);
10
+ }), r(() => {
11
+ s?.focusedContent.removeEventListener("change", l);
12
+ }), {
13
+ focusedContent: a(c),
14
+ setFocusedContent: (e) => s?.focusedContent.set(e),
15
+ setFocusedContentKeyPath: (e) => s?.setFocusedContentKeyPath(e)
16
+ };
17
+ };
33
18
  //#endregion
34
- export { l as createFocusDictionaryClient, u as installFocusDictionary, d as useFocusDictionary };
19
+ export { s as useFocusDictionary };
@@ -1,3 +1,12 @@
1
- import { c as e, l as t } from "../../getDictionary-BE4ZLuzI.mjs";
2
- import { installIntlayerEditor as n } from "./installIntlayerEditor.mjs";
3
- export { e as ContentSelectorWrapper, n as installIntlayerEditor, t as useEditor };
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t, installIntlayerEditor as n } from "./installIntlayerEditor.mjs";
2
+ import { useEditorEnabled as r } from "./editorEnabled.mjs";
3
+ import { useFocusDictionary as i } from "./focusDictionary.mjs";
4
+ import { t as a } from "../../ContentSelectorWrapper-B7p44V28.mjs";
5
+ import { useConfiguration as o } from "./configuration.mjs";
6
+ import { useDictionariesRecord as s } from "./dictionariesRecord.mjs";
7
+ import { useEditedContent as c } from "./editedContent.mjs";
8
+ import { c as l, l as u } from "../../getDictionary-5DAguynf.mjs";
9
+ import { useCrossFrameMessageListener as d } from "./useCrossFrameMessageListener.mjs";
10
+ import { useCrossFrameState as f } from "./useCrossFrameState.mjs";
11
+ import { useIframeClickInterceptor as p, useIframeClickMerger as m } from "./useIframeClickInterceptor.mjs";
12
+ export { a as ContentSelectorWrapper, e as INTLAYER_EDITOR_MANAGER_SYMBOL, t as getEditorStateManager, n as installIntlayerEditor, o as useConfiguration, d as useCrossFrameMessageListener, f as useCrossFrameState, s as useDictionariesRecord, c as useEditedContent, l as useEditor, r as useEditorEnabled, u as useEditorLocale, i as useFocusDictionary, p as useIframeClickInterceptor, m as useIframeClickMerger };
@@ -1,21 +1,22 @@
1
- import { installCommunicator as e } from "./communicator.mjs";
2
- import { installEditorEnabled as t } from "./editorEnabled.mjs";
3
- import { installFocusDictionary as n } from "./focusDictionary.mjs";
4
- import { installDictionariesRecord as r } from "./dictionariesRecord.mjs";
5
- import { installEditedContent as i } from "./editedContent.mjs";
6
- import a from "@intlayer/config/built";
1
+ import e from "@intlayer/config/built";
2
+ import { EditorStateManager as t, defineIntlayerElements as n } from "@intlayer/editor";
7
3
  //#region src/editor/installIntlayerEditor.ts
8
- var { editor: o } = a, { applicationURL: s, editorURL: c, cmsURL: l } = o ?? {}, u = (e) => {
9
- typeof window > "u" || window.self !== window.top && (o.applicationURL.length > 0 && window.postMessage(e, o.applicationURL), o.editorURL.length > 0 && window.parent.postMessage(e, o.editorURL), o.cmsURL.length > 0 && window.parent.postMessage(e, o.cmsURL));
10
- }, d = (a, o) => {
11
- e(a, {
12
- postMessage: u,
13
- allowedOrigins: [
14
- s,
15
- c,
16
- l
17
- ]
18
- }), t(a), r(a), i(a, o), n(a);
19
- };
4
+ var { editor: r } = e ?? {}, i = () => ({
5
+ allowedOrigins: [
6
+ r?.applicationURL,
7
+ r?.editorURL,
8
+ r?.cmsURL
9
+ ].filter(Boolean),
10
+ postMessageFn: (e, t) => {
11
+ typeof window > "u" || window.self !== window.top && (window.parent?.postMessage(e, t), window.postMessage(e, t));
12
+ }
13
+ }), a = Symbol("INTLAYER_EDITOR_STATE_MANAGER"), o = null, s = (r) => {
14
+ let s = new t({
15
+ mode: "client",
16
+ messenger: i(),
17
+ configuration: e
18
+ });
19
+ r.provide(a, s), o = s, n(), s.start();
20
+ }, c = () => o;
20
21
  //#endregion
21
- export { d as installIntlayerEditor };
22
+ export { a as INTLAYER_EDITOR_MANAGER_SYMBOL, c as getEditorStateManager, s as installIntlayerEditor };
@@ -1,29 +1,9 @@
1
- import { useCommunicator as e } from "./communicator.mjs";
2
- import { getCurrentInstance as t, onScopeDispose as n } from "vue";
3
- import { compareUrls as r } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onScopeDispose as r } from "vue";
4
3
  //#region src/editor/useCrossFrameMessageListener.ts
5
- var i = /* @__PURE__ */ new Map(), a = !1, o = (e, t) => {
6
- let n = i.get(e);
7
- n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
8
- }, s = (e, t) => {
9
- let n = i.get(e);
10
- n && (n.delete(t), n.size === 0 && i.delete(e));
11
- }, c = (e, t) => {
12
- a || typeof window > "u" || (window.addEventListener("message", (n) => {
13
- let { type: a, data: o, senderId: s } = n.data ?? {};
14
- a && s !== t && (!e || e.includes("*") || e.some((e) => r(e, n.origin))) && i.get(a)?.forEach((e) => {
15
- e(o);
16
- });
17
- }), a = !0);
18
- }, l = (r, i) => {
19
- let { allowedOrigins: a, postMessage: l, senderId: u } = e() ?? {};
20
- return c(a, u), i ? (o(r, i), n(() => s(r, i))) : t() || console.warn("useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."), (e) => {
21
- l({
22
- type: r,
23
- data: e,
24
- senderId: u
25
- });
26
- };
4
+ var i = (i, a) => {
5
+ let o = n(e) ?? t();
6
+ return a && o && r(o.messenger.subscribe(i, a)), (e) => o?.messenger.send(i, e);
27
7
  };
28
8
  //#endregion
29
- export { l as useCrossFrameMessageListener };
9
+ export { i as useCrossFrameMessageListener };
@@ -1,52 +1,39 @@
1
- import { useCommunicator as e } from "./communicator.mjs";
2
- import { useCrossFrameMessageListener as t } from "./useCrossFrameMessageListener.mjs";
3
- import { getCurrentInstance as n, ref as r } from "vue";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n, onScopeDispose as r, ref as i } from "vue";
3
+ import { CrossFrameStateManager as a } from "@intlayer/editor";
4
4
  //#region src/editor/useCrossFrameState.ts
5
- var i = /* @__PURE__ */ new Map(), a = (e, t) => typeof e == "function" ? e(t) : e, o = (e) => e == null ? e : JSON.parse(JSON.stringify(e)), s = (s, c, l = {
5
+ var o = (o, s, c = {
6
6
  emit: !0,
7
7
  receive: !0
8
8
  }) => {
9
- if (i.has(s)) {
10
- let { state: e, setState: t, postState: n } = i.get(s);
11
- return [
12
- e,
13
- t,
14
- n
9
+ let l = n(e) ?? t(), { emit: u = !0, receive: d = !0 } = c, f = i(s);
10
+ if (l) {
11
+ let e = new a(o, l.messenger, {
12
+ emit: u,
13
+ receive: d,
14
+ initialValue: s
15
+ });
16
+ e.start();
17
+ let t = (e) => {
18
+ f.value = e.detail;
19
+ };
20
+ return e.addEventListener("change", t), r(() => {
21
+ e.removeEventListener("change", t), e.stop();
22
+ }), [
23
+ f,
24
+ (t) => {
25
+ e.set(t);
26
+ },
27
+ () => e.postCurrentValue()
15
28
  ];
16
29
  }
17
- n() || console.warn("useCrossFrameState called outside a component setup function - reactivity may be limited");
18
- let { emit: u = !0, receive: d = !0 } = l, f = r(a(c)), { postMessage: p, senderId: m } = e() ?? {}, h = (e) => {
19
- !u || typeof p != "function" || e === void 0 || p({
20
- type: `${s}/post`,
21
- data: e,
22
- senderId: m
23
- });
24
- }, g = (e) => {
25
- let t = o(a(e, f.value));
26
- f.value = t, h(t);
27
- }, _ = () => {
28
- typeof p == "function" && p({
29
- type: `${s}/post`,
30
- data: f.value,
31
- senderId: m
32
- });
33
- };
34
- return h(f.value), d && typeof p == "function" && f.value === void 0 && p({
35
- type: `${s}/get`,
36
- senderId: m
37
- }), t(`${s}/post`, d ? (e) => {
38
- f.value = e;
39
- } : void 0), t(`${s}/get`, u ? (e, t) => {
40
- u && t !== m && h(f.value);
41
- } : void 0), i.set(s, {
42
- state: f,
43
- setState: g,
44
- postState: _
45
- }), [
30
+ return [
46
31
  f,
47
- g,
48
- _
32
+ (e) => {
33
+ f.value = e;
34
+ },
35
+ () => {}
49
36
  ];
50
37
  };
51
38
  //#endregion
52
- export { s as useCrossFrameState };
39
+ export { o as useCrossFrameState };
@@ -1,21 +1,8 @@
1
- import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
2
- import { getCurrentInstance as t, onBeforeUnmount as n, onMounted as r } from "vue";
3
- import { MessageKey as i } from "@intlayer/editor";
1
+ import { INTLAYER_EDITOR_MANAGER_SYMBOL as e, getEditorStateManager as t } from "./installIntlayerEditor.mjs";
2
+ import { inject as n } from "vue";
4
3
  //#region src/editor/useCrossURLPathState.ts
5
- var a = (t, n) => e(i.INTLAYER_URL_CHANGE, t, n), o = (e) => {
6
- let [i, o] = a(e, {
7
- emit: !0,
8
- receive: !1
9
- }), s = t(), c, l, u = () => o(window.location.pathname);
10
- return s ? (r(() => {
11
- c = history.pushState, l = history.replaceState;
12
- let e = (e) => (...t) => {
13
- e.apply(history, t), window.dispatchEvent(new Event("locationchange"));
14
- };
15
- history.pushState = e(c), history.replaceState = e(l), window.addEventListener("locationchange", u), window.addEventListener("popstate", u), window.addEventListener("hashchange", u), u();
16
- }), n(() => {
17
- window.removeEventListener("locationchange", u), window.removeEventListener("popstate", u), window.removeEventListener("hashchange", u), c && (history.pushState = c), l && (history.replaceState = l);
18
- })) : console.warn("useCrossURLPathSetter must be called within a component setup function"), [i, o];
4
+ var r = () => {
5
+ n(e) ?? t();
19
6
  };
20
7
  //#endregion
21
- export { o as useCrossURLPathSetter, a as useCrossURLPathState };
8
+ export { r as useCrossURLPathSetter };
@@ -1,2 +1,2 @@
1
- import { l as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { c as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  export { e as useEditor };
@@ -1,15 +1,10 @@
1
- import { createSharedComposable as e } from "./createSharedComposable.mjs";
2
- import { useCrossFrameMessageListener as t } from "./useCrossFrameMessageListener.mjs";
3
- import { getCurrentInstance as n, onBeforeUnmount as r, onMounted as i } from "vue";
4
- import { MessageKey as a, mergeIframeClick as o } from "@intlayer/editor";
1
+ import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
2
+ import { MessageKey as t, mergeIframeClick as n } from "@intlayer/editor";
5
3
  //#region src/editor/useIframeClickInterceptor.ts
6
- var s = e(() => {
7
- let e = t(a.INTLAYER_IFRAME_CLICKED), o = n(), s = () => {
8
- e();
9
- };
10
- o ? (i(() => window.addEventListener("mousedown", s)), r(() => window.removeEventListener("mousedown", s))) : console.warn("useIframeClickInterceptor must be called within a component setup function");
11
- }), c = e(() => {
12
- s(), t(a.INTLAYER_IFRAME_CLICKED, o);
13
- });
4
+ var r = () => {
5
+ e(t.INTLAYER_IFRAME_CLICKED);
6
+ }, i = () => {
7
+ e(t.INTLAYER_IFRAME_CLICKED, n);
8
+ };
14
9
  //#endregion
15
- export { s as useIframeClickInterceptor, c as useIframeClickMerger };
10
+ export { r as useIframeClickInterceptor, i as useIframeClickMerger };
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { compact as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useCompact.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { currency as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useCurrency.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { date as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useDate.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { bindIntl as r } from "@intlayer/core/utils";
4
4
  //#region src/format/useIntl.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { list as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useList.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { number as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useNumber.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { percentage as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/usePercentage.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { relativeTime as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useRelativeTime.ts
@@ -1,4 +1,4 @@
1
- import { w as e } from "../../getDictionary-BE4ZLuzI.mjs";
1
+ import { C as e } from "../../getDictionary-5DAguynf.mjs";
2
2
  import { computed as t, inject as n } from "vue";
3
3
  import { units as r } from "@intlayer/core/formatters";
4
4
  //#region src/format/useUnit.ts
@@ -1,2 +1,2 @@
1
- import { t as e } from "../getDictionary-BE4ZLuzI.mjs";
1
+ import { t as e } from "../getDictionary-5DAguynf.mjs";
2
2
  export { e as getDictionary };
@@ -1,2 +1,2 @@
1
- import { m as e } from "../getDictionary-BE4ZLuzI.mjs";
1
+ import { p as e } from "../getDictionary-5DAguynf.mjs";
2
2
  export { e as getIntlayer };