solid-intlayer 8.3.3 → 8.4.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/IntlayerProvider.cjs +1 -1
- package/dist/cjs/client/format/useIntl.cjs +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/cjs/client/t.cjs +1 -1
- package/dist/cjs/client/useContent.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleBase.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/ContentSelector.cjs +1 -0
- package/dist/cjs/editor/EditorProvider.cjs +1 -0
- package/dist/cjs/editor/useEditor.cjs +1 -0
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/client-BOid_svT.mjs +108 -0
- package/dist/client-DLNjmXFC.js +1 -0
- package/dist/esm/client/IntlayerProvider.mjs +2 -56
- package/dist/esm/client/format/useIntl.mjs +2 -10
- package/dist/esm/client/getBrowserLocale.mjs +8 -8
- package/dist/esm/client/index.mjs +5 -11
- package/dist/esm/client/t.mjs +2 -10
- package/dist/esm/client/useContent.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
- package/dist/esm/client/useIntlayer.mjs +1 -1
- package/dist/esm/client/useLocale.mjs +2 -24
- package/dist/esm/client/useLocaleBase.mjs +2 -15
- package/dist/esm/client/useLocaleStorage.mjs +9 -9
- package/dist/esm/client/useRewriteURL.mjs +2 -15
- package/dist/esm/client/useTraduction.mjs +1 -1
- package/dist/esm/editor/ContentSelector.mjs +9 -0
- package/dist/esm/editor/EditorProvider.mjs +2 -0
- package/dist/esm/editor/useEditor.mjs +2 -0
- package/dist/esm/getDictionary.mjs +6 -2
- package/dist/esm/getIntlayer.mjs +6 -2
- package/dist/esm/html/HTMLRenderer.mjs +15 -24
- package/dist/esm/index.mjs +10 -14
- package/dist/esm/markdown/MarkdownProvider.mjs +0 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +22 -31
- package/dist/esm/plugins.mjs +145 -2
- package/dist/types/client/IntlayerProvider.d.ts +0 -1
- package/dist/types/client/useContent.d.ts +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +4 -4
- package/dist/types/editor/ContentSelector.d.ts +16 -0
- package/dist/types/editor/EditorProvider.d.ts +2 -0
- package/dist/types/editor/useEditor.d.ts +6 -0
- package/package.json +8 -9
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +0 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +0 -1
- package/dist/cjs/editor/contexts/CommunicatorContext.cjs +0 -1
- package/dist/cjs/editor/contexts/ConfigurationContext.cjs +0 -1
- package/dist/cjs/editor/contexts/DictionariesRecordContext.cjs +0 -1
- package/dist/cjs/editor/contexts/EditedContentContext.cjs +0 -1
- package/dist/cjs/editor/contexts/EditorEnabledContext.cjs +0 -1
- package/dist/cjs/editor/contexts/EditorProvider.cjs +0 -1
- package/dist/cjs/editor/contexts/FocusDictionaryContext.cjs +0 -1
- package/dist/cjs/editor/contexts/index.cjs +0 -1
- package/dist/cjs/editor/contexts/useCrossFrameMessageListener.cjs +0 -1
- package/dist/cjs/editor/contexts/useCrossFrameState.cjs +0 -1
- package/dist/cjs/editor/contexts/useCrossURLPathState.cjs +0 -1
- package/dist/cjs/editor/contexts/useIframeClickInterceptor.cjs +0 -1
- package/dist/cjs/editor/index.cjs +0 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +0 -1
- package/dist/esm/editor/ContentSelectorWrapper.mjs +0 -2
- package/dist/esm/editor/IntlayerEditorProvider.mjs +0 -39
- package/dist/esm/editor/contexts/CommunicatorContext.mjs +0 -29
- package/dist/esm/editor/contexts/ConfigurationContext.mjs +0 -18
- package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +0 -40
- package/dist/esm/editor/contexts/EditedContentContext.mjs +0 -136
- package/dist/esm/editor/contexts/EditorEnabledContext.mjs +0 -20
- package/dist/esm/editor/contexts/EditorProvider.mjs +0 -68
- package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +0 -42
- package/dist/esm/editor/contexts/index.mjs +0 -12
- package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +0 -31
- package/dist/esm/editor/contexts/useCrossFrameState.mjs +0 -45
- package/dist/esm/editor/contexts/useCrossURLPathState.mjs +0 -24
- package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +0 -17
- package/dist/esm/editor/index.mjs +0 -2
- package/dist/esm/editor/useEditedContentRenderer.mjs +0 -16
- package/dist/getDictionary-DKdSGWHu.mjs +0 -188
- package/dist/getDictionary-DxYuk0_0.js +0 -1
- package/dist/types/editor/ContentSelectorWrapper.d.ts +0 -6
- package/dist/types/editor/IntlayerEditorProvider.d.ts +0 -2
- package/dist/types/editor/contexts/CommunicatorContext.d.ts +0 -9
- package/dist/types/editor/contexts/ConfigurationContext.d.ts +0 -8
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +0 -15
- package/dist/types/editor/contexts/EditedContentContext.d.ts +0 -34
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts +0 -10
- package/dist/types/editor/contexts/EditorProvider.d.ts +0 -5
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +0 -20
- package/dist/types/editor/contexts/index.d.ts +0 -11
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +0 -18
- package/dist/types/editor/contexts/useCrossFrameState.d.ts +0 -28
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts +0 -3
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +0 -8
- package/dist/types/editor/index.d.ts +0 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +0 -12
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
|
|
2
|
-
import { createComponent as t } from "solid-js/web";
|
|
3
|
-
import { createContext as n, useContext as r } from "solid-js";
|
|
4
|
-
import { MessageKey as i } from "@intlayer/editor";
|
|
5
|
-
//#region src/editor/contexts/ConfigurationContext.tsx
|
|
6
|
-
var a = n(void 0), o = () => e(i.INTLAYER_CONFIGURATION, void 0, {
|
|
7
|
-
receive: !1,
|
|
8
|
-
emit: !0
|
|
9
|
-
}), s = (e) => t(a.Provider, {
|
|
10
|
-
get value() {
|
|
11
|
-
return e.configuration;
|
|
12
|
-
},
|
|
13
|
-
get children() {
|
|
14
|
-
return e.children;
|
|
15
|
-
}
|
|
16
|
-
}), c = () => r(a);
|
|
17
|
-
//#endregion
|
|
18
|
-
export { s as ConfigurationProvider, c as useConfiguration, o as useConfigurationState };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
|
|
2
|
-
import { createComponent as t } from "solid-js/web";
|
|
3
|
-
import { createContext as n, createMemo as r, useContext as i } from "solid-js";
|
|
4
|
-
import { MessageKey as a } from "@intlayer/editor";
|
|
5
|
-
//#region src/editor/contexts/DictionariesRecordContext.tsx
|
|
6
|
-
var o = n(void 0), s = n(void 0), c = (n) => {
|
|
7
|
-
let [i, c] = e(a.INTLAYER_LOCALE_DICTIONARIES_CHANGED, void 0), l = r(() => ({ localeDictionaries: i() ?? {} })), u = r(() => ({
|
|
8
|
-
setLocaleDictionaries: c,
|
|
9
|
-
setLocaleDictionary: (e) => {
|
|
10
|
-
c((t) => ({
|
|
11
|
-
...t,
|
|
12
|
-
[e.localId]: e
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
}));
|
|
16
|
-
return t(o.Provider, {
|
|
17
|
-
get value() {
|
|
18
|
-
return l();
|
|
19
|
-
},
|
|
20
|
-
get children() {
|
|
21
|
-
return t(s.Provider, {
|
|
22
|
-
get value() {
|
|
23
|
-
return u();
|
|
24
|
-
},
|
|
25
|
-
get children() {
|
|
26
|
-
return n.children;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}, l = () => i(s), u = () => {
|
|
32
|
-
let e = l(), t = i(o);
|
|
33
|
-
if (!t) throw Error("useDictionariesRecordStates must be used within a DictionariesRecordProvider");
|
|
34
|
-
return {
|
|
35
|
-
...t,
|
|
36
|
-
...e
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
40
|
-
export { c as DictionariesRecordProvider, u as useDictionariesRecord, l as useDictionariesRecordActions };
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
|
|
2
|
-
import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
|
|
3
|
-
import { useDictionariesRecord as n } from "./DictionariesRecordContext.mjs";
|
|
4
|
-
import { createComponent as r } from "solid-js/web";
|
|
5
|
-
import { NodeType as i } from "@intlayer/types/nodeType";
|
|
6
|
-
import { createContext as a, useContext as o } from "solid-js";
|
|
7
|
-
import { MessageKey as s } from "@intlayer/editor";
|
|
8
|
-
import { editDictionaryByKeyPath as c, getContentNodeByKeyPath as l, renameContentNodeByKeyPath as u } from "@intlayer/core/dictionaryManipulator";
|
|
9
|
-
//#region src/editor/contexts/EditedContentContext.tsx
|
|
10
|
-
var d = a(void 0), f = (t) => e(`${s.INTLAYER_EDITED_CONTENT_CHANGED}/post`, t), p = (t) => e(`${s.INTLAYER_EDITED_CONTENT_CHANGED}/get`, t), m = a(void 0), h = (e) => {
|
|
11
|
-
let { localeDictionaries: a } = n(), [o, f] = t(s.INTLAYER_EDITED_CONTENT_CHANGED), p = (e) => {
|
|
12
|
-
if (typeof e == "function") f((t) => {
|
|
13
|
-
let n = t?.[Object.keys(t || {})[0]], r = e(n);
|
|
14
|
-
return {
|
|
15
|
-
...t,
|
|
16
|
-
[r.key]: r
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
else {
|
|
20
|
-
let t = e;
|
|
21
|
-
f((e) => ({
|
|
22
|
-
...e,
|
|
23
|
-
[t.key]: t
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
}, h = (e, t) => {
|
|
27
|
-
f((n) => ({
|
|
28
|
-
...n,
|
|
29
|
-
[e]: {
|
|
30
|
-
...n?.[e],
|
|
31
|
-
content: t
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
}, g = (e, t, n = [], r = !0) => {
|
|
35
|
-
f((i) => {
|
|
36
|
-
let o = a[e]?.content, s = structuredClone(i?.[e]?.content ?? o), u = n;
|
|
37
|
-
if (!r) {
|
|
38
|
-
let e = 0, t = n.slice(0, -1), r = n[n.length - 1], i = r.key;
|
|
39
|
-
for (; l(s, u) !== void 0;) e++, i = e === 0 ? r.key : `${r.key} (${e})`, u = [...t, {
|
|
40
|
-
...r,
|
|
41
|
-
key: i
|
|
42
|
-
}];
|
|
43
|
-
}
|
|
44
|
-
let d = c(s, u, t);
|
|
45
|
-
return {
|
|
46
|
-
...i,
|
|
47
|
-
[e]: {
|
|
48
|
-
...i?.[e],
|
|
49
|
-
content: d
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
}, _ = (e, t, n = []) => {
|
|
54
|
-
f((r) => {
|
|
55
|
-
let i = a[e]?.content, o = u(structuredClone(r?.[e]?.content ?? i), t, n);
|
|
56
|
-
return {
|
|
57
|
-
...r,
|
|
58
|
-
[e]: {
|
|
59
|
-
...r?.[e],
|
|
60
|
-
content: o
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
}, v = (e, t) => {
|
|
65
|
-
f((n) => {
|
|
66
|
-
let r = a[e]?.content, o = structuredClone(n?.[e]?.content ?? r), s = structuredClone(o), c = t.slice(0, -1), u = t[t.length - 1]?.key;
|
|
67
|
-
if (u) {
|
|
68
|
-
let e = l(s, c.filter((e) => e.type !== i.Translation));
|
|
69
|
-
e && typeof e == "object" && u in e && delete e[u];
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
...n,
|
|
73
|
-
[e]: {
|
|
74
|
-
...n?.[e],
|
|
75
|
-
content: s
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
}, y = (e) => {
|
|
80
|
-
f((t) => {
|
|
81
|
-
let n = { ...t };
|
|
82
|
-
return delete n[e], n;
|
|
83
|
-
});
|
|
84
|
-
}, b = (e) => {
|
|
85
|
-
f((t) => ({
|
|
86
|
-
...t,
|
|
87
|
-
[e]: {
|
|
88
|
-
...t?.[e],
|
|
89
|
-
content: {}
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
}, x = () => {
|
|
93
|
-
f({});
|
|
94
|
-
}, S = (e, t) => {
|
|
95
|
-
let n = o();
|
|
96
|
-
if (!n) return;
|
|
97
|
-
let r = t.filter((e) => e.type !== i.Translation);
|
|
98
|
-
if (e.includes(":local:") || e.includes(":remote:")) return l(n?.[e]?.content ?? {}, r);
|
|
99
|
-
let a = Object.keys(n).filter((t) => t.startsWith(`${e}:`));
|
|
100
|
-
for (let e of a) {
|
|
101
|
-
let t = l(n?.[e]?.content ?? {}, r);
|
|
102
|
-
if (t) return t;
|
|
103
|
-
}
|
|
104
|
-
}, C = { editedContent: o() }, w = {
|
|
105
|
-
setEditedContentState: f,
|
|
106
|
-
setEditedDictionary: p,
|
|
107
|
-
setEditedContent: h,
|
|
108
|
-
addEditedContent: g,
|
|
109
|
-
renameEditedContent: _,
|
|
110
|
-
removeEditedContent: v,
|
|
111
|
-
restoreEditedContent: y,
|
|
112
|
-
clearEditedDictionaryContent: b,
|
|
113
|
-
clearEditedContent: x,
|
|
114
|
-
getEditedContentValue: S
|
|
115
|
-
};
|
|
116
|
-
return r(d.Provider, {
|
|
117
|
-
value: C,
|
|
118
|
-
get children() {
|
|
119
|
-
return r(m.Provider, {
|
|
120
|
-
value: w,
|
|
121
|
-
get children() {
|
|
122
|
-
return e.children;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}, g = () => o(m), _ = () => {
|
|
128
|
-
let e = g(), t = o(d);
|
|
129
|
-
if (!t) throw Error("useEditedContent must be used within a EditedContentProvider");
|
|
130
|
-
return {
|
|
131
|
-
...t,
|
|
132
|
-
...e
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
//#endregion
|
|
136
|
-
export { h as EditedContentProvider, _ as useEditedContent, g as useEditedContentActions, p as useGetEditedContentState, f as usePostEditedContentState };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
|
|
2
|
-
import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
|
|
3
|
-
import { createComponent as n } from "solid-js/web";
|
|
4
|
-
import { createContext as r, useContext as i } from "solid-js";
|
|
5
|
-
import { MessageKey as a } from "@intlayer/editor";
|
|
6
|
-
//#region src/editor/contexts/EditorEnabledContext.tsx
|
|
7
|
-
var o = r({ enabled: () => !1 }), s = (e) => t(a.INTLAYER_EDITOR_ENABLED, !1, e), c = (t) => e(`${a.INTLAYER_EDITOR_ENABLED}/post`, t), l = (t) => e(`${a.INTLAYER_EDITOR_ENABLED}/get`, t), u = (e) => {
|
|
8
|
-
let [t] = s({
|
|
9
|
-
emit: !1,
|
|
10
|
-
receive: !0
|
|
11
|
-
});
|
|
12
|
-
return n(o.Provider, {
|
|
13
|
-
value: { enabled: t },
|
|
14
|
-
get children() {
|
|
15
|
-
return e.children;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}, d = () => i(o);
|
|
19
|
-
//#endregion
|
|
20
|
-
export { u as EditorEnabledProvider, d as useEditorEnabled, s as useEditorEnabledState, l as useGetEditorEnabledState, c as usePostEditorEnabledState };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { CommunicatorProvider as e } from "./CommunicatorContext.mjs";
|
|
2
|
-
import { ConfigurationProvider as t } from "./ConfigurationContext.mjs";
|
|
3
|
-
import { DictionariesRecordProvider as n } from "./DictionariesRecordContext.mjs";
|
|
4
|
-
import { EditedContentProvider as r, useGetEditedContentState as i } from "./EditedContentContext.mjs";
|
|
5
|
-
import { EditorEnabledProvider as a, useEditorEnabled as o, useGetEditorEnabledState as s } from "./EditorEnabledContext.mjs";
|
|
6
|
-
import { FocusDictionaryProvider as c } from "./FocusDictionaryContext.mjs";
|
|
7
|
-
import { createComponent as l, memo as u } from "solid-js/web";
|
|
8
|
-
import { createEffect as d, createSignal as f } from "solid-js";
|
|
9
|
-
//#region src/editor/contexts/EditorProvider.tsx
|
|
10
|
-
var p = (e) => {
|
|
11
|
-
let t = i();
|
|
12
|
-
return d(() => {
|
|
13
|
-
t();
|
|
14
|
-
}), l(n, { get children() {
|
|
15
|
-
return l(r, { get children() {
|
|
16
|
-
return l(c, { get children() {
|
|
17
|
-
return e.children;
|
|
18
|
-
} });
|
|
19
|
-
} });
|
|
20
|
-
} });
|
|
21
|
-
}, m = (e) => {
|
|
22
|
-
let t = s(), { enabled: n } = o();
|
|
23
|
-
return d(() => {
|
|
24
|
-
n() || t();
|
|
25
|
-
}), u(() => u(() => !!n())() ? e.children : e.fallback);
|
|
26
|
-
}, h = (e) => {
|
|
27
|
-
let [t, n] = f(!1);
|
|
28
|
-
return d(() => {
|
|
29
|
-
n(window.self !== window.top);
|
|
30
|
-
}), u(() => u(() => !!t())() ? e.children : e.fallback);
|
|
31
|
-
}, g = (n) => l(a, { get children() {
|
|
32
|
-
return l(t, {
|
|
33
|
-
get configuration() {
|
|
34
|
-
return n.configuration;
|
|
35
|
-
},
|
|
36
|
-
get children() {
|
|
37
|
-
return l(h, {
|
|
38
|
-
get fallback() {
|
|
39
|
-
return n.children;
|
|
40
|
-
},
|
|
41
|
-
get children() {
|
|
42
|
-
return l(e, {
|
|
43
|
-
get postMessage() {
|
|
44
|
-
return n.postMessage;
|
|
45
|
-
},
|
|
46
|
-
get allowedOrigins() {
|
|
47
|
-
return n.allowedOrigins;
|
|
48
|
-
},
|
|
49
|
-
get children() {
|
|
50
|
-
return l(m, {
|
|
51
|
-
get fallback() {
|
|
52
|
-
return n.children;
|
|
53
|
-
},
|
|
54
|
-
get children() {
|
|
55
|
-
return l(p, { get children() {
|
|
56
|
-
return n.children;
|
|
57
|
-
} });
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
} });
|
|
67
|
-
//#endregion
|
|
68
|
-
export { g as EditorProvider };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
|
|
2
|
-
import { createComponent as t } from "solid-js/web";
|
|
3
|
-
import { createContext as n, useContext as r } from "solid-js";
|
|
4
|
-
import { MessageKey as i } from "@intlayer/editor";
|
|
5
|
-
//#region src/editor/contexts/FocusDictionaryContext.tsx
|
|
6
|
-
var a = n(void 0), o = n(void 0), s = (n) => {
|
|
7
|
-
let [r, s] = e(i.INTLAYER_FOCUSED_CONTENT_CHANGED, null), c = (e) => {
|
|
8
|
-
s((t) => t && {
|
|
9
|
-
...t,
|
|
10
|
-
keyPath: e
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
return t(a.Provider, {
|
|
14
|
-
get value() {
|
|
15
|
-
return { focusedContent: r() };
|
|
16
|
-
},
|
|
17
|
-
get children() {
|
|
18
|
-
return t(o.Provider, {
|
|
19
|
-
value: {
|
|
20
|
-
setFocusedContent: s,
|
|
21
|
-
setFocusedContentKeyPath: c
|
|
22
|
-
},
|
|
23
|
-
get children() {
|
|
24
|
-
return n.children;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}, c = () => {
|
|
30
|
-
let e = r(o);
|
|
31
|
-
if (e === void 0) throw Error("useFocusDictionaryActions must be used within a FocusDictionaryProvider");
|
|
32
|
-
return e;
|
|
33
|
-
}, l = () => {
|
|
34
|
-
let e = c(), t = r(a);
|
|
35
|
-
if (t === void 0) throw Error("useFocusDictionaryState must be used within a FocusDictionaryProvider");
|
|
36
|
-
return {
|
|
37
|
-
...t,
|
|
38
|
-
...e
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { s as FocusDictionaryProvider, l as useFocusDictionary, c as useFocusDictionaryActions };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
|
|
2
|
-
import { useCrossFrameState as t } from "./useCrossFrameState.mjs";
|
|
3
|
-
import { ConfigurationProvider as n, useConfiguration as r, useConfigurationState as i } from "./ConfigurationContext.mjs";
|
|
4
|
-
import { DictionariesRecordProvider as a, useDictionariesRecord as o, useDictionariesRecordActions as s } from "./DictionariesRecordContext.mjs";
|
|
5
|
-
import { EditedContentProvider as c, useEditedContent as l, useEditedContentActions as u, useGetEditedContentState as d, usePostEditedContentState as f } from "./EditedContentContext.mjs";
|
|
6
|
-
import { EditorEnabledProvider as p, useEditorEnabled as m, useEditorEnabledState as h, useGetEditorEnabledState as g, usePostEditorEnabledState as _ } from "./EditorEnabledContext.mjs";
|
|
7
|
-
import { FocusDictionaryProvider as v, useFocusDictionary as y, useFocusDictionaryActions as b } from "./FocusDictionaryContext.mjs";
|
|
8
|
-
import { EditorProvider as x } from "./EditorProvider.mjs";
|
|
9
|
-
import { useCrossURLPathSetter as S, useCrossURLPathState as C } from "./useCrossURLPathState.mjs";
|
|
10
|
-
import { useIframeClickInterceptor as w, useIframeClickMerger as T } from "./useIframeClickInterceptor.mjs";
|
|
11
|
-
export * from "@intlayer/editor";
|
|
12
|
-
export { n as ConfigurationProvider, a as DictionariesRecordProvider, c as EditedContentProvider, p as EditorEnabledProvider, x as EditorProvider, v as FocusDictionaryProvider, r as useConfiguration, i as useConfigurationState, e as useCrossFrameMessageListener, t as useCrossFrameState, S as useCrossURLPathSetter, C as useCrossURLPathState, o as useDictionariesRecord, s as useDictionariesRecordActions, l as useEditedContent, u as useEditedContentActions, m as useEditorEnabled, h as useEditorEnabledState, y as useFocusDictionary, b as useFocusDictionaryActions, d as useGetEditedContentState, g as useGetEditorEnabledState, w as useIframeClickInterceptor, T as useIframeClickMerger, f as usePostEditedContentState, _ as usePostEditorEnabledState };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useCommunicator as e } from "./CommunicatorContext.mjs";
|
|
2
|
-
import { onCleanup as t, onMount as n } from "solid-js";
|
|
3
|
-
import { compareUrls as r } from "@intlayer/editor";
|
|
4
|
-
//#region src/editor/contexts/useCrossFrameMessageListener.tsx
|
|
5
|
-
var i = (i, a) => {
|
|
6
|
-
let o = e();
|
|
7
|
-
if (!o) throw Error("useCrossFrameMessageListener must be used within a CommunicatorProvider");
|
|
8
|
-
let { allowedOrigins: s, postMessage: c, senderId: l } = o;
|
|
9
|
-
return n(() => {
|
|
10
|
-
if (a) {
|
|
11
|
-
let e = (e) => {
|
|
12
|
-
let { type: t, data: n, senderId: o } = e.data;
|
|
13
|
-
t === i && o !== l && (s === void 0 || s?.filter((e) => ![
|
|
14
|
-
null,
|
|
15
|
-
void 0,
|
|
16
|
-
"",
|
|
17
|
-
"*"
|
|
18
|
-
].includes(e)).some((t) => r(t, e.origin)) || s?.includes("*")) && a(n);
|
|
19
|
-
};
|
|
20
|
-
window.addEventListener("message", e), t(() => window.removeEventListener("message", e));
|
|
21
|
-
}
|
|
22
|
-
}), (e) => {
|
|
23
|
-
c({
|
|
24
|
-
type: i,
|
|
25
|
-
data: e,
|
|
26
|
-
senderId: l
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
//#endregion
|
|
31
|
-
export { i as useCrossFrameMessageListener };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useCommunicator as e } from "./CommunicatorContext.mjs";
|
|
2
|
-
import { useCrossFrameMessageListener as t } from "./useCrossFrameMessageListener.mjs";
|
|
3
|
-
import { createEffect as n, createSignal as r } from "solid-js";
|
|
4
|
-
//#region src/editor/contexts/useCrossFrameState.tsx
|
|
5
|
-
var i = (i, a, o) => {
|
|
6
|
-
let { postMessage: s, senderId: c } = e() ?? {}, { emit: l, receive: u } = o ?? {
|
|
7
|
-
emit: !0,
|
|
8
|
-
receive: !0
|
|
9
|
-
}, [d, f] = r(typeof a == "function" ? a() : a);
|
|
10
|
-
return t(`${i}/post`, u ? (e) => {
|
|
11
|
-
f(() => e);
|
|
12
|
-
} : void 0), t(`${i}/get`, l ? (e, t) => {
|
|
13
|
-
l && typeof s == "function" && t !== c && d() !== void 0 && s({
|
|
14
|
-
type: `${i}/post`,
|
|
15
|
-
data: d(),
|
|
16
|
-
senderId: c
|
|
17
|
-
});
|
|
18
|
-
} : void 0), n(() => {
|
|
19
|
-
u && typeof s == "function" && d() === void 0 && s({
|
|
20
|
-
type: `${i}/get`,
|
|
21
|
-
senderId: c
|
|
22
|
-
});
|
|
23
|
-
}), [
|
|
24
|
-
d,
|
|
25
|
-
(e) => {
|
|
26
|
-
f((t) => {
|
|
27
|
-
let n = typeof e == "function" ? e(t) : e;
|
|
28
|
-
return l && typeof s == "function" && n !== void 0 && s({
|
|
29
|
-
type: `${i}/post`,
|
|
30
|
-
data: n,
|
|
31
|
-
senderId: c
|
|
32
|
-
}), n;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
() => {
|
|
36
|
-
typeof s == "function" && s({
|
|
37
|
-
type: `${i}/post`,
|
|
38
|
-
data: d(),
|
|
39
|
-
senderId: c
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { i as useCrossFrameState };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameState as e } from "./useCrossFrameState.mjs";
|
|
2
|
-
import { onCleanup as t, onMount as n } from "solid-js";
|
|
3
|
-
import { MessageKey as r } from "@intlayer/editor";
|
|
4
|
-
//#region src/editor/contexts/useCrossURLPathState.tsx
|
|
5
|
-
var i = (t, n) => e(r.INTLAYER_URL_CHANGE, t, n), a = (e) => {
|
|
6
|
-
let r = i(e, {
|
|
7
|
-
emit: !0,
|
|
8
|
-
receive: !1
|
|
9
|
-
}), [a, o] = r;
|
|
10
|
-
return n(() => {
|
|
11
|
-
let e = history.pushState, n = history.replaceState, r = (e) => function(...t) {
|
|
12
|
-
e.apply(this, t), window.dispatchEvent(new Event("locationchange"));
|
|
13
|
-
};
|
|
14
|
-
history.pushState = r(e), history.replaceState = r(n);
|
|
15
|
-
let i = () => {
|
|
16
|
-
o(window.location.pathname);
|
|
17
|
-
};
|
|
18
|
-
window.addEventListener("locationchange", i), window.addEventListener("popstate", i), window.addEventListener("hashchange", i), window.addEventListener("load", i), i(), t(() => {
|
|
19
|
-
window.removeEventListener("locationchange", i), window.removeEventListener("popstate", i), window.removeEventListener("hashchange", i), window.removeEventListener("load", i), history.pushState = e, history.replaceState = n;
|
|
20
|
-
});
|
|
21
|
-
}), r;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { a as useCrossURLPathSetter, i as useCrossURLPathState };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
|
|
2
|
-
import { onCleanup as t, onMount as n } from "solid-js";
|
|
3
|
-
import { MessageKey as r, mergeIframeClick as i } from "@intlayer/editor";
|
|
4
|
-
//#region src/editor/contexts/useIframeClickInterceptor.tsx
|
|
5
|
-
var a = () => {
|
|
6
|
-
let i = e(r.INTLAYER_IFRAME_CLICKED);
|
|
7
|
-
n(() => {
|
|
8
|
-
let e = (e) => {
|
|
9
|
-
i();
|
|
10
|
-
};
|
|
11
|
-
document.addEventListener("mousedown", e), t(() => {
|
|
12
|
-
document.removeEventListener("mousedown", e);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}, o = () => e(r.INTLAYER_IFRAME_CLICKED, i);
|
|
16
|
-
//#endregion
|
|
17
|
-
export { a as useIframeClickInterceptor, o as useIframeClickMerger };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useEditedContentActions as e } from "./contexts/EditedContentContext.mjs";
|
|
2
|
-
import { getContent as t } from "@intlayer/core/interpreter";
|
|
3
|
-
//#region src/editor/useEditedContentRenderer.tsx
|
|
4
|
-
var n = ({ dictionaryKey: t, keyPath: n, children: r }) => {
|
|
5
|
-
let i = e();
|
|
6
|
-
return i ? i.getEditedContentValue(t, n) ?? r : r;
|
|
7
|
-
}, r = (e) => {
|
|
8
|
-
let r = n(e);
|
|
9
|
-
if (typeof r == "object") {
|
|
10
|
-
let n = t(r, e, e.locale);
|
|
11
|
-
return typeof n == "string" ? n : (console.error(`Incorrect edited content format. Content type: ${typeof n}. Expected string. Value ${JSON.stringify(n)}`), e.children);
|
|
12
|
-
}
|
|
13
|
-
return r;
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { r as EditedContentRenderer, n as useEditedContentRenderer };
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { renderIntlayerNode as e } from "./esm/IntlayerNode.mjs";
|
|
2
|
-
import { useEditorEnabled as t } from "./esm/editor/contexts/EditorEnabledContext.mjs";
|
|
3
|
-
import { useFocusDictionary as n } from "./esm/editor/contexts/FocusDictionaryContext.mjs";
|
|
4
|
-
import { IntlayerClientContext as r, useIntlayerContext as i } from "./esm/client/IntlayerProvider.mjs";
|
|
5
|
-
import { useLoadDynamic as a } from "./esm/client/useLoadDynamic.mjs";
|
|
6
|
-
import { ContentSelector as o } from "./esm/UI/ContentSelector.mjs";
|
|
7
|
-
import { EditedContentRenderer as s } from "./esm/editor/useEditedContentRenderer.mjs";
|
|
8
|
-
import { MarkdownMetadataRenderer as c, MarkdownRenderer as l } from "./esm/markdown/MarkdownRenderer.mjs";
|
|
9
|
-
import { renderSolidElement as u } from "./esm/solidElement/renderSolidElement.mjs";
|
|
10
|
-
import { conditionPlugin as d, enumerationPlugin as f, filePlugin as p, genderPlugin as m, getDictionary as h, getHTML as g, getIntlayer as _, nestedPlugin as v, splitInsertionTemplate as y, translationPlugin as b } from "@intlayer/core/interpreter";
|
|
11
|
-
import { Dynamic as x, createComponent as S, mergeProps as C } from "solid-js/web";
|
|
12
|
-
import w from "@intlayer/config/built";
|
|
13
|
-
import { getMarkdownMetadata as T } from "@intlayer/core/markdown";
|
|
14
|
-
import { HTML_TAGS as E } from "@intlayer/core/transpiler";
|
|
15
|
-
import { NodeType as D } from "@intlayer/types/nodeType";
|
|
16
|
-
import { isSameKeyPath as O } from "@intlayer/core/utils";
|
|
17
|
-
import { createMemo as k, useContext as A } from "solid-js";
|
|
18
|
-
//#region src/client/useDictionary.ts
|
|
19
|
-
var j = (e, t) => {
|
|
20
|
-
let n = A(r);
|
|
21
|
-
return k(() => q(e, t ?? n?.locale?.()));
|
|
22
|
-
}, M = async (e, t) => {
|
|
23
|
-
let { locale: n } = A(r), i = w?.internationalization.defaultLocale, a = t ?? n() ?? i;
|
|
24
|
-
return j(await e[a]?.(), a);
|
|
25
|
-
}, N = (e, t, n) => {
|
|
26
|
-
let { locale: i } = A(r) ?? {}, o = w?.internationalization.defaultLocale, s = n ?? i?.() ?? o;
|
|
27
|
-
return j(a(`${String(t)}.${s}`, e[s]?.()), s);
|
|
28
|
-
}, P = (e, t) => _(e, t, K(t)), F = (e, t) => {
|
|
29
|
-
let n = A(r);
|
|
30
|
-
return k(() => {
|
|
31
|
-
let r = n?.locale();
|
|
32
|
-
return P(e, t ?? r);
|
|
33
|
-
});
|
|
34
|
-
}, I = (e) => {
|
|
35
|
-
let { focusedContent: t, setFocusedContent: r } = n(), i = k(() => e.keyPath.filter((e) => e.type !== D.Translation)), a = () => r({
|
|
36
|
-
dictionaryKey: e.dictionaryKey,
|
|
37
|
-
keyPath: i()
|
|
38
|
-
}), s = k(() => (t?.dictionaryKey === e.dictionaryKey && (t?.keyPath?.length ?? 0) > 0 && O(t?.keyPath ?? [], i())) ?? !1);
|
|
39
|
-
return S(o, {
|
|
40
|
-
onPress: a,
|
|
41
|
-
get isSelecting() {
|
|
42
|
-
return s();
|
|
43
|
-
},
|
|
44
|
-
get children() {
|
|
45
|
-
return e.children;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}, L = (e) => {
|
|
49
|
-
let { enabled: n } = t(), { disableEditor: r } = i();
|
|
50
|
-
return n() && !r ? S(I, C(e, { get children() {
|
|
51
|
-
return e.children;
|
|
52
|
-
} })) : e.children;
|
|
53
|
-
}, R = {
|
|
54
|
-
id: "intlayer-node-plugin",
|
|
55
|
-
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
56
|
-
transform: (t, { plugins: n, ...r }) => e({
|
|
57
|
-
...r,
|
|
58
|
-
value: r.children,
|
|
59
|
-
children: w?.editor.enabled ? S(L, C(r, { get children() {
|
|
60
|
-
return S(s, C(r, { get children() {
|
|
61
|
-
return r.children;
|
|
62
|
-
} }));
|
|
63
|
-
} })) : r.children
|
|
64
|
-
})
|
|
65
|
-
}, z = {
|
|
66
|
-
id: "solid-node-plugin",
|
|
67
|
-
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
68
|
-
transform: (t, { plugins: n, ...r }) => e({
|
|
69
|
-
...r,
|
|
70
|
-
value: "[[solid-element]]",
|
|
71
|
-
children: w?.editor.enabled ? S(L, C(r, { get children() {
|
|
72
|
-
return typeof Node < "u" && t instanceof Node ? t : u(t);
|
|
73
|
-
} })) : typeof Node < "u" && t instanceof Node ? t : u(t)
|
|
74
|
-
})
|
|
75
|
-
}, B = (e, t) => {
|
|
76
|
-
let n = y(e, t);
|
|
77
|
-
return n.isSimple, n.parts;
|
|
78
|
-
}, V = {
|
|
79
|
-
id: "insertion-plugin",
|
|
80
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === D.Insertion,
|
|
81
|
-
transform: (e, t, n) => {
|
|
82
|
-
let r = [...t.keyPath, { type: D.Insertion }], i = e[D.Insertion];
|
|
83
|
-
return (e) => {
|
|
84
|
-
let a = {
|
|
85
|
-
id: "insertion-string-plugin",
|
|
86
|
-
canHandle: (e) => typeof e == "string",
|
|
87
|
-
transform: (n, r, i) => {
|
|
88
|
-
let a = B(i(n, {
|
|
89
|
-
...r,
|
|
90
|
-
children: n,
|
|
91
|
-
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
92
|
-
}), e);
|
|
93
|
-
return i(a, {
|
|
94
|
-
...r,
|
|
95
|
-
plugins: t.plugins,
|
|
96
|
-
children: a
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return n(i, {
|
|
101
|
-
...t,
|
|
102
|
-
children: i,
|
|
103
|
-
keyPath: r,
|
|
104
|
-
plugins: [a, ...t.plugins ?? []]
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}, H = {
|
|
109
|
-
id: "markdown-string-plugin",
|
|
110
|
-
canHandle: (e) => typeof e == "string",
|
|
111
|
-
transform: (t, n, r) => {
|
|
112
|
-
let { plugins: i, ...a } = n, o = r(T(t), {
|
|
113
|
-
plugins: [{
|
|
114
|
-
id: "markdown-metadata-plugin",
|
|
115
|
-
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
116
|
-
transform: (n, r) => e({
|
|
117
|
-
...r,
|
|
118
|
-
value: n,
|
|
119
|
-
children: S(L, C(a, { get children() {
|
|
120
|
-
return S(c, C(a, {
|
|
121
|
-
get metadataKeyPath() {
|
|
122
|
-
return r.keyPath;
|
|
123
|
-
},
|
|
124
|
-
children: t
|
|
125
|
-
}));
|
|
126
|
-
} }))
|
|
127
|
-
})
|
|
128
|
-
}],
|
|
129
|
-
dictionaryKey: a.dictionaryKey,
|
|
130
|
-
keyPath: []
|
|
131
|
-
}), s = (r) => e({
|
|
132
|
-
...n,
|
|
133
|
-
value: t,
|
|
134
|
-
children: S(L, C(a, { get children() {
|
|
135
|
-
return S(l, C(a, {
|
|
136
|
-
components: r,
|
|
137
|
-
children: t
|
|
138
|
-
}));
|
|
139
|
-
} })),
|
|
140
|
-
additionalProps: { metadata: o }
|
|
141
|
-
}), u = s();
|
|
142
|
-
return new Proxy(u, { get(e, n, r) {
|
|
143
|
-
return n === "value" ? t : n === "metadata" ? o : n === "use" ? (e) => s(e) : Reflect.get(e, n, r);
|
|
144
|
-
} });
|
|
145
|
-
}
|
|
146
|
-
}, U = {
|
|
147
|
-
id: "markdown-plugin",
|
|
148
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === D.Markdown,
|
|
149
|
-
transform: (e, t, n) => {
|
|
150
|
-
let r = [...t.keyPath, { type: D.Markdown }], i = e[D.Markdown];
|
|
151
|
-
return n(i, {
|
|
152
|
-
...t,
|
|
153
|
-
children: i,
|
|
154
|
-
keyPath: r,
|
|
155
|
-
plugins: [H, ...t.plugins ?? []]
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}, W = (() => {
|
|
159
|
-
let e = {};
|
|
160
|
-
for (let t of E) e[t] = ({ children: e, ...n }) => S(x, C({ component: t }, n, { children: e }));
|
|
161
|
-
return e;
|
|
162
|
-
})(), G = {
|
|
163
|
-
id: "html-plugin",
|
|
164
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === D.HTML,
|
|
165
|
-
transform: (e) => {
|
|
166
|
-
let t = e[D.HTML], n = (e) => g(t, {
|
|
167
|
-
...W,
|
|
168
|
-
...e
|
|
169
|
-
}), r = [n()];
|
|
170
|
-
return new Proxy(r, { get(e, r, i) {
|
|
171
|
-
return r === "value" ? t : r === "use" ? (e) => n(e) : Reflect.get(e, r, i);
|
|
172
|
-
} });
|
|
173
|
-
}
|
|
174
|
-
}, K = (e, t = !0) => [
|
|
175
|
-
b(e ?? w.internationalization.defaultLocale, t ? w.internationalization.defaultLocale : void 0),
|
|
176
|
-
f,
|
|
177
|
-
d,
|
|
178
|
-
v(e ?? w.internationalization.defaultLocale),
|
|
179
|
-
p,
|
|
180
|
-
m,
|
|
181
|
-
R,
|
|
182
|
-
z,
|
|
183
|
-
V,
|
|
184
|
-
U,
|
|
185
|
-
G
|
|
186
|
-
], q = (e, t) => h(e, t, K(t));
|
|
187
|
-
//#endregion
|
|
188
|
-
export { R as a, z as c, P as d, N as f, V as i, L as l, j as m, K as n, U as o, M as p, G as r, H as s, q as t, F as u };
|