solid-intlayer 8.4.10 → 8.5.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/client/IntlayerProvider.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/useRewriteURL.cjs +1 -1
- package/dist/cjs/client/useTraduction.cjs +1 -1
- package/dist/cjs/editor/EditorProvider.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -0
- package/dist/cjs/format/useCompact.cjs +1 -0
- package/dist/cjs/format/useCurrency.cjs +1 -0
- package/dist/cjs/format/useDate.cjs +1 -0
- package/dist/cjs/format/useIntl.cjs +1 -0
- package/dist/cjs/format/useList.cjs +1 -0
- package/dist/cjs/format/useNumber.cjs +1 -0
- package/dist/cjs/format/usePercentage.cjs +1 -0
- package/dist/cjs/format/useRelativeTime.cjs +1 -0
- package/dist/cjs/format/useUnit.cjs +1 -0
- package/dist/cjs/html/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
- package/dist/cjs/markdown/compiler.cjs +1 -1
- package/dist/cjs/markdown/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/client-BAX4Q-5b.js +1 -0
- package/dist/{client-CM5281g3.mjs → client-BIdlTo6F.mjs} +45 -49
- package/dist/esm/client/IntlayerProvider.mjs +2 -2
- package/dist/esm/client/index.mjs +4 -4
- package/dist/esm/client/t.mjs +1 -1
- package/dist/esm/client/useContent.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
- package/dist/esm/client/useIntlayer.mjs +1 -1
- package/dist/esm/client/useLocale.mjs +1 -1
- package/dist/esm/client/useLocaleBase.mjs +1 -1
- package/dist/esm/client/useRewriteURL.mjs +1 -1
- package/dist/esm/client/useTraduction.mjs +1 -1
- package/dist/esm/editor/EditorProvider.mjs +1 -1
- package/dist/esm/editor/useEditor.mjs +1 -1
- package/dist/esm/format/index.mjs +10 -0
- package/dist/esm/format/useCompact.mjs +12 -0
- package/dist/esm/format/useCurrency.mjs +13 -0
- package/dist/esm/format/useDate.mjs +19 -0
- package/dist/esm/format/useIntl.mjs +10 -0
- package/dist/esm/format/useList.mjs +12 -0
- package/dist/esm/format/useNumber.mjs +13 -0
- package/dist/esm/format/usePercentage.mjs +13 -0
- package/dist/esm/format/useRelativeTime.mjs +13 -0
- package/dist/esm/format/useUnit.mjs +12 -0
- package/dist/esm/html/index.mjs +2 -2
- package/dist/esm/index.mjs +4 -11
- package/dist/esm/markdown/MarkdownRenderer.mjs +32 -19
- package/dist/esm/markdown/compiler.mjs +5 -3
- package/dist/esm/markdown/index.mjs +4 -5
- package/dist/esm/plugins.mjs +40 -42
- package/dist/types/{src/client → client}/index.d.ts +0 -1
- package/dist/types/format/index.d.ts +9 -0
- package/dist/types/format/useCompact.d.ts +5 -0
- package/dist/types/format/useCurrency.d.ts +5 -0
- package/dist/types/format/useDate.d.ts +8 -0
- package/dist/types/{src/client/format → format}/useIntl.d.ts +1 -1
- package/dist/types/format/useList.d.ts +5 -0
- package/dist/types/format/useNumber.d.ts +8 -0
- package/dist/types/format/usePercentage.d.ts +5 -0
- package/dist/types/format/useRelativeTime.d.ts +5 -0
- package/dist/types/format/useUnit.d.ts +5 -0
- package/dist/types/html/index.d.ts +3 -0
- package/dist/types/{src/index.d.ts → index.d.ts} +1 -3
- package/dist/types/{src/markdown → markdown}/MarkdownProvider.d.ts +4 -4
- package/dist/types/{src/markdown → markdown}/MarkdownRenderer.d.ts +8 -9
- package/dist/types/{src/markdown → markdown}/compiler.d.ts +4 -3
- package/dist/types/markdown/index.d.ts +3 -0
- package/package.json +37 -6
- package/dist/cjs/client/format/useIntl.cjs +0 -1
- package/dist/client-ITsjcUYQ.js +0 -1
- package/dist/esm/client/format/useIntl.mjs +0 -2
- package/dist/types/src/html/index.d.ts +0 -3
- package/dist/types/src/markdown/index.d.ts +0 -4
- /package/dist/types/{src/IntlayerNode.d.ts → IntlayerNode.d.ts} +0 -0
- /package/dist/types/{src/UI → UI}/ContentSelector.d.ts +0 -0
- /package/dist/types/{src/client → client}/IntlayerProvider.d.ts +0 -0
- /package/dist/types/{src/client → client}/getBrowserLocale.d.ts +0 -0
- /package/dist/types/{src/client → client}/t.d.ts +0 -0
- /package/dist/types/{src/client → client}/useContent.d.ts +0 -0
- /package/dist/types/{src/client → client}/useDictionary.d.ts +0 -0
- /package/dist/types/{src/client → client}/useDictionaryAsync.d.ts +0 -0
- /package/dist/types/{src/client → client}/useDictionaryDynamic.d.ts +0 -0
- /package/dist/types/{src/client → client}/useIntlayer.d.ts +0 -0
- /package/dist/types/{src/client → client}/useLoadDynamic.d.ts +0 -0
- /package/dist/types/{src/client → client}/useLocale.d.ts +0 -0
- /package/dist/types/{src/client → client}/useLocaleBase.d.ts +0 -0
- /package/dist/types/{src/client → client}/useLocaleStorage.d.ts +0 -0
- /package/dist/types/{src/client → client}/useRewriteURL.d.ts +0 -0
- /package/dist/types/{src/client → client}/useTraduction.d.ts +0 -0
- /package/dist/types/{src/editor → editor}/ContentSelector.d.ts +0 -0
- /package/dist/types/{src/editor → editor}/EditorProvider.d.ts +0 -0
- /package/dist/types/{src/editor → editor}/useEditor.d.ts +0 -0
- /package/dist/types/{src/getDictionary.d.ts → getDictionary.d.ts} +0 -0
- /package/dist/types/{src/getIntlayer.d.ts → getIntlayer.d.ts} +0 -0
- /package/dist/types/{src/html → html}/HTMLProvider.d.ts +0 -0
- /package/dist/types/{src/html → html}/HTMLRenderer.d.ts +0 -0
- /package/dist/types/{src/html → html}/types.d.ts +0 -0
- /package/dist/types/{src/markdown → markdown}/runtime.d.ts +0 -0
- /package/dist/types/{src/plugins.d.ts → plugins.d.ts} +0 -0
- /package/dist/types/{src/solidElement → solidElement}/renderSolidElement.d.ts +0 -0
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
2
|
import { MarkdownContext as t, useMarkdown as n } from "./MarkdownProvider.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { getMarkdownMetadata as
|
|
5
|
-
import {
|
|
3
|
+
import { createComponent as r } from "solid-js/web";
|
|
4
|
+
import { getMarkdownMetadata as i } from "@intlayer/core/markdown";
|
|
5
|
+
import { Suspense as a, createMemo as o, createResource as s, useContext as c } from "solid-js";
|
|
6
|
+
import { getContentNodeByKeyPath as l } from "@intlayer/core/dictionaryManipulator";
|
|
6
7
|
//#region src/markdown/MarkdownRenderer.tsx
|
|
7
|
-
var
|
|
8
|
-
let n =
|
|
8
|
+
var u = (t, n = {}) => e(t, n), d = (e = {}) => {
|
|
9
|
+
let n = c(t);
|
|
9
10
|
return (t) => n ? n.renderMarkdown(t, {
|
|
10
11
|
forceBlock: e.forceBlock,
|
|
11
12
|
preserveFrontmatter: e.preserveFrontmatter,
|
|
12
13
|
tagfilter: e.tagfilter
|
|
13
|
-
}, e.components, e.wrapper) :
|
|
14
|
-
},
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
}, e.components, e.wrapper) : u(t, e);
|
|
15
|
+
}, f = (e) => {
|
|
16
|
+
let i = c(t), { renderMarkdown: o } = n(), [l] = s(() => [
|
|
17
|
+
e.children,
|
|
18
|
+
e.forceBlock,
|
|
19
|
+
e.preserveFrontmatter,
|
|
20
|
+
e.tagfilter,
|
|
21
|
+
e.components,
|
|
22
|
+
e.wrapper
|
|
23
|
+
], ([e, t, n, r, a, s]) => o(e, {
|
|
24
|
+
forceBlock: t,
|
|
25
|
+
preserveFrontmatter: n,
|
|
26
|
+
tagfilter: r
|
|
20
27
|
}, {
|
|
21
|
-
...
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
...i?.components ?? {},
|
|
29
|
+
...a ?? {}
|
|
30
|
+
}, s));
|
|
31
|
+
return r(a, {
|
|
32
|
+
fallback: null,
|
|
33
|
+
get children() {
|
|
34
|
+
return l();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}, p = (e) => {
|
|
38
|
+
let t = o(() => i(e.children));
|
|
39
|
+
return o(() => l(t(), e.metadataKeyPath))();
|
|
27
40
|
};
|
|
28
41
|
//#endregion
|
|
29
|
-
export {
|
|
42
|
+
export { p as MarkdownMetadataRenderer, f as MarkdownRenderer, u as renderMarkdown, d as useMarkdownRenderer };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./runtime.mjs";
|
|
2
|
-
import { compileWithOptions as t } from "@intlayer/core/markdown";
|
|
3
2
|
//#region src/markdown/compiler.tsx
|
|
4
|
-
var
|
|
3
|
+
var t = async (t = "", n = {}) => {
|
|
4
|
+
let { compileWithOptions: r } = await import("@intlayer/core/markdown");
|
|
5
|
+
return r(t, e, n);
|
|
6
|
+
}, n = t, r = t;
|
|
5
7
|
//#endregion
|
|
6
|
-
export {
|
|
8
|
+
export { r as compile, t as compileMarkdown, n as compiler };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export { i as MarkdownContext, s as MarkdownMetadataRenderer, a as MarkdownProvider, c as MarkdownRenderer, t as compile, n as compileMarkdown, r as compiler, l as renderMarkdown, e as solidRuntime, o as useMarkdown, u as useMarkdownRenderer };
|
|
1
|
+
import { compileMarkdown as e } from "./compiler.mjs";
|
|
2
|
+
import { MarkdownProvider as t, useMarkdown as n } from "./MarkdownProvider.mjs";
|
|
3
|
+
import { MarkdownRenderer as r, renderMarkdown as i, useMarkdownRenderer as a } from "./MarkdownRenderer.mjs";
|
|
4
|
+
export { t as MarkdownProvider, r as MarkdownRenderer, e as compileMarkdown, i as renderMarkdown, n as useMarkdown, a as useMarkdownRenderer };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -4,48 +4,46 @@ import { renderSolidElement as n } from "./solidElement/renderSolidElement.mjs";
|
|
|
4
4
|
import { conditionPlugin as r, enumerationPlugin as i, filePlugin as a, genderPlugin as o, getHTML as s, nestedPlugin as c, splitInsertionTemplate as l, translationPlugin as u } from "@intlayer/core/interpreter";
|
|
5
5
|
import { Dynamic as d, createComponent as f, mergeProps as p } from "solid-js/web";
|
|
6
6
|
import m from "@intlayer/config/built";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import { getMarkdownMetadata as h } from "@intlayer/core/markdown";
|
|
8
|
+
import { HTML_TAGS as g } from "@intlayer/core/transpiler";
|
|
9
|
+
import { isEnabled as _ } from "@intlayer/editor/isEnabled";
|
|
10
|
+
import * as v from "@intlayer/types/nodeType";
|
|
11
|
+
import { Suspense as y, lazy as b } from "solid-js";
|
|
10
12
|
//#region src/plugins.tsx
|
|
11
|
-
var
|
|
12
|
-
import("@intlayer/core/markdown").then((e) => {
|
|
13
|
-
y = e.getMarkdownMetadata;
|
|
14
|
-
});
|
|
15
|
-
var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.MarkdownMetadataRenderer }))), x = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.MarkdownRenderer }))), S = {
|
|
13
|
+
var x = b(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownMetadataRenderer }))), S = b(() => import("./markdown/MarkdownRenderer.mjs").then((e) => ({ default: e.MarkdownRenderer }))), C = {
|
|
16
14
|
id: "intlayer-node-plugin",
|
|
17
15
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
18
16
|
transform: (n, { plugins: r, ...i }) => e({
|
|
19
17
|
...i,
|
|
20
18
|
value: i.children,
|
|
21
|
-
children:
|
|
19
|
+
children: _ ? f(t, p(i, { get children() {
|
|
22
20
|
return i.children;
|
|
23
21
|
} })) : i.children
|
|
24
22
|
})
|
|
25
|
-
},
|
|
23
|
+
}, w = {
|
|
26
24
|
id: "solid-node-plugin",
|
|
27
25
|
canHandle: (e) => typeof e == "object" && e?.props !== void 0 || typeof Node < "u" && e instanceof Node,
|
|
28
26
|
transform: (r, { plugins: i, ...a }) => e({
|
|
29
27
|
...a,
|
|
30
28
|
value: "[[solid-element]]",
|
|
31
|
-
children:
|
|
29
|
+
children: _ ? f(t, p(a, { get children() {
|
|
32
30
|
return typeof Node < "u" && r instanceof Node ? r : n(r);
|
|
33
31
|
} })) : typeof Node < "u" && r instanceof Node ? r : n(r)
|
|
34
32
|
})
|
|
35
|
-
},
|
|
33
|
+
}, T = (e, t) => {
|
|
36
34
|
let n = l(e, t);
|
|
37
35
|
return n.isSimple, n.parts;
|
|
38
|
-
},
|
|
36
|
+
}, E = {
|
|
39
37
|
id: "insertion-plugin",
|
|
40
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
38
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === v.INSERTION,
|
|
41
39
|
transform: (e, t, n) => {
|
|
42
|
-
let r = [...t.keyPath, { type:
|
|
40
|
+
let r = [...t.keyPath, { type: v.INSERTION }], i = e[v.INSERTION];
|
|
43
41
|
return (e) => {
|
|
44
42
|
let a = {
|
|
45
43
|
id: "insertion-string-plugin",
|
|
46
44
|
canHandle: (e) => typeof e == "string",
|
|
47
45
|
transform: (n, r, i) => {
|
|
48
|
-
let a =
|
|
46
|
+
let a = T(i(n, {
|
|
49
47
|
...r,
|
|
50
48
|
children: n,
|
|
51
49
|
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
@@ -65,11 +63,11 @@ var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.Markdow
|
|
|
65
63
|
});
|
|
66
64
|
};
|
|
67
65
|
}
|
|
68
|
-
},
|
|
66
|
+
}, D = {
|
|
69
67
|
id: "markdown-string-plugin",
|
|
70
68
|
canHandle: (e) => typeof e == "string",
|
|
71
69
|
transform: (n, r, i) => {
|
|
72
|
-
let { plugins: a, ...o } = r, s = i(
|
|
70
|
+
let { plugins: a, ...o } = r, s = i(h(n) ?? {}, {
|
|
73
71
|
plugins: [{
|
|
74
72
|
id: "markdown-metadata-plugin",
|
|
75
73
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -77,10 +75,10 @@ var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.Markdow
|
|
|
77
75
|
...i,
|
|
78
76
|
value: r,
|
|
79
77
|
children: m.editor.enabled ? f(t, p(o, { get children() {
|
|
80
|
-
return f(
|
|
78
|
+
return f(y, {
|
|
81
79
|
fallback: n,
|
|
82
80
|
get children() {
|
|
83
|
-
return f(
|
|
81
|
+
return f(x, p(o, {
|
|
84
82
|
get metadataKeyPath() {
|
|
85
83
|
return i.keyPath;
|
|
86
84
|
},
|
|
@@ -88,10 +86,10 @@ var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.Markdow
|
|
|
88
86
|
}));
|
|
89
87
|
}
|
|
90
88
|
});
|
|
91
|
-
} })) : f(
|
|
89
|
+
} })) : f(y, {
|
|
92
90
|
fallback: n,
|
|
93
91
|
get children() {
|
|
94
|
-
return f(
|
|
92
|
+
return f(x, p(o, {
|
|
95
93
|
get metadataKeyPath() {
|
|
96
94
|
return i.keyPath;
|
|
97
95
|
},
|
|
@@ -107,19 +105,19 @@ var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.Markdow
|
|
|
107
105
|
...r,
|
|
108
106
|
value: n,
|
|
109
107
|
children: m.editor.enabled ? f(t, p(o, { get children() {
|
|
110
|
-
return f(
|
|
108
|
+
return f(y, {
|
|
111
109
|
fallback: n,
|
|
112
110
|
get children() {
|
|
113
|
-
return f(
|
|
111
|
+
return f(S, p(o, {
|
|
114
112
|
components: i,
|
|
115
113
|
children: n
|
|
116
114
|
}));
|
|
117
115
|
}
|
|
118
116
|
});
|
|
119
|
-
} })) : f(
|
|
117
|
+
} })) : f(y, {
|
|
120
118
|
fallback: n,
|
|
121
119
|
get children() {
|
|
122
|
-
return f(
|
|
120
|
+
return f(S, p(o, {
|
|
123
121
|
components: i,
|
|
124
122
|
children: n
|
|
125
123
|
}));
|
|
@@ -131,46 +129,46 @@ var b = v(() => import("./markdown/index.mjs").then((e) => ({ default: e.Markdow
|
|
|
131
129
|
return t === "value" ? n : t === "metadata" ? s : t === "use" ? (e) => c(e) : Reflect.get(e, t, r);
|
|
132
130
|
} });
|
|
133
131
|
}
|
|
134
|
-
},
|
|
132
|
+
}, O = {
|
|
135
133
|
id: "markdown-plugin",
|
|
136
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
134
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === v.MARKDOWN,
|
|
137
135
|
transform: (e, t, n) => {
|
|
138
|
-
let r = [...t.keyPath, { type:
|
|
136
|
+
let r = [...t.keyPath, { type: v.MARKDOWN }], i = e[v.MARKDOWN];
|
|
139
137
|
return n(i, {
|
|
140
138
|
...t,
|
|
141
139
|
children: i,
|
|
142
140
|
keyPath: r,
|
|
143
|
-
plugins: [
|
|
141
|
+
plugins: [D, ...t.plugins ?? []]
|
|
144
142
|
});
|
|
145
143
|
}
|
|
146
|
-
},
|
|
144
|
+
}, k = (() => {
|
|
147
145
|
let e = {};
|
|
148
|
-
for (let t of
|
|
146
|
+
for (let t of g) e[t] = ({ children: e, ...n }) => f(d, p({ component: t }, n, { children: e }));
|
|
149
147
|
return e;
|
|
150
|
-
})(),
|
|
148
|
+
})(), A = {
|
|
151
149
|
id: "html-plugin",
|
|
152
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
150
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === v.HTML,
|
|
153
151
|
transform: (e) => {
|
|
154
|
-
let t = e[
|
|
155
|
-
...
|
|
152
|
+
let t = e[v.HTML], n = (e) => s(t, {
|
|
153
|
+
...k,
|
|
156
154
|
...e
|
|
157
155
|
}), r = [n()];
|
|
158
156
|
return new Proxy(r, { get(e, r, i) {
|
|
159
157
|
return r === "value" ? t : r === "use" ? (e) => n(e) : Reflect.get(e, r, i);
|
|
160
158
|
} });
|
|
161
159
|
}
|
|
162
|
-
},
|
|
160
|
+
}, j = (e, t = !0) => [
|
|
163
161
|
u(e ?? m.internationalization.defaultLocale, t ? m.internationalization.defaultLocale : void 0),
|
|
164
162
|
i,
|
|
165
163
|
r,
|
|
166
164
|
c(e ?? m.internationalization.defaultLocale),
|
|
167
165
|
a,
|
|
168
166
|
o,
|
|
169
|
-
S,
|
|
170
167
|
C,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
w,
|
|
169
|
+
E,
|
|
170
|
+
O,
|
|
171
|
+
A
|
|
174
172
|
];
|
|
175
173
|
//#endregion
|
|
176
|
-
export {
|
|
174
|
+
export { j as getPlugins, A as htmlPlugin, E as insertionPlugin, C as intlayerNodePlugins, O as markdownPlugin, D as markdownStringPlugin, w as solidNodePlugins };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { useIntl } from './format/useIntl';
|
|
2
1
|
export { getBrowserLocale } from './getBrowserLocale';
|
|
3
2
|
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, useIntlayerContext, } from './IntlayerProvider';
|
|
4
3
|
export { t } from './t';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './useCompact';
|
|
2
|
+
export * from './useCurrency';
|
|
3
|
+
export * from './useDate';
|
|
4
|
+
export * from './useIntl';
|
|
5
|
+
export * from './useList';
|
|
6
|
+
export * from './useNumber';
|
|
7
|
+
export * from './usePercentage';
|
|
8
|
+
export * from './useRelativeTime';
|
|
9
|
+
export * from './useUnit';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { date } from '@intlayer/core/formatters';
|
|
2
|
+
/**
|
|
3
|
+
* Solid client hook that provides a localized date/time formatter.
|
|
4
|
+
*
|
|
5
|
+
* @returns {(date: Date | string | number, options?: DateProps) => string}
|
|
6
|
+
* A function to format dates into localized strings.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useDate: () => (...args: Parameters<typeof date>) => string;
|
|
@@ -12,7 +12,7 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
12
12
|
* const intl = useIntl(); // uses context locale
|
|
13
13
|
*
|
|
14
14
|
* // Standard API, but no need to pass locale as the first argument
|
|
15
|
-
* const formatted = new intl().NumberFormat({
|
|
15
|
+
* const formatted = new (intl().NumberFormat)({
|
|
16
16
|
* style: 'currency',
|
|
17
17
|
* currency: 'USD'
|
|
18
18
|
* }).format(123.45);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { number } from '@intlayer/core/formatters';
|
|
2
|
+
/**
|
|
3
|
+
* Solid client hook that provides a localized number formatter.
|
|
4
|
+
*
|
|
5
|
+
* @returns {(value: string | number, options?: import("@intlayer/core/formatters").NumberProps) => string}
|
|
6
|
+
* A function to format numbers into localized strings.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useNumber: () => (...args: Parameters<typeof number>) => string;
|
|
@@ -4,9 +4,7 @@ declare module '@intlayer/core/interpreter' {
|
|
|
4
4
|
interface IInterpreterPlugin<T, S, L extends LocalesValues> extends IInterpreterPluginSolid<T, S, L> {
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export { getBrowserLocale, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic,
|
|
7
|
+
export { getBrowserLocale, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage, useRewriteURL, } from './client/index';
|
|
8
8
|
export { getDictionary } from './getDictionary';
|
|
9
9
|
export { getIntlayer } from './getIntlayer';
|
|
10
|
-
export { HTMLProvider, HTMLRenderer, type HTMLRendererProps, type RenderHTMLProps, renderHTML, useHTMLRenderer, } from './html/index';
|
|
11
10
|
export type { IntlayerNode } from './IntlayerNode';
|
|
12
|
-
export { compileMarkdown, MarkdownProvider, MarkdownRenderer, useMarkdown, } from './markdown/index';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, JSXElement, ParentProps } from 'solid-js';
|
|
1
|
+
import { Component, JSXElement, ParentProps, ValidComponent } from 'solid-js';
|
|
2
2
|
import { HTMLComponents } from '../html/types';
|
|
3
3
|
export type MarkdownProviderOptions = {
|
|
4
4
|
/** Forces the compiler to always output content with a block-level wrapper. */
|
|
@@ -10,16 +10,16 @@ export type MarkdownProviderOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
type MarkdownProviderValue = {
|
|
12
12
|
components?: HTMLComponents<'permissive', {}>;
|
|
13
|
-
renderMarkdown: (content: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?:
|
|
13
|
+
renderMarkdown: (content: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => JSXElement | Promise<JSXElement>;
|
|
14
14
|
};
|
|
15
15
|
export declare const MarkdownContext: import('solid-js').Context<MarkdownProviderValue | undefined>;
|
|
16
16
|
export type MarkdownProviderProps = ParentProps<{
|
|
17
17
|
components?: HTMLComponents<'permissive', {}>;
|
|
18
|
-
wrapper?:
|
|
18
|
+
wrapper?: ValidComponent;
|
|
19
19
|
forceBlock?: boolean;
|
|
20
20
|
preserveFrontmatter?: boolean;
|
|
21
21
|
tagfilter?: boolean;
|
|
22
|
-
renderMarkdown?: (content: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?:
|
|
22
|
+
renderMarkdown?: (content: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => JSXElement | Promise<JSXElement>;
|
|
23
23
|
}>;
|
|
24
24
|
export declare const MarkdownProvider: Component<MarkdownProviderProps>;
|
|
25
25
|
export declare const useMarkdown: () => MarkdownProviderValue;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { KeyPath } from '@intlayer/types/keyPath';
|
|
2
2
|
import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
|
-
import { Component, JSX } from 'solid-js';
|
|
3
|
+
import { Component, JSX, ValidComponent } from 'solid-js';
|
|
4
4
|
import { HTMLComponents } from '../html/types';
|
|
5
|
-
type RenderMarkdownOptions = {
|
|
5
|
+
export type RenderMarkdownOptions = {
|
|
6
6
|
components?: HTMLComponents<'permissive', {}>;
|
|
7
|
-
wrapper?:
|
|
7
|
+
wrapper?: ValidComponent;
|
|
8
8
|
forceBlock?: boolean;
|
|
9
9
|
preserveFrontmatter?: boolean;
|
|
10
10
|
tagfilter?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const renderMarkdown: (content: string, options?: RenderMarkdownOptions) => JSX.Element
|
|
13
|
-
export declare const useMarkdownRenderer: (options?: RenderMarkdownOptions) => (content: string) => JSX.Element
|
|
14
|
-
type MarkdownRendererProps = RenderMarkdownOptions & {
|
|
12
|
+
export declare const renderMarkdown: (content: string, options?: RenderMarkdownOptions) => Promise<JSX.Element>;
|
|
13
|
+
export declare const useMarkdownRenderer: (options?: RenderMarkdownOptions) => (content: string) => Promise<JSX.Element>;
|
|
14
|
+
export type MarkdownRendererProps = RenderMarkdownOptions & {
|
|
15
15
|
dictionaryKey: string;
|
|
16
16
|
keyPath: KeyPath[];
|
|
17
17
|
locale?: LocalesValues;
|
|
18
18
|
children: string;
|
|
19
19
|
};
|
|
20
|
-
export declare const MarkdownRenderer:
|
|
21
|
-
type MarkdownMetadataRendererProps = MarkdownRendererProps & {
|
|
20
|
+
export declare const MarkdownRenderer: (props: MarkdownRendererProps) => JSX.Element;
|
|
21
|
+
export type MarkdownMetadataRendererProps = MarkdownRendererProps & {
|
|
22
22
|
metadataKeyPath: KeyPath[];
|
|
23
23
|
};
|
|
24
24
|
export declare const MarkdownMetadataRenderer: Component<MarkdownMetadataRendererProps>;
|
|
25
|
-
export {};
|
|
@@ -2,10 +2,11 @@ import { CompileOptions } from '@intlayer/core/markdown';
|
|
|
2
2
|
import { JSX } from 'solid-js';
|
|
3
3
|
/**
|
|
4
4
|
* Compile markdown to Solid JSX elements.
|
|
5
|
+
* Lazily imports the heavy markdown library to enable code splitting.
|
|
5
6
|
*/
|
|
6
|
-
export declare const compileMarkdown: (markdown?: string, options?: CompileOptions) => JSX.Element
|
|
7
|
+
export declare const compileMarkdown: (markdown?: string, options?: CompileOptions) => Promise<JSX.Element>;
|
|
7
8
|
/**
|
|
8
9
|
* Solid component that renders markdown to JSX.
|
|
9
10
|
*/
|
|
10
|
-
export declare const compiler: (markdown?: string, options?: CompileOptions) => JSX.Element
|
|
11
|
-
export declare const compile: (markdown?: string, options?: CompileOptions) => JSX.Element
|
|
11
|
+
export declare const compiler: (markdown?: string, options?: CompileOptions) => Promise<JSX.Element>;
|
|
12
|
+
export declare const compile: (markdown?: string, options?: CompileOptions) => Promise<JSX.Element>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-intlayer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -36,9 +36,28 @@
|
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
38
|
"types": "./dist/types/index.d.ts",
|
|
39
|
+
"solid": "./dist/esm/index.mjs",
|
|
39
40
|
"require": "./dist/cjs/index.cjs",
|
|
40
41
|
"import": "./dist/esm/index.mjs"
|
|
41
42
|
},
|
|
43
|
+
"./html": {
|
|
44
|
+
"types": "./dist/types/html/index.d.ts",
|
|
45
|
+
"solid": "./dist/esm/html/index.mjs",
|
|
46
|
+
"require": "./dist/cjs/html/index.cjs",
|
|
47
|
+
"import": "./dist/esm/html/index.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./markdown": {
|
|
50
|
+
"types": "./dist/types/markdown/index.d.ts",
|
|
51
|
+
"solid": "./dist/esm/markdown/index.mjs",
|
|
52
|
+
"require": "./dist/cjs/markdown/index.cjs",
|
|
53
|
+
"import": "./dist/esm/markdown/index.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./format": {
|
|
56
|
+
"types": "./dist/types/format/index.d.ts",
|
|
57
|
+
"solid": "./dist/esm/format/index.mjs",
|
|
58
|
+
"require": "./dist/cjs/format/index.cjs",
|
|
59
|
+
"import": "./dist/esm/format/index.mjs"
|
|
60
|
+
},
|
|
42
61
|
"./package.json": "./package.json"
|
|
43
62
|
},
|
|
44
63
|
"main": "dist/cjs/index.cjs",
|
|
@@ -46,6 +65,18 @@
|
|
|
46
65
|
"types": "dist/types/index.d.ts",
|
|
47
66
|
"typesVersions": {
|
|
48
67
|
"*": {
|
|
68
|
+
".": [
|
|
69
|
+
"./dist/types/index.d.ts"
|
|
70
|
+
],
|
|
71
|
+
"html": [
|
|
72
|
+
"./dist/types/html/index.d.ts"
|
|
73
|
+
],
|
|
74
|
+
"markdown": [
|
|
75
|
+
"./dist/types/markdown/index.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"format": [
|
|
78
|
+
"./dist/types/format/index.d.ts"
|
|
79
|
+
],
|
|
49
80
|
"package.json": [
|
|
50
81
|
"./package.json"
|
|
51
82
|
]
|
|
@@ -73,11 +104,11 @@
|
|
|
73
104
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
74
105
|
},
|
|
75
106
|
"dependencies": {
|
|
76
|
-
"@intlayer/api": "8.
|
|
77
|
-
"@intlayer/config": "8.
|
|
78
|
-
"@intlayer/core": "8.
|
|
79
|
-
"@intlayer/editor": "8.
|
|
80
|
-
"@intlayer/types": "8.
|
|
107
|
+
"@intlayer/api": "8.5.1",
|
|
108
|
+
"@intlayer/config": "8.5.1",
|
|
109
|
+
"@intlayer/core": "8.5.1",
|
|
110
|
+
"@intlayer/editor": "8.5.1",
|
|
111
|
+
"@intlayer/types": "8.5.1"
|
|
81
112
|
},
|
|
82
113
|
"devDependencies": {
|
|
83
114
|
"@solidjs/testing-library": "0.8.10",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../../client-ITsjcUYQ.js`);exports.useIntl=e.l;
|
package/dist/client-ITsjcUYQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-C91j1N6u.js`),t=require(`./cjs/getDictionary.cjs`),n=require(`./cjs/getIntlayer.cjs`),r=require(`./cjs/client/useLocaleStorage.cjs`),i=require(`./cjs/client/useLoadDynamic.cjs`);let a=require(`@intlayer/core/interpreter`),o=require(`solid-js/web`),s=require(`@intlayer/config/built`);s=e.t(s);let c=require(`solid-js`),l=require(`@intlayer/editor/isEnabled`),u=require(`@intlayer/core/formatters`),d=require(`@intlayer/core/localization`);var f=()=>{if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!l.isEnabled)return;let{locale:e}=h(),[t,n]=(0,c.createSignal)(null);(0,c.onMount)(()=>{import(`@intlayer/editor`).then(({initEditorClient:e})=>{n(e())})}),(0,c.createEffect)(()=>{let n=t(),r=e();n&&r&&n.currentLocale.set(r)}),(0,c.onCleanup)(()=>{import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})})},p=({children:e})=>(f(),e),m=(0,c.createContext)({locale:()=>r.localeInStorage??s.default?.internationalization?.defaultLocale,setLocale:()=>null}),h=()=>(0,c.useContext)(m),g=e=>{let{internationalization:t}=s.default??{},{defaultLocale:n,locales:i}=t??{},[a,l]=(0,c.createSignal)(e.locale??r.localeInStorage??e.defaultLocale??n),u=e.setLocale??(t=>{if(a().toString()!==t.toString()){if(!i?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}l(t),r.setLocaleInStorage(t,e.isCookieEnabled)}}),f=(0,c.createMemo)(()=>(0,d.localeResolver)(a()));return(0,c.createEffect)((0,c.on)(()=>e.locale,e=>{e&&e!==(0,c.untrack)(a)&&l(e)},{defer:!0})),(0,o.createComponent)(m.Provider,{value:{locale:f,setLocale:u},get children(){return e.children}})},_=e=>(0,o.createComponent)(g,(0,o.mergeProps)(e,{get children(){return[(0,o.createComponent)(p,{}),(0,o.memo)(()=>e.children)]}})),v=e=>{let t=(0,c.useContext)(m);return(0,c.createMemo)(()=>(0,u.bindIntl)(e??t.locale()))},y=(e,t)=>{let{locale:n}=(0,c.useContext)(m);return(0,a.getTranslation)(e,t??(typeof n==`function`?n():n))},b=(e,n)=>{let r=(0,c.useContext)(m);return(0,c.createMemo)(()=>t.getDictionary(e,n??r?.locale?.()))},x=async(e,t)=>{let{locale:n}=(0,c.useContext)(m),r=s.default?.internationalization.defaultLocale,i=t??n()??r;return b(await e[i]?.(),i)},S=(e,t,n)=>{let{locale:r}=(0,c.useContext)(m)??{},a=s.default?.internationalization.defaultLocale,o=n??r?.()??a;return b(i.useLoadDynamic(`${String(t)}.${o}`,e[o]?.()),o)},C=(e,t)=>{let r=(0,c.useContext)(m);return(0,c.createMemo)(()=>{let i=r?.locale();return n.getIntlayer(e,t??i)})},w=({isCookieEnabled:e,onLocaleChange:t}={})=>{let{defaultLocale:n,locales:i}=s.default?.internationalization??{},a=(0,c.useContext)(m);return(0,c.createEffect)((0,c.on)(()=>a?.locale?.(),e=>{t&&e!==void 0&&t(e)},{defer:!0})),{locale:a?.locale,defaultLocale:n,availableLocales:i,setLocale:t=>{if(!i?.map(String).includes(t)){console.error(`Locale ${t} is not available`);return}a?.setLocale(t),r.setLocaleInStorage(t,e??a?.isCookieEnabled??!0)}}},{defaultLocale:T,locales:E}=s.default.internationalization,D=()=>{let{locale:e,setLocale:t}=(0,c.useContext)(m);return{locale:e,defaultLocale:T,availableLocales:E,setLocale:t}},O=()=>{let{locale:e}=w(),t=s.default?.routing?.rewrite;(0,c.createEffect)(()=>{if(typeof window>`u`||!t)return;let n=e(),r=window.location.pathname,i=(0,d.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 S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return m}});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|