vue-intlayer 8.3.1 → 8.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/ContentSelector-BaMG67_z.js +1 -0
  2. package/dist/ContentSelector-D9fc9D1G.mjs +76 -0
  3. package/dist/EditedContentRenderer-CXoF8k9R.mjs +25 -0
  4. package/dist/EditedContentRenderer-S0zWbUak.js +1 -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/index.cjs +1 -1
  36. package/dist/cjs/format/useCompact.cjs +1 -1
  37. package/dist/cjs/format/useCurrency.cjs +1 -1
  38. package/dist/cjs/format/useDate.cjs +1 -1
  39. package/dist/cjs/format/useIntl.cjs +1 -1
  40. package/dist/cjs/format/useList.cjs +1 -1
  41. package/dist/cjs/format/useNumber.cjs +1 -1
  42. package/dist/cjs/format/usePercentage.cjs +1 -1
  43. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  44. package/dist/cjs/format/useUnit.cjs +1 -1
  45. package/dist/cjs/getDictionary.cjs +1 -1
  46. package/dist/cjs/getIntlayer.cjs +1 -1
  47. package/dist/cjs/html/HTMLRenderer.cjs +1 -1
  48. package/dist/cjs/html/index.cjs +1 -1
  49. package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
  50. package/dist/cjs/html/types.cjs +1 -1
  51. package/dist/cjs/index.cjs +1 -1
  52. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  53. package/dist/cjs/markdown/compiler.cjs +1 -1
  54. package/dist/cjs/markdown/index.cjs +1 -1
  55. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -1
  56. package/dist/cjs/markdown/runtime.cjs +1 -1
  57. package/dist/cjs/plugins.cjs +1 -1
  58. package/dist/cjs/renderIntlayerNode.cjs +1 -1
  59. package/dist/communicator-1rnoOTtT.js +1 -0
  60. package/dist/esm/UI/ContentSelector.mjs +2 -4
  61. package/dist/esm/client/index.mjs +3 -26
  62. package/dist/esm/client/installIntlayer.mjs +2 -16
  63. package/dist/esm/client/useDictionary.mjs +2 -100
  64. package/dist/esm/client/useDictionaryAsync.mjs +2 -21
  65. package/dist/esm/client/useDictionaryDynamic.mjs +2 -5
  66. package/dist/esm/client/useIntlayer.mjs +2 -59
  67. package/dist/esm/client/useLoadDynamic.mjs +14 -16
  68. package/dist/esm/client/useLocale.mjs +2 -34
  69. package/dist/esm/client/useLocaleStorage.mjs +24 -29
  70. package/dist/esm/client/useRewriteURL.mjs +2 -23
  71. package/dist/esm/editor/ContentSelectorWrapper.mjs +2 -4
  72. package/dist/esm/editor/EditedContentRenderer.mjs +2 -4
  73. package/dist/esm/editor/EditorSelectorRenderer.mjs +43 -38
  74. package/dist/esm/editor/communicator.mjs +26 -32
  75. package/dist/esm/editor/configuration.mjs +10 -10
  76. package/dist/esm/editor/createSharedComposable.mjs +9 -11
  77. package/dist/esm/editor/dictionariesRecord.mjs +35 -52
  78. package/dist/esm/editor/editedContent.mjs +41 -63
  79. package/dist/esm/editor/editorEnabled.mjs +37 -55
  80. package/dist/esm/editor/editorLocale.mjs +2 -12
  81. package/dist/esm/editor/focusDictionary.mjs +33 -38
  82. package/dist/esm/editor/index.mjs +3 -7
  83. package/dist/esm/editor/installIntlayerEditor.mjs +20 -16
  84. package/dist/esm/editor/useCrossFrameMessageListener.mjs +28 -28
  85. package/dist/esm/editor/useCrossFrameState.mjs +51 -43
  86. package/dist/esm/editor/useCrossURLPathState.mjs +20 -25
  87. package/dist/esm/editor/useEditedContentRenderer.mjs +9 -17
  88. package/dist/esm/editor/useEditor.mjs +2 -11
  89. package/dist/esm/editor/useIframeClickInterceptor.mjs +14 -22
  90. package/dist/esm/format/index.mjs +10 -20
  91. package/dist/esm/format/useCompact.mjs +15 -15
  92. package/dist/esm/format/useCurrency.mjs +15 -15
  93. package/dist/esm/format/useDate.mjs +15 -15
  94. package/dist/esm/format/useIntl.mjs +9 -12
  95. package/dist/esm/format/useList.mjs +15 -15
  96. package/dist/esm/format/useNumber.mjs +15 -15
  97. package/dist/esm/format/usePercentage.mjs +14 -14
  98. package/dist/esm/format/useRelativeTime.mjs +15 -15
  99. package/dist/esm/format/useUnit.mjs +15 -15
  100. package/dist/esm/getDictionary.mjs +2 -15
  101. package/dist/esm/getIntlayer.mjs +2 -15
  102. package/dist/esm/html/HTMLRenderer.mjs +25 -31
  103. package/dist/esm/html/index.mjs +3 -11
  104. package/dist/esm/html/installIntlayerHTML.mjs +23 -33
  105. package/dist/esm/html/types.mjs +0 -1
  106. package/dist/esm/index.mjs +12 -69
  107. package/dist/esm/markdown/MarkdownRenderer.mjs +105 -131
  108. package/dist/esm/markdown/compiler.mjs +6 -12
  109. package/dist/esm/markdown/index.mjs +5 -22
  110. package/dist/esm/markdown/installIntlayerMarkdown.mjs +47 -80
  111. package/dist/esm/markdown/runtime.mjs +19 -54
  112. package/dist/esm/plugins.mjs +2 -21
  113. package/dist/esm/renderIntlayerNode.mjs +33 -47
  114. package/dist/getDictionary-BE4ZLuzI.mjs +387 -0
  115. package/dist/getDictionary-DMdOvXMh.js +1 -0
  116. package/dist/types/getDictionary.d.ts +1 -2
  117. package/dist/types/getIntlayer.d.ts +1 -2
  118. package/dist/types/plugins.d.ts +5 -0
  119. package/package.json +13 -13
  120. package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js +0 -1
  121. package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-CR8kSRs9.mjs +0 -73
  122. package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-BlN498QG.mjs +0 -36
  123. package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-DYN7KHa_.js +0 -1
  124. package/dist/plugins-Bzptc2vR.js +0 -1
  125. package/dist/plugins-rixQm8YE.mjs +0 -293
