solid-intlayer 9.8.1 → 9.8.2
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/LoadingBoundary.cjs +1 -0
- package/dist/cjs/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/analytics/useExperiment.cjs +1 -1
- package/dist/cjs/client/IntlayerProvider.cjs +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/client/t.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/useLoadDynamic.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -1
- package/dist/cjs/client/usePathname.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/markdown/runtime.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/server/useDictionary.cjs +1 -1
- package/dist/cjs/solidCompat.cjs +1 -0
- package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
- package/dist/esm/LoadingBoundary.mjs +12 -0
- package/dist/esm/analytics/useAnalytics.mjs +14 -11
- package/dist/esm/analytics/useExperiment.mjs +5 -4
- package/dist/esm/client/IntlayerProvider.mjs +28 -28
- package/dist/esm/client/getBrowserLocale.mjs +21 -21
- package/dist/esm/client/t.mjs +4 -4
- package/dist/esm/client/useDictionary.mjs +22 -14
- package/dist/esm/client/useDictionaryAsync.mjs +3 -3
- package/dist/esm/client/useDictionaryDynamic.mjs +26 -23
- package/dist/esm/client/useLoadDynamic.mjs +4 -5
- package/dist/esm/client/useLocale.mjs +15 -14
- package/dist/esm/client/useLocaleStorage.mjs +7 -7
- package/dist/esm/client/usePathname.mjs +9 -8
- package/dist/esm/client/useRewriteURL.mjs +6 -6
- package/dist/esm/client/useTraduction.mjs +5 -5
- package/dist/esm/editor/useEditor.mjs +11 -11
- package/dist/esm/getDictionary.mjs +3 -3
- package/dist/esm/html/HTMLProvider.mjs +5 -4
- package/dist/esm/html/HTMLRenderer.mjs +6 -6
- package/dist/esm/markdown/MarkdownProvider.mjs +20 -19
- package/dist/esm/markdown/MarkdownRenderer.mjs +27 -25
- package/dist/esm/markdown/runtime.mjs +8 -13
- package/dist/esm/plugins.mjs +76 -75
- package/dist/esm/server/useDictionary.mjs +9 -6
- package/dist/esm/solidCompat.mjs +48 -0
- package/dist/esm/solidElement/renderSolidElement.mjs +14 -16
- package/dist/rolldown-runtime-BocRIvOZ.js +1 -0
- package/dist/solid/IntlayerNode.jsx +10 -0
- package/dist/solid/LoadingBoundary.jsx +10 -0
- package/dist/solid/analytics/AnalyticsProvider.jsx +11 -0
- package/dist/solid/analytics/exposureSink.js +21 -0
- package/dist/solid/analytics/index.js +5 -0
- package/dist/solid/analytics/useAnalytics.jsx +58 -0
- package/dist/solid/analytics/useConversion.js +24 -0
- package/dist/solid/analytics/useExperiment.js +58 -0
- package/dist/solid/client/IntlayerProvider.jsx +81 -0
- package/dist/solid/client/getBrowserLocale.jsx +113 -0
- package/dist/solid/client/index.js +14 -0
- package/dist/solid/client/t.js +15 -0
- package/dist/solid/client/useContent.js +15 -0
- package/dist/solid/client/useDictionary.js +56 -0
- package/dist/solid/client/useDictionaryAsync.js +17 -0
- package/dist/solid/client/useDictionaryDynamic.js +105 -0
- package/dist/solid/client/useIntlayer.js +55 -0
- package/dist/solid/client/useLoadDynamic.js +134 -0
- package/dist/solid/client/useLocale.js +51 -0
- package/dist/solid/client/useLocaleBase.js +18 -0
- package/dist/solid/client/useLocaleStorage.js +52 -0
- package/dist/solid/client/usePathname.js +40 -0
- package/dist/solid/client/useRewriteURL.js +20 -0
- package/dist/solid/client/useTraduction.js +31 -0
- package/dist/solid/editor/ContentSelector.jsx +9 -0
- package/dist/solid/editor/EditorProvider.jsx +7 -0
- package/dist/solid/editor/useEditor.jsx +37 -0
- package/dist/solid/esm-BS5TZIsL.js +644 -0
- package/dist/solid/format/index.js +10 -0
- package/dist/solid/format/useCompact.js +14 -0
- package/dist/solid/format/useCurrency.js +15 -0
- package/dist/solid/format/useDate.js +24 -0
- package/dist/solid/format/useIntl.js +30 -0
- package/dist/solid/format/useList.js +14 -0
- package/dist/solid/format/useNumber.js +18 -0
- package/dist/solid/format/usePercentage.js +15 -0
- package/dist/solid/format/useRelativeTime.js +15 -0
- package/dist/solid/format/useUnit.js +14 -0
- package/dist/solid/getDictionary.js +16 -0
- package/dist/solid/getIntlayer.js +13 -0
- package/dist/solid/html/HTMLProvider.jsx +16 -0
- package/dist/solid/html/HTMLRenderer.jsx +45 -0
- package/dist/solid/html/index.js +3 -0
- package/dist/solid/html/types.js +0 -0
- package/dist/solid/index.js +21 -0
- package/dist/solid/isEnabled-C5NUhdhZ.js +100 -0
- package/dist/solid/markdown/MarkdownProvider.jsx +38 -0
- package/dist/solid/markdown/MarkdownRenderer.jsx +47 -0
- package/dist/solid/markdown/compiler.jsx +62 -0
- package/dist/solid/markdown/index.js +4 -0
- package/dist/solid/markdown/runtime.jsx +42 -0
- package/dist/solid/plugins.jsx +230 -0
- package/dist/solid/proxyKeys.js +13 -0
- package/dist/solid/server/index.js +1 -0
- package/dist/solid/server/useDictionary.js +29 -0
- package/dist/solid/solidCompat.js +155 -0
- package/dist/solid/solidElement/renderSolidElement.jsx +32 -0
- package/dist/types/LoadingBoundary.d.ts +12 -0
- package/dist/types/client/useDictionaryDynamic.d.ts +1 -1
- package/dist/types/client/useLoadDynamic.d.ts +4 -4
- package/dist/types/client/useLocaleStorage.d.ts +2 -2
- package/dist/types/format/useIntl.d.ts +1 -1
- package/dist/types/getDictionary.d.ts +5 -1
- package/dist/types/html/HTMLProvider.d.ts +1 -1
- package/dist/types/markdown/MarkdownProvider.d.ts +5 -1
- package/dist/types/server/useDictionary.d.ts +6 -6
- package/dist/types/solidCompat.d.ts +92 -0
- package/dist/types/solidElement/renderSolidElement.d.ts +1 -1
- package/package.json +25 -18
|
@@ -1,61 +1,64 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { resolveInterpreterLocale as
|
|
2
|
+
import { createAsyncValue as t, trackAsyncValue as n } from "../solidCompat.mjs";
|
|
3
|
+
import { IntlayerClientContext as r } from "./IntlayerProvider.mjs";
|
|
4
|
+
import { useDictionary as i } from "./useDictionary.mjs";
|
|
5
|
+
import { seedDynamicValue as a, useLoadDynamic as o } from "./useLoadDynamic.mjs";
|
|
6
|
+
import { resolveInterpreterLocale as s } from "@intlayer/core/interpreter";
|
|
7
|
+
import { createMemo as c, useContext as l } from "solid-js";
|
|
7
8
|
import { QUALIFIER_DYNAMIC_TYPES_KEY as u, getDictionarySelectorCacheKey as d, getPreloadedDictionary as f, isQualifiedDynamicLoaderMap as p, parseDictionarySelector as m, resolveDictionaryArgument as h, resolveQualifiedDynamicContentAsync as g } from "@intlayer/core/dictionaryManipulator";
|
|
8
9
|
// src/client/useDictionaryDynamic.ts
|
|
9
10
|
var _ = (_, v, y) => {
|
|
10
|
-
let b =
|
|
11
|
+
let b = l(r) ?? {}, { locale: x } = b, S = String(v);
|
|
11
12
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && p(_)) {
|
|
12
|
-
let { locale:
|
|
13
|
+
let { locale: r, selector: a } = m(y), l = () => m(h({
|
|
13
14
|
localeOrSelector: y,
|
|
14
15
|
contextLocale: x?.(),
|
|
15
16
|
contextVariant: b.variant?.(),
|
|
16
17
|
dictionaryKey: S
|
|
17
|
-
})).selector, f = _[u].includes("item") &&
|
|
18
|
+
})).selector, f = _[u].includes("item") && a?.item === void 0, p = () => r ?? x?.() ?? s();
|
|
18
19
|
if (!f) {
|
|
19
|
-
let e =
|
|
20
|
+
let e = o(() => {
|
|
20
21
|
let e = p();
|
|
21
22
|
return {
|
|
22
|
-
cacheKey: `${S}.${e}.${d(
|
|
23
|
+
cacheKey: `${S}.${e}.${d(l())}`,
|
|
23
24
|
locale: e
|
|
24
25
|
};
|
|
25
26
|
}, ({ locale: e }) => g({
|
|
26
27
|
loaderMap: _,
|
|
27
28
|
key: S,
|
|
28
29
|
locale: e,
|
|
29
|
-
selector:
|
|
30
|
+
selector: l(),
|
|
30
31
|
transform: (e) => e
|
|
31
32
|
}).then((e) => Array.isArray(e) ? e[0] : e));
|
|
32
|
-
return
|
|
33
|
+
return i(e, r);
|
|
33
34
|
}
|
|
34
|
-
let
|
|
35
|
+
let v = t(() => ({
|
|
35
36
|
locale: p(),
|
|
36
|
-
selector:
|
|
37
|
+
selector: l()
|
|
37
38
|
}), ({ locale: e, selector: t }) => g({
|
|
38
39
|
loaderMap: _,
|
|
39
40
|
key: S,
|
|
40
41
|
locale: e,
|
|
41
42
|
selector: t,
|
|
42
43
|
transform: (e) => e
|
|
43
|
-
})), C =
|
|
44
|
+
})), C = c(() => {
|
|
44
45
|
let t = v(), n = p();
|
|
45
46
|
return Array.isArray(t) ? t.map((t) => e(t, n)) : [];
|
|
46
47
|
});
|
|
47
|
-
return
|
|
48
|
-
v();
|
|
49
|
-
}), new Proxy(C, {
|
|
48
|
+
return n(v), new Proxy(C, {
|
|
50
49
|
get(e, t) {
|
|
51
|
-
|
|
50
|
+
let n = e(), r = n?.[t];
|
|
51
|
+
return typeof r == "function" ? r.bind(n) : r;
|
|
52
|
+
},
|
|
53
|
+
has(e, t) {
|
|
54
|
+
return t in e();
|
|
52
55
|
},
|
|
53
56
|
apply(e) {
|
|
54
57
|
return e();
|
|
55
58
|
}
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
|
-
let C = _, w = y, T = () => w ?? x?.() ??
|
|
61
|
+
let C = _, w = y, T = () => w ?? x?.() ?? s(), E = () => {
|
|
59
62
|
let e = T();
|
|
60
63
|
return {
|
|
61
64
|
cacheKey: `${S}.${e}`,
|
|
@@ -65,8 +68,8 @@ var _ = (_, v, y) => {
|
|
|
65
68
|
let t = C[e];
|
|
66
69
|
return t ? t() : Promise.reject(/* @__PURE__ */ Error(`No dynamic dictionary loader found for key "${S}" and locale "${e}".`));
|
|
67
70
|
}, O = f(C, T());
|
|
68
|
-
O &&
|
|
69
|
-
let k =
|
|
70
|
-
return
|
|
71
|
+
O && a(E(), O);
|
|
72
|
+
let k = o(E, D);
|
|
73
|
+
return i(k, w);
|
|
71
74
|
};
|
|
72
75
|
export { _ as useDictionaryDynamic };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PROXY_RESERVED_KEYS as e } from "../proxyKeys.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { createAsyncValue as t, trackAsyncValue as n } from "../solidCompat.mjs";
|
|
3
|
+
import { untrack as r } from "solid-js";
|
|
3
4
|
// src/client/useLoadDynamic.ts
|
|
4
5
|
var i = Symbol("NO_PENDING_PRIMITIVE_FALLBACK"), a = Symbol("LOADABLE_SETTLED_VALUE"), o = /* @__PURE__ */ new Map(), s = (e) => typeof e == "string" ? e : e.cacheKey, c = (e, t) => t.reduce((e, t) => {
|
|
5
6
|
if (e != null) return Reflect.get(Object(e), t);
|
|
@@ -48,9 +49,7 @@ var i = Symbol("NO_PENDING_PRIMITIVE_FALLBACK"), a = Symbol("LOADABLE_SETTLED_VA
|
|
|
48
49
|
}, h = (e) => {
|
|
49
50
|
if (!(e === null || typeof e != "object" && typeof e != "function")) return e[a];
|
|
50
51
|
}, g = (e, r) => {
|
|
51
|
-
let
|
|
52
|
-
return
|
|
53
|
-
i();
|
|
54
|
-
}), m(() => i());
|
|
52
|
+
let i = t(() => typeof e == "function" ? e() : e, (e) => u(e, r));
|
|
53
|
+
return n(i), m(i);
|
|
55
54
|
};
|
|
56
55
|
export { m as createLoadableProxy, s as getDynamicSourceCacheKey, u as loadDynamicValue, d as seedDynamicValue, h as unwrapLoadable, g as useLoadDynamic };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { createChangeEffect as e } from "../solidCompat.mjs";
|
|
2
|
+
import { IntlayerClientContext as t } from "./IntlayerProvider.mjs";
|
|
3
|
+
import { setLocaleInStorage as n } from "./useLocaleStorage.mjs";
|
|
4
|
+
import { internationalization as r } from "@intlayer/config/built";
|
|
5
|
+
import { useContext as i } from "solid-js";
|
|
5
6
|
// src/client/useLocale.ts
|
|
6
|
-
var { defaultLocale:
|
|
7
|
-
let
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
locale:
|
|
12
|
-
defaultLocale:
|
|
13
|
-
availableLocales:
|
|
7
|
+
var { defaultLocale: a, locales: o } = r ?? {}, s = ({ isCookieEnabled: r, onLocaleChange: s } = {}) => {
|
|
8
|
+
let c = i(t);
|
|
9
|
+
return e(() => c?.locale?.(), (e) => {
|
|
10
|
+
s && e !== void 0 && s(e);
|
|
11
|
+
}), {
|
|
12
|
+
locale: c?.locale,
|
|
13
|
+
defaultLocale: a,
|
|
14
|
+
availableLocales: o,
|
|
14
15
|
setLocale: (e) => {
|
|
15
|
-
|
|
16
|
+
o?.map(String).includes(e) ? (c?.setLocale(e), n(e, r ?? c?.isCookieEnabled ?? !0)) : console.error(`Locale ${e} is not available`);
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
|
-
export {
|
|
20
|
+
export { s as useLocale };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LocaleStorageClient as e, getCachedLocaleFromStorageClient as t, getLocaleFromStorageClient as n, localeStorageOptions as r, setLocaleInStorageClient as i } from "@intlayer/core/utils";
|
|
2
|
+
import { createMemo as a } from "solid-js";
|
|
3
3
|
// src/client/useLocaleStorage.ts
|
|
4
|
-
var o =
|
|
5
|
-
...
|
|
4
|
+
var o = t, s = /* @__PURE__ */ n(r), c = s, l = (e, t) => i(e, {
|
|
5
|
+
...r,
|
|
6
|
+
isCookieEnabled: t
|
|
7
|
+
}), u = l, d = (t) => a(() => e({
|
|
8
|
+
...r,
|
|
6
9
|
isCookieEnabled: t
|
|
7
|
-
}), u = l, d = (n) => e(() => t({
|
|
8
|
-
...i,
|
|
9
|
-
isCookieEnabled: n
|
|
10
10
|
})), f = d;
|
|
11
11
|
export { o as getLocaleInStorage, c as localeCookie, s as localeInStorage, u as setLocaleCookie, l as setLocaleInStorage, f as useLocaleCookie, d as useLocaleStorage };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { onMounted as e } from "../solidCompat.mjs";
|
|
2
|
+
import { createSignal as t } from "solid-js";
|
|
3
|
+
import { getPathWithoutLocale as n } from "@intlayer/core/localization";
|
|
3
4
|
// src/client/usePathname.ts
|
|
4
|
-
var
|
|
5
|
-
let [
|
|
5
|
+
var r = () => {
|
|
6
|
+
let [r, i] = t(typeof window < "u" ? window.location.pathname : "");
|
|
6
7
|
return e(() => {
|
|
7
8
|
if (typeof window > "u") return;
|
|
8
9
|
let e = () => {
|
|
9
|
-
|
|
10
|
+
i(window.location.pathname);
|
|
10
11
|
};
|
|
11
|
-
window.addEventListener("popstate", e),
|
|
12
|
-
}), () => r(
|
|
12
|
+
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
13
|
+
}), () => n(r());
|
|
13
14
|
};
|
|
14
|
-
export {
|
|
15
|
+
export { r as usePathname };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { createWatchEffect as e } from "../solidCompat.mjs";
|
|
2
|
+
import { useLocale as t } from "./useLocale.mjs";
|
|
3
|
+
import { routing as n } from "@intlayer/config/built";
|
|
4
4
|
import { getRewritePath as r } from "@intlayer/core/localization";
|
|
5
5
|
// src/client/useRewriteURL.ts
|
|
6
6
|
var i = () => {
|
|
7
|
-
let { locale: i } =
|
|
8
|
-
|
|
7
|
+
let { locale: i } = t(), a = n?.rewrite;
|
|
8
|
+
e(i, (e) => {
|
|
9
9
|
if (typeof window > "u" || !a) return;
|
|
10
|
-
let
|
|
10
|
+
let t = window.location.pathname, n = r(t, e, a);
|
|
11
11
|
n && n !== t && window.history.replaceState(window.history.state, "", n + window.location.search + window.location.hash);
|
|
12
12
|
});
|
|
13
13
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { getTranslation as t } from "@intlayer/core/interpreter";
|
|
3
|
+
import { internationalization as n } from "@intlayer/config/built";
|
|
4
|
+
import { useContext as r } from "solid-js";
|
|
5
5
|
// src/client/useTraduction.ts
|
|
6
6
|
var i = (i) => {
|
|
7
|
-
let { locale: a } =
|
|
8
|
-
return
|
|
7
|
+
let { locale: a } = r(e) ?? {};
|
|
8
|
+
return t(i, a?.() ?? n.defaultLocale);
|
|
9
9
|
};
|
|
10
10
|
export { i as useTranslation };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { createWatchEffect as t, onMounted as n } from "../solidCompat.mjs";
|
|
3
|
+
import { createSignal as r, onCleanup as i } from "solid-js";
|
|
3
4
|
import { isEnabled as a } from "@intlayer/editor/isEnabled";
|
|
4
5
|
// src/editor/useEditor.tsx
|
|
5
6
|
var o = () => {
|
|
6
7
|
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !a) return;
|
|
7
|
-
let { locale: o, setLocale: s } = e(), [c, l] =
|
|
8
|
-
|
|
8
|
+
let { locale: o, setLocale: s } = e(), [c, l] = r(null);
|
|
9
|
+
n(() => {
|
|
9
10
|
import("@intlayer/editor").then(({ initEditorClient: e }) => {
|
|
10
11
|
let t = e();
|
|
11
12
|
l(t);
|
|
12
13
|
}).catch(() => {});
|
|
13
|
-
}), t(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}), t
|
|
19
|
-
let e = c(), t = o();
|
|
14
|
+
}), t(c, (e) => {
|
|
15
|
+
if (e) return e.onLocaleChangeRequested(s);
|
|
16
|
+
}), t(() => ({
|
|
17
|
+
managerInstance: c(),
|
|
18
|
+
currentLocale: o()
|
|
19
|
+
}), ({ managerInstance: e, currentLocale: t }) => {
|
|
20
20
|
e && t && e.currentLocale.set(t);
|
|
21
|
-
}),
|
|
21
|
+
}), i(() => {
|
|
22
22
|
import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
23
23
|
e();
|
|
24
24
|
}).catch(() => {});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getDictionary as t } from "@intlayer/core/interpreter";
|
|
3
3
|
// src/getDictionary.ts
|
|
4
|
-
var n = (n, r) => {
|
|
5
|
-
let
|
|
6
|
-
return t(n, r,
|
|
4
|
+
var n = (n, r, i = e) => {
|
|
5
|
+
let a = typeof r == "object" && r ? r.locale : r;
|
|
6
|
+
return t(n, r, i(a));
|
|
7
7
|
};
|
|
8
8
|
export { n as getDictionary };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createComponent as
|
|
1
|
+
import { getContextProvider as e } from "../solidCompat.mjs";
|
|
2
|
+
import { createComponent as t } from "solid-js/web";
|
|
3
|
+
import { createContext as n, useContext as r } from "solid-js";
|
|
3
4
|
// src/html/HTMLProvider.tsx
|
|
4
|
-
var
|
|
5
|
+
var i = n(null), a = e(i), o = () => r(i), s = (e) => t(a, {
|
|
5
6
|
get value() {
|
|
6
7
|
return { components: e.components };
|
|
7
8
|
},
|
|
@@ -9,4 +10,4 @@ var r = e(), i = () => t(r), a = (e) => n(r.Provider, {
|
|
|
9
10
|
return e.children;
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
|
-
export {
|
|
13
|
+
export { s as HTMLProvider, o as useHTMLContext };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useHTMLContext as e } from "./HTMLProvider.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
4
|
import { VOID_HTML_ELEMENTS as a } from "@intlayer/core/transpiler";
|
|
5
5
|
// src/html/HTMLRenderer.tsx
|
|
6
6
|
var o = (e, { components: o = {} } = {}) => {
|
|
7
|
-
let s = Object.fromEntries(Object.entries(o).filter(([, e]) => e).map(([e,
|
|
8
|
-
if (typeof
|
|
9
|
-
if (typeof
|
|
7
|
+
let s = Object.fromEntries(Object.entries(o).filter(([, e]) => e).map(([e, t]) => [e, (e) => r(n, i({ component: t }, e))])), c = new Proxy(s, { get(e, t) {
|
|
8
|
+
if (typeof t == "string" && t in e) return e[t];
|
|
9
|
+
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return a.has(t) ? ({ children: e, ...a }) => r(n, i({ component: t }, a)) : (e) => r(n, i({ component: t }, e));
|
|
10
10
|
} });
|
|
11
|
-
return
|
|
11
|
+
return t(e, c);
|
|
12
12
|
}, s = ({ components: t } = {}) => {
|
|
13
13
|
let n = e();
|
|
14
14
|
return (e) => o(e, { components: {
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createComponent as
|
|
1
|
+
import { getContextProvider as e } from "../solidCompat.mjs";
|
|
2
|
+
import { compileMarkdown as t } from "./compiler.mjs";
|
|
3
|
+
import { createComponent as n } from "solid-js/web";
|
|
4
|
+
import { createContext as r, useContext as i } from "solid-js";
|
|
4
5
|
// src/markdown/MarkdownProvider.tsx
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
6
|
+
var a = r(null), o = e(a), s = (e) => {
|
|
7
|
+
let r = (n, r, i, a) => {
|
|
8
|
+
if (e.renderMarkdown) return e.renderMarkdown(n, r, i, a);
|
|
8
9
|
let o = {
|
|
9
|
-
forceBlock: r?.forceBlock ??
|
|
10
|
-
preserveFrontmatter: r?.preserveFrontmatter ??
|
|
11
|
-
tagfilter: r?.tagfilter ??
|
|
12
|
-
wrapper: a ||
|
|
10
|
+
forceBlock: r?.forceBlock ?? e.forceBlock,
|
|
11
|
+
preserveFrontmatter: r?.preserveFrontmatter ?? e.preserveFrontmatter,
|
|
12
|
+
tagfilter: r?.tagfilter ?? e.tagfilter,
|
|
13
|
+
wrapper: a || e.wrapper,
|
|
13
14
|
components: {
|
|
14
|
-
...
|
|
15
|
+
...e.components,
|
|
15
16
|
...i ?? {}
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
return
|
|
19
|
+
return t(n, o);
|
|
19
20
|
};
|
|
20
|
-
return
|
|
21
|
+
return n(o, {
|
|
21
22
|
get value() {
|
|
22
23
|
return {
|
|
23
|
-
components:
|
|
24
|
-
renderMarkdown:
|
|
24
|
+
components: e.components,
|
|
25
|
+
renderMarkdown: r
|
|
25
26
|
};
|
|
26
27
|
},
|
|
27
28
|
get children() {
|
|
28
|
-
return
|
|
29
|
+
return e.children;
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
|
-
},
|
|
32
|
-
let e =
|
|
32
|
+
}, c = () => {
|
|
33
|
+
let e = i(a);
|
|
33
34
|
if (!e) throw Error("useMarkdown must be used within a MarkdownProvider. To fix this error, wrap your component with <MarkdownProvider>.");
|
|
34
35
|
return e;
|
|
35
36
|
};
|
|
36
|
-
export {
|
|
37
|
+
export { a as MarkdownContext, s as MarkdownProvider, c as useMarkdown };
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { getMarkdownMetadata as
|
|
1
|
+
import { LoadingBoundary as e } from "../LoadingBoundary.mjs";
|
|
2
|
+
import { createAsyncValue as t } from "../solidCompat.mjs";
|
|
3
|
+
import { compileMarkdown as n } from "./compiler.mjs";
|
|
4
|
+
import { MarkdownContext as r, useMarkdown as i } from "./MarkdownProvider.mjs";
|
|
5
|
+
import { createComponent as a } from "solid-js/web";
|
|
6
|
+
import { getMarkdownMetadata as o } from "@intlayer/core/markdown";
|
|
7
|
+
import { createMemo as s, useContext as c } from "solid-js";
|
|
8
|
+
import { getContentNodeByKeyPath as l } from "@intlayer/core/dictionaryManipulator";
|
|
7
9
|
// src/markdown/MarkdownRenderer.tsx
|
|
8
|
-
var u = (
|
|
9
|
-
let
|
|
10
|
-
return (
|
|
10
|
+
var u = (e, t = {}) => n(e, t), d = (e = {}) => {
|
|
11
|
+
let t = c(r);
|
|
12
|
+
return (n) => t ? t.renderMarkdown(n, {
|
|
11
13
|
forceBlock: e.forceBlock,
|
|
12
14
|
preserveFrontmatter: e.preserveFrontmatter,
|
|
13
15
|
tagfilter: e.tagfilter
|
|
14
|
-
}, e.components, e.wrapper) : u(
|
|
15
|
-
}, f = (
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
], ([e, t, n, r,
|
|
16
|
+
}, e.components, e.wrapper) : u(n, e);
|
|
17
|
+
}, f = (n) => {
|
|
18
|
+
let o = c(r), { renderMarkdown: s } = i(), l = t(() => [
|
|
19
|
+
n.children,
|
|
20
|
+
n.forceBlock,
|
|
21
|
+
n.preserveFrontmatter,
|
|
22
|
+
n.tagfilter,
|
|
23
|
+
n.components,
|
|
24
|
+
n.wrapper
|
|
25
|
+
], ([e, t, n, r, i, a]) => s(e, {
|
|
24
26
|
forceBlock: t,
|
|
25
27
|
preserveFrontmatter: n,
|
|
26
28
|
tagfilter: r
|
|
27
29
|
}, {
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
},
|
|
31
|
-
return
|
|
30
|
+
...o?.components ?? {},
|
|
31
|
+
...i ?? {}
|
|
32
|
+
}, a));
|
|
33
|
+
return a(e, { get children() {
|
|
32
34
|
return l();
|
|
33
35
|
} });
|
|
34
36
|
}, p = (e) => {
|
|
35
|
-
let t =
|
|
36
|
-
return
|
|
37
|
+
let t = s(() => o(e.children));
|
|
38
|
+
return s(() => l(t(), e.metadataKeyPath))();
|
|
37
39
|
};
|
|
38
40
|
export { p as MarkdownMetadataRenderer, f as MarkdownRenderer, u as renderMarkdown, d as useMarkdownRenderer };
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { Dynamic as e, createComponent as t } from "solid-js/web";
|
|
1
|
+
import { Dynamic as e, createComponent as t, memo as n, mergeProps as r } from "solid-js/web";
|
|
2
|
+
import { createComponent as i } from "solid-js";
|
|
2
3
|
// src/markdown/runtime.tsx
|
|
3
|
-
var
|
|
4
|
-
createElement: (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
...r,
|
|
9
|
-
get children() {
|
|
10
|
-
return i.length === 1 ? i[0] : i;
|
|
11
|
-
}
|
|
12
|
-
}),
|
|
13
|
-
cloneElement: (e, n) => typeof e == "function" ? t(e, n) : e,
|
|
4
|
+
var a = {
|
|
5
|
+
createElement: (i, a, ...o) => t(e, r({ component: i }, a ?? {}, { get children() {
|
|
6
|
+
return n(() => o.length === 1)() ? o[0] : o;
|
|
7
|
+
} })),
|
|
8
|
+
cloneElement: (e, t) => typeof e == "function" ? i(e, t) : e,
|
|
14
9
|
Fragment: (e) => e.children,
|
|
15
10
|
normalizeProps: (e, t) => {
|
|
16
11
|
let n = {};
|
|
@@ -18,4 +13,4 @@ var n = {
|
|
|
18
13
|
return n;
|
|
19
14
|
}
|
|
20
15
|
};
|
|
21
|
-
export {
|
|
16
|
+
export { a as default, a as solidRuntime };
|