nextia 8.0.2 → 8.0.4
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 +0 -1
- package/package.json +6 -7
- package/src/lib/fx.js +6 -7
- package/src/lib/index.js +5 -5
- package/src/lib/utils.js +19 -25
package/README.md
CHANGED
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.
|
|
4
|
+
"version": "8.0.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -37,13 +37,12 @@
|
|
|
37
37
|
"test:coverage": "vitest run --silent --coverage"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react": "^19.0.0"
|
|
41
|
-
"react-dom": "^19.0.0"
|
|
40
|
+
"react": "^19.0.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@vitejs/plugin-react": "6.0.
|
|
45
|
-
"@vitest/coverage-v8": "4.1.
|
|
46
|
-
"jsdom": "29.1.
|
|
47
|
-
"vitest": "4.1.
|
|
43
|
+
"@vitejs/plugin-react": "6.0.2",
|
|
44
|
+
"@vitest/coverage-v8": "4.1.6",
|
|
45
|
+
"jsdom": "29.1.1",
|
|
46
|
+
"vitest": "4.1.6"
|
|
48
47
|
}
|
|
49
48
|
}
|
package/src/lib/fx.js
CHANGED
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createContext, use, useEffect, useReducer, useState } from 'react'
|
|
11
|
-
import { env } from './utils.js'
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
const Pages = createContext()
|
|
12
|
+
const Pagex = createContext()
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* util
|
|
@@ -159,7 +157,7 @@ const reducerLogger = (state, action) => {
|
|
|
159
157
|
*/
|
|
160
158
|
|
|
161
159
|
function useCx() {
|
|
162
|
-
const pages = use(
|
|
160
|
+
const pages = use(Pagex)
|
|
163
161
|
const [icons, setIcons] = useState()
|
|
164
162
|
|
|
165
163
|
useEffect(() => {
|
|
@@ -177,7 +175,8 @@ function useCx() {
|
|
|
177
175
|
return {
|
|
178
176
|
context: pages?.context,
|
|
179
177
|
i18n: pages?.i18n,
|
|
180
|
-
icons
|
|
178
|
+
icons,
|
|
179
|
+
logger: pages?.logger ?? false
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
|
|
@@ -185,7 +184,7 @@ function useFx(functions = { initialState: {} }) {
|
|
|
185
184
|
const cx = useCx()
|
|
186
185
|
const { initialState } = functions
|
|
187
186
|
const [state, dispatch] = useReducer(
|
|
188
|
-
|
|
187
|
+
cx.logger ? reducerLogger : reducer,
|
|
189
188
|
initialState
|
|
190
189
|
)
|
|
191
190
|
|
|
@@ -236,4 +235,4 @@ function useFx(functions = { initialState: {} }) {
|
|
|
236
235
|
return Object.freeze(props)
|
|
237
236
|
}
|
|
238
237
|
|
|
239
|
-
export {
|
|
238
|
+
export { Pagex, useCx, useFx }
|
package/src/lib/index.js
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* https://github.com/sinuhedev/nextia
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Pagex, useCx, useFx } from './fx.js'
|
|
11
11
|
import { useQueryString, useResize } from './hooks.js'
|
|
12
12
|
import { I18n, Icon, Link, Svg } from './ui.js'
|
|
13
|
-
import { css,
|
|
13
|
+
import { css, startViewTransition, version } from './utils.js'
|
|
14
14
|
|
|
15
15
|
export {
|
|
16
16
|
css,
|
|
17
|
-
env,
|
|
18
17
|
I18n,
|
|
19
18
|
Icon,
|
|
20
19
|
Link,
|
|
21
|
-
|
|
20
|
+
Pagex,
|
|
22
21
|
Svg,
|
|
23
22
|
startViewTransition,
|
|
24
23
|
useCx,
|
|
25
24
|
useFx,
|
|
26
25
|
useQueryString,
|
|
27
|
-
useResize
|
|
26
|
+
useResize,
|
|
27
|
+
version
|
|
28
28
|
}
|
package/src/lib/utils.js
CHANGED
|
@@ -7,37 +7,15 @@
|
|
|
7
7
|
* https://github.com/sinuhedev/nextia
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { flushSync } from 'react-dom'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* env
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const env = import.meta.env
|
|
17
|
-
|
|
18
|
-
const VERSION = Object.fromEntries(
|
|
19
|
-
document
|
|
20
|
-
.querySelector('meta[name="version"]')
|
|
21
|
-
?.getAttribute('content')
|
|
22
|
-
.split(', ')
|
|
23
|
-
.map((item) => {
|
|
24
|
-
const [key, value] = item.split('=')
|
|
25
|
-
return [key, value]
|
|
26
|
-
}) ?? ''
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
env.VERSION = VERSION
|
|
30
|
-
|
|
31
10
|
/**
|
|
32
11
|
* View Transition
|
|
33
12
|
*/
|
|
34
13
|
|
|
35
14
|
async function startViewTransition(fun = () => {}, ref, animation = 'fade') {
|
|
36
|
-
if (!document.startViewTransition
|
|
37
|
-
return fun()
|
|
15
|
+
if (!document.startViewTransition) return fun()
|
|
38
16
|
|
|
39
17
|
ref.style.viewTransitionName = animation
|
|
40
|
-
await document.startViewTransition(() =>
|
|
18
|
+
await document.startViewTransition(() => fun).finished
|
|
41
19
|
ref.style.viewTransitionName = ''
|
|
42
20
|
}
|
|
43
21
|
|
|
@@ -64,4 +42,20 @@ function css(...classNames) {
|
|
|
64
42
|
.join(' ')
|
|
65
43
|
}
|
|
66
44
|
|
|
67
|
-
|
|
45
|
+
/**
|
|
46
|
+
* getVersion
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
const version = () =>
|
|
50
|
+
Object.fromEntries(
|
|
51
|
+
document
|
|
52
|
+
.querySelector('meta[name="version"]')
|
|
53
|
+
?.getAttribute('content')
|
|
54
|
+
.split(', ')
|
|
55
|
+
.map((item) => {
|
|
56
|
+
const [key, value] = item.split('=')
|
|
57
|
+
return [key, value]
|
|
58
|
+
}) ?? ''
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
export { css, startViewTransition, version }
|