solid-intlayer 9.6.0 → 9.7.1
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/analytics/index.cjs +1 -1
- package/dist/cjs/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/analytics/useConversion.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/index.cjs +1 -1
- package/dist/cjs/client/t.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -1
- package/dist/cjs/html/HTMLProvider.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/esm/IntlayerNode.mjs +1 -2
- package/dist/esm/analytics/AnalyticsProvider.mjs +1 -2
- package/dist/esm/analytics/exposureSink.mjs +1 -2
- package/dist/esm/analytics/index.mjs +3 -3
- package/dist/esm/analytics/useAnalytics.mjs +11 -18
- package/dist/esm/analytics/useConversion.mjs +3 -4
- package/dist/esm/analytics/useExperiment.mjs +4 -5
- package/dist/esm/client/IntlayerProvider.mjs +21 -28
- package/dist/esm/client/getBrowserLocale.mjs +16 -17
- package/dist/esm/client/index.mjs +11 -11
- package/dist/esm/client/t.mjs +5 -6
- package/dist/esm/client/useContent.mjs +1 -2
- package/dist/esm/client/useDictionary.mjs +1 -2
- package/dist/esm/client/useDictionaryAsync.mjs +4 -5
- package/dist/esm/client/useDictionaryDynamic.mjs +20 -21
- package/dist/esm/client/useIntlayer.mjs +1 -2
- package/dist/esm/client/useLoadDynamic.mjs +1 -2
- package/dist/esm/client/useLocale.mjs +6 -11
- package/dist/esm/client/useLocaleBase.mjs +1 -2
- package/dist/esm/client/useLocaleStorage.mjs +1 -2
- package/dist/esm/client/usePathname.mjs +1 -2
- package/dist/esm/client/useRewriteURL.mjs +1 -2
- package/dist/esm/client/useTraduction.mjs +6 -7
- package/dist/esm/editor/ContentSelector.mjs +1 -2
- package/dist/esm/editor/EditorProvider.mjs +1 -2
- package/dist/esm/editor/useEditor.mjs +9 -5
- package/dist/esm/format/index.mjs +10 -10
- package/dist/esm/format/useCompact.mjs +1 -2
- package/dist/esm/format/useCurrency.mjs +1 -2
- package/dist/esm/format/useDate.mjs +1 -2
- package/dist/esm/format/useIntl.mjs +1 -2
- package/dist/esm/format/useList.mjs +1 -2
- package/dist/esm/format/useNumber.mjs +1 -2
- package/dist/esm/format/usePercentage.mjs +1 -2
- package/dist/esm/format/useRelativeTime.mjs +1 -2
- package/dist/esm/format/useUnit.mjs +1 -2
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getIntlayer.mjs +1 -2
- package/dist/esm/html/HTMLProvider.mjs +6 -7
- package/dist/esm/html/HTMLRenderer.mjs +7 -8
- package/dist/esm/index.mjs +20 -20
- package/dist/esm/markdown/MarkdownProvider.mjs +17 -18
- package/dist/esm/markdown/MarkdownRenderer.mjs +12 -13
- package/dist/esm/markdown/compiler.mjs +1 -2
- package/dist/esm/markdown/runtime.mjs +1 -2
- package/dist/esm/plugins.mjs +90 -91
- package/dist/esm/proxyKeys.mjs +1 -2
- package/dist/esm/server/index.mjs +1 -2
- package/dist/esm/server/useDictionary.mjs +1 -2
- package/dist/esm/solidElement/renderSolidElement.mjs +1 -2
- package/dist/esm-BnFj8Txc.js +1 -0
- package/dist/{esm-CtrrRmRn.mjs → esm-hfQR-yiQ.mjs} +77 -82
- package/dist/{isEnabled-BbWU6Ox5.mjs → isEnabled-DVKEZ2He.mjs} +1 -2
- package/package.json +15 -15
- package/dist/esm-CXlI80Tk.js +0 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { IntlayerClientContext as t } from "./IntlayerProvider.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useDictionary as n } from "./useDictionary.mjs";
|
|
4
|
+
import { seedDynamicValue as r, useLoadDynamic as i } from "./useLoadDynamic.mjs";
|
|
5
|
+
import { createMemo as a, createRenderEffect as o, createResource as s, useContext as c } from "solid-js";
|
|
6
|
+
import { resolveInterpreterLocale as l } from "@intlayer/core/interpreter";
|
|
7
7
|
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
|
-
|
|
8
|
+
// src/client/useDictionaryDynamic.ts
|
|
9
9
|
var _ = (_, v, y) => {
|
|
10
|
-
let b =
|
|
10
|
+
let b = c(t) ?? {}, { locale: x } = b, S = String(v);
|
|
11
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && p(_)) {
|
|
12
|
-
let { locale: t, selector:
|
|
12
|
+
let { locale: t, selector: r } = m(y), c = () => m(h({
|
|
13
13
|
localeOrSelector: y,
|
|
14
14
|
contextLocale: x?.(),
|
|
15
15
|
contextVariant: b.variant?.(),
|
|
16
16
|
dictionaryKey: S
|
|
17
|
-
})).selector, f = _[u].includes("item") &&
|
|
17
|
+
})).selector, f = _[u].includes("item") && r?.item === void 0, p = () => t ?? x?.() ?? l();
|
|
18
18
|
if (!f) {
|
|
19
|
-
let e =
|
|
19
|
+
let e = i(() => {
|
|
20
20
|
let e = p();
|
|
21
21
|
return {
|
|
22
|
-
cacheKey: `${S}.${e}.${d(
|
|
22
|
+
cacheKey: `${S}.${e}.${d(c())}`,
|
|
23
23
|
locale: e
|
|
24
24
|
};
|
|
25
25
|
}, ({ locale: e }) => g({
|
|
26
26
|
loaderMap: _,
|
|
27
27
|
key: S,
|
|
28
28
|
locale: e,
|
|
29
|
-
selector:
|
|
29
|
+
selector: c(),
|
|
30
30
|
transform: (e) => e
|
|
31
31
|
}).then((e) => Array.isArray(e) ? e[0] : e));
|
|
32
|
-
return
|
|
32
|
+
return n(e, t);
|
|
33
33
|
}
|
|
34
|
-
let [v] =
|
|
34
|
+
let [v] = s(() => ({
|
|
35
35
|
locale: p(),
|
|
36
|
-
selector:
|
|
36
|
+
selector: c()
|
|
37
37
|
}), ({ locale: e, selector: t }) => g({
|
|
38
38
|
loaderMap: _,
|
|
39
39
|
key: S,
|
|
40
40
|
locale: e,
|
|
41
41
|
selector: t,
|
|
42
42
|
transform: (e) => e
|
|
43
|
-
})), C =
|
|
43
|
+
})), C = a(() => {
|
|
44
44
|
let t = v(), n = p();
|
|
45
45
|
return Array.isArray(t) ? t.map((t) => e(t, n)) : [];
|
|
46
46
|
});
|
|
47
|
-
return
|
|
47
|
+
return o(() => {
|
|
48
48
|
v();
|
|
49
49
|
}), new Proxy(C, {
|
|
50
50
|
get(e, t) {
|
|
@@ -55,7 +55,7 @@ var _ = (_, v, y) => {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
let C = _, w = y, T = () => w ?? x?.() ??
|
|
58
|
+
let C = _, w = y, T = () => w ?? x?.() ?? l(), E = () => {
|
|
59
59
|
let e = T();
|
|
60
60
|
return {
|
|
61
61
|
cacheKey: `${S}.${e}`,
|
|
@@ -65,9 +65,8 @@ var _ = (_, v, y) => {
|
|
|
65
65
|
let t = C[e];
|
|
66
66
|
return t ? t() : Promise.reject(/* @__PURE__ */ Error(`No dynamic dictionary loader found for key "${S}" and locale "${e}".`));
|
|
67
67
|
}, O = f(C, T());
|
|
68
|
-
O &&
|
|
69
|
-
let k =
|
|
70
|
-
return
|
|
68
|
+
O && r(E(), O);
|
|
69
|
+
let k = i(E, D);
|
|
70
|
+
return n(k, w);
|
|
71
71
|
};
|
|
72
|
-
//#endregion
|
|
73
72
|
export { _ as useDictionaryDynamic };
|
|
@@ -2,7 +2,7 @@ import { getIntlayer as e } from "../getIntlayer.mjs";
|
|
|
2
2
|
import { IntlayerClientContext as t } from "./IntlayerProvider.mjs";
|
|
3
3
|
import { createMemo as n, useContext as r } from "solid-js";
|
|
4
4
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
5
|
-
|
|
5
|
+
// src/client/useIntlayer.ts
|
|
6
6
|
var a = (a, o) => {
|
|
7
7
|
let s = r(t) ?? {}, c = n(() => {
|
|
8
8
|
let t = s?.locale?.();
|
|
@@ -22,5 +22,4 @@ var a = (a, o) => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { a as useIntlayer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PROXY_RESERVED_KEYS as e } from "../proxyKeys.mjs";
|
|
2
2
|
import { createRenderEffect as t, createResource as n, untrack as r } from "solid-js";
|
|
3
|
-
|
|
3
|
+
// src/client/useLoadDynamic.ts
|
|
4
4
|
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
5
|
if (e != null) return Reflect.get(Object(e), t);
|
|
6
6
|
}, e), l = (e, t) => typeof e == "function" ? e(t) : e, u = (e, t) => {
|
|
@@ -53,5 +53,4 @@ var i = Symbol("NO_PENDING_PRIMITIVE_FALLBACK"), a = Symbol("LOADABLE_SETTLED_VA
|
|
|
53
53
|
i();
|
|
54
54
|
}), m(() => i());
|
|
55
55
|
};
|
|
56
|
-
//#endregion
|
|
57
56
|
export { m as createLoadableProxy, s as getDynamicSourceCacheKey, u as loadDynamicValue, d as seedDynamicValue, h as unwrapLoadable, g as useLoadDynamic };
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
+
import { setLocaleInStorage as t } from "./useLocaleStorage.mjs";
|
|
3
3
|
import { internationalization as n } from "@intlayer/config/built";
|
|
4
4
|
import { createEffect as r, on as i, useContext as a } from "solid-js";
|
|
5
|
-
|
|
5
|
+
// src/client/useLocale.ts
|
|
6
6
|
var { defaultLocale: o, locales: s } = n ?? {}, c = ({ isCookieEnabled: n, onLocaleChange: c } = {}) => {
|
|
7
|
-
let l = a(
|
|
7
|
+
let l = a(e);
|
|
8
8
|
return r(i(() => l?.locale?.(), (e) => {
|
|
9
9
|
c && e !== void 0 && c(e);
|
|
10
10
|
}, { defer: !0 })), {
|
|
11
11
|
locale: l?.locale,
|
|
12
12
|
defaultLocale: o,
|
|
13
13
|
availableLocales: s,
|
|
14
|
-
setLocale: (
|
|
15
|
-
|
|
16
|
-
console.error(`Locale ${t} is not available`);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
l?.setLocale(t), e(t, n ?? l?.isCookieEnabled ?? !0);
|
|
14
|
+
setLocale: (e) => {
|
|
15
|
+
s?.map(String).includes(e) ? (l?.setLocale(e), t(e, n ?? l?.isCookieEnabled ?? !0)) : console.error(`Locale ${e} is not available`);
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
18
|
};
|
|
23
|
-
//#endregion
|
|
24
19
|
export { c as useLocale };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
2
|
import { internationalization as t } from "@intlayer/config/built";
|
|
3
3
|
import { useContext as n } from "solid-js";
|
|
4
|
-
|
|
4
|
+
// src/client/useLocaleBase.ts
|
|
5
5
|
var { defaultLocale: r, locales: i } = t, a = () => {
|
|
6
6
|
let { locale: t, setLocale: a } = n(e) ?? {};
|
|
7
7
|
return {
|
|
@@ -11,5 +11,4 @@ var { defaultLocale: r, locales: i } = t, a = () => {
|
|
|
11
11
|
setLocale: a
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { a as useLocaleBase };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMemo as e } from "solid-js";
|
|
2
2
|
import { LocaleStorageClient as t, getCachedLocaleFromStorageClient as n, getLocaleFromStorageClient as r, localeStorageOptions as i, setLocaleInStorageClient as a } from "@intlayer/core/utils";
|
|
3
|
-
|
|
3
|
+
// src/client/useLocaleStorage.ts
|
|
4
4
|
var o = n, s = /* @__PURE__ */ r(i), c = s, l = (e, t) => a(e, {
|
|
5
5
|
...i,
|
|
6
6
|
isCookieEnabled: t
|
|
@@ -8,5 +8,4 @@ var o = n, s = /* @__PURE__ */ r(i), c = s, l = (e, t) => a(e, {
|
|
|
8
8
|
...i,
|
|
9
9
|
isCookieEnabled: n
|
|
10
10
|
})), f = d;
|
|
11
|
-
//#endregion
|
|
12
11
|
export { o as getLocaleInStorage, c as localeCookie, s as localeInStorage, u as setLocaleCookie, l as setLocaleInStorage, f as useLocaleCookie, d as useLocaleStorage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createEffect as e, createSignal as t, onCleanup as n } from "solid-js";
|
|
2
2
|
import { getPathWithoutLocale as r } from "@intlayer/core/localization";
|
|
3
|
-
|
|
3
|
+
// src/client/usePathname.ts
|
|
4
4
|
var i = () => {
|
|
5
5
|
let [i, a] = t(typeof window < "u" ? window.location.pathname : "");
|
|
6
6
|
return e(() => {
|
|
@@ -11,5 +11,4 @@ var i = () => {
|
|
|
11
11
|
window.addEventListener("popstate", e), n(() => window.removeEventListener("popstate", e));
|
|
12
12
|
}), () => r(i());
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { i as usePathname };
|
|
@@ -2,7 +2,7 @@ import { useLocale as e } from "./useLocale.mjs";
|
|
|
2
2
|
import { routing as t } from "@intlayer/config/built";
|
|
3
3
|
import { createEffect as n } from "solid-js";
|
|
4
4
|
import { getRewritePath as r } from "@intlayer/core/localization";
|
|
5
|
-
|
|
5
|
+
// src/client/useRewriteURL.ts
|
|
6
6
|
var i = () => {
|
|
7
7
|
let { locale: i } = e(), a = t?.rewrite;
|
|
8
8
|
n(() => {
|
|
@@ -11,5 +11,4 @@ var i = () => {
|
|
|
11
11
|
n && n !== t && window.history.replaceState(window.history.state, "", n + window.location.search + window.location.hash);
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { i as useRewriteURL };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "./IntlayerProvider.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { internationalization as t } from "@intlayer/config/built";
|
|
3
|
+
import { useContext as n } from "solid-js";
|
|
4
|
+
import { getTranslation as r } from "@intlayer/core/interpreter";
|
|
5
|
+
// src/client/useTraduction.ts
|
|
6
6
|
var i = (i) => {
|
|
7
|
-
let { locale: a } =
|
|
8
|
-
return
|
|
7
|
+
let { locale: a } = n(e) ?? {};
|
|
8
|
+
return r(i, a?.() ?? t.defaultLocale);
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { i as useTranslation };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dynamic as e, createComponent as t } from "solid-js/web";
|
|
2
2
|
import { isEnabled as n } from "@intlayer/editor/isEnabled";
|
|
3
|
-
|
|
3
|
+
// src/editor/ContentSelector.tsx
|
|
4
4
|
var r = (r) => process.env.INTLAYER_EDITOR_ENABLED === "false" || !n ? r.children : t(e, {
|
|
5
5
|
component: "intlayer-content-selector-wrapper",
|
|
6
6
|
get "attr:key-path"() {
|
|
@@ -13,5 +13,4 @@ var r = (r) => process.env.INTLAYER_EDITOR_ENABLED === "false" || !n ? r.childre
|
|
|
13
13
|
return r.children;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
//#endregion
|
|
17
16
|
export { r as ContentSelector };
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { createEffect as t, createSignal as n, onCleanup as r, onMount as i } from "solid-js";
|
|
3
3
|
import { isEnabled as a } from "@intlayer/editor/isEnabled";
|
|
4
|
-
|
|
4
|
+
// src/editor/useEditor.tsx
|
|
5
5
|
var o = () => {
|
|
6
6
|
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !a) return;
|
|
7
|
-
let { locale: o } = e(), [
|
|
7
|
+
let { locale: o, setLocale: s } = e(), [c, l] = n(null);
|
|
8
8
|
i(() => {
|
|
9
9
|
import("@intlayer/editor").then(({ initEditorClient: e }) => {
|
|
10
10
|
let t = e();
|
|
11
|
-
|
|
11
|
+
l(t);
|
|
12
12
|
}).catch(() => {});
|
|
13
13
|
}), t(() => {
|
|
14
|
-
let e =
|
|
14
|
+
let e = c();
|
|
15
|
+
if (!e) return;
|
|
16
|
+
let t = e.onLocaleChangeRequested(s);
|
|
17
|
+
r(t);
|
|
18
|
+
}), t(() => {
|
|
19
|
+
let e = c(), t = o();
|
|
15
20
|
e && t && e.currentLocale.set(t);
|
|
16
21
|
}), r(() => {
|
|
17
22
|
import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
@@ -19,5 +24,4 @@ var o = () => {
|
|
|
19
24
|
}).catch(() => {});
|
|
20
25
|
});
|
|
21
26
|
};
|
|
22
|
-
//#endregion
|
|
23
27
|
export { o as useEditor };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
export {
|
|
1
|
+
import { useCompact as e } from "./useCompact.mjs";
|
|
2
|
+
import { useCurrency as t } from "./useCurrency.mjs";
|
|
3
|
+
import { useDate as n } from "./useDate.mjs";
|
|
4
|
+
import { useIntl as r } from "./useIntl.mjs";
|
|
5
|
+
import { useList as i } from "./useList.mjs";
|
|
6
|
+
import { useNumber as a } from "./useNumber.mjs";
|
|
7
|
+
import { usePercentage as o } from "./usePercentage.mjs";
|
|
8
|
+
import { useRelativeTime as s } from "./useRelativeTime.mjs";
|
|
9
|
+
import { useUnit as c } from "./useUnit.mjs";
|
|
10
|
+
export { e as useCompact, t as useCurrency, n as useDate, r as useIntl, i as useList, a as useNumber, o as usePercentage, s as useRelativeTime, c as useUnit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { compact as t } from "@intlayer/core/formatters";
|
|
3
|
-
|
|
3
|
+
// src/format/useCompact.ts
|
|
4
4
|
var n = () => {
|
|
5
5
|
let { locale: n } = e();
|
|
6
6
|
return (...e) => t(e[0], {
|
|
@@ -8,5 +8,4 @@ var n = () => {
|
|
|
8
8
|
locale: e[1]?.locale ?? n()
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { n as useCompact };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { useContext as t } from "solid-js";
|
|
3
3
|
import { currency as n } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useCurrency.ts
|
|
5
5
|
var r = () => {
|
|
6
6
|
let { locale: r } = t(e) ?? {};
|
|
7
7
|
return (...e) => n(e[0], {
|
|
@@ -9,5 +9,4 @@ var r = () => {
|
|
|
9
9
|
locale: e[1]?.locale ?? r()
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as useCurrency };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { useContext as t } from "solid-js";
|
|
3
3
|
import { date as n, presets as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useDate.ts
|
|
5
5
|
var i = () => {
|
|
6
6
|
let { locale: i } = t(e) ?? {};
|
|
7
7
|
return (...e) => {
|
|
@@ -15,5 +15,4 @@ var i = () => {
|
|
|
15
15
|
return n(e[0], t);
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { i as useDate };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { createMemo as t, useContext as n } from "solid-js";
|
|
3
3
|
import { bindIntl as r } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useIntl.ts
|
|
5
5
|
var i = (i) => {
|
|
6
6
|
let a = n(e);
|
|
7
7
|
return t(() => {
|
|
@@ -9,5 +9,4 @@ var i = (i) => {
|
|
|
9
9
|
return r(e);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { i as useIntl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { list as t } from "@intlayer/core/formatters";
|
|
3
|
-
|
|
3
|
+
// src/format/useList.ts
|
|
4
4
|
var n = () => {
|
|
5
5
|
let { locale: n } = e();
|
|
6
6
|
return (...e) => t(e[0], {
|
|
@@ -8,5 +8,4 @@ var n = () => {
|
|
|
8
8
|
locale: e[1]?.locale ?? n()
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { n as useList };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { useContext as t } from "solid-js";
|
|
3
3
|
import { number as n } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useNumber.ts
|
|
5
5
|
var r = () => {
|
|
6
6
|
let { locale: r } = t(e) ?? {};
|
|
7
7
|
return (...e) => n(e[0], {
|
|
@@ -9,5 +9,4 @@ var r = () => {
|
|
|
9
9
|
locale: e[1]?.locale ?? r()
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as useNumber };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { useContext as t } from "solid-js";
|
|
3
3
|
import { percentage as n } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/usePercentage.ts
|
|
5
5
|
var r = () => {
|
|
6
6
|
let { locale: r } = t(e) ?? {};
|
|
7
7
|
return (...e) => n(e[0], {
|
|
@@ -9,5 +9,4 @@ var r = () => {
|
|
|
9
9
|
locale: e[1]?.locale ?? r()
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as usePercentage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntlayerClientContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { useContext as t } from "solid-js";
|
|
3
3
|
import { relativeTime as n } from "@intlayer/core/formatters";
|
|
4
|
-
|
|
4
|
+
// src/format/useRelativeTime.ts
|
|
5
5
|
var r = () => {
|
|
6
6
|
let { locale: r } = t(e) ?? {};
|
|
7
7
|
return (...e) => n(e[0], e[1], {
|
|
@@ -9,5 +9,4 @@ var r = () => {
|
|
|
9
9
|
locale: e[2]?.locale ?? r()
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as useRelativeTime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
2
|
import { units as t } from "@intlayer/core/formatters";
|
|
3
|
-
|
|
3
|
+
// src/format/useUnit.ts
|
|
4
4
|
var n = () => {
|
|
5
5
|
let { locale: n } = e();
|
|
6
6
|
return (...e) => t(e[0], {
|
|
@@ -8,5 +8,4 @@ var n = () => {
|
|
|
8
8
|
locale: e[1]?.locale ?? n()
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { n as useUnit };
|
|
@@ -1,9 +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
4
|
var n = (n, r) => {
|
|
5
5
|
let i = typeof r == "object" && r ? r.locale : r;
|
|
6
6
|
return t(n, r, e(i));
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { n as getDictionary };
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getIntlayer as t } from "@intlayer/core/interpreter";
|
|
3
|
-
|
|
3
|
+
// src/getIntlayer.ts
|
|
4
4
|
var n = (n, r) => {
|
|
5
5
|
let i = typeof r == "object" && r ? r.locale : r;
|
|
6
6
|
return t(n, r, e(i));
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { n as getIntlayer };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var r =
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
import { createComponent as n } from "solid-js/web";
|
|
3
|
+
// src/html/HTMLProvider.tsx
|
|
4
|
+
var r = e(), i = () => t(r), a = (e) => n(r.Provider, {
|
|
5
5
|
get value() {
|
|
6
|
-
return { components:
|
|
6
|
+
return { components: e.components };
|
|
7
7
|
},
|
|
8
8
|
get children() {
|
|
9
|
-
return
|
|
9
|
+
return e.children;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
//#endregion
|
|
13
12
|
export { a as HTMLProvider, i as useHTMLContext };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useHTMLContext as e } from "./HTMLProvider.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Dynamic as t, createComponent as n, mergeProps as r } from "solid-js/web";
|
|
3
|
+
import { getHTML as i } from "@intlayer/core/interpreter";
|
|
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, i]) => [e, (e) => n(t, r({ component: i }, e))])), c = new Proxy(s, { get(e, i) {
|
|
8
|
+
if (typeof i == "string" && i in e) return e[i];
|
|
9
|
+
if (typeof i == "string" && /^[a-z][a-z0-9]*$/.test(i)) return a.has(i) ? ({ children: e, ...a }) => n(t, r({ component: i }, a)) : (e) => n(t, r({ component: i }, e));
|
|
10
10
|
} });
|
|
11
|
-
return
|
|
11
|
+
return i(e, c);
|
|
12
12
|
}, s = ({ components: t } = {}) => {
|
|
13
13
|
let n = e();
|
|
14
14
|
return (e) => o(e, { components: {
|
|
@@ -16,5 +16,4 @@ var o = (e, { components: o = {} } = {}) => {
|
|
|
16
16
|
...t
|
|
17
17
|
} });
|
|
18
18
|
}, c = (e) => s({ components: e.components || e.userComponents })(e.children || e.html || "");
|
|
19
|
-
//#endregion
|
|
20
19
|
export { c as HTMLRenderer, o as renderHTML, s as useHTMLRenderer };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
1
|
+
import { AnalyticsProvider as e } from "./analytics/AnalyticsProvider.mjs";
|
|
2
|
+
import { useAnalytics as t } from "./analytics/useAnalytics.mjs";
|
|
3
|
+
import { useConversion as n } from "./analytics/useConversion.mjs";
|
|
4
|
+
import { useExperiment as r } from "./analytics/useExperiment.mjs";
|
|
5
|
+
import { getBrowserLocale as i } from "./client/getBrowserLocale.mjs";
|
|
6
|
+
import { IntlayerClientContext as a, IntlayerProvider as o, IntlayerProviderContent as s, useIntlayerContext as c } from "./client/IntlayerProvider.mjs";
|
|
7
|
+
import { localeCookie as l, localeInStorage as u, setLocaleCookie as d, setLocaleInStorage as f, useLocaleCookie as p, useLocaleStorage as m } from "./client/useLocaleStorage.mjs";
|
|
8
|
+
import { t as h } from "./client/t.mjs";
|
|
9
|
+
import { useDictionary as g } from "./client/useDictionary.mjs";
|
|
10
|
+
import { useDictionaryAsync as _ } from "./client/useDictionaryAsync.mjs";
|
|
11
|
+
import { useDictionaryDynamic as v } from "./client/useDictionaryDynamic.mjs";
|
|
12
|
+
import { useIntlayer as y } from "./client/useIntlayer.mjs";
|
|
13
|
+
import { useLoadDynamic as b } from "./client/useLoadDynamic.mjs";
|
|
14
|
+
import { useLocale as x } from "./client/useLocale.mjs";
|
|
15
|
+
import { useLocaleBase as S } from "./client/useLocaleBase.mjs";
|
|
16
|
+
import { usePathname as C } from "./client/usePathname.mjs";
|
|
17
|
+
import { useRewriteURL as w } from "./client/useRewriteURL.mjs";
|
|
18
|
+
import { getDictionary as T } from "./getDictionary.mjs";
|
|
19
|
+
import { getIntlayer as E } from "./getIntlayer.mjs";
|
|
20
20
|
import "./analytics/index.mjs";
|
|
21
|
-
export {
|
|
21
|
+
export { e as AnalyticsProvider, a as IntlayerClientContext, o as IntlayerProvider, s as IntlayerProviderContent, i as getBrowserLocale, T as getDictionary, E as getIntlayer, l as localeCookie, u as localeInStorage, d as setLocaleCookie, f as setLocaleInStorage, h as t, t as useAnalytics, n as useConversion, g as useDictionary, _ as useDictionaryAsync, v as useDictionaryDynamic, r as useExperiment, y as useIntlayer, c as useIntlayerContext, b as useLoadDynamic, x as useLocale, S as useLocaleBase, p as useLocaleCookie, m as useLocaleStorage, C as usePathname, w as useRewriteURL };
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
var i =
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
2
|
+
import { createContext as t, useContext as n } from "solid-js";
|
|
3
|
+
import { createComponent as r } from "solid-js/web";
|
|
4
|
+
// src/markdown/MarkdownProvider.tsx
|
|
5
|
+
var i = t(), a = (t) => {
|
|
6
|
+
let n = (n, r, i, a) => {
|
|
7
|
+
if (t.renderMarkdown) return t.renderMarkdown(n, r, i, a);
|
|
8
8
|
let o = {
|
|
9
|
-
forceBlock: r?.forceBlock ??
|
|
10
|
-
preserveFrontmatter: r?.preserveFrontmatter ??
|
|
11
|
-
tagfilter: r?.tagfilter ??
|
|
12
|
-
wrapper: a ||
|
|
9
|
+
forceBlock: r?.forceBlock ?? t.forceBlock,
|
|
10
|
+
preserveFrontmatter: r?.preserveFrontmatter ?? t.preserveFrontmatter,
|
|
11
|
+
tagfilter: r?.tagfilter ?? t.tagfilter,
|
|
12
|
+
wrapper: a || t.wrapper,
|
|
13
13
|
components: {
|
|
14
|
-
...
|
|
14
|
+
...t.components,
|
|
15
15
|
...i ?? {}
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
return e(
|
|
18
|
+
return e(n, o);
|
|
19
19
|
};
|
|
20
|
-
return
|
|
20
|
+
return r(i.Provider, {
|
|
21
21
|
get value() {
|
|
22
22
|
return {
|
|
23
|
-
components:
|
|
24
|
-
renderMarkdown:
|
|
23
|
+
components: t.components,
|
|
24
|
+
renderMarkdown: n
|
|
25
25
|
};
|
|
26
26
|
},
|
|
27
27
|
get children() {
|
|
28
|
-
return
|
|
28
|
+
return t.children;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}, o = () => {
|
|
32
|
-
let e =
|
|
32
|
+
let e = n(i);
|
|
33
33
|
if (!e) throw Error("useMarkdown must be used within a MarkdownProvider. To fix this error, wrap your component with <MarkdownProvider>.");
|
|
34
34
|
return e;
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { i as MarkdownContext, a as MarkdownProvider, o as useMarkdown };
|