@@ -1,53 +1,36 @@
1
- import { MessageKey as s } from "@intlayer/editor";
2
- import { ref as l, readonly as d, inject as m, watch as D } from "vue";
3
- import { createSharedComposable as R } from "./createSharedComposable.mjs";
4
- import { useCrossFrameState as u } from "./useCrossFrameState.mjs";
5
- let o = null;
6
- const n = /* @__PURE__ */ Symbol(
7
- "intlayerDictionariesRecord"
8
- ), f = () => {
9
- if (o) return o;
10
- const e = l(void 0);
11
- return o = {
12
- localeDictionaries: d(e),
13
- setLocaleDictionaries: (i) => {
14
- e.value = i ?? {};
15
- },
16
- setLocaleDictionary(i) {
17
- e.value = {
18
- ...e.value,
19
- [i.localId]: i
20
- };
21
- }
22
- }, o;
23
- }, C = (e) => {
24
- const i = f();
25
- import("@intlayer/unmerged-dictionaries-entry").then((t) => {
26
- const r = t.getUnmergedDictionaries(), a = Object.fromEntries(
27
- Object.values(r).flat().map((c) => [c.localId, c])
28
- );
29
- i.setLocaleDictionaries(a);
30
- }), e.provide(n, i);
31
- }, v = R(() => {
32
- const e = m(
33
- n
34
- );
35
- if (!e)
36
- throw new Error("DictionariesRecord state not found");
37
- const [i, t] = u(
38
- s.INTLAYER_LOCALE_DICTIONARIES_CHANGED,
39
- void 0
40
- );
41
- D(
42
- e.localeDictionaries,
43
- (r) => {
44
- t(r);
45
- },
46
- { immediate: !0 }
47
- );
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";
5
+ //#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 });
48
34
  });
