solid-intlayer 8.3.4 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/useDictionaryDynamic.d.ts +1 -1
- package/dist/types/editor/{ContentSelectorWrapper.d.ts → ContentSelector.d.ts} +4 -4
- package/dist/types/editor/EditorProvider.d.ts +2 -0
- package/dist/types/editor/useEditor.d.ts +6 -0
- package/package.json +7 -7
- 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 -11
- package/dist/esm/editor/contexts/CommunicatorContext.mjs +0 -11
- package/dist/esm/editor/contexts/ConfigurationContext.mjs +0 -9
- package/dist/esm/editor/contexts/DictionariesRecordContext.mjs +0 -19
- package/dist/esm/editor/contexts/EditedContentContext.mjs +0 -30
- package/dist/esm/editor/contexts/EditorEnabledContext.mjs +0 -20
- package/dist/esm/editor/contexts/EditorProvider.mjs +0 -38
- package/dist/esm/editor/contexts/FocusDictionaryContext.mjs +0 -19
- package/dist/esm/editor/contexts/index.mjs +0 -13
- package/dist/esm/editor/contexts/useCrossFrameMessageListener.mjs +0 -9
- package/dist/esm/editor/contexts/useCrossFrameState.mjs +0 -25
- package/dist/esm/editor/contexts/useCrossURLPathState.mjs +0 -4
- package/dist/esm/editor/contexts/useIframeClickInterceptor.mjs +0 -10
- package/dist/esm/editor/index.mjs +0 -2
- package/dist/esm/editor/useEditedContentRenderer.mjs +0 -19
- package/dist/getDictionary-DdbGMGJZ.mjs +0 -197
- package/dist/getDictionary-PBgZNa_l.js +0 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts +0 -2
- package/dist/types/editor/contexts/CommunicatorContext.d.ts +0 -8
- package/dist/types/editor/contexts/ConfigurationContext.d.ts +0 -2
- package/dist/types/editor/contexts/DictionariesRecordContext.d.ts +0 -12
- package/dist/types/editor/contexts/EditedContentContext.d.ts +0 -30
- package/dist/types/editor/contexts/EditorEnabledContext.d.ts +0 -6
- package/dist/types/editor/contexts/EditorProvider.d.ts +0 -15
- package/dist/types/editor/contexts/FocusDictionaryContext.d.ts +0 -12
- package/dist/types/editor/contexts/index.d.ts +0 -12
- package/dist/types/editor/contexts/useCrossFrameMessageListener.d.ts +0 -2
- package/dist/types/editor/contexts/useCrossFrameState.d.ts +0 -7
- package/dist/types/editor/contexts/useCrossURLPathState.d.ts +0 -2
- package/dist/types/editor/contexts/useIframeClickInterceptor.d.ts +0 -2
- package/dist/types/editor/index.d.ts +0 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +0 -12
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { createMemo as c } from "solid-js";
|
|
7
|
-
var l = (() => {
|
|
1
|
+
import { useHTMLContext as e } from "./HTMLProvider.mjs";
|
|
2
|
+
import { getHTML as t } from "@intlayer/core/interpreter";
|
|
3
|
+
import { Dynamic as n, createComponent as r, mergeProps as i } from "solid-js/web";
|
|
4
|
+
import { HTML_TAGS as a } from "@intlayer/core/transpiler";
|
|
5
|
+
var o = (() => {
|
|
8
6
|
let e = {};
|
|
9
|
-
for (let t of
|
|
7
|
+
for (let t of a) e[t] = ({ children: e, ...a }) => r(n, i({ component: t }, a, { children: e }));
|
|
10
8
|
return e;
|
|
11
|
-
})(),
|
|
12
|
-
...
|
|
13
|
-
...
|
|
14
|
-
}),
|
|
15
|
-
let n =
|
|
16
|
-
return (
|
|
9
|
+
})(), s = (e, { components: n } = {}) => t(e, {
|
|
10
|
+
...o,
|
|
11
|
+
...n
|
|
12
|
+
}), c = ({ components: t } = {}) => {
|
|
13
|
+
let n = e();
|
|
14
|
+
return (e) => s(e, { components: {
|
|
17
15
|
...n?.components,
|
|
18
|
-
...
|
|
16
|
+
...t
|
|
19
17
|
} });
|
|
20
|
-
},
|
|
21
|
-
let n = d({ components: t.components || t.userComponents }), r = () => t.children || t.html || "", i = c(() => e({
|
|
22
|
-
dictionaryKey: t.dictionaryKey,
|
|
23
|
-
keyPath: t.keyPath,
|
|
24
|
-
children: r()
|
|
25
|
-
})), o = () => t.dictionaryKey && t.keyPath && typeof i() == "string" ? i() : r();
|
|
26
|
-
return a(() => n(o()));
|
|
27
|
-
};
|
|
18
|
+
}, l = (e) => c({ components: e.components || e.userComponents })(e.children || e.html || "");
|
|
28
19
|
//#endregion
|
|
29
|
-
export {
|
|
20
|
+
export { l as HTMLRenderer, o as defaultHTMLComponents, s as renderHTML, c as useHTMLRenderer };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { d as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { useRewriteURL as S } from "./client/useRewriteURL.mjs";
|
|
11
|
-
import { compileMarkdown as C } from "./markdown/compiler.mjs";
|
|
12
|
-
import { MarkdownProvider as w, useMarkdown as T } from "./markdown/MarkdownProvider.mjs";
|
|
13
|
-
import { MarkdownRenderer as E } from "./markdown/MarkdownRenderer.mjs";
|
|
1
|
+
import { compileMarkdown as e } from "./markdown/compiler.mjs";
|
|
2
|
+
import { MarkdownProvider as t, useMarkdown as n } from "./markdown/MarkdownProvider.mjs";
|
|
3
|
+
import { MarkdownRenderer as r } from "./markdown/MarkdownRenderer.mjs";
|
|
4
|
+
import { getDictionary as i } from "./getDictionary.mjs";
|
|
5
|
+
import { getIntlayer as a } from "./getIntlayer.mjs";
|
|
6
|
+
import { a as o, c as s, d as c, f as l, i as u, l as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v } from "../client-BOid_svT.mjs";
|
|
7
|
+
import { localeCookie as y, localeInStorage as b, setLocaleCookie as x, setLocaleInStorage as S, useLocaleCookie as C, useLocaleStorage as w } from "./client/useLocaleStorage.mjs";
|
|
8
|
+
import { getBrowserLocale as T } from "./client/getBrowserLocale.mjs";
|
|
9
|
+
import { useLoadDynamic as E } from "./client/useLoadDynamic.mjs";
|
|
14
10
|
import { HTMLProvider as D } from "./html/HTMLProvider.mjs";
|
|
15
11
|
import { HTMLRenderer as O, renderHTML as k, useHTMLRenderer as A } from "./html/HTMLRenderer.mjs";
|
|
16
12
|
import "./html/index.mjs";
|
|
17
|
-
export { D as HTMLProvider, O as HTMLRenderer,
|
|
13
|
+
export { D as HTMLProvider, O as HTMLRenderer, v as IntlayerClientContext, c as IntlayerProvider, l as IntlayerProviderContent, t as MarkdownProvider, r as MarkdownRenderer, e as compileMarkdown, T as getBrowserLocale, i as getDictionary, a as getIntlayer, y as localeCookie, b as localeInStorage, k as renderHTML, x as setLocaleCookie, S as setLocaleInStorage, s as t, g as useDictionary, p as useDictionaryAsync, o as useDictionaryDynamic, A as useHTMLRenderer, d as useIntl, u as useIntlayer, m as useIntlayerContext, E as useLoadDynamic, h as useLocale, f as useLocaleBase, C as useLocaleCookie, w as useLocaleStorage, n as useMarkdown, _ as useRewriteURL };
|
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { getContentNodeByKeyPath as s } from "@intlayer/core/dictionaryManipulator";
|
|
1
|
+
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
|
+
import { MarkdownContext as t, useMarkdown as n } from "./MarkdownProvider.mjs";
|
|
3
|
+
import { getMarkdownMetadata as r } from "@intlayer/core/markdown";
|
|
4
|
+
import { createMemo as i, useContext as a } from "solid-js";
|
|
5
|
+
import { getContentNodeByKeyPath as o } from "@intlayer/core/dictionaryManipulator";
|
|
7
6
|
//#region src/markdown/MarkdownRenderer.tsx
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
return (
|
|
7
|
+
var s = (t, n = {}) => e(t, n), c = (e = {}) => {
|
|
8
|
+
let n = a(t);
|
|
9
|
+
return (t) => n ? n.renderMarkdown(t, {
|
|
10
|
+
forceBlock: e.forceBlock,
|
|
11
|
+
preserveFrontmatter: e.preserveFrontmatter,
|
|
12
|
+
tagfilter: e.tagfilter
|
|
13
|
+
}, e.components, e.wrapper) : s(t, e);
|
|
14
|
+
}, l = (e) => {
|
|
15
|
+
let r = a(t), { renderMarkdown: i } = n();
|
|
16
|
+
return i(e.children, {
|
|
11
17
|
forceBlock: e.forceBlock,
|
|
12
18
|
preserveFrontmatter: e.preserveFrontmatter,
|
|
13
19
|
tagfilter: e.tagfilter
|
|
14
|
-
}, e.components, e.wrapper) : c(n, e);
|
|
15
|
-
}, u = (t) => {
|
|
16
|
-
let i = o(n), { renderMarkdown: s } = r(), c = a(() => e({
|
|
17
|
-
dictionaryKey: t.dictionaryKey,
|
|
18
|
-
keyPath: t.keyPath,
|
|
19
|
-
children: t.children
|
|
20
|
-
}));
|
|
21
|
-
return s(typeof c() == "string" ? c() : t.children, {
|
|
22
|
-
forceBlock: t.forceBlock,
|
|
23
|
-
preserveFrontmatter: t.preserveFrontmatter,
|
|
24
|
-
tagfilter: t.tagfilter
|
|
25
20
|
}, {
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
keyPath: t.keyPath,
|
|
33
|
-
children: t.children
|
|
34
|
-
})), r = a(() => i(n()));
|
|
35
|
-
return a(() => s(r(), t.metadataKeyPath))();
|
|
21
|
+
...r?.components ?? {},
|
|
22
|
+
...e.components ?? {}
|
|
23
|
+
}, e.wrapper);
|
|
24
|
+
}, u = (e) => {
|
|
25
|
+
let t = i(() => r(e.children));
|
|
26
|
+
return i(() => o(t(), e.metadataKeyPath))();
|
|
36
27
|
};
|
|
37
28
|
//#endregion
|
|
38
|
-
export {
|
|
29
|
+
export { u as MarkdownMetadataRenderer, l as MarkdownRenderer, s as renderMarkdown, c as useMarkdownRenderer };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,2 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { renderIntlayerNode as e } from "./IntlayerNode.mjs";
|
|
2
|
+
import { ContentSelector as t } from "./editor/ContentSelector.mjs";
|
|
3
|
+
import { MarkdownMetadataRenderer as n, MarkdownRenderer as r } from "./markdown/MarkdownRenderer.mjs";
|
|
4
|
+
import { renderSolidElement as i } from "./solidElement/renderSolidElement.mjs";
|
|
5
|
+
import { conditionPlugin as a, enumerationPlugin as o, filePlugin as s, genderPlugin as c, getHTML as l, nestedPlugin as u, splitInsertionTemplate as d, translationPlugin as f } from "@intlayer/core/interpreter";
|
|
6
|
+
import { Dynamic as p, createComponent as m, mergeProps as h } from "solid-js/web";
|
|
7
|
+
import g from "@intlayer/config/built";
|
|
8
|
+
import { getMarkdownMetadata as _ } from "@intlayer/core/markdown";
|
|
9
|
+
import { HTML_TAGS as v } from "@intlayer/core/transpiler";
|
|
10
|
+
import { NodeType as y } from "@intlayer/types/nodeType";
|
|
11
|
+
//#region src/plugins.tsx
|
|
12
|
+
var b = {
|
|
13
|
+
id: "intlayer-node-plugin",
|
|
14
|
+
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
15
|
+
transform: (n, { plugins: r, ...i }) => e({
|
|
16
|
+
...i,
|
|
17
|
+
value: i.children,
|
|
18
|
+
children: g?.editor.enabled ? m(t, h(i, { get children() {
|
|
19
|
+
return i.children;
|
|
20
|
+
} })) : i.children
|
|
21
|
+
})
|
|
22
|
+
}, x = {
|
|
23
|
+
id: "solid-node-plugin",
|
|
24
|
+
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
25
|
+
transform: (n, { plugins: r, ...a }) => e({
|
|
26
|
+
...a,
|
|
27
|
+
value: "[[solid-element]]",
|
|
28
|
+
children: g?.editor.enabled ? m(t, h(a, { get children() {
|
|
29
|
+
return typeof Node < "u" && n instanceof Node ? n : i(n);
|
|
30
|
+
} })) : typeof Node < "u" && n instanceof Node ? n : i(n)
|
|
31
|
+
})
|
|
32
|
+
}, S = (e, t) => {
|
|
33
|
+
let n = d(e, t);
|
|
34
|
+
return n.isSimple, n.parts;
|
|
35
|
+
}, C = {
|
|
36
|
+
id: "insertion-plugin",
|
|
37
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === y.Insertion,
|
|
38
|
+
transform: (e, t, n) => {
|
|
39
|
+
let r = [...t.keyPath, { type: y.Insertion }], i = e[y.Insertion];
|
|
40
|
+
return (e) => {
|
|
41
|
+
let a = {
|
|
42
|
+
id: "insertion-string-plugin",
|
|
43
|
+
canHandle: (e) => typeof e == "string",
|
|
44
|
+
transform: (n, r, i) => {
|
|
45
|
+
let a = S(i(n, {
|
|
46
|
+
...r,
|
|
47
|
+
children: n,
|
|
48
|
+
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
49
|
+
}), e);
|
|
50
|
+
return i(a, {
|
|
51
|
+
...r,
|
|
52
|
+
plugins: t.plugins,
|
|
53
|
+
children: a
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return n(i, {
|
|
58
|
+
...t,
|
|
59
|
+
children: i,
|
|
60
|
+
keyPath: r,
|
|
61
|
+
plugins: [a, ...t.plugins ?? []]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, w = {
|
|
66
|
+
id: "markdown-string-plugin",
|
|
67
|
+
canHandle: (e) => typeof e == "string",
|
|
68
|
+
transform: (i, a, o) => {
|
|
69
|
+
let { plugins: s, ...c } = a, l = o(_(i), {
|
|
70
|
+
plugins: [{
|
|
71
|
+
id: "markdown-metadata-plugin",
|
|
72
|
+
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
73
|
+
transform: (r, a) => e({
|
|
74
|
+
...a,
|
|
75
|
+
value: r,
|
|
76
|
+
children: m(t, h(c, { get children() {
|
|
77
|
+
return m(n, h(c, {
|
|
78
|
+
get metadataKeyPath() {
|
|
79
|
+
return a.keyPath;
|
|
80
|
+
},
|
|
81
|
+
children: i
|
|
82
|
+
}));
|
|
83
|
+
} }))
|
|
84
|
+
})
|
|
85
|
+
}],
|
|
86
|
+
dictionaryKey: c.dictionaryKey,
|
|
87
|
+
keyPath: []
|
|
88
|
+
}), u = (n) => e({
|
|
89
|
+
...a,
|
|
90
|
+
value: i,
|
|
91
|
+
children: m(t, h(c, { get children() {
|
|
92
|
+
return m(r, h(c, {
|
|
93
|
+
components: n,
|
|
94
|
+
children: i
|
|
95
|
+
}));
|
|
96
|
+
} })),
|
|
97
|
+
additionalProps: { metadata: l }
|
|
98
|
+
}), d = u();
|
|
99
|
+
return new Proxy(d, { get(e, t, n) {
|
|
100
|
+
return t === "value" ? i : t === "metadata" ? l : t === "use" ? (e) => u(e) : Reflect.get(e, t, n);
|
|
101
|
+
} });
|
|
102
|
+
}
|
|
103
|
+
}, T = {
|
|
104
|
+
id: "markdown-plugin",
|
|
105
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === y.Markdown,
|
|
106
|
+
transform: (e, t, n) => {
|
|
107
|
+
let r = [...t.keyPath, { type: y.Markdown }], i = e[y.Markdown];
|
|
108
|
+
return n(i, {
|
|
109
|
+
...t,
|
|
110
|
+
children: i,
|
|
111
|
+
keyPath: r,
|
|
112
|
+
plugins: [w, ...t.plugins ?? []]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, E = (() => {
|
|
116
|
+
let e = {};
|
|
117
|
+
for (let t of v) e[t] = ({ children: e, ...n }) => m(p, h({ component: t }, n, { children: e }));
|
|
118
|
+
return e;
|
|
119
|
+
})(), D = {
|
|
120
|
+
id: "html-plugin",
|
|
121
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === y.HTML,
|
|
122
|
+
transform: (e) => {
|
|
123
|
+
let t = e[y.HTML], n = (e) => l(t, {
|
|
124
|
+
...E,
|
|
125
|
+
...e
|
|
126
|
+
}), r = [n()];
|
|
127
|
+
return new Proxy(r, { get(e, r, i) {
|
|
128
|
+
return r === "value" ? t : r === "use" ? (e) => n(e) : Reflect.get(e, r, i);
|
|
129
|
+
} });
|
|
130
|
+
}
|
|
131
|
+
}, O = (e, t = !0) => [
|
|
132
|
+
f(e ?? g.internationalization.defaultLocale, t ? g.internationalization.defaultLocale : void 0),
|
|
133
|
+
o,
|
|
134
|
+
a,
|
|
135
|
+
u(e ?? g.internationalization.defaultLocale),
|
|
136
|
+
s,
|
|
137
|
+
c,
|
|
138
|
+
b,
|
|
139
|
+
x,
|
|
140
|
+
C,
|
|
141
|
+
T,
|
|
142
|
+
D
|
|
143
|
+
];
|
|
144
|
+
//#endregion
|
|
145
|
+
export { O as getPlugins, D as htmlPlugin, C as insertionPlugin, b as intlayerNodePlugins, T as markdownPlugin, w as markdownStringPlugin, x as solidNodePlugins };
|
|
@@ -5,4 +5,4 @@ import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from '@intlayer/ty
|
|
|
5
5
|
*
|
|
6
6
|
* If the locale is not provided, it will use the locale from the client context
|
|
7
7
|
*/
|
|
8
|
-
export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import('solid-js').Accessor<import('@intlayer/core/interpreter').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, (string & {}) | "af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr
|
|
8
|
+
export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => import('solid-js').Accessor<import('@intlayer/core/interpreter').DeepTransformContent<T["content"], import('../plugins').IInterpreterPluginState, (string & {}) | "is" | "id" | "tr" | "th" | "hr" | "mi" | "mn" | "ms" | "af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr-BA" | "hr-HR" | "cs" | "cs-CZ" | "da" | "da-DK" | "dv" | "dv-MV" | "nl" | "nl-BE" | "nl-NL" | "en" | "en-AU" | "en-BZ" | "en-BW" | "en-CA" | "en-CB" | "en-GH" | "en-HK" | "en-IN" | "en-IE" | "en-JM" | "en-KE" | "en-MY" | "en-NZ" | "en-NG" | "en-PK" | "en-PH" | "en-SG" | "en-ZA" | "en-TZ" | "en-TT" | "en-UG" | "en-GB" | "en-US" | "en-ZW" | "eo" | "et" | "et-EE" | "fo" | "fo-FO" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fr" | "fr-BE" | "fr-CA" | "fr-FR" | "fr-LU" | "fr-MC" | "fr-CH" | "mk" | "mk-MK" | "gl" | "gl-ES" | "ka" | "ka-GE" | "de" | "de-AT" | "de-DE" | "de-LI" | "de-LU" | "de-CH" | "el" | "el-GR" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hu" | "hu-HU" | "is-IS" | "id-ID" | "ga" | "ga-IE" | "it" | "it-IT" | "it-CH" | "ja" | "ja-JP" | "kn" | "kn-IN" | "kk" | "kk-KZ" | "km" | "km-KH" | "kok" | "kok-IN" | "ko" | "ko-KR" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lo" | "lo-LA" | "lv" | "lv-LV" | "lt" | "lt-LT" | "dsb" | "dsb-DE" | "mg-MG" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi-NZ" | "mr" | "mr-IN" | "mn-MN" | "ne" | "ne-NP" | "ns" | "ns-ZA" | "no" | "nb" | "nb-NO" | "nn" | "nn-NO" | "ps" | "ps-AR" | "pl" | "pl-PL" | "pt" | "pt-BR" | "pt-CV" | "pt-GW" | "pt-MO" | "pt-MZ" | "pt-PT" | "pt-ST" | "pt-TL" | "pa" | "pa-IN" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-MD" | "ro-RO" | "rm" | "rm-CH" | "ru" | "ru-MD" | "ru-RU" | "se" | "se-FI" | "se-NO" | "se-SE" | "sa" | "sa-IN" | "gd" | "gd-GB" | "sr-Cyrl" | "sr-BA" | "sr-RS" | "sr" | "sr-SP" | "si" | "si-LK" | "sk" | "sk-SK" | "sl" | "sl-SI" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-CU" | "es-DO" | "es-EC" | "es-SV" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PY" | "es-PE" | "es-PR" | "es-ES" | "es-US" | "es-UY" | "es-VE" | "sw" | "sw-KE" | "sv" | "sv-FI" | "sv-SE" | "syr" | "syr-SY" | "tl" | "tl-PH" | "ta" | "ta-IN" | "tt" | "tt-RU" | "te" | "te-IN" | "th-TH" | "ts" | "tn" | "tn-ZA" | "tr-TR" | "uk" | "uk-UA" | "hsb" | "hsb-DE" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "ve" | "ve-ZA" | "vi" | "vi-VN" | "cy" | "cy-GB" | "xh" | "xh-ZA" | "yi" | "yi-001" | "yo" | "yo-NG" | "zu" | "zu-ZA">>;
|
|
@@ -3,9 +3,9 @@ import { Component, JSX } from 'solid-js';
|
|
|
3
3
|
declare module 'solid-js' {
|
|
4
4
|
namespace JSX {
|
|
5
5
|
interface IntrinsicElements {
|
|
6
|
-
'intlayer-content-selector': JSX.HTMLAttributes<HTMLElement> & {
|
|
7
|
-
'
|
|
8
|
-
'
|
|
6
|
+
'intlayer-content-selector-wrapper': JSX.HTMLAttributes<HTMLElement> & {
|
|
7
|
+
'key-path'?: string;
|
|
8
|
+
'dictionary-key'?: string;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -13,4 +13,4 @@ declare module 'solid-js' {
|
|
|
13
13
|
export type ContentSelectorWrapperProps = NodeProps & Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
14
14
|
children?: JSX.Element;
|
|
15
15
|
};
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const ContentSelector: Component<ContentSelectorWrapperProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialises the Intlayer editor client singleton when the editor is enabled.
|
|
3
|
+
* Syncs the current locale from the Intlayer context into the editor manager so
|
|
4
|
+
* the editor always knows which locale the app is displaying.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useEditor: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/api": "8.
|
|
77
|
-
"@intlayer/config": "8.
|
|
78
|
-
"@intlayer/core": "8.
|
|
79
|
-
"@intlayer/editor": "8.
|
|
80
|
-
"@intlayer/types": "8.
|
|
76
|
+
"@intlayer/api": "8.4.0",
|
|
77
|
+
"@intlayer/config": "8.4.0",
|
|
78
|
+
"@intlayer/core": "8.4.0",
|
|
79
|
+
"@intlayer/editor": "8.4.0",
|
|
80
|
+
"@intlayer/types": "8.4.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@solidjs/testing-library": "0.8.10",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@utils/ts-config": "1.0.4",
|
|
88
88
|
"@utils/ts-config-types": "1.0.4",
|
|
89
89
|
"@utils/tsdown-config": "1.0.4",
|
|
90
|
-
"jsdom": "
|
|
90
|
+
"jsdom": "29.0.0",
|
|
91
91
|
"rimraf": "6.1.3",
|
|
92
92
|
"tsdown": "0.21.4",
|
|
93
93
|
"typescript": "5.9.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../getDictionary-PBgZNa_l.js`);exports.ContentSelectorRenderer=e.l;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-C91j1N6u.js`);const e=require(`./contexts/EditorProvider.cjs`);let t=require(`solid-js/web`);var n=n=>(0,t.createComponent)(e.EditorProvider,{mode:`client`,get children(){return n.children}});exports.IntlayerEditorProvider=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorProvider.cjs`);var t=()=>{let t=e.useEditorStateManager();return{postMessage:e=>t.messenger.send(e.type,e.data),senderId:t.messenger.senderId}};exports.useCommunicator=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.createSignal)(n.configuration.value),a=e=>i(e.detail);return n.configuration.addEventListener(`change`,a),(0,t.onCleanup)(()=>n.configuration.removeEventListener(`change`,a)),r};exports.useConfiguration=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.createSignal)(n.localeDictionaries.value??{}),a=e=>i(e.detail??{});return n.localeDictionaries.addEventListener(`change`,a),(0,t.onCleanup)(()=>n.localeDictionaries.removeEventListener(`change`,a)),{localeDictionaries:r,setLocaleDictionaries:e=>n.localeDictionaries.set(e),setLocaleDictionary:e=>n.setLocaleDictionary(e)}},r=()=>{let{setLocaleDictionaries:e,setLocaleDictionary:t}=n();return{setLocaleDictionaries:e,setLocaleDictionary:t}};exports.useDictionariesRecord=n,exports.useDictionariesRecordActions=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.createSignal)(n.editedContent.value),a=e=>i(e.detail);return n.editedContent.addEventListener(`change`,a),(0,t.onCleanup)(()=>n.editedContent.removeEventListener(`change`,a)),{editedContent:r,setEditedContentState:e=>n.editedContent.set(e),setEditedDictionary:e=>n.setEditedDictionary(e),setEditedContent:(e,t)=>n.setEditedContent(e,t),addEditedContent:(e,t,r,i)=>n.addContent(e,t,r,i),renameEditedContent:(e,t,r)=>n.renameContent(e,t,r),removeEditedContent:(e,t)=>n.removeContent(e,t),restoreEditedContent:e=>n.restoreContent(e),clearEditedDictionaryContent:e=>n.clearContent(e),clearEditedContent:()=>n.clearAllContent(),getEditedContentValue:(e,t)=>n.getContentValue(e,t)}},r=()=>{let{editedContent:e,...t}=n();return t},i=()=>{let t=e.useEditorStateManager();return()=>t.messenger.send(`INTLAYER_EDITED_CONTENT_CHANGED/get`)},a=()=>{let t=e.useEditorStateManager();return()=>t.editedContent.postCurrentValue()};exports.useEditedContent=n,exports.useEditedContentActions=r,exports.useGetEditedContentState=i,exports.usePostEditedContentState=a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.createSignal)(n.editorEnabled.value??!1),a=e=>i(e.detail);return n.editorEnabled.addEventListener(`change`,a),(0,t.onCleanup)(()=>n.editorEnabled.removeEventListener(`change`,a)),{enabled:r}},r=()=>{let{enabled:t}=n(),r=e.useEditorStateManager();return[t,e=>r.editorEnabled.set(e)]},i=()=>{let t=e.useEditorStateManager();return()=>{t.messenger.send(`INTLAYER_EDITOR_ENABLED/get`)}},a=()=>{let t=e.useEditorStateManager();return()=>t.editorEnabled.postCurrentValue()};exports.useEditorEnabled=n,exports.useEditorEnabledState=r,exports.useGetEditorEnabledState=i,exports.usePostEditorEnabledState=a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../../chunk-C91j1N6u.js`);let t=require(`solid-js/web`),n=require(`@intlayer/config/built`);n=e.t(n);let r=require(`@intlayer/editor`),i=require(`solid-js`);var{editor:a}=n.default??{},o=()=>({allowedOrigins:[a?.applicationURL,a?.editorURL,a?.cmsURL].filter(Boolean),postMessageFn:(e,t)=>{typeof window>`u`||window.self!==window.top&&(window.parent?.postMessage(e,t),window.postMessage(e,t))}}),s=(0,i.createContext)(null),c=()=>{let e=(0,i.useContext)(s);if(!e)throw Error(`useEditorStateManager: no EditorProvider found`);return e},l=e=>{let a=e.postMessage||e.allowedOrigins?{allowedOrigins:e.allowedOrigins??[`*`],postMessageFn:e.postMessage?t=>e.postMessage(t):o().postMessageFn}:o(),c=new r.EditorStateManager({mode:e.mode??`client`,messenger:a,configuration:e.configuration??n.default});return(0,i.onMount)(()=>{(0,r.defineIntlayerElements)(),c.start()}),(0,i.onCleanup)(()=>c.stop()),(0,t.createComponent)(s.Provider,{value:c,get children(){return e.children}})};exports.EditorProvider=l,exports.useEditorStateManager=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.createSignal)(n.focusedContent.value??null),a=e=>i(e.detail);return n.focusedContent.addEventListener(`change`,a),(0,t.onCleanup)(()=>n.focusedContent.removeEventListener(`change`,a)),{focusedContent:r,setFocusedContent:e=>n.focusedContent.set(e),setFocusedContentKeyPath:e=>n.setFocusedContentKeyPath(e)}},r=()=>{let{setFocusedContent:e,setFocusedContentKeyPath:t}=n();return{setFocusedContent:e,setFocusedContentKeyPath:t}};exports.useFocusDictionary=n,exports.useFocusDictionaryActions=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorProvider.cjs`),t=require(`./CommunicatorContext.cjs`),n=require(`./ConfigurationContext.cjs`),r=require(`./DictionariesRecordContext.cjs`),i=require(`./EditedContentContext.cjs`),a=require(`./EditorEnabledContext.cjs`),o=require(`./FocusDictionaryContext.cjs`),s=require(`./useCrossFrameMessageListener.cjs`),c=require(`./useCrossFrameState.cjs`),l=require(`./useCrossURLPathState.cjs`),u=require(`./useIframeClickInterceptor.cjs`);exports.EditorProvider=e.EditorProvider,exports.useCommunicator=t.useCommunicator,exports.useConfiguration=n.useConfiguration,exports.useCrossFrameMessageListener=s.useCrossFrameMessageListener,exports.useCrossFrameState=c.useCrossFrameState,exports.useCrossURLPathSetter=l.useCrossURLPathSetter,exports.useCrossURLPathState=l.useCrossURLPathState,exports.useDictionariesRecord=r.useDictionariesRecord,exports.useDictionariesRecordActions=r.useDictionariesRecordActions,exports.useEditedContent=i.useEditedContent,exports.useEditedContentActions=i.useEditedContentActions,exports.useEditorEnabled=a.useEditorEnabled,exports.useEditorEnabledState=a.useEditorEnabledState,exports.useEditorStateManager=e.useEditorStateManager,exports.useFocusDictionary=o.useFocusDictionary,exports.useFocusDictionaryActions=o.useFocusDictionaryActions,exports.useGetEditedContentState=i.useGetEditedContentState,exports.useGetEditorEnabledState=a.useGetEditorEnabledState,exports.useIframeClickInterceptor=u.useIframeClickInterceptor,exports.useIframeClickMerger=u.useIframeClickMerger,exports.usePostEditedContentState=i.usePostEditedContentState,exports.usePostEditorEnabledState=a.usePostEditorEnabledState;var d=require(`@intlayer/editor`);Object.keys(d).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return d[e]}})});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`solid-js`);var n=(n,r)=>{let i=e.useEditorStateManager();return r&&(0,t.onCleanup)(i.messenger.subscribe(n,r)),e=>i.messenger.send(n,e)};exports.useCrossFrameMessageListener=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./EditorProvider.cjs`);let t=require(`@intlayer/editor`),n=require(`solid-js`);var r=(r,i,a)=>{let o=e.useEditorStateManager(),{emit:s=!0,receive:c=!0}=a??{},l=new t.CrossFrameStateManager(r,o.messenger,{emit:s,receive:c,initialValue:i});l.start(),(0,n.onCleanup)(()=>l.stop());let[u,d]=(0,n.createSignal)(l.value,{equals:!1}),f=e=>{d(()=>e.detail)};return l.addEventListener(`change`,f),(0,n.onCleanup)(()=>l.removeEventListener(`change`,f)),[u,e=>{let t=typeof e==`function`?e(u()):e;l.set(t)},()=>l.postCurrentValue()]};exports.useCrossFrameState=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=()=>{},t=()=>{};exports.useCrossURLPathSetter=e,exports.useCrossURLPathState=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../chunk-C91j1N6u.js`);const e=require(`./useCrossFrameMessageListener.cjs`);let t=require(`@intlayer/editor`);var n=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED)},r=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED,t.mergeIframeClick)};exports.useIframeClickInterceptor=n,exports.useIframeClickMerger=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../getDictionary-PBgZNa_l.js`);exports.ContentSelectorRenderer=e.l;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-C91j1N6u.js`);const e=require(`./contexts/EditedContentContext.cjs`);let t=require(`@intlayer/core/interpreter`);var n=({dictionaryKey:t,keyPath:n,children:r})=>{let i=e.useEditedContentActions();return i?i.getEditedContentValue(t,n)??r:r},r=e=>{let r=n(e);if(typeof r==`object`){let n=(0,t.getContent)(r,{...e,locale:e.locale},(0,t.getBasePlugins)(e.locale));return typeof n==`string`?n:(console.error(`Incorrect edited content format. Content type: ${typeof n}. Expected string. Value ${JSON.stringify(n)}`),e.children)}return r};exports.EditedContentRenderer=r,exports.useEditedContentRenderer=n;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EditorProvider as e } from "./contexts/EditorProvider.mjs";
|
|
2
|
-
import { createComponent as t } from "solid-js/web";
|
|
3
|
-
//#region src/editor/IntlayerEditorProvider.tsx
|
|
4
|
-
var n = (n) => t(e, {
|
|
5
|
-
mode: "client",
|
|
6
|
-
get children() {
|
|
7
|
-
return n.children;
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
//#endregion
|
|
11
|
-
export { n as IntlayerEditorProvider };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
//#region src/editor/contexts/CommunicatorContext.tsx
|
|
3
|
-
var t = () => {
|
|
4
|
-
let t = e();
|
|
5
|
-
return {
|
|
6
|
-
postMessage: (e) => t.messenger.send(e.type, e.data),
|
|
7
|
-
senderId: t.messenger.senderId
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { t as useCommunicator };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { createSignal as t, onCleanup as n } from "solid-js";
|
|
3
|
-
//#region src/editor/contexts/ConfigurationContext.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
let r = e(), [i, a] = t(r.configuration.value), o = (e) => a(e.detail);
|
|
6
|
-
return r.configuration.addEventListener("change", o), n(() => r.configuration.removeEventListener("change", o)), i;
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { r as useConfiguration };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { createSignal as t, onCleanup as n } from "solid-js";
|
|
3
|
-
//#region src/editor/contexts/DictionariesRecordContext.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
let r = e(), [i, a] = t(r.localeDictionaries.value ?? {}), o = (e) => a(e.detail ?? {});
|
|
6
|
-
return r.localeDictionaries.addEventListener("change", o), n(() => r.localeDictionaries.removeEventListener("change", o)), {
|
|
7
|
-
localeDictionaries: i,
|
|
8
|
-
setLocaleDictionaries: (e) => r.localeDictionaries.set(e),
|
|
9
|
-
setLocaleDictionary: (e) => r.setLocaleDictionary(e)
|
|
10
|
-
};
|
|
11
|
-
}, i = () => {
|
|
12
|
-
let { setLocaleDictionaries: e, setLocaleDictionary: t } = r();
|
|
13
|
-
return {
|
|
14
|
-
setLocaleDictionaries: e,
|
|
15
|
-
setLocaleDictionary: t
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { r as useDictionariesRecord, i as useDictionariesRecordActions };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { createSignal as t, onCleanup as n } from "solid-js";
|
|
3
|
-
//#region src/editor/contexts/EditedContentContext.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
let r = e(), [i, a] = t(r.editedContent.value), o = (e) => a(e.detail);
|
|
6
|
-
return r.editedContent.addEventListener("change", o), n(() => r.editedContent.removeEventListener("change", o)), {
|
|
7
|
-
editedContent: i,
|
|
8
|
-
setEditedContentState: (e) => r.editedContent.set(e),
|
|
9
|
-
setEditedDictionary: (e) => r.setEditedDictionary(e),
|
|
10
|
-
setEditedContent: (e, t) => r.setEditedContent(e, t),
|
|
11
|
-
addEditedContent: (e, t, n, i) => r.addContent(e, t, n, i),
|
|
12
|
-
renameEditedContent: (e, t, n) => r.renameContent(e, t, n),
|
|
13
|
-
removeEditedContent: (e, t) => r.removeContent(e, t),
|
|
14
|
-
restoreEditedContent: (e) => r.restoreContent(e),
|
|
15
|
-
clearEditedDictionaryContent: (e) => r.clearContent(e),
|
|
16
|
-
clearEditedContent: () => r.clearAllContent(),
|
|
17
|
-
getEditedContentValue: (e, t) => r.getContentValue(e, t)
|
|
18
|
-
};
|
|
19
|
-
}, i = () => {
|
|
20
|
-
let { editedContent: e, ...t } = r();
|
|
21
|
-
return t;
|
|
22
|
-
}, a = () => {
|
|
23
|
-
let t = e();
|
|
24
|
-
return () => t.messenger.send("INTLAYER_EDITED_CONTENT_CHANGED/get");
|
|
25
|
-
}, o = () => {
|
|
26
|
-
let t = e();
|
|
27
|
-
return () => t.editedContent.postCurrentValue();
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { r as useEditedContent, i as useEditedContentActions, a as useGetEditedContentState, o as usePostEditedContentState };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { createSignal as t, onCleanup as n } from "solid-js";
|
|
3
|
-
//#region src/editor/contexts/EditorEnabledContext.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
let r = e(), [i, a] = t(r.editorEnabled.value ?? !1), o = (e) => a(e.detail);
|
|
6
|
-
return r.editorEnabled.addEventListener("change", o), n(() => r.editorEnabled.removeEventListener("change", o)), { enabled: i };
|
|
7
|
-
}, i = () => {
|
|
8
|
-
let { enabled: t } = r(), n = e();
|
|
9
|
-
return [t, (e) => n.editorEnabled.set(e)];
|
|
10
|
-
}, a = () => {
|
|
11
|
-
let t = e();
|
|
12
|
-
return () => {
|
|
13
|
-
t.messenger.send("INTLAYER_EDITOR_ENABLED/get");
|
|
14
|
-
};
|
|
15
|
-
}, o = () => {
|
|
16
|
-
let t = e();
|
|
17
|
-
return () => t.editorEnabled.postCurrentValue();
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
20
|
-
export { r as useEditorEnabled, i as useEditorEnabledState, a as useGetEditorEnabledState, o as usePostEditorEnabledState };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createComponent as e } from "solid-js/web";
|
|
2
|
-
import t from "@intlayer/config/built";
|
|
3
|
-
import { EditorStateManager as n, defineIntlayerElements as r } from "@intlayer/editor";
|
|
4
|
-
import { createContext as i, onCleanup as a, onMount as o, useContext as s } from "solid-js";
|
|
5
|
-
//#region src/editor/contexts/EditorProvider.tsx
|
|
6
|
-
var { editor: c } = t ?? {}, l = () => ({
|
|
7
|
-
allowedOrigins: [
|
|
8
|
-
c?.applicationURL,
|
|
9
|
-
c?.editorURL,
|
|
10
|
-
c?.cmsURL
|
|
11
|
-
].filter(Boolean),
|
|
12
|
-
postMessageFn: (e, t) => {
|
|
13
|
-
typeof window > "u" || window.self !== window.top && (window.parent?.postMessage(e, t), window.postMessage(e, t));
|
|
14
|
-
}
|
|
15
|
-
}), u = i(null), d = () => {
|
|
16
|
-
let e = s(u);
|
|
17
|
-
if (!e) throw Error("useEditorStateManager: no EditorProvider found");
|
|
18
|
-
return e;
|
|
19
|
-
}, f = (i) => {
|
|
20
|
-
let s = i.postMessage || i.allowedOrigins ? {
|
|
21
|
-
allowedOrigins: i.allowedOrigins ?? ["*"],
|
|
22
|
-
postMessageFn: i.postMessage ? (e) => i.postMessage(e) : l().postMessageFn
|
|
23
|
-
} : l(), c = new n({
|
|
24
|
-
mode: i.mode ?? "client",
|
|
25
|
-
messenger: s,
|
|
26
|
-
configuration: i.configuration ?? t
|
|
27
|
-
});
|
|
28
|
-
return o(() => {
|
|
29
|
-
r(), c.start();
|
|
30
|
-
}), a(() => c.stop()), e(u.Provider, {
|
|
31
|
-
value: c,
|
|
32
|
-
get children() {
|
|
33
|
-
return i.children;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
//#endregion
|
|
38
|
-
export { f as EditorProvider, d as useEditorStateManager };
|