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,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/FocusDictionaryContext.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
let r = e(), [i, a] = t(r.focusedContent.value ?? null), o = (e) => a(e.detail);
|
|
6
|
-
return r.focusedContent.addEventListener("change", o), n(() => r.focusedContent.removeEventListener("change", o)), {
|
|
7
|
-
focusedContent: i,
|
|
8
|
-
setFocusedContent: (e) => r.focusedContent.set(e),
|
|
9
|
-
setFocusedContentKeyPath: (e) => r.setFocusedContentKeyPath(e)
|
|
10
|
-
};
|
|
11
|
-
}, i = () => {
|
|
12
|
-
let { setFocusedContent: e, setFocusedContentKeyPath: t } = r();
|
|
13
|
-
return {
|
|
14
|
-
setFocusedContent: e,
|
|
15
|
-
setFocusedContentKeyPath: t
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { r as useFocusDictionary, i as useFocusDictionaryActions };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EditorProvider as e, useEditorStateManager as t } from "./EditorProvider.mjs";
|
|
2
|
-
import { useCommunicator as n } from "./CommunicatorContext.mjs";
|
|
3
|
-
import { useConfiguration as r } from "./ConfigurationContext.mjs";
|
|
4
|
-
import { useDictionariesRecord as i, useDictionariesRecordActions as a } from "./DictionariesRecordContext.mjs";
|
|
5
|
-
import { useEditedContent as o, useEditedContentActions as s, useGetEditedContentState as c, usePostEditedContentState as l } from "./EditedContentContext.mjs";
|
|
6
|
-
import { useEditorEnabled as u, useEditorEnabledState as d, useGetEditorEnabledState as f, usePostEditorEnabledState as p } from "./EditorEnabledContext.mjs";
|
|
7
|
-
import { useFocusDictionary as m, useFocusDictionaryActions as h } from "./FocusDictionaryContext.mjs";
|
|
8
|
-
import { useCrossFrameMessageListener as g } from "./useCrossFrameMessageListener.mjs";
|
|
9
|
-
import { useCrossFrameState as _ } from "./useCrossFrameState.mjs";
|
|
10
|
-
import { useCrossURLPathSetter as v, useCrossURLPathState as y } from "./useCrossURLPathState.mjs";
|
|
11
|
-
import { useIframeClickInterceptor as b, useIframeClickMerger as x } from "./useIframeClickInterceptor.mjs";
|
|
12
|
-
export * from "@intlayer/editor";
|
|
13
|
-
export { e as EditorProvider, n as useCommunicator, r as useConfiguration, g as useCrossFrameMessageListener, _ as useCrossFrameState, v as useCrossURLPathSetter, y as useCrossURLPathState, i as useDictionariesRecord, a as useDictionariesRecordActions, o as useEditedContent, s as useEditedContentActions, u as useEditorEnabled, d as useEditorEnabledState, t as useEditorStateManager, m as useFocusDictionary, h as useFocusDictionaryActions, c as useGetEditedContentState, f as useGetEditorEnabledState, b as useIframeClickInterceptor, x as useIframeClickMerger, l as usePostEditedContentState, p as usePostEditorEnabledState };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { onCleanup as t } from "solid-js";
|
|
3
|
-
//#region src/editor/contexts/useCrossFrameMessageListener.tsx
|
|
4
|
-
var n = (n, r) => {
|
|
5
|
-
let i = e();
|
|
6
|
-
return r && t(i.messenger.subscribe(n, r)), (e) => i.messenger.send(n, e);
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { n as useCrossFrameMessageListener };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEditorStateManager as e } from "./EditorProvider.mjs";
|
|
2
|
-
import { CrossFrameStateManager as t } from "@intlayer/editor";
|
|
3
|
-
import { createSignal as n, onCleanup as r } from "solid-js";
|
|
4
|
-
//#region src/editor/contexts/useCrossFrameState.tsx
|
|
5
|
-
var i = (i, a, o) => {
|
|
6
|
-
let s = e(), { emit: c = !0, receive: l = !0 } = o ?? {}, u = new t(i, s.messenger, {
|
|
7
|
-
emit: c,
|
|
8
|
-
receive: l,
|
|
9
|
-
initialValue: a
|
|
10
|
-
});
|
|
11
|
-
u.start(), r(() => u.stop());
|
|
12
|
-
let [d, f] = n(u.value, { equals: !1 }), p = (e) => {
|
|
13
|
-
f(() => e.detail);
|
|
14
|
-
};
|
|
15
|
-
return u.addEventListener("change", p), r(() => u.removeEventListener("change", p)), [
|
|
16
|
-
d,
|
|
17
|
-
(e) => {
|
|
18
|
-
let t = typeof e == "function" ? e(d()) : e;
|
|
19
|
-
u.set(t);
|
|
20
|
-
},
|
|
21
|
-
() => u.postCurrentValue()
|
|
22
|
-
];
|
|
23
|
-
};
|
|
24
|
-
//#endregion
|
|
25
|
-
export { i as useCrossFrameState };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useCrossFrameMessageListener as e } from "./useCrossFrameMessageListener.mjs";
|
|
2
|
-
import { MessageKey as t, mergeIframeClick as n } from "@intlayer/editor";
|
|
3
|
-
//#region src/editor/contexts/useIframeClickInterceptor.tsx
|
|
4
|
-
var r = () => {
|
|
5
|
-
e(t.INTLAYER_IFRAME_CLICKED);
|
|
6
|
-
}, i = () => {
|
|
7
|
-
e(t.INTLAYER_IFRAME_CLICKED, n);
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
export { r as useIframeClickInterceptor, i as useIframeClickMerger };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEditedContentActions as e } from "./contexts/EditedContentContext.mjs";
|
|
2
|
-
import { getBasePlugins as t, getContent as n } from "@intlayer/core/interpreter";
|
|
3
|
-
//#region src/editor/useEditedContentRenderer.tsx
|
|
4
|
-
var r = ({ dictionaryKey: t, keyPath: n, children: r }) => {
|
|
5
|
-
let i = e();
|
|
6
|
-
return i ? i.getEditedContentValue(t, n) ?? r : r;
|
|
7
|
-
}, i = (e) => {
|
|
8
|
-
let i = r(e);
|
|
9
|
-
if (typeof i == "object") {
|
|
10
|
-
let r = n(i, {
|
|
11
|
-
...e,
|
|
12
|
-
locale: e.locale
|
|
13
|
-
}, t(e.locale));
|
|
14
|
-
return typeof r == "string" ? r : (console.error(`Incorrect edited content format. Content type: ${typeof r}. Expected string. Value ${JSON.stringify(r)}`), e.children);
|
|
15
|
-
}
|
|
16
|
-
return i;
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
export { i as EditedContentRenderer, r as useEditedContentRenderer };
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { renderIntlayerNode as e } from "./esm/IntlayerNode.mjs";
|
|
2
|
-
import { useEditorStateManager as t } from "./esm/editor/contexts/EditorProvider.mjs";
|
|
3
|
-
import { useEditorEnabled as n } from "./esm/editor/contexts/EditorEnabledContext.mjs";
|
|
4
|
-
import { useFocusDictionary as r } from "./esm/editor/contexts/FocusDictionaryContext.mjs";
|
|
5
|
-
import { IntlayerClientContext as i, useIntlayerContext as a } from "./esm/client/IntlayerProvider.mjs";
|
|
6
|
-
import { useLoadDynamic as o } from "./esm/client/useLoadDynamic.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 ee, getHTML as h, getIntlayer as g, nestedPlugin as _, splitInsertionTemplate as v, translationPlugin as y } from "@intlayer/core/interpreter";
|
|
11
|
-
import { Dynamic as te, createComponent as b, effect as x, getOwner as S, insert as C, mergeProps as w, template as T, use as E } from "solid-js/web";
|
|
12
|
-
import D from "@intlayer/config/built";
|
|
13
|
-
import { getMarkdownMetadata as O } from "@intlayer/core/markdown";
|
|
14
|
-
import { HTML_TAGS as ne } from "@intlayer/core/transpiler";
|
|
15
|
-
import { NodeType as k } from "@intlayer/types/nodeType";
|
|
16
|
-
import { isSameKeyPath as A } from "@intlayer/core/utils";
|
|
17
|
-
import { MessageKey as j, defineIntlayerElements as M } from "@intlayer/editor";
|
|
18
|
-
import { createMemo as N, onCleanup as P, onMount as F, useContext as I } from "solid-js";
|
|
19
|
-
//#region src/client/useDictionary.ts
|
|
20
|
-
var L = (e, t) => {
|
|
21
|
-
let n = I(i);
|
|
22
|
-
return N(() => $(e, t ?? n?.locale?.()));
|
|
23
|
-
}, R = async (e, t) => {
|
|
24
|
-
let { locale: n } = I(i), r = D?.internationalization.defaultLocale, a = t ?? n() ?? r;
|
|
25
|
-
return L(await e[a]?.(), a);
|
|
26
|
-
}, z = (e, t, n) => {
|
|
27
|
-
let { locale: r } = I(i) ?? {}, a = D?.internationalization.defaultLocale, s = n ?? r?.() ?? a;
|
|
28
|
-
return L(o(`${String(t)}.${s}`, e[s]?.()), s);
|
|
29
|
-
}, B = (e, t) => g(e, t, Q(t)), V = (e, t) => {
|
|
30
|
-
let n = I(i);
|
|
31
|
-
return N(() => {
|
|
32
|
-
let r = n?.locale();
|
|
33
|
-
return B(e, t ?? r);
|
|
34
|
-
});
|
|
35
|
-
}, H = /* @__PURE__ */ T("<intlayer-content-selector>", !0, !1, !1), U = (e) => {
|
|
36
|
-
let { focusedContent: n, setFocusedContent: i } = r(), a = t(), o = N(() => e.keyPath.filter((e) => e.type !== k.Translation)), s = N(() => (n()?.dictionaryKey === e.dictionaryKey && (n()?.keyPath?.length ?? 0) > 0 && A(n()?.keyPath ?? [], o())) ?? !1), c, l = () => {
|
|
37
|
-
i({
|
|
38
|
-
dictionaryKey: e.dictionaryKey,
|
|
39
|
-
keyPath: o()
|
|
40
|
-
});
|
|
41
|
-
}, u = () => {
|
|
42
|
-
a.messenger.send(`${j.INTLAYER_HOVERED_CONTENT_CHANGED}/post`, {
|
|
43
|
-
dictionaryKey: e.dictionaryKey,
|
|
44
|
-
keyPath: o()
|
|
45
|
-
});
|
|
46
|
-
}, d = () => {
|
|
47
|
-
a.messenger.send(`${j.INTLAYER_HOVERED_CONTENT_CHANGED}/post`, null);
|
|
48
|
-
};
|
|
49
|
-
return F(() => {
|
|
50
|
-
c && (c.addEventListener("intlayer:press", l), c.addEventListener("intlayer:hover", u), c.addEventListener("intlayer:unhover", d), P(() => {
|
|
51
|
-
c?.removeEventListener("intlayer:press", l), c?.removeEventListener("intlayer:hover", u), c?.removeEventListener("intlayer:unhover", d);
|
|
52
|
-
}));
|
|
53
|
-
}), (() => {
|
|
54
|
-
var t = H(), n = c;
|
|
55
|
-
return typeof n == "function" ? E(n, t) : c = t, t._$owner = S(), C(t, () => e.children), x(() => t.isSelecting = s() || void 0), t;
|
|
56
|
-
})();
|
|
57
|
-
}, W = (e) => {
|
|
58
|
-
let { enabled: t } = n(), { disableEditor: r } = a();
|
|
59
|
-
return F(() => M()), t() && !r ? b(U, w(e, { get children() {
|
|
60
|
-
return e.children;
|
|
61
|
-
} })) : e.children;
|
|
62
|
-
}, G = {
|
|
63
|
-
id: "intlayer-node-plugin",
|
|
64
|
-
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
65
|
-
transform: (t, { plugins: n, ...r }) => e({
|
|
66
|
-
...r,
|
|
67
|
-
value: r.children,
|
|
68
|
-
children: D?.editor.enabled ? b(W, w(r, { get children() {
|
|
69
|
-
return b(s, w(r, { get children() {
|
|
70
|
-
return r.children;
|
|
71
|
-
} }));
|
|
72
|
-
} })) : r.children
|
|
73
|
-
})
|
|
74
|
-
}, K = {
|
|
75
|
-
id: "solid-node-plugin",
|
|
76
|
-
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
77
|
-
transform: (t, { plugins: n, ...r }) => e({
|
|
78
|
-
...r,
|
|
79
|
-
value: "[[solid-element]]",
|
|
80
|
-
children: D?.editor.enabled ? b(W, w(r, { get children() {
|
|
81
|
-
return typeof Node < "u" && t instanceof Node ? t : u(t);
|
|
82
|
-
} })) : typeof Node < "u" && t instanceof Node ? t : u(t)
|
|
83
|
-
})
|
|
84
|
-
}, q = (e, t) => {
|
|
85
|
-
let n = v(e, t);
|
|
86
|
-
return n.isSimple, n.parts;
|
|
87
|
-
}, J = {
|
|
88
|
-
id: "insertion-plugin",
|
|
89
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === k.Insertion,
|
|
90
|
-
transform: (e, t, n) => {
|
|
91
|
-
let r = [...t.keyPath, { type: k.Insertion }], i = e[k.Insertion];
|
|
92
|
-
return (e) => {
|
|
93
|
-
let a = {
|
|
94
|
-
id: "insertion-string-plugin",
|
|
95
|
-
canHandle: (e) => typeof e == "string",
|
|
96
|
-
transform: (n, r, i) => {
|
|
97
|
-
let a = q(i(n, {
|
|
98
|
-
...r,
|
|
99
|
-
children: n,
|
|
100
|
-
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
101
|
-
}), e);
|
|
102
|
-
return i(a, {
|
|
103
|
-
...r,
|
|
104
|
-
plugins: t.plugins,
|
|
105
|
-
children: a
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
return n(i, {
|
|
110
|
-
...t,
|
|
111
|
-
children: i,
|
|
112
|
-
keyPath: r,
|
|
113
|
-
plugins: [a, ...t.plugins ?? []]
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}, Y = {
|
|
118
|
-
id: "markdown-string-plugin",
|
|
119
|
-
canHandle: (e) => typeof e == "string",
|
|
120
|
-
transform: (t, n, r) => {
|
|
121
|
-
let { plugins: i, ...a } = n, o = r(O(t), {
|
|
122
|
-
plugins: [{
|
|
123
|
-
id: "markdown-metadata-plugin",
|
|
124
|
-
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
125
|
-
transform: (n, r) => e({
|
|
126
|
-
...r,
|
|
127
|
-
value: n,
|
|
128
|
-
children: b(W, w(a, { get children() {
|
|
129
|
-
return b(c, w(a, {
|
|
130
|
-
get metadataKeyPath() {
|
|
131
|
-
return r.keyPath;
|
|
132
|
-
},
|
|
133
|
-
children: t
|
|
134
|
-
}));
|
|
135
|
-
} }))
|
|
136
|
-
})
|
|
137
|
-
}],
|
|
138
|
-
dictionaryKey: a.dictionaryKey,
|
|
139
|
-
keyPath: []
|
|
140
|
-
}), s = (r) => e({
|
|
141
|
-
...n,
|
|
142
|
-
value: t,
|
|
143
|
-
children: b(W, w(a, { get children() {
|
|
144
|
-
return b(l, w(a, {
|
|
145
|
-
components: r,
|
|
146
|
-
children: t
|
|
147
|
-
}));
|
|
148
|
-
} })),
|
|
149
|
-
additionalProps: { metadata: o }
|
|
150
|
-
}), u = s();
|
|
151
|
-
return new Proxy(u, { get(e, n, r) {
|
|
152
|
-
return n === "value" ? t : n === "metadata" ? o : n === "use" ? (e) => s(e) : Reflect.get(e, n, r);
|
|
153
|
-
} });
|
|
154
|
-
}
|
|
155
|
-
}, X = {
|
|
156
|
-
id: "markdown-plugin",
|
|
157
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === k.Markdown,
|
|
158
|
-
transform: (e, t, n) => {
|
|
159
|
-
let r = [...t.keyPath, { type: k.Markdown }], i = e[k.Markdown];
|
|
160
|
-
return n(i, {
|
|
161
|
-
...t,
|
|
162
|
-
children: i,
|
|
163
|
-
keyPath: r,
|
|
164
|
-
plugins: [Y, ...t.plugins ?? []]
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}, re = (() => {
|
|
168
|
-
let e = {};
|
|
169
|
-
for (let t of ne) e[t] = ({ children: e, ...n }) => b(te, w({ component: t }, n, { children: e }));
|
|
170
|
-
return e;
|
|
171
|
-
})(), Z = {
|
|
172
|
-
id: "html-plugin",
|
|
173
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType === k.HTML,
|
|
174
|
-
transform: (e) => {
|
|
175
|
-
let t = e[k.HTML], n = (e) => h(t, {
|
|
176
|
-
...re,
|
|
177
|
-
...e
|
|
178
|
-
}), r = [n()];
|
|
179
|
-
return new Proxy(r, { get(e, r, i) {
|
|
180
|
-
return r === "value" ? t : r === "use" ? (e) => n(e) : Reflect.get(e, r, i);
|
|
181
|
-
} });
|
|
182
|
-
}
|
|
183
|
-
}, Q = (e, t = !0) => [
|
|
184
|
-
y(e ?? D.internationalization.defaultLocale, t ? D.internationalization.defaultLocale : void 0),
|
|
185
|
-
f,
|
|
186
|
-
d,
|
|
187
|
-
_(e ?? D.internationalization.defaultLocale),
|
|
188
|
-
p,
|
|
189
|
-
m,
|
|
190
|
-
G,
|
|
191
|
-
K,
|
|
192
|
-
J,
|
|
193
|
-
X,
|
|
194
|
-
Z
|
|
195
|
-
], $ = (e, t) => ee(e, t, Q(t));
|
|
196
|
-
//#endregion
|
|
197
|
-
export { G as a, K as c, B as d, z as f, J as i, W as l, L as m, Q as n, X as o, R as p, Z as r, Y as s, $ as t, V as u };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-C91j1N6u.js`),t=require(`./cjs/IntlayerNode.cjs`),n=require(`./cjs/editor/contexts/EditorProvider.cjs`),r=require(`./cjs/editor/contexts/EditorEnabledContext.cjs`),i=require(`./cjs/editor/contexts/FocusDictionaryContext.cjs`),a=require(`./cjs/client/IntlayerProvider.cjs`),o=require(`./cjs/client/useLoadDynamic.cjs`),s=require(`./cjs/editor/useEditedContentRenderer.cjs`),c=require(`./cjs/markdown/MarkdownRenderer.cjs`),l=require(`./cjs/solidElement/renderSolidElement.cjs`);let u=require(`@intlayer/core/interpreter`),d=require(`solid-js/web`),f=require(`@intlayer/config/built`);f=e.t(f);let p=require(`@intlayer/core/markdown`),m=require(`@intlayer/core/transpiler`),h=require(`@intlayer/types/nodeType`),g=require(`@intlayer/core/utils`),_=require(`@intlayer/editor`),v=require(`solid-js`);var y=(e,t)=>{let n=(0,v.useContext)(a.IntlayerClientContext);return(0,v.createMemo)(()=>I(e,t??n?.locale?.()))},b=async(e,t)=>{let{locale:n}=(0,v.useContext)(a.IntlayerClientContext),r=f.default?.internationalization.defaultLocale,i=t??n()??r;return y(await e[i]?.(),i)},x=(e,t,n)=>{let{locale:r}=(0,v.useContext)(a.IntlayerClientContext)??{},i=f.default?.internationalization.defaultLocale,s=n??r?.()??i;return y(o.useLoadDynamic(`${String(t)}.${s}`,e[s]?.()),s)},S=(e,t)=>(0,u.getIntlayer)(e,t,F(t)),C=(e,t)=>{let n=(0,v.useContext)(a.IntlayerClientContext);return(0,v.createMemo)(()=>{let r=n?.locale();return S(e,t??r)})},w=(0,d.template)(`<intlayer-content-selector>`,!0,!1,!1),T=e=>{let{focusedContent:t,setFocusedContent:r}=i.useFocusDictionary(),a=n.useEditorStateManager(),o=(0,v.createMemo)(()=>e.keyPath.filter(e=>e.type!==h.NodeType.Translation)),s=(0,v.createMemo)(()=>(t()?.dictionaryKey===e.dictionaryKey&&(t()?.keyPath?.length??0)>0&&(0,g.isSameKeyPath)(t()?.keyPath??[],o()))??!1),c,l=()=>{r({dictionaryKey:e.dictionaryKey,keyPath:o()})},u=()=>{a.messenger.send(`${_.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,{dictionaryKey:e.dictionaryKey,keyPath:o()})},f=()=>{a.messenger.send(`${_.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,null)};return(0,v.onMount)(()=>{c&&(c.addEventListener(`intlayer:press`,l),c.addEventListener(`intlayer:hover`,u),c.addEventListener(`intlayer:unhover`,f),(0,v.onCleanup)(()=>{c?.removeEventListener(`intlayer:press`,l),c?.removeEventListener(`intlayer:hover`,u),c?.removeEventListener(`intlayer:unhover`,f)}))}),(()=>{var t=w(),n=c;return typeof n==`function`?(0,d.use)(n,t):c=t,t._$owner=(0,d.getOwner)(),(0,d.insert)(t,()=>e.children),(0,d.effect)(()=>t.isSelecting=s()||void 0),t})()},E=e=>{let{enabled:t}=r.useEditorEnabled(),{disableEditor:n}=a.useIntlayerContext();return(0,v.onMount)(()=>(0,_.defineIntlayerElements)()),t()&&!n?(0,d.createComponent)(T,(0,d.mergeProps)(e,{get children(){return e.children}})):e.children},D={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:n,...r})=>t.renderIntlayerNode({...r,value:r.children,children:f.default?.editor.enabled?(0,d.createComponent)(E,(0,d.mergeProps)(r,{get children(){return(0,d.createComponent)(s.EditedContentRenderer,(0,d.mergeProps)(r,{get children(){return r.children}}))}})):r.children})},O={id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:n,...r})=>t.renderIntlayerNode({...r,value:`[[solid-element]]`,children:f.default?.editor.enabled?(0,d.createComponent)(E,(0,d.mergeProps)(r,{get children(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)}})):typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)})},k=(e,t)=>{let n=(0,u.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},A={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.Insertion,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.NodeType.Insertion}],i=e[h.NodeType.Insertion];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(n,r,i)=>{let a=k(i(n,{...r,children:n,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]}),e);return i(a,{...r,plugins:t.plugins,children:a})}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}}},j={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let{plugins:i,...a}=n,o=r((0,p.getMarkdownMetadata)(e),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:(0,d.createComponent)(E,(0,d.mergeProps)(a,{get children(){return(0,d.createComponent)(c.MarkdownMetadataRenderer,(0,d.mergeProps)(a,{get metadataKeyPath(){return r.keyPath},children:e}))}}))})}],dictionaryKey:a.dictionaryKey,keyPath:[]}),s=r=>t.renderIntlayerNode({...n,value:e,children:(0,d.createComponent)(E,(0,d.mergeProps)(a,{get children(){return(0,d.createComponent)(c.MarkdownRenderer,(0,d.mergeProps)(a,{components:r,children:e}))}})),additionalProps:{metadata:o}}),l=s();return new Proxy(l,{get(t,n,r){return n===`value`?e:n===`metadata`?o:n===`use`?e=>s(e):Reflect.get(t,n,r)}})}},M={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.NodeType.Markdown}],i=e[h.NodeType.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[j,...t.plugins??[]]})}},N=(()=>{let e={};for(let t of m.HTML_TAGS)e[t]=({children:e,...n})=>(0,d.createComponent)(d.Dynamic,(0,d.mergeProps)({component:t},n,{children:e}));return e})(),P={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.NodeType.HTML,transform:e=>{let t=e[h.NodeType.HTML],n=e=>(0,u.getHTML)(t,{...N,...e}),r=[n()];return new Proxy(r,{get(e,r,i){return r===`value`?t:r===`use`?e=>n(e):Reflect.get(e,r,i)}})}},F=(e,t=!0)=>[(0,u.translationPlugin)(e??f.default.internationalization.defaultLocale,t?f.default.internationalization.defaultLocale:void 0),u.enumerationPlugin,u.conditionPlugin,(0,u.nestedPlugin)(e??f.default.internationalization.defaultLocale),u.filePlugin,u.genderPlugin,D,O,A,M,P],I=(e,t)=>(0,u.getDictionary)(e,t,F(t));Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return C}});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DictionaryContent } from '@intlayer/editor';
|
|
2
|
-
import { Dictionary } from '@intlayer/types/dictionary';
|
|
3
|
-
export type { DictionaryContent };
|
|
4
|
-
export declare const useDictionariesRecord: () => {
|
|
5
|
-
localeDictionaries: import('solid-js').Accessor<DictionaryContent>;
|
|
6
|
-
setLocaleDictionaries: (value: DictionaryContent) => void;
|
|
7
|
-
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const useDictionariesRecordActions: () => {
|
|
10
|
-
setLocaleDictionaries: (value: DictionaryContent) => void;
|
|
11
|
-
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
12
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DictionaryContent } from '@intlayer/editor';
|
|
2
|
-
import { ContentNode, Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';
|
|
3
|
-
import { KeyPath } from '@intlayer/types/keyPath';
|
|
4
|
-
export declare const useEditedContent: () => {
|
|
5
|
-
editedContent: import('solid-js').Accessor<DictionaryContent | undefined>;
|
|
6
|
-
setEditedContentState: (value: DictionaryContent) => void;
|
|
7
|
-
setEditedDictionary: (dict: Dictionary) => void;
|
|
8
|
-
setEditedContent: (localId: LocalDictionaryId, value: Dictionary["content"]) => void;
|
|
9
|
-
addEditedContent: (localId: LocalDictionaryId, value: ContentNode, keyPath?: KeyPath[], overwrite?: boolean) => void;
|
|
10
|
-
renameEditedContent: (localId: LocalDictionaryId, newKey: KeyPath["key"], keyPath?: KeyPath[]) => void;
|
|
11
|
-
removeEditedContent: (localId: LocalDictionaryId, keyPath: KeyPath[]) => void;
|
|
12
|
-
restoreEditedContent: (localId: LocalDictionaryId) => void;
|
|
13
|
-
clearEditedDictionaryContent: (localId: LocalDictionaryId) => void;
|
|
14
|
-
clearEditedContent: () => void;
|
|
15
|
-
getEditedContentValue: (localIdOrKey: LocalDictionaryId | string, keyPath: KeyPath[]) => ContentNode | undefined;
|
|
16
|
-
};
|
|
17
|
-
export declare const useEditedContentActions: () => {
|
|
18
|
-
setEditedContentState: (value: DictionaryContent) => void;
|
|
19
|
-
setEditedDictionary: (dict: Dictionary) => void;
|
|
20
|
-
setEditedContent: (localId: LocalDictionaryId, value: Dictionary["content"]) => void;
|
|
21
|
-
addEditedContent: (localId: LocalDictionaryId, value: ContentNode, keyPath?: KeyPath[], overwrite?: boolean) => void;
|
|
22
|
-
renameEditedContent: (localId: LocalDictionaryId, newKey: KeyPath["key"], keyPath?: KeyPath[]) => void;
|
|
23
|
-
removeEditedContent: (localId: LocalDictionaryId, keyPath: KeyPath[]) => void;
|
|
24
|
-
restoreEditedContent: (localId: LocalDictionaryId) => void;
|
|
25
|
-
clearEditedDictionaryContent: (localId: LocalDictionaryId) => void;
|
|
26
|
-
clearEditedContent: () => void;
|
|
27
|
-
getEditedContentValue: (localIdOrKey: LocalDictionaryId | string, keyPath: KeyPath[]) => ContentNode | undefined;
|
|
28
|
-
};
|
|
29
|
-
export declare const useGetEditedContentState: () => () => void;
|
|
30
|
-
export declare const usePostEditedContentState: () => () => void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const useEditorEnabled: () => {
|
|
2
|
-
enabled: import('solid-js').Accessor<boolean>;
|
|
3
|
-
};
|
|
4
|
-
export declare const useEditorEnabledState: () => readonly [import('solid-js').Accessor<boolean>, (value: boolean) => void];
|
|
5
|
-
export declare const useGetEditorEnabledState: () => () => void;
|
|
6
|
-
export declare const usePostEditorEnabledState: () => () => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EditorStateManager } from '@intlayer/editor';
|
|
2
|
-
import { IntlayerConfig } from '@intlayer/types/config';
|
|
3
|
-
import { Component, ParentProps } from 'solid-js';
|
|
4
|
-
export type EditorProviderProps = {
|
|
5
|
-
mode?: 'editor' | 'client';
|
|
6
|
-
configuration?: IntlayerConfig;
|
|
7
|
-
postMessage?: (data: any) => void;
|
|
8
|
-
allowedOrigins?: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare const useEditorStateManager: () => EditorStateManager;
|
|
11
|
-
export declare const EditorProvider: Component<ParentProps<EditorProviderProps>>;
|
|
12
|
-
export type { EditorProviderProps as CommunicatorProviderProps };
|
|
13
|
-
export type ConfigurationProviderProps = {
|
|
14
|
-
configuration?: IntlayerConfig;
|
|
15
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FileContent } from '@intlayer/editor';
|
|
2
|
-
import { KeyPath } from '@intlayer/types/keyPath';
|
|
3
|
-
export type { FileContent };
|
|
4
|
-
export declare const useFocusDictionary: () => {
|
|
5
|
-
focusedContent: import('solid-js').Accessor<FileContent | null>;
|
|
6
|
-
setFocusedContent: (value: FileContent | null) => void;
|
|
7
|
-
setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const useFocusDictionaryActions: () => {
|
|
10
|
-
setFocusedContent: (value: FileContent | null) => void;
|
|
11
|
-
setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from '@intlayer/editor';
|
|
2
|
-
export * from './CommunicatorContext';
|
|
3
|
-
export * from './ConfigurationContext';
|
|
4
|
-
export * from './DictionariesRecordContext';
|
|
5
|
-
export * from './EditedContentContext';
|
|
6
|
-
export * from './EditorEnabledContext';
|
|
7
|
-
export * from './EditorProvider';
|
|
8
|
-
export * from './FocusDictionaryContext';
|
|
9
|
-
export * from './useCrossFrameMessageListener';
|
|
10
|
-
export * from './useCrossFrameState';
|
|
11
|
-
export * from './useCrossURLPathState';
|
|
12
|
-
export * from './useIframeClickInterceptor';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MessageKey } from '@intlayer/editor';
|
|
2
|
-
import { Accessor } from 'solid-js';
|
|
3
|
-
export type CrossFrameStateOptions = {
|
|
4
|
-
emit?: boolean;
|
|
5
|
-
receive?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const useCrossFrameState: <S>(key: `${MessageKey}`, initialState?: S, options?: CrossFrameStateOptions) => [Accessor<S>, (value: S | ((prev: S) => S)) => void, () => void];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ContentSelectorWrapper';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Locale } from '@intlayer/types/allLocales';
|
|
2
|
-
import { KeyPath } from '@intlayer/types/keyPath';
|
|
3
|
-
import { Component } from 'solid-js';
|
|
4
|
-
type EditedContentRendererProps = {
|
|
5
|
-
dictionaryKey: string;
|
|
6
|
-
keyPath: KeyPath[];
|
|
7
|
-
children: string;
|
|
8
|
-
locale?: Locale;
|
|
9
|
-
};
|
|
10
|
-
export declare const useEditedContentRenderer: ({ dictionaryKey, keyPath, children, }: EditedContentRendererProps) => string;
|
|
11
|
-
export declare const EditedContentRenderer: Component<EditedContentRendererProps>;
|
|
12
|
-
export {};
|