create-packer 1.25.22 → 1.25.24
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 +1 -1
- package/template/web-app/next/.gitignore +2 -0
- package/template/web-app/next/package.json +1 -0
- package/template/web-app/react/hooks/index.ts +1 -0
- package/template/web-app/react/hooks/useLowPriorityState.ts +26 -0
- package/template/web-app/react-webpack/hooks/index.ts +1 -0
- package/template/web-app/react-webpack/hooks/useLowPriorityState.ts +26 -0
- package/template/web-app/react-webpack/webpack.config.mjs +3 -1
- package/template/workspace/pnpm/package.json +2 -2
- package/template/web-app/next/pnpm-lock.yaml +0 -4187
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as useLoadingAction } from './useLoadingAction'
|
|
2
2
|
export { default as useInterval } from './useInterval'
|
|
3
3
|
export { default as useVisible } from './useVisible'
|
|
4
|
+
export { default as useLowPriorityState } from './useLowPriorityState'
|
|
4
5
|
export * from './useSyncState'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState, useTransition, DependencyList } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param callback
|
|
6
|
+
* @param watches If set, it is autorun callback
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export default function useLowPriorityState<V>(callback: () => V, watches?: DependencyList) {
|
|
10
|
+
const [value, setValue] = useState<V>(callback)
|
|
11
|
+
const [loading, startTransition] = useTransition()
|
|
12
|
+
|
|
13
|
+
function startLoad() {
|
|
14
|
+
startTransition(() => {
|
|
15
|
+
setValue(callback())
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (watches) {
|
|
21
|
+
startLoad()
|
|
22
|
+
}
|
|
23
|
+
}, watches)
|
|
24
|
+
|
|
25
|
+
return [value, { loading, startLoad }] as const
|
|
26
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as useLoadingAction } from './useLoadingAction'
|
|
2
2
|
export { default as useInterval } from './useInterval'
|
|
3
3
|
export { default as useVisible } from './useVisible'
|
|
4
|
+
export { default as useLowPriorityState } from './useLowPriorityState'
|
|
4
5
|
export * from './useSyncState'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState, useTransition, DependencyList } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param callback
|
|
6
|
+
* @param watches If set, it is autorun callback
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export default function useLowPriorityState<V>(callback: () => V, watches?: DependencyList) {
|
|
10
|
+
const [value, setValue] = useState<V>(callback)
|
|
11
|
+
const [loading, startTransition] = useTransition()
|
|
12
|
+
|
|
13
|
+
function startLoad() {
|
|
14
|
+
startTransition(() => {
|
|
15
|
+
setValue(callback())
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (watches) {
|
|
21
|
+
startLoad()
|
|
22
|
+
}
|
|
23
|
+
}, watches)
|
|
24
|
+
|
|
25
|
+
return [value, { loading, startLoad }] as const
|
|
26
|
+
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
"private": true,
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "ts-node ./scripts/build.ts",
|
|
8
|
+
"build": "pnpm run clean:dist && ts-node ./scripts/build.ts",
|
|
9
9
|
"changeVersion": "pnpm changeset && pnpm changeset version && pnpm run clear:changelog",
|
|
10
10
|
"clear:changelog": "pnpm -r exec rimraf CHANGELOG.md",
|
|
11
11
|
"commit": "git add . && cz",
|
|
12
12
|
"push": "pnpm run commit && git push",
|
|
13
13
|
"login": "npm login --registry http://registry.npmjs.org",
|
|
14
14
|
"clean:dist": "pnpm -r exec rimraf dist",
|
|
15
|
-
"pub": "pnpm run
|
|
15
|
+
"pub": "pnpm run build && pnpm run changeVersion && pnpm run push && pnpm -r publish --registry https://registry.npmjs.org"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [],
|
|
18
18
|
"author": "kevily",
|