@use-raf/state 0.0.2 → 1.0.0

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -6
  3. package/package.json +20 -27
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 einouqo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,25 @@
1
1
  # @use-raf/state
2
2
 
3
+ [![npm-version-badge]][npm-link]
4
+ [![npm-downloads-badge]][npm-link]
5
+ [![bundle-size-badge]][bundlephobia-link]
6
+ [![types-badge]][npm-link]
7
+ [![license-badge]][license-link]
8
+
3
9
  A React hook that synchronizes state updates with `requestAnimationFrame` for optimal rendering performance.
4
10
 
11
+ <!--links:start-->
12
+ [npm-version-badge]: https://img.shields.io/npm/v/@use-raf/state.svg
13
+ [npm-downloads-badge]: https://img.shields.io/npm/dm/@use-raf/state.svg
14
+ [bundle-size-badge]: https://img.shields.io/bundlephobia/minzip/@use-raf/state
15
+ [bundlephobia-link]: https://bundlephobia.com/package/@use-raf/state
16
+ [types-badge]: https://img.shields.io/npm/types/@use-raf/state
17
+ [npm-link]: https://www.npmjs.com/package/@use-raf/state
18
+ [license-badge]: https://img.shields.io/npm/l/@use-raf/state.svg
19
+ [license-link]: https://github.com/einouqo/use-raf/blob/main/LICENSE
20
+ [codspeed-link]: https://codspeed.io/einouqo/use-raf
21
+ <!--links:end-->
22
+
5
23
  ## Installation
6
24
 
7
25
  ```bash
@@ -60,7 +78,7 @@ const Demo = () => {
60
78
  **Note:** When multiple updater functions are called between frames (e.g., `setState(prev => prev + 1)` three times), `@use-raf/state` correctly chains them, resulting in `3`, while other implementations (`@shined/react-use`, `react-use`, `@reactuses/core`) only apply the last update, resulting in `1`. See [the trial test case](./src/state.test.ts#L367-L410):
61
79
 
62
80
  ```bash
63
- bun run test:trial
81
+ pnpm run test:trial
64
82
  ```
65
83
 
66
84
  Another example illustrating this behavior:
@@ -132,11 +150,7 @@ Benchmarked against similar hooks from popular libraries. While `react-use` lead
132
150
  **Running benchmarks:**
133
151
 
134
152
  ```bash
135
- bun run bench
153
+ pnpm run bench
136
154
  ```
137
155
 
138
156
  **Performance regression tracking:** benchmark results are continuously monitored via [CodSpeed][codspeed-link] to detect performance regressions.
139
-
140
- <!--links:start-->
141
- [codspeed-link]: https://codspeed.io/einouqo/use-raf
142
- <!--links:end-->
package/package.json CHANGED
@@ -1,21 +1,14 @@
1
1
  {
2
2
  "name": "@use-raf/state",
3
- "version": "0.0.2",
3
+ "version": "1.0.0",
4
4
  "description": "React frame-synchronized state hook",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
- ".": "./src/index.ts"
10
- },
11
- "publishConfig": {
12
- "main": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js"
18
- }
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
19
12
  }
20
13
  },
21
14
  "files": [
@@ -34,22 +27,11 @@
34
27
  "animation",
35
28
  "schedule"
36
29
  ],
37
- "scripts": {
38
- "build": "tsup",
39
- "lint": "biome check",
40
- "lint:fix": "biome check --write",
41
- "test": "vitest run",
42
- "test:watch": "vitest",
43
- "test:trial": "TRIAL=true vitest run",
44
- "bench": "vitest bench --run --no-file-parallelism --sequence.shuffle",
45
- "bench:watch": "vitest bench --no-file-parallelism --sequence.shuffle",
46
- "bench:regress": "vitest bench --run -t '#regress' --no-file-parallelism"
47
- },
48
30
  "peerDependencies": {
49
31
  "react": ">=16.14"
50
32
  },
51
33
  "dependencies": {
52
- "@use-raf/skd": "workspace:*"
34
+ "@use-raf/skd": "1.0.0"
53
35
  },
54
36
  "devDependencies": {
55
37
  "@reactuses/core": "^6.1.8",
@@ -65,5 +47,16 @@
65
47
  "bugs": {
66
48
  "url": "https://github.com/einouqo/use-raf/issues"
67
49
  },
68
- "license": "MIT"
69
- }
50
+ "license": "MIT",
51
+ "scripts": {
52
+ "build": "tsup",
53
+ "lint": "biome check",
54
+ "lint:fix": "biome check --write",
55
+ "test": "vitest run",
56
+ "test:watch": "vitest",
57
+ "test:trial": "TRIAL=true vitest run",
58
+ "bench": "vitest bench --run --no-file-parallelism --sequence.shuffle",
59
+ "bench:watch": "vitest bench --no-file-parallelism --sequence.shuffle",
60
+ "bench:regress": "vitest bench --run -t '#regress' --no-file-parallelism"
61
+ }
62
+ }