next 16; react 19; node 24 (#263)

* next 16; react 19

* fix build errors

* add typecheck to workflow

* use node 24

* claude update
This commit is contained in:
tmshv authored and GitHub committed 2026-02-08 23:07:25 +07:00
1 parent 60fb98ddeb
commit 3df47621a2
12 files changed
+1721 -736

No files matched your search

+6 -5
View File
@@ -1,8 +1,9 @@
import { useReducer } from "react"
import { useCallback, useState } from "react"
export function useToggle(initialValue: boolean): [boolean, (nextValue?: boolean) => void] {
return useReducer(
(state: boolean, next?: boolean) => typeof next === "boolean" ? next : !state,
initialValue,
)
const [state, setState] = useState(initialValue)
const toggle = useCallback((next?: boolean) => {
setState(prev => typeof next === "boolean" ? next : !prev)
}, [])
return [state, toggle]
}
+16 -6
View File
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useState } from "react"
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
export type TransitionProps = {
children?: React.ReactNode
@@ -7,9 +7,11 @@ export type TransitionProps = {
show: boolean
}
export const Transition: React.FC<TransitionProps> = props => {
export function Transition(props: TransitionProps) {
const [mounted, setMounted] = useState(props.show)
const [opacity, setOpacity] = useState(0)
const timerRef = useRef<ReturnType<typeof setTimeout>>(null)
const onTransitionEnd = useCallback(() => {
if (opacity === 0) {
setMounted(false)
@@ -20,19 +22,27 @@ export const Transition: React.FC<TransitionProps> = props => {
[props.duration],
)
if (props.show && !mounted) {
setMounted(true)
}
if (!props.show && opacity !== 0) {
setOpacity(0)
}
useEffect(() => {
if (!props.show) {
setOpacity(0)
return
}
setMounted(true)
let t = setTimeout(() => {
timerRef.current = setTimeout(() => {
setOpacity(1)
}, 16)
return () => {
clearTimeout(t)
if (timerRef.current) {
clearTimeout(timerRef.current)
}
}
}, [props.show])