solid-intlayer 8.0.0-canary.2 → 8.0.0-canary.4
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/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +1 -0
- package/dist/cjs/html/HTMLRenderer.cjs +1 -0
- package/dist/cjs/html/index.cjs +1 -0
- package/dist/cjs/html/types.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/index.mjs +1 -1
- package/dist/esm/getDictionary.mjs +1 -1
- package/dist/esm/getIntlayer.mjs +1 -1
- package/dist/esm/html/HTMLProvider.mjs +15 -0
- package/dist/esm/html/HTMLRenderer.mjs +51 -0
- package/dist/esm/html/index.mjs +10 -0
- package/dist/esm/html/types.mjs +1 -0
- package/dist/esm/index.mjs +41 -35
- package/dist/esm/markdown/MarkdownRenderer.mjs +28 -27
- package/dist/esm/plugins.mjs +4 -5
- package/dist/{plugins-CAuPi9pi.mjs → plugins-BKpuMxBh.mjs} +72 -85
- package/dist/plugins-CR0xYCzd.js +1 -0
- package/dist/types/html/HTMLProvider.d.ts +11 -0
- package/dist/types/html/HTMLRenderer.d.ts +50 -0
- package/dist/types/html/index.d.ts +3 -0
- package/dist/types/html/types.d.ts +44 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/markdown/MarkdownProvider.d.ts +5 -4
- package/dist/types/markdown/MarkdownRenderer.d.ts +2 -1
- package/dist/types/plugins.d.ts +18 -13
- package/package.json +7 -7
- package/dist/plugins-DJinCEPo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@intlayer/core");require("@intlayer/types");require("solid-js");require("../client/IntlayerProvider.cjs");require("@intlayer/config/built");const e=require("../../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@intlayer/core");require("@intlayer/types");require("solid-js");require("../client/IntlayerProvider.cjs");require("@intlayer/config/built");const e=require("../../plugins-CR0xYCzd.js");require("../client/useLocaleStorage.cjs");require("../client/useLocaleBase.cjs");require("../UI/ContentSelector.cjs");require("@intlayer/editor");require("./contexts/ConfigurationContext.cjs");require("./contexts/DictionariesRecordContext.cjs");require("./contexts/EditedContentContext.cjs");require("./contexts/EditorEnabledContext.cjs");require("./contexts/CommunicatorContext.cjs");require("./contexts/FocusDictionaryContext.cjs");exports.ContentSelectorRenderer=e.ContentSelectorRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../plugins-CR0xYCzd.js");exports.ContentSelectorRenderer=e.ContentSelectorRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core"),e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@intlayer/core"),e=require("../plugins-CR0xYCzd.js"),l=(t,i,n)=>{const r=[e.intlayerNodePlugins,e.solidNodePlugins,e.insertionPlugin,e.markdownPlugin,e.htmlPlugin,...n??[]];return o.getDictionary(t,i,r)};exports.getDictionary=l;
|
package/dist/cjs/getIntlayer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/core"),e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@intlayer/core"),e=require("../plugins-CR0xYCzd.js"),l=(t,n,r)=>{const o=[e.intlayerNodePlugins,e.solidNodePlugins,e.insertionPlugin,e.markdownPlugin,e.htmlPlugin,...r??[]];return i.getIntlayer(t,n,o)};exports.getIntlayer=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("solid-js"),n=e.createContext(),o=()=>e.useContext(n),r=t=>e.createComponent(n.Provider,{get value(){return{components:t.components}},get children(){return t.children}});exports.HTMLProvider=r;exports.useHTMLContext=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../web-Ch-xTpJg.js"),s=require("@intlayer/core"),r=require("solid-js"),a=require("../editor/useEditedContentRenderer.cjs"),T=require("./HTMLProvider.cjs"),M=()=>{const e={};for(const n of s.HTML_TAGS)e[n]=({children:t,...o})=>r.createComponent(c.Dynamic,r.mergeProps({component:n},o,{children:t}));return e},d=M(),i=(e,{components:n}={})=>{const t={...d,...n};return s.getHTML(e,t)},u=({components:e}={})=>{const n=T.useHTMLContext();return t=>i(t,{components:{...n?.components,...e}})},y=e=>{const n=u({components:e.components||e.userComponents}),t=()=>e.children||e.html||"",o=r.createMemo(()=>a.useEditedContentRenderer({dictionaryKey:e.dictionaryKey,keyPath:e.keyPath,children:t()})),m=()=>e.dictionaryKey&&e.keyPath&&typeof o()=="string"?o():t();return c.memo(()=>n(m()))};exports.HTMLRenderer=y;exports.defaultHTMLComponents=d;exports.renderHTML=i;exports.useHTMLRenderer=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./HTMLProvider.cjs"),e=require("./HTMLRenderer.cjs");exports.HTMLProvider=r.HTMLProvider;exports.useHTMLContext=r.useHTMLContext;exports.HTMLRenderer=e.HTMLRenderer;exports.defaultHTMLComponents=e.defaultHTMLComponents;exports.renderHTML=e.renderHTML;exports.useHTMLRenderer=e.useHTMLRenderer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./client/format/useIntl.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./client/format/useIntl.cjs"),i=require("./client/getBrowserLocale.cjs"),r=require("./client/IntlayerProvider.cjs"),a=require("./client/t.cjs"),c=require("./client/useDictionary.cjs"),s=require("./client/useDictionaryAsync.cjs"),l=require("./client/useDictionaryDynamic.cjs"),u=require("./client/useIntlayer.cjs"),d=require("./client/useLoadDynamic.cjs"),y=require("./client/useLocale.cjs"),L=require("./client/useLocaleBase.cjs"),e=require("./client/useLocaleStorage.cjs"),I=require("./getDictionary.cjs"),M=require("./getIntlayer.cjs"),k=require("./html/HTMLProvider.cjs"),o=require("./html/HTMLRenderer.cjs"),q=require("./markdown/compiler.cjs"),n=require("./markdown/MarkdownProvider.cjs"),g=require("./markdown/MarkdownRenderer.cjs");exports.useIntl=t.useIntl;exports.getBrowserLocale=i.getBrowserLocale;exports.IntlayerClientContext=r.IntlayerClientContext;exports.IntlayerProvider=r.IntlayerProvider;exports.IntlayerProviderContent=r.IntlayerProviderContent;exports.useIntlayerContext=r.useIntlayerContext;exports.t=a.t;exports.useDictionary=c.useDictionary;exports.useDictionaryAsync=s.useDictionaryAsync;exports.useDictionaryDynamic=l.useDictionaryDynamic;exports.useIntlayer=u.useIntlayer;exports.useLoadDynamic=d.useLoadDynamic;exports.useLocale=y.useLocale;exports.useLocaleBase=L.useLocaleBase;exports.localeCookie=e.localeCookie;exports.localeInStorage=e.localeInStorage;exports.setLocaleCookie=e.setLocaleCookie;exports.setLocaleInStorage=e.setLocaleInStorage;exports.useLocaleCookie=e.useLocaleCookie;exports.useLocaleStorage=e.useLocaleStorage;exports.getDictionary=I.getDictionary;exports.getIntlayer=M.getIntlayer;exports.HTMLProvider=k.HTMLProvider;exports.HTMLRenderer=o.HTMLRenderer;exports.renderHTML=o.renderHTML;exports.useHTMLRenderer=o.useHTMLRenderer;exports.compileMarkdown=q.compileMarkdown;exports.MarkdownProvider=n.MarkdownProvider;exports.useMarkdown=n.useMarkdown;exports.MarkdownRenderer=g.MarkdownRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@intlayer/core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@intlayer/core"),n=require("solid-js"),o=require("../editor/useEditedContentRenderer.cjs"),k=require("./MarkdownProvider.cjs"),h=e=>{const{renderMarkdown:r}=k.useMarkdown(),t=n.createMemo(()=>o.useEditedContentRenderer({dictionaryKey:e.dictionaryKey,keyPath:e.keyPath,children:e.children})),a=()=>typeof t()=="string"?t():e.children,{dictionaryKey:m,keyPath:w,locale:P,children:C,components:c,wrapper:i,forceBlock:y,preserveFrontmatter:s,tagfilter:l,...M}=e;return r(a(),{components:c,wrapper:i,forceBlock:y,preserveFrontmatter:s,tagfilter:l,...M})},u=e=>{const r=n.createMemo(()=>o.useEditedContentRenderer({dictionaryKey:e.dictionaryKey,keyPath:e.keyPath,children:e.children})),t=n.createMemo(()=>d.getMarkdownMetadata(r()));return n.createMemo(()=>d.getContentNodeByKeyPath(t(),e.metadataKeyPath))()};exports.MarkdownMetadataRenderer=u;exports.MarkdownRenderer=h;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../web-Ch-xTpJg.js");require("@intlayer/core");require("@intlayer/types");const e=require("../plugins-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../web-Ch-xTpJg.js");require("@intlayer/core");require("@intlayer/types");const e=require("../plugins-CR0xYCzd.js");require("./editor/useEditedContentRenderer.cjs");require("./IntlayerNode.cjs");require("./markdown/MarkdownProvider.cjs");require("./markdown/MarkdownRenderer.cjs");require("./solidElement/renderSolidElement.cjs");require("solid-js");exports.htmlPlugin=e.htmlPlugin;exports.insertionPlugin=e.insertionPlugin;exports.intlayerNodePlugins=e.intlayerNodePlugins;exports.markdownPlugin=e.markdownPlugin;exports.markdownStringPlugin=e.markdownStringPlugin;exports.solidNodePlugins=e.solidNodePlugins;
|
|
@@ -3,7 +3,7 @@ import "@intlayer/types";
|
|
|
3
3
|
import "solid-js";
|
|
4
4
|
import "../client/IntlayerProvider.mjs";
|
|
5
5
|
import "@intlayer/config/built";
|
|
6
|
-
import { C as S } from "../../plugins-
|
|
6
|
+
import { C as S } from "../../plugins-BKpuMxBh.mjs";
|
|
7
7
|
import "../client/useLocaleStorage.mjs";
|
|
8
8
|
import "../client/useLocaleBase.mjs";
|
|
9
9
|
import "../UI/ContentSelector.mjs";
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext as n, useContext as o, createComponent as r } from "solid-js";
|
|
2
|
+
const t = n(), s = () => o(t), u = (e) => r(t.Provider, {
|
|
3
|
+
get value() {
|
|
4
|
+
return {
|
|
5
|
+
components: e.components
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
get children() {
|
|
9
|
+
return e.children;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
u as HTMLProvider,
|
|
14
|
+
s as useHTMLContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { m as c, D as m } from "../../web-mv0y5CK4.mjs";
|
|
2
|
+
import { HTML_TAGS as s, getHTML as d } from "@intlayer/core";
|
|
3
|
+
import { createMemo as i, createComponent as a, mergeProps as u } from "solid-js";
|
|
4
|
+
import { useEditedContentRenderer as y } from "../editor/useEditedContentRenderer.mjs";
|
|
5
|
+
import { useHTMLContext as f } from "./HTMLProvider.mjs";
|
|
6
|
+
const T = () => {
|
|
7
|
+
const e = {};
|
|
8
|
+
for (const t of s)
|
|
9
|
+
e[t] = ({
|
|
10
|
+
children: n,
|
|
11
|
+
...o
|
|
12
|
+
}) => a(m, u({
|
|
13
|
+
component: t
|
|
14
|
+
}, o, {
|
|
15
|
+
children: n
|
|
16
|
+
}));
|
|
17
|
+
return e;
|
|
18
|
+
}, C = T(), M = (e, {
|
|
19
|
+
components: t
|
|
20
|
+
} = {}) => {
|
|
21
|
+
const n = {
|
|
22
|
+
...C,
|
|
23
|
+
...t
|
|
24
|
+
};
|
|
25
|
+
return d(e, n);
|
|
26
|
+
}, H = ({
|
|
27
|
+
components: e
|
|
28
|
+
} = {}) => {
|
|
29
|
+
const t = f();
|
|
30
|
+
return (n) => M(n, {
|
|
31
|
+
components: {
|
|
32
|
+
...t?.components,
|
|
33
|
+
...e
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, x = (e) => {
|
|
37
|
+
const t = H({
|
|
38
|
+
components: e.components || e.userComponents
|
|
39
|
+
}), n = () => e.children || e.html || "", o = i(() => y({
|
|
40
|
+
dictionaryKey: e.dictionaryKey,
|
|
41
|
+
keyPath: e.keyPath,
|
|
42
|
+
children: n()
|
|
43
|
+
})), r = () => e.dictionaryKey && e.keyPath && typeof o() == "string" ? o() : n();
|
|
44
|
+
return c(() => t(r()));
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
x as HTMLRenderer,
|
|
48
|
+
C as defaultHTMLComponents,
|
|
49
|
+
M as renderHTML,
|
|
50
|
+
H as useHTMLRenderer
|
|
51
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLProvider as o, useHTMLContext as n } from "./HTMLProvider.mjs";
|
|
2
|
+
import { HTMLRenderer as H, defaultHTMLComponents as L, renderHTML as M, useHTMLRenderer as T } from "./HTMLRenderer.mjs";
|
|
3
|
+
export {
|
|
4
|
+
o as HTMLProvider,
|
|
5
|
+
H as HTMLRenderer,
|
|
6
|
+
L as defaultHTMLComponents,
|
|
7
|
+
M as renderHTML,
|
|
8
|
+
n as useHTMLContext,
|
|
9
|
+
T as useHTMLRenderer
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,45 +1,51 @@
|
|
|
1
1
|
import { useIntl as r } from "./client/format/useIntl.mjs";
|
|
2
2
|
import { getBrowserLocale as a } from "./client/getBrowserLocale.mjs";
|
|
3
|
-
import { IntlayerClientContext as
|
|
4
|
-
import { t as
|
|
5
|
-
import { useDictionary as
|
|
3
|
+
import { IntlayerClientContext as m, IntlayerProvider as x, IntlayerProviderContent as l, useIntlayerContext as p } from "./client/IntlayerProvider.mjs";
|
|
4
|
+
import { t as i } from "./client/t.mjs";
|
|
5
|
+
import { useDictionary as c } from "./client/useDictionary.mjs";
|
|
6
6
|
import { useDictionaryAsync as u } from "./client/useDictionaryAsync.mjs";
|
|
7
|
-
import { useDictionaryDynamic as
|
|
8
|
-
import { useIntlayer as
|
|
9
|
-
import { useLoadDynamic as
|
|
10
|
-
import { useLocale as
|
|
7
|
+
import { useDictionaryDynamic as L } from "./client/useDictionaryDynamic.mjs";
|
|
8
|
+
import { useIntlayer as M } from "./client/useIntlayer.mjs";
|
|
9
|
+
import { useLoadDynamic as C } from "./client/useLoadDynamic.mjs";
|
|
10
|
+
import { useLocale as D } from "./client/useLocale.mjs";
|
|
11
11
|
import { useLocaleBase as v } from "./client/useLocaleBase.mjs";
|
|
12
|
-
import { localeCookie as
|
|
13
|
-
import { getDictionary as
|
|
14
|
-
import { getIntlayer as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { localeCookie as P, localeInStorage as T, setLocaleCookie as R, setLocaleInStorage as S, useLocaleCookie as B, useLocaleStorage as A } from "./client/useLocaleStorage.mjs";
|
|
13
|
+
import { getDictionary as h } from "./getDictionary.mjs";
|
|
14
|
+
import { getIntlayer as q } from "./getIntlayer.mjs";
|
|
15
|
+
import { HTMLProvider as E } from "./html/HTMLProvider.mjs";
|
|
16
|
+
import { HTMLRenderer as G, renderHTML as J, useHTMLRenderer as K } from "./html/HTMLRenderer.mjs";
|
|
17
|
+
import { compileMarkdown as O } from "./markdown/compiler.mjs";
|
|
18
|
+
import { MarkdownProvider as U, useMarkdown as V } from "./markdown/MarkdownProvider.mjs";
|
|
19
|
+
import { MarkdownRenderer as X } from "./markdown/MarkdownRenderer.mjs";
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
E as HTMLProvider,
|
|
22
|
+
G as HTMLRenderer,
|
|
23
|
+
m as IntlayerClientContext,
|
|
24
|
+
x as IntlayerProvider,
|
|
25
|
+
l as IntlayerProviderContent,
|
|
26
|
+
U as MarkdownProvider,
|
|
27
|
+
X as MarkdownRenderer,
|
|
28
|
+
O as compileMarkdown,
|
|
25
29
|
a as getBrowserLocale,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
R as
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
h as getDictionary,
|
|
31
|
+
q as getIntlayer,
|
|
32
|
+
P as localeCookie,
|
|
33
|
+
T as localeInStorage,
|
|
34
|
+
J as renderHTML,
|
|
35
|
+
R as setLocaleCookie,
|
|
36
|
+
S as setLocaleInStorage,
|
|
37
|
+
i as t,
|
|
38
|
+
c as useDictionary,
|
|
34
39
|
u as useDictionaryAsync,
|
|
35
|
-
|
|
40
|
+
L as useDictionaryDynamic,
|
|
41
|
+
K as useHTMLRenderer,
|
|
36
42
|
r as useIntl,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
M as useIntlayer,
|
|
44
|
+
p as useIntlayerContext,
|
|
45
|
+
C as useLoadDynamic,
|
|
46
|
+
D as useLocale,
|
|
41
47
|
v as useLocaleBase,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
B as useLocaleCookie,
|
|
49
|
+
A as useLocaleStorage,
|
|
50
|
+
V as useMarkdown
|
|
45
51
|
};
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { getMarkdownMetadata as l, getContentNodeByKeyPath as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { getMarkdownMetadata as l, getContentNodeByKeyPath as k } from "@intlayer/core";
|
|
2
|
+
import { createMemo as n } from "solid-js";
|
|
3
|
+
import { useEditedContentRenderer as o } from "../editor/useEditedContentRenderer.mjs";
|
|
4
|
+
import { useMarkdown as s } from "./MarkdownProvider.mjs";
|
|
5
|
+
const R = (e) => {
|
|
5
6
|
const {
|
|
6
|
-
renderMarkdown:
|
|
7
|
-
} =
|
|
7
|
+
renderMarkdown: r
|
|
8
|
+
} = s(), t = n(() => o({
|
|
8
9
|
dictionaryKey: e.dictionaryKey,
|
|
9
10
|
keyPath: e.keyPath,
|
|
10
11
|
children: e.children
|
|
11
|
-
}), a = typeof t == "string" ? t : e.children, {
|
|
12
|
-
dictionaryKey:
|
|
13
|
-
keyPath:
|
|
14
|
-
locale:
|
|
12
|
+
})), a = () => typeof t() == "string" ? t() : e.children, {
|
|
13
|
+
dictionaryKey: M,
|
|
14
|
+
keyPath: f,
|
|
15
|
+
locale: K,
|
|
15
16
|
children: P,
|
|
16
|
-
components:
|
|
17
|
-
wrapper:
|
|
18
|
-
forceBlock:
|
|
19
|
-
preserveFrontmatter:
|
|
20
|
-
tagfilter:
|
|
17
|
+
components: d,
|
|
18
|
+
wrapper: c,
|
|
19
|
+
forceBlock: i,
|
|
20
|
+
preserveFrontmatter: y,
|
|
21
|
+
tagfilter: m,
|
|
21
22
|
...h
|
|
22
23
|
} = e;
|
|
23
|
-
return
|
|
24
|
-
components:
|
|
25
|
-
wrapper:
|
|
26
|
-
forceBlock:
|
|
27
|
-
preserveFrontmatter:
|
|
28
|
-
tagfilter:
|
|
24
|
+
return r(a(), {
|
|
25
|
+
components: d,
|
|
26
|
+
wrapper: c,
|
|
27
|
+
forceBlock: i,
|
|
28
|
+
preserveFrontmatter: y,
|
|
29
|
+
tagfilter: m,
|
|
29
30
|
...h
|
|
30
31
|
});
|
|
31
|
-
},
|
|
32
|
-
const
|
|
32
|
+
}, x = (e) => {
|
|
33
|
+
const r = n(() => o({
|
|
33
34
|
dictionaryKey: e.dictionaryKey,
|
|
34
35
|
keyPath: e.keyPath,
|
|
35
36
|
children: e.children
|
|
36
|
-
}), t = l(
|
|
37
|
-
return
|
|
37
|
+
})), t = n(() => l(r()));
|
|
38
|
+
return n(() => k(t(), e.metadataKeyPath))();
|
|
38
39
|
};
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
x as MarkdownMetadataRenderer,
|
|
42
|
+
R as MarkdownRenderer
|
|
42
43
|
};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../web-mv0y5CK4.mjs";
|
|
2
2
|
import "@intlayer/core";
|
|
3
3
|
import "@intlayer/types";
|
|
4
|
-
import { h as
|
|
4
|
+
import { h as u, a as P, i as d, m as e, b as h, s as k } from "../plugins-BKpuMxBh.mjs";
|
|
5
5
|
import "./editor/useEditedContentRenderer.mjs";
|
|
6
6
|
import "./IntlayerNode.mjs";
|
|
7
7
|
import "./markdown/MarkdownProvider.mjs";
|
|
@@ -9,11 +9,10 @@ import "./markdown/MarkdownRenderer.mjs";
|
|
|
9
9
|
import "./solidElement/renderSolidElement.mjs";
|
|
10
10
|
import "solid-js";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
P as interpreterPluginsEnabledState,
|
|
12
|
+
u as htmlPlugin,
|
|
13
|
+
P as insertionPlugin,
|
|
15
14
|
d as intlayerNodePlugins,
|
|
16
|
-
|
|
15
|
+
e as markdownPlugin,
|
|
17
16
|
h as markdownStringPlugin,
|
|
18
17
|
k as solidNodePlugins
|
|
19
18
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { D as w } from "./web-mv0y5CK4.mjs";
|
|
2
|
-
import { isSameKeyPath as M, HTML_TAGS as H, getMarkdownMetadata as
|
|
3
|
-
import { NodeType as
|
|
4
|
-
import { createComponent as s, mergeProps as
|
|
5
|
-
import { useIntlayerContext as
|
|
2
|
+
import { isSameKeyPath as M, HTML_TAGS as H, getMarkdownMetadata as C, getHTML as S, splitInsertionTemplate as T } from "@intlayer/core";
|
|
3
|
+
import { NodeType as d } from "@intlayer/types";
|
|
4
|
+
import { createComponent as s, mergeProps as c, createMemo as h } from "solid-js";
|
|
5
|
+
import { useIntlayerContext as b } from "./esm/client/IntlayerProvider.mjs";
|
|
6
6
|
import "@intlayer/config/built";
|
|
7
7
|
import { EditedContentRenderer as K } from "./esm/editor/useEditedContentRenderer.mjs";
|
|
8
8
|
import { renderIntlayerNode as y } from "./esm/IntlayerNode.mjs";
|
|
9
9
|
import "./esm/markdown/MarkdownProvider.mjs";
|
|
10
|
-
import { MarkdownMetadataRenderer as
|
|
11
|
-
import { renderSolidElement as
|
|
10
|
+
import { MarkdownMetadataRenderer as v, MarkdownRenderer as I } from "./esm/markdown/MarkdownRenderer.mjs";
|
|
11
|
+
import { renderSolidElement as R } from "./esm/solidElement/renderSolidElement.mjs";
|
|
12
12
|
import "./esm/client/useLocaleStorage.mjs";
|
|
13
13
|
import "./esm/client/useLocaleBase.mjs";
|
|
14
|
-
import { ContentSelector as
|
|
14
|
+
import { ContentSelector as L } from "./esm/UI/ContentSelector.mjs";
|
|
15
15
|
import "@intlayer/editor";
|
|
16
16
|
import "./esm/editor/contexts/ConfigurationContext.mjs";
|
|
17
17
|
import "./esm/editor/contexts/DictionariesRecordContext.mjs";
|
|
18
18
|
import "./esm/editor/contexts/EditedContentContext.mjs";
|
|
19
19
|
import { useEditorEnabled as E } from "./esm/editor/contexts/EditorEnabledContext.mjs";
|
|
20
20
|
import "./esm/editor/contexts/CommunicatorContext.mjs";
|
|
21
|
-
import { useFocusDictionary as
|
|
21
|
+
import { useFocusDictionary as N } from "./esm/editor/contexts/FocusDictionaryContext.mjs";
|
|
22
22
|
const j = (e) => {
|
|
23
23
|
const {
|
|
24
|
-
focusedContent:
|
|
25
|
-
setFocusedContent:
|
|
26
|
-
} =
|
|
24
|
+
focusedContent: n,
|
|
25
|
+
setFocusedContent: t
|
|
26
|
+
} = N(), a = h(() => e.keyPath.filter((o) => o.type !== d.Translation)), r = () => t({
|
|
27
27
|
dictionaryKey: e.dictionaryKey,
|
|
28
28
|
keyPath: a()
|
|
29
|
-
}), u = h(() => (
|
|
30
|
-
return s(
|
|
29
|
+
}), u = h(() => (n?.dictionaryKey === e.dictionaryKey && (n?.keyPath?.length ?? 0) > 0 && M(n?.keyPath ?? [], a())) ?? !1);
|
|
30
|
+
return s(L, {
|
|
31
31
|
onPress: r,
|
|
32
32
|
get isSelecting() {
|
|
33
33
|
return u();
|
|
@@ -38,11 +38,11 @@ const j = (e) => {
|
|
|
38
38
|
});
|
|
39
39
|
}, f = (e) => {
|
|
40
40
|
const {
|
|
41
|
-
enabled:
|
|
41
|
+
enabled: n
|
|
42
42
|
} = E(), {
|
|
43
|
-
disableEditor:
|
|
44
|
-
} =
|
|
45
|
-
return
|
|
43
|
+
disableEditor: t
|
|
44
|
+
} = b();
|
|
45
|
+
return n() && !t ? s(j, c(e, {
|
|
46
46
|
get children() {
|
|
47
47
|
return e.children;
|
|
48
48
|
}
|
|
@@ -51,17 +51,17 @@ const j = (e) => {
|
|
|
51
51
|
id: "intlayer-node-plugin",
|
|
52
52
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
53
53
|
transform: (e, {
|
|
54
|
-
plugins:
|
|
54
|
+
plugins: n,
|
|
55
55
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
56
|
-
...
|
|
56
|
+
...t
|
|
57
57
|
}) => y({
|
|
58
|
-
...
|
|
59
|
-
value:
|
|
60
|
-
children: s(f,
|
|
58
|
+
...t,
|
|
59
|
+
value: t.children,
|
|
60
|
+
children: s(f, c(t, {
|
|
61
61
|
get children() {
|
|
62
|
-
return s(K,
|
|
62
|
+
return s(K, c(t, {
|
|
63
63
|
get children() {
|
|
64
|
-
return
|
|
64
|
+
return t.children;
|
|
65
65
|
}
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
@@ -71,30 +71,30 @@ const j = (e) => {
|
|
|
71
71
|
id: "solid-node-plugin",
|
|
72
72
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
73
73
|
transform: (e, {
|
|
74
|
-
plugins:
|
|
74
|
+
plugins: n,
|
|
75
75
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
76
|
-
...
|
|
76
|
+
...t
|
|
77
77
|
}) => y({
|
|
78
|
-
...
|
|
78
|
+
...t,
|
|
79
79
|
value: "[[solid-element]]",
|
|
80
|
-
children: s(f,
|
|
80
|
+
children: s(f, c(t, {
|
|
81
81
|
get children() {
|
|
82
|
-
return typeof Node < "u" && e instanceof Node ? e :
|
|
82
|
+
return typeof Node < "u" && e instanceof Node ? e : R(e);
|
|
83
83
|
}
|
|
84
84
|
}))
|
|
85
85
|
})
|
|
86
|
-
}, x = (e,
|
|
87
|
-
const
|
|
88
|
-
return
|
|
86
|
+
}, x = (e, n) => {
|
|
87
|
+
const t = T(e, n);
|
|
88
|
+
return t.isSimple, t.parts;
|
|
89
89
|
}, se = {
|
|
90
90
|
id: "insertion-plugin",
|
|
91
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
92
|
-
transform: (e,
|
|
93
|
-
const a = [...
|
|
94
|
-
type:
|
|
95
|
-
}], r = e[
|
|
96
|
-
return
|
|
97
|
-
...
|
|
91
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === d.Insertion,
|
|
92
|
+
transform: (e, n, t) => {
|
|
93
|
+
const a = [...n.keyPath, {
|
|
94
|
+
type: d.Insertion
|
|
95
|
+
}], r = e[d.Insertion];
|
|
96
|
+
return t(r, {
|
|
97
|
+
...n,
|
|
98
98
|
children: r,
|
|
99
99
|
keyPath: a,
|
|
100
100
|
plugins: [{
|
|
@@ -104,38 +104,38 @@ const j = (e) => {
|
|
|
104
104
|
const p = g(o, {
|
|
105
105
|
...m,
|
|
106
106
|
children: o,
|
|
107
|
-
plugins: [...(
|
|
107
|
+
plugins: [...(n.plugins ?? []).filter((i) => i.id !== "intlayer-node-plugin")]
|
|
108
108
|
});
|
|
109
109
|
return (i) => {
|
|
110
110
|
const l = x(p, i);
|
|
111
111
|
return g(l, {
|
|
112
112
|
...m,
|
|
113
|
-
plugins:
|
|
113
|
+
plugins: n.plugins,
|
|
114
114
|
children: l
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
}, ...
|
|
118
|
+
}, ...n.plugins ?? []]
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
}, D = {
|
|
122
122
|
id: "markdown-string-plugin",
|
|
123
123
|
canHandle: (e) => typeof e == "string",
|
|
124
|
-
transform: (e,
|
|
124
|
+
transform: (e, n, t) => {
|
|
125
125
|
const {
|
|
126
126
|
plugins: a,
|
|
127
127
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
128
128
|
...r
|
|
129
|
-
} =
|
|
129
|
+
} = n, u = C(e), m = t(u, {
|
|
130
130
|
plugins: [{
|
|
131
131
|
id: "markdown-metadata-plugin",
|
|
132
132
|
canHandle: (i) => typeof i == "string" || typeof i == "number" || typeof i == "boolean" || !i,
|
|
133
133
|
transform: (i, l) => y({
|
|
134
134
|
...l,
|
|
135
135
|
value: i,
|
|
136
|
-
children: s(f,
|
|
136
|
+
children: s(f, c(r, {
|
|
137
137
|
get children() {
|
|
138
|
-
return s(
|
|
138
|
+
return s(v, c(r, {
|
|
139
139
|
get metadataKeyPath() {
|
|
140
140
|
return l.keyPath;
|
|
141
141
|
},
|
|
@@ -148,11 +148,11 @@ const j = (e) => {
|
|
|
148
148
|
dictionaryKey: r.dictionaryKey,
|
|
149
149
|
keyPath: []
|
|
150
150
|
}), g = (i) => y({
|
|
151
|
-
...
|
|
151
|
+
...n,
|
|
152
152
|
value: e,
|
|
153
|
-
children: s(f,
|
|
153
|
+
children: s(f, c(r, {
|
|
154
154
|
get children() {
|
|
155
|
-
return s(
|
|
155
|
+
return s(I, c(r, i, {
|
|
156
156
|
children: e
|
|
157
157
|
}));
|
|
158
158
|
}
|
|
@@ -167,69 +167,56 @@ const j = (e) => {
|
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
},
|
|
170
|
+
}, ce = {
|
|
171
171
|
id: "markdown-plugin",
|
|
172
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
173
|
-
transform: (e,
|
|
174
|
-
const a = [...
|
|
175
|
-
type:
|
|
176
|
-
}], r = e[
|
|
177
|
-
return
|
|
178
|
-
...
|
|
172
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === d.Markdown,
|
|
173
|
+
transform: (e, n, t) => {
|
|
174
|
+
const a = [...n.keyPath, {
|
|
175
|
+
type: d.Markdown
|
|
176
|
+
}], r = e[d.Markdown];
|
|
177
|
+
return t(r, {
|
|
178
|
+
...n,
|
|
179
179
|
children: r,
|
|
180
180
|
keyPath: a,
|
|
181
|
-
plugins: [D, ...
|
|
181
|
+
plugins: [D, ...n.plugins ?? []]
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
}, A = () => {
|
|
185
185
|
const e = {};
|
|
186
|
-
for (const
|
|
187
|
-
e[
|
|
188
|
-
children:
|
|
186
|
+
for (const n of H)
|
|
187
|
+
e[n] = ({
|
|
188
|
+
children: t,
|
|
189
189
|
...a
|
|
190
|
-
}) => s(w,
|
|
191
|
-
component:
|
|
190
|
+
}) => s(w, c({
|
|
191
|
+
component: n
|
|
192
192
|
}, a, {
|
|
193
|
-
children:
|
|
193
|
+
children: t
|
|
194
194
|
}));
|
|
195
195
|
return e;
|
|
196
|
-
}, F = A(),
|
|
196
|
+
}, F = A(), de = {
|
|
197
197
|
id: "html-plugin",
|
|
198
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
198
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === d.HTML,
|
|
199
199
|
transform: (e) => {
|
|
200
|
-
const
|
|
200
|
+
const n = e[d.HTML], t = (u) => {
|
|
201
201
|
const o = {
|
|
202
202
|
...F,
|
|
203
203
|
...u
|
|
204
204
|
};
|
|
205
|
-
return
|
|
206
|
-
}, r = [
|
|
205
|
+
return S(n, o);
|
|
206
|
+
}, r = [t()];
|
|
207
207
|
return new Proxy(r, {
|
|
208
208
|
get(u, o, m) {
|
|
209
|
-
return o === "value" ?
|
|
209
|
+
return o === "value" ? n : o === "use" ? (g) => t(g) : Reflect.get(u, o, m);
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
}, ue = {
|
|
214
|
-
translation: !0,
|
|
215
|
-
enumeration: !0,
|
|
216
|
-
condition: !0,
|
|
217
|
-
insertion: !0,
|
|
218
|
-
nested: !0,
|
|
219
|
-
html: !0,
|
|
220
|
-
solidNode: !0,
|
|
221
|
-
solidIntlayerNode: !0,
|
|
222
|
-
solidInsertion: !0,
|
|
223
|
-
solidMarkdown: !0,
|
|
224
|
-
solidHtml: !0
|
|
225
213
|
};
|
|
226
214
|
export {
|
|
227
215
|
f as C,
|
|
228
216
|
se as a,
|
|
229
217
|
D as b,
|
|
230
|
-
|
|
231
|
-
ce as h,
|
|
218
|
+
de as h,
|
|
232
219
|
ae as i,
|
|
233
|
-
|
|
220
|
+
ce as m,
|
|
234
221
|
le as s
|
|
235
222
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const q=require("./web-Ch-xTpJg.js"),m=require("@intlayer/core"),s=require("@intlayer/types"),r=require("solid-js"),w=require("./cjs/client/IntlayerProvider.cjs");require("@intlayer/config/built");const T=require("./cjs/editor/useEditedContentRenderer.cjs"),p=require("./cjs/IntlayerNode.cjs");require("./cjs/markdown/MarkdownProvider.cjs");const P=require("./cjs/markdown/MarkdownRenderer.cjs"),N=require("./cjs/solidElement/renderSolidElement.cjs");require("./cjs/client/useLocaleStorage.cjs");require("./cjs/client/useLocaleBase.cjs");const M=require("./cjs/UI/ContentSelector.cjs");require("@intlayer/editor");require("./cjs/editor/contexts/ConfigurationContext.cjs");require("./cjs/editor/contexts/DictionariesRecordContext.cjs");require("./cjs/editor/contexts/EditedContentContext.cjs");const S=require("./cjs/editor/contexts/EditorEnabledContext.cjs");require("./cjs/editor/contexts/CommunicatorContext.cjs");const H=require("./cjs/editor/contexts/FocusDictionaryContext.cjs"),I=e=>{const{focusedContent:n,setFocusedContent:t}=H.useFocusDictionary(),l=r.createMemo(()=>e.keyPath.filter(a=>a.type!==s.NodeType.Translation)),o=()=>t({dictionaryKey:e.dictionaryKey,keyPath:l()}),c=r.createMemo(()=>(n?.dictionaryKey===e.dictionaryKey&&(n?.keyPath?.length??0)>0&&m.isSameKeyPath(n?.keyPath??[],l()))??!1);return r.createComponent(M.ContentSelector,{onPress:o,get isSelecting(){return c()},get children(){return e.children}})},y=e=>{const{enabled:n}=S.useEditorEnabled(),{disableEditor:t}=w.useIntlayerContext();return n()&&!t?r.createComponent(I,r.mergeProps(e,{get children(){return e.children}})):e.children},b={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:n,...t})=>p.renderIntlayerNode({...t,value:t.children,children:r.createComponent(y,r.mergeProps(t,{get children(){return r.createComponent(T.EditedContentRenderer,r.mergeProps(t,{get children(){return t.children}}))}}))})},K={id:"solid-node-plugin",canHandle:e=>typeof e=="object"&&e?.props!==void 0||typeof Node<"u"&&e instanceof Node,transform:(e,{plugins:n,...t})=>p.renderIntlayerNode({...t,value:"[[solid-element]]",children:r.createComponent(y,r.mergeProps(t,{get children(){return typeof Node<"u"&&e instanceof Node?e:N.renderSolidElement(e)}}))})},_=(e,n)=>{const t=m.splitInsertionTemplate(e,n);return t.isSimple,t.parts},E={id:"insertion-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.Insertion,transform:(e,n,t)=>{const l=[...n.keyPath,{type:s.NodeType.Insertion}],o=e[s.NodeType.Insertion];return t(o,{...n,children:o,keyPath:l,plugins:[{id:"insertion-string-plugin",canHandle:a=>typeof a=="string",transform:(a,u,g)=>{const f=g(a,{...u,children:a,plugins:[...(n.plugins??[]).filter(i=>i.id!=="intlayer-node-plugin")]});return i=>{const d=_(f,i);return g(d,{...u,plugins:n.plugins,children:d})}}},...n.plugins??[]]})}},h={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,t)=>{const{plugins:l,...o}=n,c=m.getMarkdownMetadata(e),u=t(c,{plugins:[{id:"markdown-metadata-plugin",canHandle:i=>typeof i=="string"||typeof i=="number"||typeof i=="boolean"||!i,transform:(i,d)=>p.renderIntlayerNode({...d,value:i,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownMetadataRenderer,r.mergeProps(o,{get metadataKeyPath(){return d.keyPath},children:e}))}}))})}],dictionaryKey:o.dictionaryKey,keyPath:[]}),g=i=>p.renderIntlayerNode({...n,value:e,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(P.MarkdownRenderer,r.mergeProps(o,i,{children:e}))}})),additionalProps:{metadata:u}}),f=g();return new Proxy(f,{get(i,d,C){return d==="value"?e:d==="metadata"?u:d==="use"?k=>g(k):Reflect.get(i,d,C)}})}},R={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.Markdown,transform:(e,n,t)=>{const l=[...n.keyPath,{type:s.NodeType.Markdown}],o=e[s.NodeType.Markdown];return t(o,{...n,children:o,keyPath:l,plugins:[h,...n.plugins??[]]})}},v=()=>{const e={};for(const n of m.HTML_TAGS)e[n]=({children:t,...l})=>r.createComponent(q.Dynamic,r.mergeProps({component:n},l,{children:t}));return e},x=v(),L={id:"html-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.HTML,transform:e=>{const n=e[s.NodeType.HTML],t=c=>{const a={...x,...c};return m.getHTML(n,a)},o=[t()];return new Proxy(o,{get(c,a,u){return a==="value"?n:a==="use"?g=>t(g):Reflect.get(c,a,u)}})}};exports.ContentSelectorRenderer=y;exports.htmlPlugin=L;exports.insertionPlugin=E;exports.intlayerNodePlugins=b;exports.markdownPlugin=R;exports.markdownStringPlugin=h;exports.solidNodePlugins=K;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, ParentProps } from 'solid-js';
|
|
2
|
+
import { HTMLComponents } from './types';
|
|
3
|
+
type HTMLProviderValue = {
|
|
4
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useHTMLContext: () => HTMLProviderValue | undefined;
|
|
7
|
+
export type HTMLProviderProps = ParentProps<{
|
|
8
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const HTMLProvider: Component<HTMLProviderProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { KeyPath } from '@intlayer/types';
|
|
2
|
+
import { Component, JSX } from 'solid-js';
|
|
3
|
+
import { HTMLComponents } from './types';
|
|
4
|
+
type HTMLTagComponent = (props: {
|
|
5
|
+
children?: JSX.Element;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}) => JSX.Element;
|
|
8
|
+
export declare const defaultHTMLComponents: Record<string, HTMLTagComponent>;
|
|
9
|
+
export type RenderHTMLProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Component overrides for HTML tags.
|
|
12
|
+
* Allows you to customize how specific HTML elements are rendered.
|
|
13
|
+
*/
|
|
14
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Renders HTML-like content to JSX with the provided components.
|
|
18
|
+
*
|
|
19
|
+
* This function does not use context from HTMLProvider. Use `useHTMLRenderer`
|
|
20
|
+
* hook if you want to leverage provider context.
|
|
21
|
+
*/
|
|
22
|
+
export declare const renderHTML: (content: string, { components }?: RenderHTMLProps) => JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Hook that returns a function to render HTML content.
|
|
25
|
+
*
|
|
26
|
+
* This hook considers the configuration from the `HTMLProvider` context if available,
|
|
27
|
+
* falling back to the provided components.
|
|
28
|
+
*/
|
|
29
|
+
export declare const useHTMLRenderer: ({ components }?: RenderHTMLProps) => (content: string) => JSX.Element;
|
|
30
|
+
export type HTMLRendererProps = RenderHTMLProps & {
|
|
31
|
+
/**
|
|
32
|
+
* The HTML content to render as a string.
|
|
33
|
+
*/
|
|
34
|
+
children?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Alias for children, used by the plugin.
|
|
37
|
+
*/
|
|
38
|
+
html?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Alias for components, used by the plugin.
|
|
41
|
+
*/
|
|
42
|
+
userComponents?: HTMLComponents<'permissive', {}>;
|
|
43
|
+
dictionaryKey?: string;
|
|
44
|
+
keyPath?: KeyPath[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Solid component that renders HTML-like content to JSX.
|
|
48
|
+
*/
|
|
49
|
+
export declare const HTMLRenderer: Component<HTMLRendererProps>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HTMLTagsType } from '@intlayer/core';
|
|
2
|
+
import { JSX } from 'solid-js';
|
|
3
|
+
/**
|
|
4
|
+
* Helper to extract specific props from the configuration value.
|
|
5
|
+
*/
|
|
6
|
+
type PropsFromConfig<Value> = Value extends true ? {} : Value extends object ? Value : {};
|
|
7
|
+
/**
|
|
8
|
+
* Common props for all elements
|
|
9
|
+
*/
|
|
10
|
+
type ElementProps = JSX.HTMLAttributes<HTMLElement>;
|
|
11
|
+
/**
|
|
12
|
+
* Solid Component type
|
|
13
|
+
*/
|
|
14
|
+
type SolidComponentType<P = {}> = (props: P) => JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Helper: Defines the mapping for the explicitly listed keys in T.
|
|
17
|
+
* Handles whether they are Required or Optional.
|
|
18
|
+
*/
|
|
19
|
+
type DefinedComponents<T, IsRequired extends boolean> = IsRequired extends true ? {
|
|
20
|
+
[K in keyof T]: SolidComponentType<ElementProps & PropsFromConfig<T[K]>>;
|
|
21
|
+
} : {
|
|
22
|
+
[K in keyof T]?: SolidComponentType<ElementProps & PropsFromConfig<T[K]>>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Helper: Defines the standard HTML tags NOT listed in T.
|
|
26
|
+
* These are always optional when included.
|
|
27
|
+
*/
|
|
28
|
+
type RestHTMLComponents<T> = {
|
|
29
|
+
[K in Exclude<keyof HTMLTagsType, keyof T>]?: SolidComponentType<ElementProps>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The supported modes for the HTMLComponents type.
|
|
33
|
+
*/
|
|
34
|
+
export type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict';
|
|
35
|
+
/**
|
|
36
|
+
* The main component definition with Mode support.
|
|
37
|
+
*/
|
|
38
|
+
export type HTMLComponents<Mode extends HTMLComponentMode = 'optional', T = {}> = Mode extends 'strict' ? DefinedComponents<T, true> : Mode extends 'inclusive' ? // Inclusive: Keys in T are required. Rest of HTML is optional.
|
|
39
|
+
DefinedComponents<T, true> & RestHTMLComponents<T> : Mode extends 'permissive' ? // Permissive: Keys in T optional. Rest of HTML optional. Any other string allowed.
|
|
40
|
+
DefinedComponents<T, false> & RestHTMLComponents<T> & {
|
|
41
|
+
[key: string]: SolidComponentType<ElementProps>;
|
|
42
|
+
} : // Optional (Default): Keys in T optional. Rest of HTML optional.
|
|
43
|
+
DefinedComponents<T, false> & RestHTMLComponents<T>;
|
|
44
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ declare module '@intlayer/core' {
|
|
|
7
7
|
export { getBrowserLocale, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntl, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage, } from './client/index';
|
|
8
8
|
export { getDictionary } from './getDictionary';
|
|
9
9
|
export { getIntlayer } from './getIntlayer';
|
|
10
|
+
export { HTMLProvider, HTMLRenderer, type HTMLRendererProps, type RenderHTMLProps, renderHTML, useHTMLRenderer, } from './html/index';
|
|
10
11
|
export type { IntlayerNode } from './IntlayerNode';
|
|
11
12
|
export { compileMarkdown, MarkdownProvider, MarkdownRenderer, useMarkdown, } from './markdown/index';
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { Component, JSXElement, ParentProps } from 'solid-js';
|
|
2
|
+
import { HTMLComponents } from '../html/types';
|
|
2
3
|
type RenderMarkdownOptions = {
|
|
3
|
-
components?:
|
|
4
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
4
5
|
wrapper?: any;
|
|
5
6
|
forceBlock?: boolean;
|
|
6
7
|
preserveFrontmatter?: boolean;
|
|
7
8
|
tagfilter?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type MarkdownProviderValue = {
|
|
10
|
-
renderMarkdown: (content: string, overrides?:
|
|
11
|
+
renderMarkdown: (content: string, overrides?: HTMLComponents<'permissive', {}> | RenderMarkdownOptions) => JSXElement;
|
|
11
12
|
};
|
|
12
13
|
export declare const MarkdownContext: import('solid-js').Context<MarkdownProviderValue | undefined>;
|
|
13
14
|
export type MarkdownProviderProps = ParentProps<{
|
|
14
|
-
components?:
|
|
15
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
15
16
|
wrapper?: any;
|
|
16
17
|
forceBlock?: boolean;
|
|
17
18
|
preserveFrontmatter?: boolean;
|
|
18
19
|
tagfilter?: boolean;
|
|
19
|
-
renderMarkdown?: (content: string, overrides?:
|
|
20
|
+
renderMarkdown?: (content: string, overrides?: HTMLComponents<'permissive', {}> | RenderMarkdownOptions) => JSXElement;
|
|
20
21
|
}>;
|
|
21
22
|
export declare const MarkdownProvider: Component<MarkdownProviderProps>;
|
|
22
23
|
export declare const useMarkdown: () => MarkdownProviderValue;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { KeyPath, LocalesValues } from '@intlayer/types';
|
|
2
2
|
import { Component } from 'solid-js';
|
|
3
|
+
import { HTMLComponents } from '../html/types';
|
|
3
4
|
type MarkdownRendererProps = {
|
|
4
5
|
dictionaryKey: string;
|
|
5
6
|
keyPath: KeyPath[];
|
|
6
7
|
locale?: LocalesValues;
|
|
7
8
|
children: string;
|
|
8
|
-
components?:
|
|
9
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
9
10
|
wrapper?: any;
|
|
10
11
|
forceBlock?: boolean;
|
|
11
12
|
preserveFrontmatter?: boolean;
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DeepTransformContent as DeepTransformContentCore,
|
|
1
|
+
import { DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core';
|
|
2
2
|
import { DeclaredLocales, LocalesValues, NodeType } from '@intlayer/types';
|
|
3
3
|
import { JSX } from 'solid-js';
|
|
4
|
+
import { HTMLComponents } from './html/types';
|
|
4
5
|
import { IntlayerNode } from './IntlayerNode';
|
|
5
6
|
/** ---------------------------------------------
|
|
6
7
|
* INTLAYER NODE PLUGIN
|
|
@@ -33,20 +34,28 @@ export declare const insertionPlugin: Plugins;
|
|
|
33
34
|
* MARKDOWN PLUGIN
|
|
34
35
|
*/
|
|
35
36
|
export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
|
|
36
|
-
metadata:
|
|
37
|
+
metadata: DeepTransformContent<string>;
|
|
38
|
+
use: (components?: HTMLComponents<'permissive', {}>) => JSX.Element;
|
|
37
39
|
}> : never;
|
|
38
40
|
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
39
41
|
export declare const markdownStringPlugin: Plugins;
|
|
40
|
-
export type MarkdownCond<T
|
|
42
|
+
export type MarkdownCond<T> = T extends {
|
|
41
43
|
nodeType: NodeType | string;
|
|
42
44
|
[NodeType.Markdown]: infer M;
|
|
43
45
|
metadata?: infer U;
|
|
46
|
+
tags?: infer U;
|
|
44
47
|
} ? {
|
|
45
|
-
use: (components
|
|
46
|
-
metadata: DeepTransformContent<U
|
|
47
|
-
}
|
|
48
|
+
use: (components?: HTMLComponents<'permissive', U>) => JSX.Element;
|
|
49
|
+
metadata: DeepTransformContent<U>;
|
|
50
|
+
} : never;
|
|
48
51
|
export declare const markdownPlugin: Plugins;
|
|
49
|
-
export type HTMLPluginCond<T
|
|
52
|
+
export type HTMLPluginCond<T> = T extends {
|
|
53
|
+
nodeType: NodeType | string;
|
|
54
|
+
[NodeType.HTML]: infer I;
|
|
55
|
+
tags?: infer U;
|
|
56
|
+
} ? {
|
|
57
|
+
use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
|
|
58
|
+
} : never;
|
|
50
59
|
/** HTML plugin. Replaces node with a function that takes components => JSX.Element. */
|
|
51
60
|
export declare const htmlPlugin: Plugins;
|
|
52
61
|
/** ---------------------------------------------
|
|
@@ -56,8 +65,8 @@ export interface IInterpreterPluginSolid<T, S, L extends LocalesValues> {
|
|
|
56
65
|
solidNode: SolidNodeCond<T>;
|
|
57
66
|
solidIntlayerNode: IntlayerNodeCond<T>;
|
|
58
67
|
solidInsertion: InsertionCond<T, S, L>;
|
|
59
|
-
solidMarkdown: MarkdownCond<T
|
|
60
|
-
solidHtml: HTMLPluginCond<T
|
|
68
|
+
solidMarkdown: MarkdownCond<T>;
|
|
69
|
+
solidHtml: HTMLPluginCond<T>;
|
|
61
70
|
}
|
|
62
71
|
/**
|
|
63
72
|
* Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.
|
|
@@ -72,7 +81,3 @@ export type IInterpreterPluginState = IInterpreterPluginStateCore & {
|
|
|
72
81
|
solidHtml: true;
|
|
73
82
|
};
|
|
74
83
|
export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
|
|
75
|
-
/**
|
|
76
|
-
* Default enabled state for the plugins. Those are necessary for the rendering on client side.
|
|
77
|
-
*/
|
|
78
|
-
export declare const interpreterPluginsEnabledState: IInterpreterPluginState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@intlayer/api": "8.0.0-canary.
|
|
78
|
-
"@intlayer/config": "8.0.0-canary.
|
|
79
|
-
"@intlayer/core": "8.0.0-canary.
|
|
80
|
-
"@intlayer/editor": "8.0.0-canary.
|
|
81
|
-
"@intlayer/types": "8.0.0-canary.
|
|
77
|
+
"@intlayer/api": "8.0.0-canary.4",
|
|
78
|
+
"@intlayer/config": "8.0.0-canary.4",
|
|
79
|
+
"@intlayer/core": "8.0.0-canary.4",
|
|
80
|
+
"@intlayer/editor": "8.0.0-canary.4",
|
|
81
|
+
"@intlayer/types": "8.0.0-canary.4"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@intlayer/unmerged-dictionaries-entry": "8.0.0-canary.
|
|
84
|
+
"@intlayer/unmerged-dictionaries-entry": "8.0.0-canary.4",
|
|
85
85
|
"@solidjs/testing-library": "0.8.10",
|
|
86
86
|
"@testing-library/jest-dom": "6.9.1",
|
|
87
87
|
"@testing-library/user-event": "14.6.1",
|
package/dist/plugins-DJinCEPo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const q=require("./web-Ch-xTpJg.js"),m=require("@intlayer/core"),s=require("@intlayer/types"),r=require("solid-js"),w=require("./cjs/client/IntlayerProvider.cjs");require("@intlayer/config/built");const N=require("./cjs/editor/useEditedContentRenderer.cjs"),p=require("./cjs/IntlayerNode.cjs");require("./cjs/markdown/MarkdownProvider.cjs");const f=require("./cjs/markdown/MarkdownRenderer.cjs"),T=require("./cjs/solidElement/renderSolidElement.cjs");require("./cjs/client/useLocaleStorage.cjs");require("./cjs/client/useLocaleBase.cjs");const S=require("./cjs/UI/ContentSelector.cjs");require("@intlayer/editor");require("./cjs/editor/contexts/ConfigurationContext.cjs");require("./cjs/editor/contexts/DictionariesRecordContext.cjs");require("./cjs/editor/contexts/EditedContentContext.cjs");const M=require("./cjs/editor/contexts/EditorEnabledContext.cjs");require("./cjs/editor/contexts/CommunicatorContext.cjs");const H=require("./cjs/editor/contexts/FocusDictionaryContext.cjs"),I=e=>{const{focusedContent:n,setFocusedContent:t}=H.useFocusDictionary(),a=r.createMemo(()=>e.keyPath.filter(l=>l.type!==s.NodeType.Translation)),o=()=>t({dictionaryKey:e.dictionaryKey,keyPath:a()}),c=r.createMemo(()=>(n?.dictionaryKey===e.dictionaryKey&&(n?.keyPath?.length??0)>0&&m.isSameKeyPath(n?.keyPath??[],a()))??!1);return r.createComponent(S.ContentSelector,{onPress:o,get isSelecting(){return c()},get children(){return e.children}})},y=e=>{const{enabled:n}=M.useEditorEnabled(),{disableEditor:t}=w.useIntlayerContext();return n()&&!t?r.createComponent(I,r.mergeProps(e,{get children(){return e.children}})):e.children},b={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:n,...t})=>p.renderIntlayerNode({...t,value:t.children,children:r.createComponent(y,r.mergeProps(t,{get children(){return r.createComponent(N.EditedContentRenderer,r.mergeProps(t,{get children(){return t.children}}))}}))})},E={id:"solid-node-plugin",canHandle:e=>typeof e=="object"&&e?.props!==void 0||typeof Node<"u"&&e instanceof Node,transform:(e,{plugins:n,...t})=>p.renderIntlayerNode({...t,value:"[[solid-element]]",children:r.createComponent(y,r.mergeProps(t,{get children(){return typeof Node<"u"&&e instanceof Node?e:T.renderSolidElement(e)}}))})},K=(e,n)=>{const t=m.splitInsertionTemplate(e,n);return t.isSimple,t.parts},_={id:"insertion-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.Insertion,transform:(e,n,t)=>{const a=[...n.keyPath,{type:s.NodeType.Insertion}],o=e[s.NodeType.Insertion];return t(o,{...n,children:o,keyPath:a,plugins:[{id:"insertion-string-plugin",canHandle:l=>typeof l=="string",transform:(l,u,g)=>{const P=g(l,{...u,children:l,plugins:[...(n.plugins??[]).filter(i=>i.id!=="intlayer-node-plugin")]});return i=>{const d=K(P,i);return g(d,{...u,plugins:n.plugins,children:d})}}},...n.plugins??[]]})}},h={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,n,t)=>{const{plugins:a,...o}=n,c=m.getMarkdownMetadata(e),u=t(c,{plugins:[{id:"markdown-metadata-plugin",canHandle:i=>typeof i=="string"||typeof i=="number"||typeof i=="boolean"||!i,transform:(i,d)=>p.renderIntlayerNode({...d,value:i,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(f.MarkdownMetadataRenderer,r.mergeProps(o,{get metadataKeyPath(){return d.keyPath},children:e}))}}))})}],dictionaryKey:o.dictionaryKey,keyPath:[]}),g=i=>p.renderIntlayerNode({...n,value:e,children:r.createComponent(y,r.mergeProps(o,{get children(){return r.createComponent(f.MarkdownRenderer,r.mergeProps(o,i,{children:e}))}})),additionalProps:{metadata:u}}),P=g();return new Proxy(P,{get(i,d,k){return d==="value"?e:d==="metadata"?u:d==="use"?C=>g(C):Reflect.get(i,d,k)}})}},R={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.Markdown,transform:(e,n,t)=>{const a=[...n.keyPath,{type:s.NodeType.Markdown}],o=e[s.NodeType.Markdown];return t(o,{...n,children:o,keyPath:a,plugins:[h,...n.plugins??[]]})}},v=()=>{const e={};for(const n of m.HTML_TAGS)e[n]=({children:t,...a})=>r.createComponent(q.Dynamic,r.mergeProps({component:n},a,{children:t}));return e},x=v(),L={id:"html-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===s.NodeType.HTML,transform:e=>{const n=e[s.NodeType.HTML],t=c=>{const l={...x,...c};return m.getHTML(n,l)},o=[t()];return new Proxy(o,{get(c,l,u){return l==="value"?n:l==="use"?g=>t(g):Reflect.get(c,l,u)}})}},j={translation:!0,enumeration:!0,condition:!0,insertion:!0,nested:!0,html:!0,solidNode:!0,solidIntlayerNode:!0,solidInsertion:!0,solidMarkdown:!0,solidHtml:!0};exports.ContentSelectorRenderer=y;exports.htmlPlugin=L;exports.insertionPlugin=_;exports.interpreterPluginsEnabledState=j;exports.intlayerNodePlugins=b;exports.markdownPlugin=R;exports.markdownStringPlugin=h;exports.solidNodePlugins=E;
|