solid-intlayer 8.7.11 → 8.7.13
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/README.md +27 -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/useContent.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleBase.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/ContentSelector.cjs +1 -1
- package/dist/cjs/editor/EditorProvider.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/format/useCompact.cjs +1 -1
- package/dist/cjs/format/useCurrency.cjs +1 -1
- package/dist/cjs/format/useDate.cjs +1 -1
- package/dist/cjs/format/useIntl.cjs +1 -1
- package/dist/cjs/format/useList.cjs +1 -1
- package/dist/cjs/format/useNumber.cjs +1 -1
- package/dist/cjs/format/usePercentage.cjs +1 -1
- package/dist/cjs/format/useRelativeTime.cjs +1 -1
- package/dist/cjs/format/useUnit.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.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/markdown/runtime.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/solidElement/renderSolidElement.cjs +1 -1
- package/dist/{types/client → client}/useContent.d.ts +1 -1
- package/dist/{types/client → client}/useDictionaryDynamic.d.ts +1 -1
- package/dist/{types/client → client}/useLocaleStorage.d.ts +4 -4
- package/dist/esm/client/IntlayerProvider.mjs +40 -2
- package/dist/esm/client/index.mjs +12 -4
- package/dist/esm/client/t.mjs +10 -2
- package/dist/esm/client/useContent.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +10 -2
- package/dist/esm/client/useDictionaryAsync.mjs +11 -2
- package/dist/esm/client/useDictionaryDynamic.mjs +12 -2
- package/dist/esm/client/useIntlayer.mjs +13 -2
- package/dist/esm/client/useLocale.mjs +24 -2
- package/dist/esm/client/useLocaleBase.mjs +15 -2
- package/dist/esm/client/useRewriteURL.mjs +15 -2
- package/dist/esm/client/useTraduction.mjs +1 -1
- package/dist/esm/editor/ContentSelector.mjs +5 -5
- package/dist/esm/editor/EditorProvider.mjs +5 -2
- package/dist/esm/editor/useEditor.mjs +22 -2
- package/dist/esm/format/useCompact.mjs +1 -1
- package/dist/esm/format/useCurrency.mjs +1 -1
- package/dist/esm/format/useDate.mjs +1 -1
- package/dist/esm/format/useIntl.mjs +1 -1
- package/dist/esm/format/useList.mjs +1 -1
- package/dist/esm/format/useNumber.mjs +1 -1
- package/dist/esm/format/usePercentage.mjs +1 -1
- package/dist/esm/format/useRelativeTime.mjs +1 -1
- package/dist/esm/format/useUnit.mjs +1 -1
- package/dist/esm/index.mjs +12 -4
- package/dist/esm/plugins.mjs +121 -108
- package/dist/plugins-D8_XlNwB.js +1 -0
- package/package.json +7 -7
- package/dist/client-D9wP8Q_u.mjs +0 -107
- package/dist/client-DrZ62_Q2.js +0 -1
- package/dist/plugins-JJ37BmVk.js +0 -1
- /package/dist/{types/IntlayerNode.d.ts → IntlayerNode.d.ts} +0 -0
- /package/dist/{types/client → client}/IntlayerProvider.d.ts +0 -0
- /package/dist/{types/client → client}/getBrowserLocale.d.ts +0 -0
- /package/dist/{types/client → client}/index.d.ts +0 -0
- /package/dist/{types/client → client}/t.d.ts +0 -0
- /package/dist/{types/client → client}/useDictionary.d.ts +0 -0
- /package/dist/{types/client → client}/useDictionaryAsync.d.ts +0 -0
- /package/dist/{types/client → client}/useIntlayer.d.ts +0 -0
- /package/dist/{types/client → client}/useLoadDynamic.d.ts +0 -0
- /package/dist/{types/client → client}/useLocale.d.ts +0 -0
- /package/dist/{types/client → client}/useLocaleBase.d.ts +0 -0
- /package/dist/{types/client → client}/useRewriteURL.d.ts +0 -0
- /package/dist/{types/client → client}/useTraduction.d.ts +0 -0
- /package/dist/{types/editor → editor}/ContentSelector.d.ts +0 -0
- /package/dist/{types/editor → editor}/EditorProvider.d.ts +0 -0
- /package/dist/{types/editor → editor}/useEditor.d.ts +0 -0
- /package/dist/{types/format → format}/index.d.ts +0 -0
- /package/dist/{types/format → format}/useCompact.d.ts +0 -0
- /package/dist/{types/format → format}/useCurrency.d.ts +0 -0
- /package/dist/{types/format → format}/useDate.d.ts +0 -0
- /package/dist/{types/format → format}/useIntl.d.ts +0 -0
- /package/dist/{types/format → format}/useList.d.ts +0 -0
- /package/dist/{types/format → format}/useNumber.d.ts +0 -0
- /package/dist/{types/format → format}/usePercentage.d.ts +0 -0
- /package/dist/{types/format → format}/useRelativeTime.d.ts +0 -0
- /package/dist/{types/format → format}/useUnit.d.ts +0 -0
- /package/dist/{types/getDictionary.d.ts → getDictionary.d.ts} +0 -0
- /package/dist/{types/getIntlayer.d.ts → getIntlayer.d.ts} +0 -0
- /package/dist/{types/html → html}/HTMLProvider.d.ts +0 -0
- /package/dist/{types/html → html}/HTMLRenderer.d.ts +0 -0
- /package/dist/{types/html → html}/index.d.ts +0 -0
- /package/dist/{types/html → html}/types.d.ts +0 -0
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{types/markdown → markdown}/MarkdownProvider.d.ts +0 -0
- /package/dist/{types/markdown → markdown}/MarkdownRenderer.d.ts +0 -0
- /package/dist/{types/markdown → markdown}/compiler.d.ts +0 -0
- /package/dist/{types/markdown → markdown}/index.d.ts +0 -0
- /package/dist/{types/markdown → markdown}/runtime.d.ts +0 -0
- /package/dist/{types/plugins.d.ts → plugins.d.ts} +0 -0
- /package/dist/{types/solidElement → solidElement}/renderSolidElement.d.ts +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
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
|
//#region src/editor/ContentSelector.tsx
|
|
4
|
-
var r = process.env.INTLAYER_EDITOR_ENABLED === "false"
|
|
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"() {
|
|
7
|
-
return JSON.stringify(
|
|
7
|
+
return JSON.stringify(r.keyPath);
|
|
8
8
|
},
|
|
9
9
|
get "attr:dictionary-key"() {
|
|
10
|
-
return
|
|
10
|
+
return r.dictionaryKey;
|
|
11
11
|
},
|
|
12
12
|
get children() {
|
|
13
|
-
return
|
|
13
|
+
return r.children;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
//#endregion
|
|
17
|
-
export {
|
|
17
|
+
export { r as ContentSelector };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useEditor as e } from "./useEditor.mjs";
|
|
2
|
+
//#region src/editor/EditorProvider.tsx
|
|
3
|
+
var t = ({ children: t }) => (e(), t);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t as EditorProvider };
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useIntlayerContext as e } from "../client/IntlayerProvider.mjs";
|
|
2
|
+
import { createEffect as t, createSignal as n, onCleanup as r, onMount as i } from "solid-js";
|
|
3
|
+
import { isEnabled as a } from "@intlayer/editor/isEnabled";
|
|
4
|
+
//#region src/editor/useEditor.tsx
|
|
5
|
+
var o = () => {
|
|
6
|
+
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !a) return;
|
|
7
|
+
let { locale: o } = e(), [s, c] = n(null);
|
|
8
|
+
i(() => {
|
|
9
|
+
import("@intlayer/editor").then(({ initEditorClient: e }) => {
|
|
10
|
+
c(e());
|
|
11
|
+
});
|
|
12
|
+
}), t(() => {
|
|
13
|
+
let e = s(), t = o();
|
|
14
|
+
e && t && e.currentLocale.set(t);
|
|
15
|
+
}), r(() => {
|
|
16
|
+
import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
17
|
+
e();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { o as useEditor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
//#region src/format/useCurrency.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
//#region src/format/useDate.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
//#region src/format/useIntl.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
//#region src/format/usePercentage.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
//#region src/format/useRelativeTime.ts
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { getIntlayer as e } from "./getIntlayer.mjs";
|
|
2
2
|
import { getDictionary as t } from "./getDictionary.mjs";
|
|
3
3
|
import { getBrowserLocale as n } from "./client/getBrowserLocale.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { localeCookie as r, localeInStorage as i, setLocaleCookie as a, setLocaleInStorage as o, useLocaleCookie as s, useLocaleStorage as c } from "./client/useLocaleStorage.mjs";
|
|
5
|
+
import { IntlayerClientContext as l, IntlayerProvider as u, IntlayerProviderContent as d, useIntlayerContext as f } from "./client/IntlayerProvider.mjs";
|
|
6
|
+
import { t as p } from "./client/t.mjs";
|
|
7
|
+
import { useDictionary as m } from "./client/useDictionary.mjs";
|
|
8
|
+
import { useDictionaryAsync as h } from "./client/useDictionaryAsync.mjs";
|
|
9
|
+
import { useLoadDynamic as g } from "./client/useLoadDynamic.mjs";
|
|
10
|
+
import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
|
|
11
|
+
import { useIntlayer as v } from "./client/useIntlayer.mjs";
|
|
12
|
+
import { useLocale as y } from "./client/useLocale.mjs";
|
|
13
|
+
import { useLocaleBase as b } from "./client/useLocaleBase.mjs";
|
|
14
|
+
import { useRewriteURL as x } from "./client/useRewriteURL.mjs";
|
|
15
|
+
export { l as IntlayerClientContext, u as IntlayerProvider, d as IntlayerProviderContent, n as getBrowserLocale, t as getDictionary, e as getIntlayer, r as localeCookie, i as localeInStorage, a as setLocaleCookie, o as setLocaleInStorage, p as t, m as useDictionary, h as useDictionaryAsync, _ as useDictionaryDynamic, v as useIntlayer, f as useIntlayerContext, g as useLoadDynamic, y as useLocale, b as useLocaleBase, s as useLocaleCookie, c as useLocaleStorage, x as useRewriteURL };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,47 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Suspense as _, lazy as v } from "solid-js";
|
|
1
|
+
import { renderIntlayerNode as e } from "./IntlayerNode.mjs";
|
|
2
|
+
import { renderSolidElement as t } from "./solidElement/renderSolidElement.mjs";
|
|
3
|
+
import { createComponent as n, mergeProps as r } from "solid-js/web";
|
|
4
|
+
import { editor as i, internationalization as a } from "@intlayer/config/built";
|
|
5
|
+
import { conditionPlugin as o, enumerationPlugin as s, fallbackPlugin as c, filePlugin as l, genderPlugin as u, nestedPlugin as d, splitInsertionTemplate as f, translationPlugin as p } from "@intlayer/core/interpreter";
|
|
6
|
+
import { getMarkdownMetadata as m } from "@intlayer/core/markdown";
|
|
7
|
+
import * as h from "@intlayer/types/nodeType";
|
|
8
|
+
import { Suspense as g, lazy as _ } from "solid-js";
|
|
10
9
|
//#region src/plugins.tsx
|
|
11
|
-
var
|
|
10
|
+
var v = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : _(() => import("./editor/ContentSelector.mjs").then((e) => ({ default: e.ContentSelector }))), y = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : _(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownMetadataRenderer }))), b = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? null : _(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownRenderer }))), x = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? null : _(() => import("./html/HTMLRenderer.mjs").then((e) => ({ default: e.HTMLRenderer }))), S = {
|
|
12
11
|
id: "intlayer-node-plugin",
|
|
13
12
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
14
|
-
transform: (
|
|
15
|
-
...
|
|
16
|
-
value:
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
transform: (t, { plugins: a, ...o }) => e({
|
|
14
|
+
...o,
|
|
15
|
+
value: o.children,
|
|
16
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
|
|
17
|
+
get fallback() {
|
|
18
|
+
return o.children;
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return n(v, r(o, { get children() {
|
|
22
|
+
return o.children;
|
|
23
|
+
} }));
|
|
24
|
+
}
|
|
25
|
+
}) : o.children
|
|
20
26
|
})
|
|
21
|
-
},
|
|
27
|
+
}, C = process.env.INTLAYER_NODE_TYPE_SOLID_NODE === "false" ? c : {
|
|
22
28
|
id: "solid-node-plugin",
|
|
23
29
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
24
|
-
transform: (
|
|
25
|
-
...
|
|
30
|
+
transform: (a, { plugins: o, ...s }) => e({
|
|
31
|
+
...s,
|
|
26
32
|
value: "[[solid-element]]",
|
|
27
|
-
children:
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
|
|
34
|
+
get fallback() {
|
|
35
|
+
return typeof Node < "u" && a instanceof Node ? a : t(a);
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return n(v, r(s, { get children() {
|
|
39
|
+
return typeof Node < "u" && a instanceof Node ? a : t(a);
|
|
40
|
+
} }));
|
|
41
|
+
}
|
|
42
|
+
}) : typeof Node < "u" && a instanceof Node ? a : t(a)
|
|
30
43
|
})
|
|
31
|
-
},
|
|
32
|
-
let n =
|
|
44
|
+
}, w = (e, t) => {
|
|
45
|
+
let n = f(e, t);
|
|
33
46
|
return n.isSimple, n.parts;
|
|
34
|
-
},
|
|
47
|
+
}, T = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? c : {
|
|
35
48
|
id: "insertion-plugin",
|
|
36
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
49
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === h.INSERTION,
|
|
37
50
|
transform: (e, t, n) => {
|
|
38
|
-
let r = [...t.keyPath, { type:
|
|
51
|
+
let r = [...t.keyPath, { type: h.INSERTION }], i = e[h.INSERTION];
|
|
39
52
|
return (e) => {
|
|
40
53
|
let a = {
|
|
41
54
|
id: "insertion-string-plugin",
|
|
42
55
|
canHandle: (e) => typeof e == "string",
|
|
43
56
|
transform: (n, r, i) => {
|
|
44
|
-
let a =
|
|
57
|
+
let a = w(i(n, {
|
|
45
58
|
...r,
|
|
46
59
|
children: n,
|
|
47
60
|
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
@@ -61,132 +74,132 @@ var y = process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === "false", b = process.en
|
|
|
61
74
|
});
|
|
62
75
|
};
|
|
63
76
|
}
|
|
64
|
-
},
|
|
77
|
+
}, E = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
|
|
65
78
|
id: "markdown-string-plugin",
|
|
66
79
|
canHandle: (e) => typeof e == "string",
|
|
67
|
-
transform: (
|
|
68
|
-
let { plugins:
|
|
80
|
+
transform: (t, a, o) => {
|
|
81
|
+
let { plugins: s, ...c } = a, l = o(m(t) ?? {}, {
|
|
69
82
|
plugins: [{
|
|
70
83
|
id: "markdown-metadata-plugin",
|
|
71
84
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
72
|
-
transform: (
|
|
73
|
-
...
|
|
74
|
-
value:
|
|
75
|
-
children:
|
|
76
|
-
return
|
|
77
|
-
fallback:
|
|
85
|
+
transform: (a, o) => e({
|
|
86
|
+
...o,
|
|
87
|
+
value: a,
|
|
88
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(v, r(c, { get children() {
|
|
89
|
+
return n(g, {
|
|
90
|
+
fallback: t,
|
|
78
91
|
get children() {
|
|
79
|
-
return
|
|
92
|
+
return n(y, r(c, {
|
|
80
93
|
get metadataKeyPath() {
|
|
81
|
-
return
|
|
94
|
+
return o.keyPath;
|
|
82
95
|
},
|
|
83
|
-
children:
|
|
96
|
+
children: t
|
|
84
97
|
}));
|
|
85
98
|
}
|
|
86
99
|
});
|
|
87
|
-
} })) :
|
|
88
|
-
fallback:
|
|
100
|
+
} })) : n(g, {
|
|
101
|
+
fallback: t,
|
|
89
102
|
get children() {
|
|
90
|
-
return
|
|
103
|
+
return n(y, r(c, {
|
|
91
104
|
get metadataKeyPath() {
|
|
92
|
-
return
|
|
105
|
+
return o.keyPath;
|
|
93
106
|
},
|
|
94
|
-
children:
|
|
107
|
+
children: t
|
|
95
108
|
}));
|
|
96
109
|
}
|
|
97
110
|
})
|
|
98
111
|
})
|
|
99
112
|
}],
|
|
100
|
-
dictionaryKey:
|
|
113
|
+
dictionaryKey: c.dictionaryKey,
|
|
101
114
|
keyPath: []
|
|
102
|
-
}),
|
|
103
|
-
...
|
|
104
|
-
value:
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
get children() {
|
|
109
|
-
return
|
|
110
|
-
components:
|
|
111
|
-
children:
|
|
115
|
+
}), u = (o) => e({
|
|
116
|
+
...a,
|
|
117
|
+
value: t,
|
|
118
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
|
|
119
|
+
fallback: t,
|
|
120
|
+
get children() {
|
|
121
|
+
return n(v, r(c, { get children() {
|
|
122
|
+
return n(b, r(c, {
|
|
123
|
+
components: o,
|
|
124
|
+
children: t
|
|
112
125
|
}));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
fallback:
|
|
126
|
+
} }));
|
|
127
|
+
}
|
|
128
|
+
}) : n(g, {
|
|
129
|
+
fallback: t,
|
|
117
130
|
get children() {
|
|
118
|
-
return
|
|
119
|
-
components:
|
|
120
|
-
children:
|
|
131
|
+
return n(b, r(c, {
|
|
132
|
+
components: o,
|
|
133
|
+
children: t
|
|
121
134
|
}));
|
|
122
135
|
}
|
|
123
136
|
}),
|
|
124
|
-
additionalProps: { metadata:
|
|
125
|
-
}),
|
|
126
|
-
return new Proxy(
|
|
127
|
-
return
|
|
137
|
+
additionalProps: { metadata: l }
|
|
138
|
+
}), d = u();
|
|
139
|
+
return new Proxy(d, { get(e, n, r) {
|
|
140
|
+
return n === "value" ? t : n === "metadata" ? l : n === "use" ? (e) => u(e) : Reflect.get(e, n, r);
|
|
128
141
|
} });
|
|
129
142
|
}
|
|
130
|
-
},
|
|
143
|
+
}, D = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? c : {
|
|
131
144
|
id: "markdown-plugin",
|
|
132
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
145
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === h.MARKDOWN,
|
|
133
146
|
transform: (e, t, n) => {
|
|
134
|
-
let r = [...t.keyPath, { type:
|
|
147
|
+
let r = [...t.keyPath, { type: h.MARKDOWN }], i = e[h.MARKDOWN];
|
|
135
148
|
return n(i, {
|
|
136
149
|
...t,
|
|
137
150
|
children: i,
|
|
138
151
|
keyPath: r,
|
|
139
|
-
plugins: [
|
|
152
|
+
plugins: [E, ...t.plugins ?? []]
|
|
140
153
|
});
|
|
141
154
|
}
|
|
142
|
-
},
|
|
155
|
+
}, O = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? c : {
|
|
143
156
|
id: "html-plugin",
|
|
144
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
145
|
-
transform: (
|
|
146
|
-
let
|
|
147
|
-
...
|
|
148
|
-
value:
|
|
149
|
-
children:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
get children() {
|
|
153
|
-
return
|
|
154
|
-
html:
|
|
155
|
-
components:
|
|
157
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === h.HTML,
|
|
158
|
+
transform: (t, a) => {
|
|
159
|
+
let o = t[h.HTML], { plugins: s, ...c } = a, l = (t) => e({
|
|
160
|
+
...c,
|
|
161
|
+
value: o,
|
|
162
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? n(g, {
|
|
163
|
+
fallback: o,
|
|
164
|
+
get children() {
|
|
165
|
+
return n(v, r(c, { get children() {
|
|
166
|
+
return n(x, r(c, {
|
|
167
|
+
html: o,
|
|
168
|
+
components: t
|
|
156
169
|
}));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
fallback:
|
|
170
|
+
} }));
|
|
171
|
+
}
|
|
172
|
+
}) : n(g, {
|
|
173
|
+
fallback: o,
|
|
161
174
|
get children() {
|
|
162
|
-
return
|
|
163
|
-
html:
|
|
164
|
-
components:
|
|
175
|
+
return n(x, r(c, {
|
|
176
|
+
html: o,
|
|
177
|
+
components: t
|
|
165
178
|
}));
|
|
166
179
|
}
|
|
167
180
|
})
|
|
168
|
-
}),
|
|
169
|
-
return new Proxy(
|
|
170
|
-
return t === "value" ?
|
|
181
|
+
}), u = [l()];
|
|
182
|
+
return new Proxy(u, { get(e, t, n) {
|
|
183
|
+
return t === "value" ? o : t === "use" ? (e) => l(e) : Reflect.get(e, t, n);
|
|
171
184
|
} });
|
|
172
185
|
}
|
|
173
|
-
},
|
|
174
|
-
let n = `${e ??
|
|
175
|
-
if (
|
|
186
|
+
}, k = /* @__PURE__ */ new Map(), A = (e, t = !0) => {
|
|
187
|
+
let n = `${e ?? a.defaultLocale}_${t}`;
|
|
188
|
+
if (k.has(n)) return k.get(n);
|
|
176
189
|
let r = [
|
|
177
|
-
|
|
178
|
-
c,
|
|
190
|
+
p(e ?? a.defaultLocale, t ? a.defaultLocale : void 0),
|
|
179
191
|
s,
|
|
180
|
-
|
|
192
|
+
o,
|
|
193
|
+
d(e ?? a.defaultLocale),
|
|
194
|
+
l,
|
|
181
195
|
u,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
P
|
|
196
|
+
S,
|
|
197
|
+
C,
|
|
198
|
+
T,
|
|
199
|
+
D,
|
|
200
|
+
O
|
|
188
201
|
];
|
|
189
|
-
return
|
|
202
|
+
return k.set(n, r), r;
|
|
190
203
|
};
|
|
191
204
|
//#endregion
|
|
192
|
-
export {
|
|
205
|
+
export { A as getPlugins, O as htmlPlugin, T as insertionPlugin, S as intlayerNodePlugins, D as markdownPlugin, E as markdownStringPlugin, C as solidNodePlugins };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./cjs/IntlayerNode.cjs`),l=require(`./cjs/solidElement/renderSolidElement.cjs`);let u=require(`solid-js/web`),d=require(`@intlayer/config/built`),f=require(`@intlayer/core/interpreter`),p=require(`@intlayer/core/markdown`),m=require(`@intlayer/types/nodeType`);m=s(m);let h=require(`solid-js`);var g=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/editor/ContentSelector.cjs`)).then(e=>({default:e.ContentSelector}))),_=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownMetadataRenderer}))),v=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/markdown/MarkdownRenderer.cjs`)).then(e=>({default:e.MarkdownRenderer}))),y=process.env.INTLAYER_NODE_TYPE_HTML===`false`?null:(0,h.lazy)(()=>Promise.resolve().then(()=>require(`./cjs/html/HTMLRenderer.cjs`)).then(e=>({default:e.HTMLRenderer}))),b={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{plugins:t,...n})=>c.renderIntlayerNode({...n,value:n.children,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{get fallback(){return n.children},get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(n,{get children(){return n.children}}))}}):n.children})},x=process.env.INTLAYER_NODE_TYPE_SOLID_NODE===`false`?f.fallbackPlugin:{id:`solid-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0||typeof Node<`u`&&e instanceof Node,transform:(e,{plugins:t,...n})=>c.renderIntlayerNode({...n,value:`[[solid-element]]`,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{get fallback(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)},get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(n,{get children(){return typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)}}))}}):typeof Node<`u`&&e instanceof Node?e:l.renderSolidElement(e)})},S=(e,t)=>{let n=(0,f.splitInsertionTemplate)(e,t);return n.isSimple,n.parts},C=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.INSERTION];return e=>{let a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(n,r,i)=>{let a=S(i(n,{...r,children:n,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]}),e);return i(a,{...r,plugins:t.plugins,children:a})}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>c.renderIntlayerNode({...n,value:t,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(_,(0,u.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})}})):(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(_,(0,u.mergeProps)(i,{get metadataKeyPath(){return n.keyPath},children:e}))}})})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>c.renderIntlayerNode({...t,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(v,(0,u.mergeProps)(i,{components:n,children:e}))}}))}}):(0,u.createComponent)(h.Suspense,{fallback:e,get children(){return(0,u.createComponent)(v,(0,u.mergeProps)(i,{components:n,children:e}))}}),additionalProps:{metadata:a}}),s=o();return new Proxy(s,{get(t,n,r){return n===`value`?e:n===`metadata`?a:n===`use`?e=>o(e):Reflect.get(t,n,r)}})}},T=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[w,...t.plugins??[]]})}},E=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.HTML],{plugins:r,...i}=t,a=e=>c.renderIntlayerNode({...i,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&d.editor.enabled?(0,u.createComponent)(h.Suspense,{fallback:n,get children(){return(0,u.createComponent)(g,(0,u.mergeProps)(i,{get children(){return(0,u.createComponent)(y,(0,u.mergeProps)(i,{html:n,components:e}))}}))}}):(0,u.createComponent)(h.Suspense,{fallback:n,get children(){return(0,u.createComponent)(y,(0,u.mergeProps)(i,{html:n,components:e}))}})}),o=[a()];return new Proxy(o,{get(e,t,r){return t===`value`?n:t===`use`?e=>a(e):Reflect.get(e,t,r)}})}},D=new Map,O=(e,t=!0)=>{let n=`${e??d.internationalization.defaultLocale}_${t}`;if(D.has(n))return D.get(n);let r=[(0,f.translationPlugin)(e??d.internationalization.defaultLocale,t?d.internationalization.defaultLocale:void 0),f.enumerationPlugin,f.conditionPlugin,(0,f.nestedPlugin)(e??d.internationalization.defaultLocale),f.filePlugin,f.genderPlugin,b,x,C,T,E];return D.set(n,r),r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@intlayer/api": "8.7.
|
|
108
|
-
"@intlayer/config": "8.7.
|
|
109
|
-
"@intlayer/core": "8.7.
|
|
110
|
-
"@intlayer/editor": "8.7.
|
|
111
|
-
"@intlayer/types": "8.7.
|
|
107
|
+
"@intlayer/api": "8.7.13",
|
|
108
|
+
"@intlayer/config": "8.7.13",
|
|
109
|
+
"@intlayer/core": "8.7.13",
|
|
110
|
+
"@intlayer/editor": "8.7.13",
|
|
111
|
+
"@intlayer/types": "8.7.13"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@solidjs/testing-library": "0.8.10",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"tsdown": "0.21.10",
|
|
124
124
|
"typescript": "6.0.3",
|
|
125
125
|
"vite": "8.0.10",
|
|
126
|
-
"vite-plugin-dts": "
|
|
126
|
+
"vite-plugin-dts": "5.0.0",
|
|
127
127
|
"vite-plugin-solid": "2.11.11",
|
|
128
128
|
"vitest": "4.1.5"
|
|
129
129
|
},
|
package/dist/client-D9wP8Q_u.mjs
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { getIntlayer as e } from "./esm/getIntlayer.mjs";
|
|
2
|
-
import { getDictionary as t } from "./esm/getDictionary.mjs";
|
|
3
|
-
import { localeInStorage as n, setLocaleInStorage as r } from "./esm/client/useLocaleStorage.mjs";
|
|
4
|
-
import { useLoadDynamic as i } from "./esm/client/useLoadDynamic.mjs";
|
|
5
|
-
import { createComponent as a, memo as o, mergeProps as s } from "solid-js/web";
|
|
6
|
-
import { internationalization as c, routing as l } from "@intlayer/config/built";
|
|
7
|
-
import { getTranslation as u } from "@intlayer/core/interpreter";
|
|
8
|
-
import { createContext as d, createEffect as f, createMemo as p, createSignal as m, on as h, onCleanup as g, onMount as _, untrack as v, useContext as y } from "solid-js";
|
|
9
|
-
import { isEnabled as b } from "@intlayer/editor/isEnabled";
|
|
10
|
-
import { getRewritePath as x, localeResolver as S } from "@intlayer/core/localization";
|
|
11
|
-
import { setIntlayerIdentifier as C } from "@intlayer/config/client";
|
|
12
|
-
//#region src/editor/useEditor.tsx
|
|
13
|
-
var w = process.env.INTLAYER_EDITOR_ENABLED === "false", T = () => {
|
|
14
|
-
if (w || !b) return;
|
|
15
|
-
let { locale: e } = O(), [t, n] = m(null);
|
|
16
|
-
_(() => {
|
|
17
|
-
import("@intlayer/editor").then(({ initEditorClient: e }) => {
|
|
18
|
-
n(e());
|
|
19
|
-
});
|
|
20
|
-
}), f(() => {
|
|
21
|
-
let n = t(), r = e();
|
|
22
|
-
n && r && n.currentLocale.set(r);
|
|
23
|
-
}), g(() => {
|
|
24
|
-
import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
25
|
-
e();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}, E = ({ children: e }) => (T(), e), D = d({
|
|
29
|
-
locale: () => n ?? c?.defaultLocale,
|
|
30
|
-
setLocale: () => null
|
|
31
|
-
}), O = () => y(D) ?? {}, k = (e) => {
|
|
32
|
-
let { defaultLocale: t, locales: i } = c ?? {}, [o, s] = m(e.locale ?? n ?? e.defaultLocale ?? t), l = e.setLocale ?? ((t) => {
|
|
33
|
-
if (o().toString() !== t.toString()) {
|
|
34
|
-
if (!i?.map(String).includes(t)) {
|
|
35
|
-
console.error(`Locale ${t} is not available`);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
s(t), r(t, e.isCookieEnabled);
|
|
39
|
-
}
|
|
40
|
-
}), u = p(() => S(o()));
|
|
41
|
-
return f(h(() => e.locale, (e) => {
|
|
42
|
-
e && e !== v(o) && s(e);
|
|
43
|
-
}, { defer: !0 })), _(() => {
|
|
44
|
-
C();
|
|
45
|
-
}), a(D.Provider, {
|
|
46
|
-
value: {
|
|
47
|
-
locale: u,
|
|
48
|
-
setLocale: l
|
|
49
|
-
},
|
|
50
|
-
get children() {
|
|
51
|
-
return e.children;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}, A = (e) => a(k, s(e, { get children() {
|
|
55
|
-
return [a(E, {}), o(() => e.children)];
|
|
56
|
-
} })), j = (e, t) => {
|
|
57
|
-
let { locale: n } = y(D) ?? {};
|
|
58
|
-
return u(e, t ?? (typeof n == "function" ? n() : n));
|
|
59
|
-
}, M = (e, n) => {
|
|
60
|
-
let r = y(D) ?? {};
|
|
61
|
-
return p(() => t(e, n ?? r?.locale?.()));
|
|
62
|
-
}, N = async (e, t) => {
|
|
63
|
-
let { locale: n } = y(D) ?? {}, r = c.defaultLocale, i = t ?? n() ?? r;
|
|
64
|
-
return M(await e[i]?.(), i);
|
|
65
|
-
}, P = (e, t, n) => {
|
|
66
|
-
let { locale: r } = y(D) ?? {}, a = c.defaultLocale, o = n ?? r?.() ?? a;
|
|
67
|
-
return M(i(`${String(t)}.${o}`, e[o]?.()), o);
|
|
68
|
-
}, F = (t, n) => {
|
|
69
|
-
let r = y(D) ?? {};
|
|
70
|
-
return p(() => {
|
|
71
|
-
let i = r?.locale();
|
|
72
|
-
return e(t, n ?? i);
|
|
73
|
-
});
|
|
74
|
-
}, I = ({ isCookieEnabled: e, onLocaleChange: t } = {}) => {
|
|
75
|
-
let { defaultLocale: n, locales: i } = c ?? {}, a = y(D) ?? {};
|
|
76
|
-
return f(h(() => a?.locale?.(), (e) => {
|
|
77
|
-
t && e !== void 0 && t(e);
|
|
78
|
-
}, { defer: !0 })), {
|
|
79
|
-
locale: a?.locale,
|
|
80
|
-
defaultLocale: n,
|
|
81
|
-
availableLocales: i,
|
|
82
|
-
setLocale: (t) => {
|
|
83
|
-
if (!i?.map(String).includes(t)) {
|
|
84
|
-
console.error(`Locale ${t} is not available`);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
a?.setLocale(t), r(t, e ?? a?.isCookieEnabled ?? !0);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}, { defaultLocale: L, locales: R } = c, z = () => {
|
|
91
|
-
let { locale: e, setLocale: t } = y(D) ?? {};
|
|
92
|
-
return {
|
|
93
|
-
locale: e,
|
|
94
|
-
defaultLocale: L,
|
|
95
|
-
availableLocales: R,
|
|
96
|
-
setLocale: t
|
|
97
|
-
};
|
|
98
|
-
}, B = () => {
|
|
99
|
-
let { locale: e } = I(), t = l?.rewrite;
|
|
100
|
-
f(() => {
|
|
101
|
-
if (typeof window > "u" || !t) return;
|
|
102
|
-
let n = e(), r = window.location.pathname, i = x(r, n, t);
|
|
103
|
-
i && i !== r && window.history.replaceState(window.history.state, "", i + window.location.search + window.location.hash);
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
//#endregion
|
|
107
|
-
export { P as a, j as c, k as d, O as f, F as i, D as l, T as m, z as n, N as o, E as p, I as r, M as s, B as t, A as u };
|
package/dist/client-DrZ62_Q2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./plugins-JJ37BmVk.js`);const e=require(`./cjs/getIntlayer.cjs`),t=require(`./cjs/getDictionary.cjs`),n=require(`./cjs/client/useLocaleStorage.cjs`),r=require(`./cjs/client/useLoadDynamic.cjs`);let i=require(`solid-js/web`),a=require(`@intlayer/config/built`),o=require(`@intlayer/core/interpreter`),s=require(`solid-js`),c=require(`@intlayer/editor/isEnabled`),l=require(`@intlayer/core/localization`),u=require(`@intlayer/config/client`);var d=process.env.INTLAYER_EDITOR_ENABLED===`false`,f=()=>{if(d||!c.isEnabled)return;let{locale:e}=h(),[t,n]=(0,s.createSignal)(null);(0,s.onMount)(()=>{import(`@intlayer/editor`).then(({initEditorClient:e})=>{n(e())})}),(0,s.createEffect)(()=>{let n=t(),r=e();n&&r&&n.currentLocale.set(r)}),(0,s.onCleanup)(()=>{import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})})},p=({children:e})=>(f(),e),m=(0,s.createContext)({locale:()=>n.localeInStorage??a.internationalization?.defaultLocale,setLocale:()=>null}),h=()=>(0,s.useContext)(m)??{},g=e=>{let{defaultLocale:t,locales:r}=a.internationalization??{},[o,c]=(0,s.createSignal)(e.locale??n.localeInStorage??e.defaultLocale??t),d=e.setLocale??(t=>{if(o().toString()!==t.toString()){if(!r?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}c(t),n.setLocaleInStorage(t,e.isCookieEnabled)}}),f=(0,s.createMemo)(()=>(0,l.localeResolver)(o()));return(0,s.createEffect)((0,s.on)(()=>e.locale,e=>{e&&e!==(0,s.untrack)(o)&&c(e)},{defer:!0})),(0,s.onMount)(()=>{(0,u.setIntlayerIdentifier)()}),(0,i.createComponent)(m.Provider,{value:{locale:f,setLocale:d},get children(){return e.children}})},_=e=>(0,i.createComponent)(g,(0,i.mergeProps)(e,{get children(){return[(0,i.createComponent)(p,{}),(0,i.memo)(()=>e.children)]}})),v=(e,t)=>{let{locale:n}=(0,s.useContext)(m)??{};return(0,o.getTranslation)(e,t??(typeof n==`function`?n():n))},y=(e,n)=>{let r=(0,s.useContext)(m)??{};return(0,s.createMemo)(()=>t.getDictionary(e,n??r?.locale?.()))},b=async(e,t)=>{let{locale:n}=(0,s.useContext)(m)??{},r=a.internationalization.defaultLocale,i=t??n()??r;return y(await e[i]?.(),i)},x=(e,t,n)=>{let{locale:i}=(0,s.useContext)(m)??{},o=a.internationalization.defaultLocale,c=n??i?.()??o;return y(r.useLoadDynamic(`${String(t)}.${c}`,e[c]?.()),c)},S=(t,n)=>{let r=(0,s.useContext)(m)??{};return(0,s.createMemo)(()=>{let i=r?.locale();return e.getIntlayer(t,n??i)})},C=({isCookieEnabled:e,onLocaleChange:t}={})=>{let{defaultLocale:r,locales:i}=a.internationalization??{},o=(0,s.useContext)(m)??{};return(0,s.createEffect)((0,s.on)(()=>o?.locale?.(),e=>{t&&e!==void 0&&t(e)},{defer:!0})),{locale:o?.locale,defaultLocale:r,availableLocales:i,setLocale:t=>{if(!i?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}o?.setLocale(t),n.setLocaleInStorage(t,e??o?.isCookieEnabled??!0)}}},{defaultLocale:w,locales:T}=a.internationalization,E=()=>{let{locale:e,setLocale:t}=(0,s.useContext)(m)??{};return{locale:e,defaultLocale:w,availableLocales:T,setLocale:t}},D=()=>{let{locale:e}=C(),t=a.routing?.rewrite;(0,s.createEffect)(()=>{if(typeof window>`u`||!t)return;let n=e(),r=window.location.pathname,i=(0,l.getRewritePath)(r,n,t);i&&i!==r&&window.history.replaceState(window.history.state,``,i+window.location.search+window.location.hash)})};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _}});
|