nextia 7.0.7 → 7.0.9
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/package.json +3 -3
- package/src/lib/fx.js +4 -3
- package/src/lib/ui.js +14 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextia",
|
|
3
3
|
"description": "Create fast web applications",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@vitejs/plugin-react": "6.0.1",
|
|
45
|
-
"@vitest/coverage-v8": "4.1.
|
|
45
|
+
"@vitest/coverage-v8": "4.1.3",
|
|
46
46
|
"jsdom": "29.0.2",
|
|
47
|
-
"vitest": "4.1.
|
|
47
|
+
"vitest": "4.1.3"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/lib/fx.js
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createContext, use, useReducer } from 'react'
|
|
11
|
+
import { env } from './utils.js'
|
|
11
12
|
|
|
12
|
-
const LOGGER =
|
|
13
|
+
const LOGGER = env.DEV && env.PUBLIC_LOGGER !== 'false'
|
|
13
14
|
const PagesFx = createContext()
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -193,8 +194,8 @@ function useFx(functions = { initialState: {} }) {
|
|
|
193
194
|
fx: { ...commonActions, ...actions },
|
|
194
195
|
//
|
|
195
196
|
context: pagesFx?.context,
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
iconsFile: pagesFx?.iconsFile,
|
|
198
|
+
i18nFile: pagesFx?.i18nFile
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
return Object.freeze(props)
|
package/src/lib/ui.js
CHANGED
|
@@ -21,12 +21,18 @@ function Link({ children, href, value = {}, ...props }) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function I18n({ value, args = [] }) {
|
|
24
|
-
const { context,
|
|
24
|
+
const { context, i18nFile } = useFx()
|
|
25
25
|
|
|
26
|
-
if (
|
|
26
|
+
if (i18nFile) {
|
|
27
27
|
try {
|
|
28
|
-
let text = value.split('.').reduce((ac, el) => ac[el],
|
|
29
|
-
|
|
28
|
+
let text = value.split('.').reduce((ac, el) => ac[el], i18nFile)
|
|
29
|
+
|
|
30
|
+
text =
|
|
31
|
+
text[
|
|
32
|
+
i18nFile.locales.indexOf(
|
|
33
|
+
context.state?.i18n || i18nFile.defaultLocale
|
|
34
|
+
)
|
|
35
|
+
]
|
|
30
36
|
|
|
31
37
|
if (args) {
|
|
32
38
|
text = text.replace(
|
|
@@ -59,20 +65,20 @@ function Icon({
|
|
|
59
65
|
strokeLinejoin = 'round',
|
|
60
66
|
...props
|
|
61
67
|
}) {
|
|
62
|
-
const {
|
|
68
|
+
const { iconsFile } = useFx()
|
|
63
69
|
const ref = useRef()
|
|
64
70
|
|
|
65
71
|
useEffect(() => {
|
|
66
|
-
if (
|
|
72
|
+
if (iconsFile) {
|
|
67
73
|
const svg = new DOMParser()
|
|
68
|
-
.parseFromString(
|
|
74
|
+
.parseFromString(iconsFile, 'image/svg+xml')
|
|
69
75
|
.documentElement.getElementById(id)
|
|
70
76
|
|
|
71
77
|
if (svg) {
|
|
72
78
|
ref.current.innerHTML = svg.innerHTML
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
|
-
}, [id,
|
|
81
|
+
}, [id, iconsFile])
|
|
76
82
|
|
|
77
83
|
return createElement('svg', {
|
|
78
84
|
xmlns: 'http://www.w3.org/2000/svg',
|