nextia 8.0.1 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nextia",
3
3
  "description": "Create fast web applications",
4
- "version": "8.0.1",
4
+ "version": "8.0.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "engines": {
package/src/lib/fx.js CHANGED
@@ -163,6 +163,8 @@ function useCx() {
163
163
  const [icons, setIcons] = useState()
164
164
 
165
165
  useEffect(() => {
166
+ if (!pages?.icons) return
167
+
166
168
  fetch(pages?.icons)
167
169
  .then((r) => r.text())
168
170
  .then((text) => {
package/src/lib/ui.js CHANGED
@@ -22,25 +22,24 @@ function Link({ children, href, value = {}, ...props }) {
22
22
  function I18n({ value, args = [] }) {
23
23
  const { context, i18n } = useCx()
24
24
 
25
- if (i18n) {
26
- try {
27
- let text = value.split('.').reduce((ac, el) => ac[el], i18n)
28
-
29
- text =
30
- text[i18n.locales.indexOf(context.state?.i18n || i18n.defaultLocale)]
31
-
32
- if (args) {
33
- text = text.replace(
34
- /([{}])\\1|[{](.*?)(?:!(.+?))?[}]/g,
35
- (match, _literal, number) => args[number] || match
36
- )
37
- }
38
-
39
- return text
40
- } catch {
41
- console.error(`Error in [il8n] => ${value}`)
42
- return value
25
+ if (!i18n) return null
26
+
27
+ try {
28
+ let text = value.split('.').reduce((ac, el) => ac[el], i18n)
29
+
30
+ text = text[i18n.locales.indexOf(context.state?.i18n || i18n.defaultLocale)]
31
+
32
+ if (args) {
33
+ text = text.replace(
34
+ /([{}])\\1|[{](.*?)(?:!(.+?))?[}]/g,
35
+ (match, _literal, number) => args[number] || match
36
+ )
43
37
  }
38
+
39
+ return text
40
+ } catch {
41
+ console.error(`Error in [il8n] => ${value}`)
42
+ return value
44
43
  }
45
44
  }
46
45
 
@@ -64,9 +63,8 @@ function Icon({
64
63
  const ref = useRef()
65
64
 
66
65
  useEffect(() => {
67
- if (icons) {
68
- ref.current.innerHTML = icons.getElementById(id).innerHTML
69
- }
66
+ const el = icons?.getElementById(id)
67
+ if (ref.current && el) ref.current.innerHTML = el.innerHTML
70
68
  }, [id, icons])
71
69
 
72
70
  return createElement('svg', {