diff --git a/.changeset/cozy-lizards-scream.md b/.changeset/cozy-lizards-scream.md deleted file mode 100644 index a56400c5..00000000 --- a/.changeset/cozy-lizards-scream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': minor ---- - -Pass the previous state value as the second argument to useInputState's transformValue callback. diff --git a/.changeset/explicit-any-policy.md b/.changeset/explicit-any-policy.md deleted file mode 100644 index 5a9d38db..00000000 --- a/.changeset/explicit-any-policy.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'react-simplikit': minor ---- - -The emitted declarations of `usePreservedCallback`, `useDebounce`, `useThrottle` and `useCallbackOncePerRender` now name their callback parameter type `CallerTypedArgs` instead of `any[]`. It is the same type, so they accept the same callbacks. `useThrottle` also constrains the callback's return type to `unknown` instead of `any`, which accepts the same callbacks. - -The throttled function returned by `useThrottle` now accepts the callback's parameters instead of `any[]`, so calling it with arguments the callback does not take is a type error. The return types of `useThrottle` and `useDebounce` are now written out in their declarations, so a consumer that emits declarations can export their result without a TS2742 error. diff --git a/.changeset/nullable-outside-click-containers.md b/.changeset/nullable-outside-click-containers.md deleted file mode 100644 index ecbbd4d5..00000000 --- a/.changeset/nullable-outside-click-containers.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -Document that `useOutsideClickEffect` accepts `null` entries in container arrays, matching its existing type and behavior. diff --git a/.changeset/quiet-impressions-read.md b/.changeset/quiet-impressions-read.md deleted file mode 100644 index 82c6d0b2..00000000 --- a/.changeset/quiet-impressions-read.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -Mark `useImpressionRef`'s `rootMargin` option as optional in the JSDoc and documentation, matching its existing type. diff --git a/.changeset/readonly-list-inputs.md b/.changeset/readonly-list-inputs.md deleted file mode 100644 index 7773d944..00000000 --- a/.changeset/readonly-list-inputs.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -Allow readonly arrays as the initial state and `setAll` input of `useList`. diff --git a/.changeset/use-double-click-keyboard-activation.md b/.changeset/use-double-click-keyboard-activation.md deleted file mode 100644 index 38a320b3..00000000 --- a/.changeset/use-double-click-keyboard-activation.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -`useDoubleClick` now runs `click` immediately for clicks that carry no click count (`event.detail === 0`), such as Enter/Space on a native button or a programmatic `element.click()`. The handler only recognised `detail` 1 and 2, so these clicks were dropped, and they also cancelled a pending mouse click. `doubleClick` is still only called for `detail === 2`. diff --git a/.changeset/use-loading-overlapping-calls.md b/.changeset/use-loading-overlapping-calls.md deleted file mode 100644 index 3a860fcb..00000000 --- a/.changeset/use-loading-overlapping-calls.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -`useLoading` now keeps `loading` as `true` until every promise passed to `startLoading` has settled. Before, when two calls overlapped, the first promise to settle set `loading` to `false` while the other was still pending. diff --git a/.changeset/use-long-press-emulated-mouse.md b/.changeset/use-long-press-emulated-mouse.md deleted file mode 100644 index d976ace5..00000000 --- a/.changeset/use-long-press-emulated-mouse.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -`useLongPress` no longer calls `onClick` twice for a tap on touch devices. After `touchend`, browsers fire emulated `mousedown`/`mouseup` events on the same element, and the hook handled them as a second, mouse press. That also called `onClick` after `onLongPressEnd` when the long press came from touch. Mouse presses that start within 1 second of a touch event are now ignored. diff --git a/.changeset/use-scroll-direction-throttle-reset.md b/.changeset/use-scroll-direction-throttle-reset.md deleted file mode 100644 index be08b159..00000000 --- a/.changeset/use-scroll-direction-throttle-reset.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -`useScrollDirection` no longer stops tracking scroll when `throttleMs` changes, or the component's effects re-run, while a throttle window is still open. The cleanup cleared the pending timer but left its id in the ref, so the next listener treated every scroll as throttled. diff --git a/.changeset/usemap-optional-initial-state.md b/.changeset/usemap-optional-initial-state.md deleted file mode 100644 index 92a3b94d..00000000 --- a/.changeset/usemap-optional-initial-state.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'react-simplikit': patch ---- - -Mark `useMap`'s `initialState` parameter as optional in the JSDoc and documentation, matching its existing default of `new Map()`. diff --git a/packages/react-simplikit/CHANGELOG.md b/packages/react-simplikit/CHANGELOG.md index c9f1ddce..129efe36 100644 --- a/packages/react-simplikit/CHANGELOG.md +++ b/packages/react-simplikit/CHANGELOG.md @@ -1,5 +1,33 @@ # react-simplikit +## 0.4.0 + +### Minor Changes + +- [#574](https://github.com/toss/react-simplikit/pull/574) [`402995e`](https://github.com/toss/react-simplikit/commit/402995eea8b2db6dd99b2c0adebf07df8d5684e9) Thanks [@DongEun02](https://github.com/DongEun02)! - Pass the previous state value as the second argument to useInputState's transformValue callback. + +- [#571](https://github.com/toss/react-simplikit/pull/571) [`a62e7d6`](https://github.com/toss/react-simplikit/commit/a62e7d69c46287984bd67a0d9109bed2de7cd665) Thanks [@hyesungoh](https://github.com/hyesungoh)! - The emitted declarations of `usePreservedCallback`, `useDebounce`, `useThrottle` and `useCallbackOncePerRender` now name their callback parameter type `CallerTypedArgs` instead of `any[]`. It is the same type, so they accept the same callbacks. `useThrottle` also constrains the callback's return type to `unknown` instead of `any`, which accepts the same callbacks. + + The throttled function returned by `useThrottle` now accepts the callback's parameters instead of `any[]`, so calling it with arguments the callback does not take is a type error. The return types of `useThrottle` and `useDebounce` are now written out in their declarations, so a consumer that emits declarations can export their result without a TS2742 error. + +### Patch Changes + +- [#572](https://github.com/toss/react-simplikit/pull/572) [`cf0dd83`](https://github.com/toss/react-simplikit/commit/cf0dd83e46dc75bec4d5535d50d8ba903d57edb6) Thanks [@GamjaIsMine02](https://github.com/GamjaIsMine02)! - Document that `useOutsideClickEffect` accepts `null` entries in container arrays, matching its existing type and behavior. + +- [#569](https://github.com/toss/react-simplikit/pull/569) [`8ead31d`](https://github.com/toss/react-simplikit/commit/8ead31d229ace4dd59a12ff8cfc4081518e2e29c) Thanks [@GamjaIsMine02](https://github.com/GamjaIsMine02)! - Mark `useImpressionRef`'s `rootMargin` option as optional in the JSDoc and documentation, matching its existing type. + +- [#575](https://github.com/toss/react-simplikit/pull/575) [`5a21c39`](https://github.com/toss/react-simplikit/commit/5a21c399616198eb48068f6095231eec73f60de6) Thanks [@GamjaIsMine02](https://github.com/GamjaIsMine02)! - Allow readonly arrays as the initial state and `setAll` input of `useList`. + +- [#579](https://github.com/toss/react-simplikit/pull/579) [`8828710`](https://github.com/toss/react-simplikit/commit/882871012fee6c7bd3684b57c238f0a1199a49f9) Thanks [@KooYS](https://github.com/KooYS)! - `useDoubleClick` now runs `click` immediately for clicks that carry no click count (`event.detail === 0`), such as Enter/Space on a native button or a programmatic `element.click()`. The handler only recognised `detail` 1 and 2, so these clicks were dropped, and they also cancelled a pending mouse click. `doubleClick` is still only called for `detail === 2`. + +- [#577](https://github.com/toss/react-simplikit/pull/577) [`89ad72e`](https://github.com/toss/react-simplikit/commit/89ad72e5663f6c9d7b00af4090136b0f81ff00a3) Thanks [@rjsgud49](https://github.com/rjsgud49)! - `useLoading` now keeps `loading` as `true` until every promise passed to `startLoading` has settled. Before, when two calls overlapped, the first promise to settle set `loading` to `false` while the other was still pending. + +- [#576](https://github.com/toss/react-simplikit/pull/576) [`7e8c88a`](https://github.com/toss/react-simplikit/commit/7e8c88ac92e82fbd1e1ab8a5f9b1b897b024c2d1) Thanks [@rjsgud49](https://github.com/rjsgud49)! - `useLongPress` no longer calls `onClick` twice for a tap on touch devices. After `touchend`, browsers fire emulated `mousedown`/`mouseup` events on the same element, and the hook handled them as a second, mouse press. That also called `onClick` after `onLongPressEnd` when the long press came from touch. Mouse presses that start within 1 second of a touch event are now ignored. + +- [#567](https://github.com/toss/react-simplikit/pull/567) [`d8e8147`](https://github.com/toss/react-simplikit/commit/d8e8147720b441f21000f46b8b618212af99d827) Thanks [@rjsgud49](https://github.com/rjsgud49)! - `useScrollDirection` no longer stops tracking scroll when `throttleMs` changes, or the component's effects re-run, while a throttle window is still open. The cleanup cleared the pending timer but left its id in the ref, so the next listener treated every scroll as throttled. + +- [#578](https://github.com/toss/react-simplikit/pull/578) [`4b9a4aa`](https://github.com/toss/react-simplikit/commit/4b9a4aa4d6b187390e3102b131b49962199aee9d) Thanks [@mmporong](https://github.com/mmporong)! - Mark `useMap`'s `initialState` parameter as optional in the JSDoc and documentation, matching its existing default of `new Map()`. + ## 0.3.3 ### Patch Changes diff --git a/packages/react-simplikit/package.json b/packages/react-simplikit/package.json index cd4b84e7..25c04084 100644 --- a/packages/react-simplikit/package.json +++ b/packages/react-simplikit/package.json @@ -1,6 +1,6 @@ { "name": "react-simplikit", - "version": "0.3.3", + "version": "0.4.0", "description": "React hooks, components and utilities for every React app, mobile web included — SSR-safe, zero dependencies", "main": "./dist/index.cjs", "module": "./dist/index.mjs",