49
- export {
50
- f as createDictionaryRecordClient,
51
- C as installDictionariesRecord,
52
- v as useDictionariesRecord
53
- };
35
+ //#endregion
36
+ export { l as createDictionaryRecordClient, u as installDictionariesRecord, d as useDictionariesRecord };
@@ -1,64 +1,42 @@
1
- import { getContentNodeByKeyPath as u } from "@intlayer/core/dictionaryManipulator";
2
- import { MessageKey as N } from "@intlayer/editor";
3
- import { NodeType as p } from "@intlayer/types/nodeType";
4
- import { ref as T, readonly as v, inject as h, watch as C } from "vue";
5
- import { createSharedComposable as _ } from "./createSharedComposable.mjs";
6
- import { useCrossFrameState as y } from "./useCrossFrameState.mjs";
7
- let d = null;
8
- const f = /* @__PURE__ */ Symbol("EditedContent"), D = (e) => {
9
- if (d) return d;
10
- const n = T({});
11
- return d = {
12
- editedContent: v(n),
13
- getEditedContentValue: (t, r) => {
14
- const i = n.value;
15
- if (!i) return;
16
- const c = r.filter(
17
- (o) => o.type !== p.Translation
18
- ), E = t.includes(":local:") || t.includes(":remote:"), s = e?.locale.value;
19
- if (E) {
20
- const o = i?.[t]?.content ?? {};
21
- return u(
22
- o,
23
- c,
24
- s
25
- );
26
- }
27
- const m = Object.keys(i).filter(
28
- (o) => o.startsWith(`${t}:`)
29
- );
30
- for (const o of m) {
31
- const l = i?.[o]?.content ?? {}, a = u(
32
- l,
33
- c,
34
- s
35
- );
36
- if (a) return a;
37
- }
38
- },
39
- setEditedContent: (t) => {
40
- n.value = t;
41
- }
42
- }, d;
43
- }, A = (e, n) => {
44
- const t = D(n);
45
- e.provide(f, t);
46
- }, R = _(() => {
47
- const e = h(f);
48
- if (!e)
49
- throw new Error("EditedContent state not found");
50
- const [n, t] = y(
51
- N.INTLAYER_EDITED_CONTENT_CHANGED,
52
- {}
53
- );
54
- return C(n, (r) => {
55
- e.editedContent.value = r ?? {};
56
- }), C(e, (r) => {
57
- t(r.editedContent.value);
58
- }), e;
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";
7
+ //#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;
59
40
  });
60
- export {
61
- D as createEditedContentClient,
62
- A as installEditedContent,
63
- R as useEditedContent
64
- };
41
+ //#endregion
42
+ export { d as createEditedContentClient, f as installEditedContent, p as useEditedContent };
@@ -1,56 +1,38 @@
1
- import E from "@intlayer/config/built";
2
- import { MessageKey as a } from "@intlayer/editor";
3
- import { ref as o, computed as f, inject as u, watch as c, onMounted as m, nextTick as p } from "vue";
4
- import { createSharedComposable as I } from "./createSharedComposable.mjs";
5
- import { useCrossFrameMessageListener as i } from "./useCrossFrameMessageListener.mjs";
6
- let r = null;
7
- const s = /* @__PURE__ */ Symbol("EditorEnabled"), l = () => typeof window > "u" ? !1 : window.self !== window.top, b = () => {
8
- if (r) return r;
9
- const e = o(E.editor.enabled), n = o(!1), t = o(!1), d = f(
10
- () => e.value && n.value && t.value
11
- );
12
- return r = {
13
- settingEnabled: e,
14
- wrapperEnabled: n,
15
- isInIframe: t,
16
- enabled: d
17
- }, r;
18
- }, T = (e) => {
19
- const n = b();
20
- typeof window < "u" && (n.isInIframe.value = l()), e.provide(s, n);
21
- }, A = I(() => {
22
- const e = u(
23
- s
24
- );
25
- if (!e)
26
- throw new Error("EditorEnabled state not found");
27
- i(
28
- `${a.INTLAYER_EDITOR_ENABLED}/post`,
29
- (t) => {
30
- e.wrapperEnabled.value = t;
31
- }
32
- );
33
- const n = i(
34
- `${a.INTLAYER_EDITOR_ENABLED}/get`,
35
- (t) => {
36
- e.wrapperEnabled.value = t;
37
- }
38
- );
39
- return c(
40
- () => e.isInIframe.value && e.settingEnabled.value,
41
- (t) => {
42
- n();
43
- },
44
- { immediate: !0 }
45
- ), m(() => {
46
- p(() => {
47
- const t = l();
48
- e.isInIframe.value = t;
49
- });
50
- }), e;
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";
6
+ //#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;
51
36
  });
