@radix-ui/react-use-previous 1.1.0 → 1.1.1-rc.1

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/dist/index.js CHANGED
@@ -28,13 +28,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // packages/react/use-previous/src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  usePrevious: () => usePrevious
34
34
  });
35
- module.exports = __toCommonJS(src_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
 
37
- // packages/react/use-previous/src/usePrevious.tsx
37
+ // packages/react/use-previous/src/use-previous.tsx
38
38
  var React = __toESM(require("react"));
39
39
  function usePrevious(value) {
40
40
  const ref = React.useRef({ value, previous: value });
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/usePrevious.tsx"],
4
- "sourcesContent": ["export { usePrevious } from './usePrevious';\n", "import * as React from 'react';\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef({ value, previous: value });\n\n // We compare values before making an update to ensure that\n // a change has been made. This ensures the previous value is\n // persisted correctly between renders.\n return React.useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\n\nexport { usePrevious };\n"],
3
+ "sources": ["../src/index.ts", "../src/use-previous.tsx"],
4
+ "sourcesContent": ["export { usePrevious } from './use-previous';\n", "import * as React from 'react';\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef({ value, previous: value });\n\n // We compare values before making an update to ensure that\n // a change has been made. This ensures the previous value is\n // persisted correctly between renders.\n return React.useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\n\nexport { usePrevious };\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAEvB,SAAS,YAAe,OAAU;AAChC,QAAM,MAAY,aAAO,EAAE,OAAO,UAAU,MAAM,CAAC;AAKnD,SAAa,cAAQ,MAAM;AACzB,QAAI,IAAI,QAAQ,UAAU,OAAO;AAC/B,UAAI,QAAQ,WAAW,IAAI,QAAQ;AACnC,UAAI,QAAQ,QAAQ;AAAA,IACtB;AACA,WAAO,IAAI,QAAQ;AAAA,EACrB,GAAG,CAAC,KAAK,CAAC;AACZ;",
6
6
  "names": []
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // packages/react/use-previous/src/usePrevious.tsx
1
+ // packages/react/use-previous/src/use-previous.tsx
2
2
  import * as React from "react";
3
3
  function usePrevious(value) {
4
4
  const ref = React.useRef({ value, previous: value });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/usePrevious.tsx"],
3
+ "sources": ["../src/use-previous.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef({ value, previous: value });\n\n // We compare values before making an update to ensure that\n // a change has been made. This ensures the previous value is\n // persisted correctly between renders.\n return React.useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\n\nexport { usePrevious };\n"],
5
5
  "mappings": ";AAAA,YAAY,WAAW;AAEvB,SAAS,YAAe,OAAU;AAChC,QAAM,MAAY,aAAO,EAAE,OAAO,UAAU,MAAM,CAAC;AAKnD,SAAa,cAAQ,MAAM;AACzB,QAAI,IAAI,QAAQ,UAAU,OAAO;AAC/B,UAAI,QAAQ,WAAW,IAAI,QAAQ;AACnC,UAAI,QAAQ,QAAQ;AAAA,IACtB;AACA,WAAO,IAAI,QAAQ;AAAA,EACrB,GAAG,CAAC,KAAK,CAAC;AACZ;",
6
6
  "names": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-use-previous",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-rc.1",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -24,9 +24,20 @@
24
24
  ],
25
25
  "sideEffects": false,
26
26
  "scripts": {
27
+ "lint": "eslint --max-warnings 0 src",
27
28
  "clean": "rm -rf dist",
28
29
  "version": "yarn version"
29
30
  },
31
+ "devDependencies": {
32
+ "@repo/eslint-config": "0.0.0",
33
+ "@repo/typescript-config": "0.0.0",
34
+ "@types/react": "^19.0.7",
35
+ "@types/react-dom": "^19.0.3",
36
+ "eslint": "^9.18.0",
37
+ "react": "^19.0.0",
38
+ "react-dom": "^19.0.0",
39
+ "typescript": "^5.7.3"
40
+ },
30
41
  "peerDependencies": {
31
42
  "@types/react": "*",
32
43
  "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
@@ -43,5 +54,6 @@
43
54
  },
44
55
  "bugs": {
45
56
  "url": "https://github.com/radix-ui/primitives/issues"
46
- }
57
+ },
58
+ "stableVersion": "1.1.0"
47
59
  }