solid-intlayer 5.5.10 → 5.6.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/README.md +3 -3
- package/dist/cjs/IntlayerNode.cjs +1 -0
- package/dist/cjs/UI/ContentSelector.cjs +1 -0
- package/dist/cjs/client/IntlayerProvider.cjs +1 -0
- package/dist/cjs/client/getBrowserLocale.cjs +1 -0
- package/dist/cjs/client/index.cjs +1 -29
- package/dist/cjs/client/t.cjs +1 -0
- package/dist/cjs/client/useContent.cjs +1 -0
- package/dist/cjs/client/useDictionary.cjs +1 -41
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -0
- package/dist/cjs/client/useIntlayer.cjs +1 -44
- package/dist/cjs/client/useIntlayerAsync.cjs +1 -0
- package/dist/cjs/client/useLoadDynamic.cjs +1 -0
- package/dist/cjs/client/useLocale.cjs +1 -33
- package/dist/cjs/client/useLocaleBase.cjs +1 -0
- package/dist/cjs/client/useLocaleCookie.cjs +1 -0
- package/dist/cjs/client/useTraduction.cjs +1 -0
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -0
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -0
- package/dist/cjs/editor/contexts/ChangedContentContext.cjs +1 -0
- package/dist/cjs/editor/contexts/CommunicatorContext.cjs +1 -0
- package/dist/cjs/editor/contexts/ConfigurationContext.cjs +1 -0
- package/dist/cjs/editor/contexts/DictionariesRecordContext.cjs +1 -0
- package/dist/cjs/editor/contexts/EditedContentContext.cjs +1 -0
- package/dist/cjs/editor/contexts/EditorEnabledContext.cjs +1 -0
- package/dist/cjs/editor/contexts/EditorProvider.cjs +1 -0
- package/dist/cjs/editor/contexts/FocusDictionaryContext.cjs +1 -0
- package/dist/cjs/editor/contexts/index.cjs +1 -0
- package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +1 -0
- package/dist/cjs/editor/contexts/useCrossFrameState.cjs +1 -0
- package/dist/cjs/editor/contexts/useCrossURLPathState.cjs +1 -0
- package/dist/cjs/editor/contexts/useIframeClickInterceptor.cjs +1 -0
- package/dist/cjs/editor/index.cjs +1 -0
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -0
- package/dist/cjs/getDictionary.cjs +1 -42
- package/dist/cjs/getIntlayer.cjs +1 -38
- package/dist/cjs/index.cjs +1 -31
- package/dist/cjs/markdown/MarkdownProvider.cjs +1 -0
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -0
- package/dist/cjs/markdown/index.cjs +1 -36
- package/dist/cjs/plugins.cjs +1 -53
- package/dist/cjs/solidElement/renderSolidElement.cjs +1 -0
- package/dist/esm/IntlayerNode.mjs +17 -0
- package/dist/esm/UI/ContentSelector.mjs +58 -0
- package/dist/esm/client/IntlayerProvider.mjs +69 -0
- package/dist/esm/client/getBrowserLocale.mjs +100 -0
- package/dist/esm/client/index.mjs +29 -5
- package/dist/esm/client/t.mjs +10 -0
- package/dist/esm/client/useContent.mjs +13 -0
- package/dist/esm/client/useDictionary.mjs +18 -13
- package/dist/esm/client/useDictionaryDynamic.mjs +16 -0
- package/dist/esm/client/useIntlayer.mjs +18 -15
- package/dist/esm/client/useIntlayerAsync.mjs +15 -0
- package/dist/esm/client/useLoadDynamic.mjs +21 -0
- package/dist/esm/client/useLocale.mjs +29 -6
- package/dist/esm/client/useLocaleBase.mjs +19 -0
- package/dist/esm/client/useLocaleCookie.mjs +19 -0
- package/dist/esm/client/useTraduction.mjs +10 -0
- package/dist/esm/editor/ContentSelectorWrapper.mjs +52 -0
- package/dist/esm/editor/IntlayerEditorProvider.mjs +64 -0
- package/dist/esm/editor/contexts/ChangedContentContext.mjs +39 -0
- package/dist/esm/editor/contexts/CommunicatorContext.mjs +30 -0
- package/dist/esm/editor/contexts/ConfigurationContext.mjs +19 -0
- package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +44 -0
- package/dist/esm/editor/contexts/EditedContentContext.mjs +147 -0
- package/dist/esm/editor/contexts/EditorEnabledContext.mjs +27 -0
- package/dist/esm/editor/contexts/EditorProvider.mjs +85 -0
- package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +47 -0
- package/dist/esm/editor/contexts/index.mjs +43 -0
- package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +35 -0
- package/dist/esm/editor/contexts/useCrossFrameState.mjs +57 -0
- package/dist/esm/editor/contexts/useCrossURLPathState.mjs +25 -0
- package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +18 -0
- package/dist/esm/editor/index.mjs +4 -0
- package/dist/esm/editor/useEditedContentRenderer.mjs +29 -0
- package/dist/esm/getDictionary.mjs +13 -18
- package/dist/esm/getIntlayer.mjs +10 -15
- package/dist/esm/index.mjs +41 -6
- package/dist/esm/markdown/MarkdownProvider.mjs +24 -0
- package/dist/esm/markdown/MarkdownRenderer.mjs +31 -0
- package/dist/esm/markdown/index.mjs +7 -10
- package/dist/esm/plugins.mjs +113 -20
- package/dist/esm/solidElement/renderSolidElement.mjs +31 -0
- package/dist/types/IntlayerNode.d.ts +15 -0
- package/dist/types/IntlayerNode.d.ts.map +1 -0
- package/dist/types/UI/ContentSelector.d.ts +11 -0
- package/dist/types/UI/ContentSelector.d.ts.map +1 -0
- package/dist/types/client/IntlayerProvider.d.ts +28 -0
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -0
- package/dist/types/client/getBrowserLocale.d.ts +25 -0
- package/dist/types/client/getBrowserLocale.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +11 -4
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/t.d.ts +9 -0
- package/dist/types/client/t.d.ts.map +1 -0
- package/dist/types/client/useContent.d.ts +10 -0
- package/dist/types/client/useContent.d.ts.map +1 -0
- package/dist/types/client/useDictionary.d.ts +7 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +9 -0
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/client/useIntlayer.d.ts +9 -6
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useIntlayerAsync.d.ts +15 -0
- package/dist/types/client/useIntlayerAsync.d.ts.map +1 -0
- package/dist/types/client/useLoadDynamic.d.ts +2 -0
- package/dist/types/client/useLoadDynamic.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +14 -3
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts +10 -0
- package/dist/types/client/useLocaleBase.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/client/useTraduction.d.ts +24 -0
- package/dist/types/client/useTraduction.d.ts.map +1 -0
- package/dist/types/editor/ContentSelectorWrapper.d.ts +7 -0
- package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -0
- package/dist/types/editor/IntlayerEditorProvider.d.ts +3 -0
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -0
- package/dist/types/editor/contexts/ChangedContentContext.d.ts +13 -0
- package/dist/types/editor/contexts/ChangedContentContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/CommunicatorContext.d.ts +10 -0
- package/dist/types/editor/contexts/CommunicatorContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/ConfigurationContext.d.ts +9 -0
- package/dist/types/editor/contexts/ConfigurationContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +16 -0
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/EditedContentContext.d.ts +33 -0
- package/dist/types/editor/contexts/EditedContentContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts +11 -0
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/EditorProvider.d.ts +6 -0
- package/dist/types/editor/contexts/EditorProvider.d.ts.map +1 -0
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +21 -0
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts.map +1 -0
- package/dist/types/editor/contexts/index.d.ts +13 -0
- package/dist/types/editor/contexts/index.d.ts.map +1 -0
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +19 -0
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts.map +1 -0
- package/dist/types/editor/contexts/useCrossFrameState.d.ts +29 -0
- package/dist/types/editor/contexts/useCrossFrameState.d.ts.map +1 -0
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts +4 -0
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts.map +1 -0
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +9 -0
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts.map +1 -0
- package/dist/types/editor/index.d.ts +2 -0
- package/dist/types/editor/index.d.ts.map +1 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts +13 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -0
- package/dist/types/getDictionary.d.ts +1 -1
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +1 -1
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownProvider.d.ts +12 -0
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -0
- package/dist/types/markdown/MarkdownRenderer.d.ts +16 -0
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +2 -3
- package/dist/types/markdown/index.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +49 -23
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/solidElement/renderSolidElement.d.ts +3 -0
- package/dist/types/solidElement/renderSolidElement.d.ts.map +1 -0
- package/dist/web-BFg6-54-.mjs +443 -0
- package/dist/web-qH6jV2Kc.js +1 -0
- package/package.json +24 -18
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/client/installIntlayer.cjs +0 -53
- package/dist/cjs/client/installIntlayer.cjs.map +0 -1
- package/dist/cjs/client/useDictionary.cjs.map +0 -1
- package/dist/cjs/client/useIntlayer.cjs.map +0 -1
- package/dist/cjs/client/useLocale.cjs.map +0 -1
- package/dist/cjs/getDictionary.cjs.map +0 -1
- package/dist/cjs/getIntlayer.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/markdown/index.cjs.map +0 -1
- package/dist/cjs/plugins.cjs.map +0 -1
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/client/installIntlayer.mjs +0 -26
- package/dist/esm/client/installIntlayer.mjs.map +0 -1
- package/dist/esm/client/useDictionary.mjs.map +0 -1
- package/dist/esm/client/useIntlayer.mjs.map +0 -1
- package/dist/esm/client/useLocale.mjs.map +0 -1
- package/dist/esm/getDictionary.mjs.map +0 -1
- package/dist/esm/getIntlayer.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/markdown/index.mjs.map +0 -1
- package/dist/esm/plugins.mjs.map +0 -1
- package/dist/types/client/installIntlayer.d.ts +0 -11
- package/dist/types/client/installIntlayer.d.ts.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import s from "@intlayer/config/built";
|
|
2
|
+
import { createContext as c, useContext as a, createMemo as x, createComponent as i } from "solid-js";
|
|
3
|
+
const u = () => "xxxx-xxxx-4xxx-yxxx".replace(/[xy]/g, function(n) {
|
|
4
|
+
const t = Math.random() * 16 | 0;
|
|
5
|
+
return (n == "x" ? t : t & 3 | 8).toString(16);
|
|
6
|
+
}), {
|
|
7
|
+
editor: e
|
|
8
|
+
} = s, r = c({
|
|
9
|
+
postMessage: () => null,
|
|
10
|
+
allowedOrigins: [e == null ? void 0 : e.applicationURL, e == null ? void 0 : e.editorURL, e == null ? void 0 : e.cmsURL],
|
|
11
|
+
senderId: ""
|
|
12
|
+
}), g = (n) => {
|
|
13
|
+
const t = u(), o = x(() => ({
|
|
14
|
+
postMessage: n.postMessage,
|
|
15
|
+
allowedOrigins: n.allowedOrigins,
|
|
16
|
+
senderId: t
|
|
17
|
+
}));
|
|
18
|
+
return i(r.Provider, {
|
|
19
|
+
get value() {
|
|
20
|
+
return o();
|
|
21
|
+
},
|
|
22
|
+
get children() {
|
|
23
|
+
return n.children;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}, d = () => a(r);
|
|
27
|
+
export {
|
|
28
|
+
g as CommunicatorProvider,
|
|
29
|
+
d as useCommunicator
|
|
30
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MessageKey as o } from "@intlayer/editor";
|
|
2
|
+
import { createContext as r, createComponent as n, useContext as i } from "solid-js";
|
|
3
|
+
import { useCrossFrameState as a } from "./useCrossFrameState.mjs";
|
|
4
|
+
const t = r(void 0), C = () => a(o.INTLAYER_CONFIGURATION, void 0, {
|
|
5
|
+
receive: !1,
|
|
6
|
+
emit: !0
|
|
7
|
+
}), f = (e) => n(t.Provider, {
|
|
8
|
+
get value() {
|
|
9
|
+
return e.configuration;
|
|
10
|
+
},
|
|
11
|
+
get children() {
|
|
12
|
+
return e.children;
|
|
13
|
+
}
|
|
14
|
+
}), m = () => i(t);
|
|
15
|
+
export {
|
|
16
|
+
f as ConfigurationProvider,
|
|
17
|
+
m as useConfiguration,
|
|
18
|
+
C as useConfigurationState
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MessageKey as C } from "@intlayer/editor";
|
|
2
|
+
import { createContext as c, useContext as s, createMemo as i, createComponent as n } from "solid-js";
|
|
3
|
+
import { useCrossFrameState as m } from "./useCrossFrameState.mjs";
|
|
4
|
+
const a = c(void 0), d = c(void 0), g = (t) => {
|
|
5
|
+
const [e, o] = m(C.INTLAYER_LOCALE_DICTIONARIES_CHANGED, void 0), u = i(() => ({
|
|
6
|
+
localeDictionaries: e() ?? {}
|
|
7
|
+
})), l = i(() => ({
|
|
8
|
+
setLocaleDictionaries: o,
|
|
9
|
+
setLocaleDictionary: (r) => {
|
|
10
|
+
o((D) => ({
|
|
11
|
+
...D,
|
|
12
|
+
[r.key]: r
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
return n(a.Provider, {
|
|
17
|
+
get value() {
|
|
18
|
+
return u();
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return n(d.Provider, {
|
|
22
|
+
get value() {
|
|
23
|
+
return l();
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return t.children;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}, v = () => s(d), h = () => {
|
|
32
|
+
const t = v(), e = s(a);
|
|
33
|
+
if (!e)
|
|
34
|
+
throw new Error("useDictionariesRecordStates must be used within a DictionariesRecordProvider");
|
|
35
|
+
return {
|
|
36
|
+
...e,
|
|
37
|
+
...t
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
g as DictionariesRecordProvider,
|
|
42
|
+
h as useDictionariesRecord,
|
|
43
|
+
v as useDictionariesRecordActions
|
|
44
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { getContentNodeByKeyPath as D, renameContentNodeByKeyPath as Y, editDictionaryByKeyPath as j } from "@intlayer/core";
|
|
2
|
+
import { MessageKey as N } from "@intlayer/editor";
|
|
3
|
+
import { createContext as _, useContext as x, createComponent as T } from "solid-js";
|
|
4
|
+
import { useDictionariesRecord as M } from "./DictionariesRecordContext.mjs";
|
|
5
|
+
import { useCrossFrameMessageListener as A } from "./useCrossFrameMessageListener.mjs";
|
|
6
|
+
import { useCrossFrameState as W } from "./useCrossFrameState.mjs";
|
|
7
|
+
const P = _(void 0), X = (r) => A(`${N.INTLAYER_EDITED_CONTENT_CHANGED}/post`, r), Z = (r) => A(`${N.INTLAYER_EDITED_CONTENT_CHANGED}/get`, r), I = _(void 0), K = (r) => {
|
|
8
|
+
const {
|
|
9
|
+
localeDictionaries: E
|
|
10
|
+
} = M(), [g, c] = W(N.INTLAYER_EDITED_CONTENT_CHANGED), w = (t) => {
|
|
11
|
+
if (typeof t == "function")
|
|
12
|
+
c((e) => {
|
|
13
|
+
const n = e == null ? void 0 : e[Object.keys(e || {})[0]], o = t(n);
|
|
14
|
+
return {
|
|
15
|
+
...e,
|
|
16
|
+
[o.key]: o
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
else {
|
|
20
|
+
const e = t;
|
|
21
|
+
c((n) => ({
|
|
22
|
+
...n,
|
|
23
|
+
[e.key]: e
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}, S = (t, e) => {
|
|
27
|
+
c((n) => ({
|
|
28
|
+
...n,
|
|
29
|
+
[t]: {
|
|
30
|
+
...n == null ? void 0 : n[t],
|
|
31
|
+
content: e
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
}, F = (t, e, n = [], o = !0) => {
|
|
35
|
+
c((s) => {
|
|
36
|
+
var l, m;
|
|
37
|
+
const i = (l = E[t]) == null ? void 0 : l.content, C = structuredClone(((m = s == null ? void 0 : s[t]) == null ? void 0 : m.content) ?? i);
|
|
38
|
+
let d = n;
|
|
39
|
+
if (!o) {
|
|
40
|
+
let u = 0;
|
|
41
|
+
const H = n.slice(0, -1), f = n[n.length - 1];
|
|
42
|
+
let h = f.key;
|
|
43
|
+
for (; typeof D(C, d) < "u"; )
|
|
44
|
+
u++, h = u === 0 ? f.key : `${f.key} (${u})`, d = [...H, {
|
|
45
|
+
...f,
|
|
46
|
+
key: h
|
|
47
|
+
}];
|
|
48
|
+
}
|
|
49
|
+
const a = j(C, d, e);
|
|
50
|
+
return {
|
|
51
|
+
...s,
|
|
52
|
+
[t]: {
|
|
53
|
+
...s == null ? void 0 : s[t],
|
|
54
|
+
content: a
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}, G = (t, e, n = []) => {
|
|
59
|
+
c((o) => {
|
|
60
|
+
var d, a;
|
|
61
|
+
const s = (d = E[t]) == null ? void 0 : d.content, i = structuredClone(((a = o == null ? void 0 : o[t]) == null ? void 0 : a.content) ?? s), C = Y(i, e, n);
|
|
62
|
+
return {
|
|
63
|
+
...o,
|
|
64
|
+
[t]: {
|
|
65
|
+
...o == null ? void 0 : o[t],
|
|
66
|
+
content: C
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}, L = (t, e) => {
|
|
71
|
+
c((n) => {
|
|
72
|
+
var a, l, m;
|
|
73
|
+
const o = (a = E[t]) == null ? void 0 : a.content, s = structuredClone(((l = n == null ? void 0 : n[t]) == null ? void 0 : l.content) ?? o), i = structuredClone(s), C = e.slice(0, -1), d = (m = e[e.length - 1]) == null ? void 0 : m.key;
|
|
74
|
+
if (d) {
|
|
75
|
+
const u = D(i, C);
|
|
76
|
+
u && typeof u == "object" && d in u && delete u[d];
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
...n,
|
|
80
|
+
[t]: {
|
|
81
|
+
...n == null ? void 0 : n[t],
|
|
82
|
+
content: i
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}, O = (t) => {
|
|
87
|
+
c((e) => {
|
|
88
|
+
const n = {
|
|
89
|
+
...e
|
|
90
|
+
};
|
|
91
|
+
return delete n[t], n;
|
|
92
|
+
});
|
|
93
|
+
}, R = (t) => {
|
|
94
|
+
c((e) => ({
|
|
95
|
+
...e,
|
|
96
|
+
[t]: {
|
|
97
|
+
...e == null ? void 0 : e[t],
|
|
98
|
+
content: {}
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
}, $ = () => {
|
|
102
|
+
c({});
|
|
103
|
+
}, b = (t, e) => {
|
|
104
|
+
var s, i, C;
|
|
105
|
+
const n = (s = E[t]) == null ? void 0 : s.content, o = ((C = (i = g()) == null ? void 0 : i[t]) == null ? void 0 : C.content) ?? n;
|
|
106
|
+
return D(o, e);
|
|
107
|
+
}, k = {
|
|
108
|
+
editedContent: g()
|
|
109
|
+
}, B = {
|
|
110
|
+
setEditedContentState: c,
|
|
111
|
+
setEditedDictionary: w,
|
|
112
|
+
setEditedContent: S,
|
|
113
|
+
addEditedContent: F,
|
|
114
|
+
renameEditedContent: G,
|
|
115
|
+
removeEditedContent: L,
|
|
116
|
+
restoreEditedContent: O,
|
|
117
|
+
clearEditedDictionaryContent: R,
|
|
118
|
+
clearEditedContent: $,
|
|
119
|
+
getEditedContentValue: b
|
|
120
|
+
};
|
|
121
|
+
return T(P.Provider, {
|
|
122
|
+
value: k,
|
|
123
|
+
get children() {
|
|
124
|
+
return T(I.Provider, {
|
|
125
|
+
value: B,
|
|
126
|
+
get children() {
|
|
127
|
+
return r.children;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}, V = () => x(I), p = () => {
|
|
133
|
+
const r = V(), E = x(P);
|
|
134
|
+
if (!E)
|
|
135
|
+
throw new Error("useEditedContent must be used within a EditedContentProvider");
|
|
136
|
+
return {
|
|
137
|
+
...E,
|
|
138
|
+
...r
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
K as EditedContentProvider,
|
|
143
|
+
p as useEditedContent,
|
|
144
|
+
V as useEditedContentActions,
|
|
145
|
+
Z as useGetEditedContentState,
|
|
146
|
+
X as usePostEditedContentState
|
|
147
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MessageKey as t } from "@intlayer/editor";
|
|
2
|
+
import { createContext as n, useContext as E, createComponent as a } from "solid-js";
|
|
3
|
+
import { useCrossFrameMessageListener as r } from "./useCrossFrameMessageListener.mjs";
|
|
4
|
+
import { useCrossFrameState as d } from "./useCrossFrameState.mjs";
|
|
5
|
+
const o = n({
|
|
6
|
+
enabled: () => !1
|
|
7
|
+
}), i = (e) => d(t.INTLAYER_EDITOR_ENABLED, !1, e), b = (e) => r(`${t.INTLAYER_EDITOR_ENABLED}/post`, e), f = (e) => r(`${t.INTLAYER_EDITOR_ENABLED}/get`, e), p = (e) => {
|
|
8
|
+
const [s] = i({
|
|
9
|
+
emit: !1,
|
|
10
|
+
receive: !0
|
|
11
|
+
});
|
|
12
|
+
return a(o.Provider, {
|
|
13
|
+
value: {
|
|
14
|
+
enabled: s
|
|
15
|
+
},
|
|
16
|
+
get children() {
|
|
17
|
+
return e.children;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, L = () => E(o);
|
|
21
|
+
export {
|
|
22
|
+
p as EditorEnabledProvider,
|
|
23
|
+
L as useEditorEnabled,
|
|
24
|
+
i as useEditorEnabledState,
|
|
25
|
+
f as useGetEditorEnabledState,
|
|
26
|
+
b as usePostEditorEnabledState
|
|
27
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { m as o } from "../../../web-BFg6-54-.mjs";
|
|
2
|
+
import { createComponent as r, createSignal as d, createEffect as i } from "solid-js";
|
|
3
|
+
import { ChangedContentProvider as c } from "./ChangedContentContext.mjs";
|
|
4
|
+
import { CommunicatorProvider as a } from "./CommunicatorContext.mjs";
|
|
5
|
+
import { ConfigurationProvider as l } from "./ConfigurationContext.mjs";
|
|
6
|
+
import { DictionariesRecordProvider as m } from "./DictionariesRecordContext.mjs";
|
|
7
|
+
import { useGetEditedContentState as u, EditedContentProvider as g } from "./EditedContentContext.mjs";
|
|
8
|
+
import { EditorEnabledProvider as f, useGetEditorEnabledState as s, useEditorEnabled as h } from "./EditorEnabledContext.mjs";
|
|
9
|
+
import { FocusDictionaryProvider as E } from "./FocusDictionaryContext.mjs";
|
|
10
|
+
const b = (e) => {
|
|
11
|
+
const t = u();
|
|
12
|
+
return i(() => {
|
|
13
|
+
t();
|
|
14
|
+
}), r(m, {
|
|
15
|
+
get children() {
|
|
16
|
+
return r(g, {
|
|
17
|
+
get children() {
|
|
18
|
+
return r(E, {
|
|
19
|
+
get children() {
|
|
20
|
+
return e.children;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}, C = (e) => {
|
|
28
|
+
const t = s(), {
|
|
29
|
+
enabled: n
|
|
30
|
+
} = h();
|
|
31
|
+
return i(() => {
|
|
32
|
+
n() || t();
|
|
33
|
+
}), o(() => n() ? e.children : e.fallback);
|
|
34
|
+
}, v = (e) => {
|
|
35
|
+
const [t, n] = d(!1);
|
|
36
|
+
return i(() => {
|
|
37
|
+
n(window.self !== window.top);
|
|
38
|
+
}), o(() => t() ? e.children : e.fallback);
|
|
39
|
+
}, M = (e) => r(c, {
|
|
40
|
+
get children() {
|
|
41
|
+
return r(f, {
|
|
42
|
+
get children() {
|
|
43
|
+
return r(l, {
|
|
44
|
+
get configuration() {
|
|
45
|
+
return e.configuration;
|
|
46
|
+
},
|
|
47
|
+
get children() {
|
|
48
|
+
return r(v, {
|
|
49
|
+
get fallback() {
|
|
50
|
+
return e.children;
|
|
51
|
+
},
|
|
52
|
+
get children() {
|
|
53
|
+
return r(a, {
|
|
54
|
+
get postMessage() {
|
|
55
|
+
return e.postMessage;
|
|
56
|
+
},
|
|
57
|
+
get allowedOrigins() {
|
|
58
|
+
return e.allowedOrigins;
|
|
59
|
+
},
|
|
60
|
+
get children() {
|
|
61
|
+
return r(C, {
|
|
62
|
+
get fallback() {
|
|
63
|
+
return e.children;
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
return r(b, {
|
|
67
|
+
get children() {
|
|
68
|
+
return e.children;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
export {
|
|
84
|
+
M as EditorProvider
|
|
85
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MessageKey as C } from "@intlayer/editor";
|
|
2
|
+
import { createContext as i, createComponent as r, useContext as s } from "solid-js";
|
|
3
|
+
import { useCrossFrameState as F } from "./useCrossFrameState.mjs";
|
|
4
|
+
const c = i(void 0), u = i(void 0), f = (t) => {
|
|
5
|
+
const [o, n] = F(C.INTLAYER_FOCUSED_CONTENT_CHANGED, null), a = (d) => {
|
|
6
|
+
n((e) => e && {
|
|
7
|
+
...e,
|
|
8
|
+
keyPath: d
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
return r(c.Provider, {
|
|
12
|
+
get value() {
|
|
13
|
+
return {
|
|
14
|
+
focusedContent: o()
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
get children() {
|
|
18
|
+
return r(u.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
setFocusedContent: n,
|
|
21
|
+
setFocusedContentKeyPath: a
|
|
22
|
+
},
|
|
23
|
+
get children() {
|
|
24
|
+
return t.children;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, y = () => {
|
|
30
|
+
const t = s(u);
|
|
31
|
+
if (t === void 0)
|
|
32
|
+
throw new Error("useFocusDictionaryActions must be used within a FocusDictionaryProvider");
|
|
33
|
+
return t;
|
|
34
|
+
}, h = () => {
|
|
35
|
+
const t = y(), o = s(c);
|
|
36
|
+
if (o === void 0)
|
|
37
|
+
throw new Error("useFocusDictionaryState must be used within a FocusDictionaryProvider");
|
|
38
|
+
return {
|
|
39
|
+
...o,
|
|
40
|
+
...t
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
f as FocusDictionaryProvider,
|
|
45
|
+
h as useFocusDictionary,
|
|
46
|
+
y as useFocusDictionaryActions
|
|
47
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export * from "@intlayer/editor";
|
|
2
|
+
import { ChangedContentProvider as r, useChangedContent as i, useChangedContentActions as s } from "./ChangedContentContext.mjs";
|
|
3
|
+
import { ConfigurationProvider as d, useConfiguration as a, useConfigurationState as u } from "./ConfigurationContext.mjs";
|
|
4
|
+
import { DictionariesRecordProvider as c, useDictionariesRecord as f, useDictionariesRecordActions as m } from "./DictionariesRecordContext.mjs";
|
|
5
|
+
import { EditedContentProvider as p, useEditedContent as x, useEditedContentActions as P, useGetEditedContentState as S, usePostEditedContentState as g } from "./EditedContentContext.mjs";
|
|
6
|
+
import { EditorEnabledProvider as v, useEditorEnabled as D, useEditorEnabledState as b, useGetEditorEnabledState as h, usePostEditorEnabledState as F } from "./EditorEnabledContext.mjs";
|
|
7
|
+
import { EditorProvider as A } from "./EditorProvider.mjs";
|
|
8
|
+
import { FocusDictionaryProvider as I, useFocusDictionary as L, useFocusDictionaryActions as k } from "./FocusDictionaryContext.mjs";
|
|
9
|
+
import { useCrossFrameMessageListener as M } from "./useCrossFrameMessageListener.mjs";
|
|
10
|
+
import { useCrossFrameState as j } from "./useCrossFrameState.mjs";
|
|
11
|
+
import { useCrossURLPathSetter as w, useCrossURLPathState as z } from "./useCrossURLPathState.mjs";
|
|
12
|
+
import { useIframeClickInterceptor as H, useIframeClickMerger as J } from "./useIframeClickInterceptor.mjs";
|
|
13
|
+
export {
|
|
14
|
+
r as ChangedContentProvider,
|
|
15
|
+
d as ConfigurationProvider,
|
|
16
|
+
c as DictionariesRecordProvider,
|
|
17
|
+
p as EditedContentProvider,
|
|
18
|
+
v as EditorEnabledProvider,
|
|
19
|
+
A as EditorProvider,
|
|
20
|
+
I as FocusDictionaryProvider,
|
|
21
|
+
i as useChangedContent,
|
|
22
|
+
s as useChangedContentActions,
|
|
23
|
+
a as useConfiguration,
|
|
24
|
+
u as useConfigurationState,
|
|
25
|
+
M as useCrossFrameMessageListener,
|
|
26
|
+
j as useCrossFrameState,
|
|
27
|
+
w as useCrossURLPathSetter,
|
|
28
|
+
z as useCrossURLPathState,
|
|
29
|
+
f as useDictionariesRecord,
|
|
30
|
+
m as useDictionariesRecordActions,
|
|
31
|
+
x as useEditedContent,
|
|
32
|
+
P as useEditedContentActions,
|
|
33
|
+
D as useEditorEnabled,
|
|
34
|
+
b as useEditorEnabledState,
|
|
35
|
+
L as useFocusDictionary,
|
|
36
|
+
k as useFocusDictionaryActions,
|
|
37
|
+
S as useGetEditedContentState,
|
|
38
|
+
h as useGetEditorEnabledState,
|
|
39
|
+
H as useIframeClickInterceptor,
|
|
40
|
+
J as useIframeClickMerger,
|
|
41
|
+
g as usePostEditedContentState,
|
|
42
|
+
F as usePostEditorEnabledState
|
|
43
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { compareUrls as c } from "@intlayer/editor";
|
|
2
|
+
import { onMount as f, onCleanup as M } from "solid-js";
|
|
3
|
+
import { useCommunicator as g } from "./CommunicatorContext.mjs";
|
|
4
|
+
const I = (r, o, C) => {
|
|
5
|
+
const t = g();
|
|
6
|
+
if (!t)
|
|
7
|
+
throw new Error("useCrossFrameMessageListener must be used within a CommunicatorProvider");
|
|
8
|
+
const {
|
|
9
|
+
allowedOrigins: e,
|
|
10
|
+
postMessage: m,
|
|
11
|
+
senderId: n
|
|
12
|
+
} = t;
|
|
13
|
+
return f(() => {
|
|
14
|
+
if (o) {
|
|
15
|
+
const s = (a) => {
|
|
16
|
+
const {
|
|
17
|
+
type: i,
|
|
18
|
+
data: p,
|
|
19
|
+
senderId: d
|
|
20
|
+
} = a.data;
|
|
21
|
+
i === r && d !== n && (typeof e > "u" || e != null && e.some((u) => c(u, a.origin)) || e != null && e.includes("*")) && o(p);
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener("message", s), M(() => window.removeEventListener("message", s));
|
|
24
|
+
}
|
|
25
|
+
}), (s) => {
|
|
26
|
+
m({
|
|
27
|
+
type: r,
|
|
28
|
+
data: s,
|
|
29
|
+
senderId: n
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
I as useCrossFrameMessageListener
|
|
35
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createSignal as $, createEffect as S } from "solid-js";
|
|
2
|
+
import { useCommunicator as C } from "./CommunicatorContext.mjs";
|
|
3
|
+
import { useCrossFrameMessageListener as a } from "./useCrossFrameMessageListener.mjs";
|
|
4
|
+
const w = (e, s, m) => {
|
|
5
|
+
const {
|
|
6
|
+
postMessage: t,
|
|
7
|
+
senderId: n
|
|
8
|
+
} = C(), {
|
|
9
|
+
emit: f,
|
|
10
|
+
receive: c
|
|
11
|
+
} = m ?? {
|
|
12
|
+
emit: !0,
|
|
13
|
+
receive: !0
|
|
14
|
+
}, [r, u] = $(typeof s == "function" ? s() : s), d = () => {
|
|
15
|
+
typeof t == "function" && t({
|
|
16
|
+
type: `${e}/post`,
|
|
17
|
+
data: r(),
|
|
18
|
+
senderId: n
|
|
19
|
+
});
|
|
20
|
+
}, y = (o) => {
|
|
21
|
+
u((p) => {
|
|
22
|
+
const i = typeof o == "function" ? o(p) : o;
|
|
23
|
+
return f && typeof t == "function" && typeof i < "u" && t({
|
|
24
|
+
type: `${e}/post`,
|
|
25
|
+
data: i,
|
|
26
|
+
senderId: n
|
|
27
|
+
}), i;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
a(
|
|
31
|
+
`${e}/post`,
|
|
32
|
+
// Only activate the state listener if the `receive` option is true
|
|
33
|
+
c ? (o) => {
|
|
34
|
+
u(() => o);
|
|
35
|
+
} : void 0
|
|
36
|
+
);
|
|
37
|
+
const g = (o, p) => {
|
|
38
|
+
f && typeof t == "function" && p !== n && (typeof r() > "u" || t({
|
|
39
|
+
type: `${e}/post`,
|
|
40
|
+
data: r(),
|
|
41
|
+
senderId: n
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
return a(
|
|
45
|
+
`${e}/get`,
|
|
46
|
+
// Only activate the state listener if the `emit` option is true
|
|
47
|
+
f ? g : void 0
|
|
48
|
+
), S(() => {
|
|
49
|
+
c && typeof t == "function" && typeof r() > "u" && t({
|
|
50
|
+
type: `${e}/get`,
|
|
51
|
+
senderId: n
|
|
52
|
+
});
|
|
53
|
+
}), [r, y, d];
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
w as useCrossFrameState
|
|
57
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MessageKey as h } from "@intlayer/editor";
|
|
2
|
+
import { onMount as d, onCleanup as p } from "solid-js";
|
|
3
|
+
import { useCrossFrameState as w } from "./useCrossFrameState.mjs";
|
|
4
|
+
const v = (n, e) => w(h.INTLAYER_URL_CHANGE, n, e), E = (n) => {
|
|
5
|
+
const e = v(n, {
|
|
6
|
+
emit: !0,
|
|
7
|
+
receive: !1
|
|
8
|
+
}), [l, i] = e;
|
|
9
|
+
return d(() => {
|
|
10
|
+
const o = history.pushState, a = history.replaceState, s = (r) => function(...c) {
|
|
11
|
+
r.apply(this, c), window.dispatchEvent(new Event("locationchange"));
|
|
12
|
+
};
|
|
13
|
+
history.pushState = s(o), history.replaceState = s(a);
|
|
14
|
+
const t = () => {
|
|
15
|
+
i(window.location.pathname);
|
|
16
|
+
};
|
|
17
|
+
window.addEventListener("locationchange", t), window.addEventListener("popstate", t), window.addEventListener("hashchange", t), window.addEventListener("load", t), t(), p(() => {
|
|
18
|
+
window.removeEventListener("locationchange", t), window.removeEventListener("popstate", t), window.removeEventListener("hashchange", t), window.removeEventListener("load", t), history.pushState = o, history.replaceState = a;
|
|
19
|
+
});
|
|
20
|
+
}), e;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
E as useCrossURLPathSetter,
|
|
24
|
+
v as useCrossURLPathState
|
|
25
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MessageKey as o, mergeIframeClick as t } from "@intlayer/editor";
|
|
2
|
+
import { onMount as s, onCleanup as m } from "solid-js";
|
|
3
|
+
import { useCrossFrameMessageListener as n } from "./useCrossFrameMessageListener.mjs";
|
|
4
|
+
const a = () => {
|
|
5
|
+
const r = n(o.INTLAYER_IFRAME_CLICKED);
|
|
6
|
+
s(() => {
|
|
7
|
+
const e = (c) => {
|
|
8
|
+
r();
|
|
9
|
+
};
|
|
10
|
+
document.addEventListener("mousedown", e), m(() => {
|
|
11
|
+
document.removeEventListener("mousedown", e);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}, u = () => n(o.INTLAYER_IFRAME_CLICKED, t);
|
|
15
|
+
export {
|
|
16
|
+
a as useIframeClickInterceptor,
|
|
17
|
+
u as useIframeClickMerger
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getContent as r } from "@intlayer/core";
|
|
2
|
+
import "@intlayer/editor";
|
|
3
|
+
import "./contexts/ChangedContentContext.mjs";
|
|
4
|
+
import "./contexts/ConfigurationContext.mjs";
|
|
5
|
+
import "./contexts/DictionariesRecordContext.mjs";
|
|
6
|
+
import { useEditedContentActions as i } from "./contexts/EditedContentContext.mjs";
|
|
7
|
+
import "./contexts/EditorEnabledContext.mjs";
|
|
8
|
+
import "solid-js";
|
|
9
|
+
import "./contexts/CommunicatorContext.mjs";
|
|
10
|
+
import "./contexts/FocusDictionaryContext.mjs";
|
|
11
|
+
const d = ({
|
|
12
|
+
dictionaryKey: e,
|
|
13
|
+
keyPath: n,
|
|
14
|
+
children: t
|
|
15
|
+
}) => {
|
|
16
|
+
const o = i();
|
|
17
|
+
return o ? o.getEditedContentValue(e, n) ?? t : t;
|
|
18
|
+
}, V = (e) => {
|
|
19
|
+
const n = d(e);
|
|
20
|
+
if (typeof n == "object") {
|
|
21
|
+
const t = r(n, e, e.locale);
|
|
22
|
+
return typeof t != "string" ? (console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`), e.children) : t;
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
V as EditedContentRenderer,
|
|
28
|
+
d as useEditedContentRenderer
|
|
29
|
+
};
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const plugins = [
|
|
10
|
-
intlayerNodePlugins,
|
|
11
|
-
markdownPlugin,
|
|
12
|
-
...additionalPlugins ?? []
|
|
1
|
+
import { getDictionary as r } from "@intlayer/core";
|
|
2
|
+
import { intlayerNodePlugins as e, solidNodePlugins as g, markdownPlugin as s } from "./plugins.mjs";
|
|
3
|
+
const c = (i, o, t) => {
|
|
4
|
+
const n = [
|
|
5
|
+
e,
|
|
6
|
+
g,
|
|
7
|
+
s,
|
|
8
|
+
...t ?? []
|
|
13
9
|
];
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
return r(
|
|
11
|
+
i,
|
|
12
|
+
o,
|
|
13
|
+
n
|
|
18
14
|
);
|
|
19
15
|
};
|
|
20
16
|
export {
|
|
21
|
-
getDictionary
|
|
17
|
+
c as getDictionary
|
|
22
18
|
};
|
|
23
|
-
//# sourceMappingURL=getDictionary.mjs.map
|