52
- export {
53
- b as createEditorEnabledClient,
54
- T as installEditorEnabled,
55
- A as useEditorEnabled
56
- };
37
+ //#endregion
38
+ export { p as createEditorEnabledClient, m as installEditorEnabled, h as useEditorEnabled };
@@ -1,12 +1,2 @@
1
- import "@intlayer/editor";
2
- import "vue";
3
- import { e as d } from "../../plugins-rixQm8YE.mjs";
4
- import "@intlayer/config/built";
5
- import "@intlayer/core/interpreter";
6
- import "../client/useLocaleStorage.mjs";
7
- import "@intlayer/core/localization";
8
- import "./createSharedComposable.mjs";
9
- import "./useCrossFrameState.mjs";
10
- export {
11
- d as useEditorLocale
12
- };
1
+ import { u as e } from "../../getDictionary-BE4ZLuzI.mjs";
2
+ export { e as useEditorLocale };
@@ -1,39 +1,34 @@
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 = /* @__PURE__ */ 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;
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";
5
+ //#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;
10
+ };
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;
34
32
  });
35
- export {
36
- d as createFocusDictionaryClient,
37
- S as installFocusDictionary,
38
- O as useFocusDictionary
39
- };
33
+ //#endregion
34
+ export { l as createFocusDictionaryClient, u as installFocusDictionary, d as useFocusDictionary };
@@ -1,7 +1,3 @@
1
- import { _ as e, u as o } from "../../plugins-rixQm8YE.mjs";
2
- import { installIntlayerEditor as l } from "./installIntlayerEditor.mjs";
3
- export {
4
- e as ContentSelectorWrapper,
5
- l as installIntlayerEditor,
6
- o as useEditor
7
- };
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,17 +1,21 @@
1
- import n from "@intlayer/config/built";
2
- import { installCommunicator as r } from "./communicator.mjs";
3
- import { installDictionariesRecord as e } from "./dictionariesRecord.mjs";
4
- import { installEditedContent as s } from "./editedContent.mjs";
5
- import { installEditorEnabled as l } from "./editorEnabled.mjs";
6
- import { installFocusDictionary as a } from "./focusDictionary.mjs";
7
- const { editor: o } = n, { applicationURL: m, editorURL: c, cmsURL: d } = o ?? {}, f = (i) => {
8
- typeof window > "u" || !(window.self !== window.top) || (o.applicationURL.length > 0 && window.postMessage(i, o.applicationURL), o.editorURL.length > 0 && window.parent.postMessage(i, o.editorURL), o.cmsURL.length > 0 && window.parent.postMessage(i, o.cmsURL));
9
- }, u = (i, t) => {
10
- r(i, {
11
- postMessage: f,
12
- allowedOrigins: [m, c, d]
13
- }), l(i), e(i), s(i, t), a(i);
14
- };
15
- export {
16
- u as installIntlayerEditor
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";
7
+ //#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);
17
19
  };
20
+ //#endregion
21
+ export { d as installIntlayerEditor };
@@ -1,29 +1,29 @@
1
- import { compareUrls as d } from "@intlayer/editor";
2
- import { onScopeDispose as u, getCurrentInstance as p } from "vue";
3
- import { useCommunicator as f } from "./communicator.mjs";
4
- const o = /* @__PURE__ */ new Map();
5
- let c = !1;
6
- const m = (e, t) => {
7
- let s = o.get(e);
8
- s || (s = /* @__PURE__ */ new Set(), o.set(e, s)), s.add(t);
9
- }, l = (e, t) => {
10
- const s = o.get(e);
11
- s && (s.delete(t), s.size === 0 && o.delete(e));
12
- }, w = (e, t) => {
13
- c || typeof window > "u" || (window.addEventListener("message", (s) => {
14
- const { type: n, data: i, senderId: a } = s.data ?? {};
15
- n && a !== t && (!e || e.includes("*") || e.some((r) => d(r, s.origin))) && o.get(n)?.forEach((r) => {
16
- r(i);
17
- });
18
- }), c = !0);
19
- }, L = (e, t) => {
20
- const { allowedOrigins: s, postMessage: n, senderId: i } = f() ?? {};
21
- return w(s, i), t ? (m(e, t), u(() => l(e, t))) : p() || console.warn(
22
- "useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."
23
- ), (r) => {
24
- n({ type: e, data: r, senderId: i });
25
- };
26
- };
27
- export {
28
- L as useCrossFrameMessageListener
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";
4
+ //#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
+ };
29
27
  };
28
+ //#endregion
29
+ export { l as useCrossFrameMessageListener };
@@ -1,44 +1,52 @@
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
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";
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 = {
6
+ emit: !0,
7
+ receive: !0
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
15
+ ];
16
+ }
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
+ }), [
46
+ f,
47
+ g,
48
+ _
49
+ ];
44
50
  };
51
+ //#endregion
52
+ export { s as useCrossFrameState };