@hanzogui/use-previous 8.3.1 → 8.3.2
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/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.js +15 -15
- package/dist/esm/index.js.map +1 -1
- package/package.json +18 -13
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -11
- package/dist/cjs/index.cjs +0 -52
- package/dist/cjs/index.native.js +0 -55
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -16
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -16
- package/dist/esm/index.native.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// via radix-ui
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.usePrevious = usePrevious;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
function usePrevious(value) {
|
|
8
|
+
const ref = React.useRef({ value, previous: value });
|
|
9
|
+
// We compare values before making an update to ensure that
|
|
10
|
+
// a change has been made. This ensures the previous value is
|
|
11
|
+
// persisted correctly between renders.
|
|
12
|
+
return React.useMemo(() => {
|
|
13
|
+
if (ref.current.value !== value) {
|
|
14
|
+
ref.current.previous = ref.current.value;
|
|
15
|
+
ref.current.value = value;
|
|
16
|
+
}
|
|
17
|
+
return ref.current.previous;
|
|
18
|
+
}, [value]);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,eAAe;;;;AAEf,MAAY,KAAK,0CAAa;AAE9B,qBAA+B,KAAQ;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IAEpD,2DAA2D;IAC3D,6DAA6D;IAC7D,uCAAuC;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAChC,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAA;YACxC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAC3B,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC7B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
// via radix-ui
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export function usePrevious(value) {
|
|
4
|
+
const ref = React.useRef({ value, previous: value });
|
|
5
|
+
// We compare values before making an update to ensure that
|
|
6
|
+
// a change has been made. This ensures the previous value is
|
|
7
|
+
// persisted correctly between renders.
|
|
8
|
+
return React.useMemo(() => {
|
|
9
|
+
if (ref.current.value !== value) {
|
|
10
|
+
ref.current.previous = ref.current.value;
|
|
11
|
+
ref.current.value = value;
|
|
12
|
+
}
|
|
13
|
+
return ref.current.previous;
|
|
14
|
+
}, [value]);
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AAEf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IAEpD,2DAA2D;IAC3D,6DAA6D;IAC7D,uCAAuC;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAChC,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAA;YACxC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAC3B,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC7B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/use-previous",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"src",
|
|
6
6
|
"types",
|
|
@@ -8,35 +8,40 @@
|
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
11
|
-
"main": "dist/cjs",
|
|
12
|
-
"module": "dist/esm",
|
|
11
|
+
"main": "./dist/cjs/index.js",
|
|
12
|
+
"module": "./dist/esm/index.js",
|
|
13
13
|
"types": "./types/index.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": "./package.json",
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./types/index.d.ts",
|
|
18
|
-
"react-native": "./dist/esm/index.
|
|
19
|
-
"browser": "./dist/esm/index.
|
|
20
|
-
"module": "./dist/esm/index.
|
|
21
|
-
"import": "./dist/esm/index.
|
|
22
|
-
"require": "./dist/cjs/index.
|
|
23
|
-
"default": "./dist/esm/index.
|
|
18
|
+
"react-native": "./dist/esm/index.js",
|
|
19
|
+
"browser": "./dist/esm/index.js",
|
|
20
|
+
"module": "./dist/esm/index.js",
|
|
21
|
+
"import": "./dist/esm/index.js",
|
|
22
|
+
"require": "./dist/cjs/index.js",
|
|
23
|
+
"default": "./dist/esm/index.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "hanzogui-build",
|
|
30
|
+
"build": "hanzogui-build --skip-native",
|
|
31
31
|
"watch": "hanzogui-build --watch",
|
|
32
32
|
"clean": "hanzogui-build clean",
|
|
33
33
|
"clean:build": "hanzogui-build clean:build"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@hanzogui/build": "8.3.
|
|
37
|
-
"react": "
|
|
36
|
+
"@hanzogui/build": "8.3.2",
|
|
37
|
+
"react": "19.2.8"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react": ">=19"
|
|
40
|
+
"react": ">=19.2.8"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/hanzoai/gui.git",
|
|
45
|
+
"directory": "pkgs/core/use-previous"
|
|
41
46
|
}
|
|
42
47
|
}
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mappings": "AAIA,OAAO,iBAAS,YAAY,GAAG,OAAO,IAAI",
|
|
3
|
-
"names": [],
|
|
4
|
-
"sources": [
|
|
5
|
-
"src/index.ts"
|
|
6
|
-
],
|
|
7
|
-
"version": 3,
|
|
8
|
-
"sourcesContent": [
|
|
9
|
-
"// via radix-ui\n\nimport * as React from 'react'\n\nexport function usePrevious<T>(value: T): 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"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAa1C"}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
30
|
-
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
34
|
-
var index_exports = {};
|
|
35
|
-
__export(index_exports, {
|
|
36
|
-
usePrevious: () => usePrevious
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(index_exports);
|
|
39
|
-
var React = __toESM(require("react"), 1);
|
|
40
|
-
function usePrevious(value) {
|
|
41
|
-
const ref = React.useRef({
|
|
42
|
-
value,
|
|
43
|
-
previous: value
|
|
44
|
-
});
|
|
45
|
-
return React.useMemo(() => {
|
|
46
|
-
if (ref.current.value !== value) {
|
|
47
|
-
ref.current.previous = ref.current.value;
|
|
48
|
-
ref.current.value = value;
|
|
49
|
-
}
|
|
50
|
-
return ref.current.previous;
|
|
51
|
-
}, [value]);
|
|
52
|
-
}
|
package/dist/cjs/index.native.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all) __defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
-
get: () => from[key],
|
|
19
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
32
|
-
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
36
|
-
var index_exports = {};
|
|
37
|
-
__export(index_exports, {
|
|
38
|
-
usePrevious: () => usePrevious
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(index_exports);
|
|
41
|
-
var React = __toESM(require("react"), 1);
|
|
42
|
-
function usePrevious(value) {
|
|
43
|
-
var ref = React.useRef({
|
|
44
|
-
value,
|
|
45
|
-
previous: value
|
|
46
|
-
});
|
|
47
|
-
return React.useMemo(function () {
|
|
48
|
-
if (ref.current.value !== value) {
|
|
49
|
-
ref.current.previous = ref.current.value;
|
|
50
|
-
ref.current.value = value;
|
|
51
|
-
}
|
|
52
|
-
return ref.current.previous;
|
|
53
|
-
}, [value]);
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","index_exports","usePrevious","module","exports","React","require","ref","useRef","previous","useMemo","current"],"sources":["index.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n usePrevious: () => usePrevious\n});\nmodule.exports = __toCommonJS(index_exports);\nvar React = __toESM(require(\"react\"), 1);\nfunction usePrevious(value) {\n var ref = React.useRef({\n value,\n previous: value\n });\n return React.useMemo(function() {\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 }, [\n value\n ]);\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,QAAQ,GAAGC,MAAM,CAACC,MAAM;AAC5B,IAAIC,SAAS,GAAGF,MAAM,CAACG,cAAc;AACrC,IAAIC,gBAAgB,GAAGJ,MAAM,CAACK,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGN,MAAM,CAACO,mBAAmB;AAClD,IAAIC,YAAY,GAAGR,MAAM,CAACS,cAAc;AACxC,IAAIC,YAAY,GAAGV,MAAM,CAACW,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBb,SAAS,CAACY,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIlB,iBAAiB,CAACe,IAAI,CAAC,EACrC,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/CpB,SAAS,CAACkB,EAAE,EAAEI,GAAG,EAAE;MAAEP,GAAG,EAAEA,CAAA,KAAMI,IAAI,CAACG,GAAG,CAAC;MAAEN,UAAU,EAAE,EAAEK,IAAI,GAAGnB,gBAAgB,CAACiB,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACL;IAAW,CAAC,CAAC;EACxH;EACA,OAAOE,EAAE;AACX,CAAC;AACD,IAAIM,OAAO,GAAGA,CAACC,GAAG,EAAEC,UAAU,EAAEd,MAAM,MAAMA,MAAM,GAAGa,GAAG,IAAI,IAAI,GAAG5B,QAAQ,CAACS,YAAY,CAACmB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAER,WAAW;AAC9G;AACA;AACA;AACA;AACAS,UAAU,IAAI,CAACD,GAAG,IAAI,CAACA,GAAG,CAACE,UAAU,GAAG3B,SAAS,CAACY,MAAM,EAAE,SAAS,EAAE;EAAEgB,KAAK,EAAEH,GAAG;EAAET,UAAU,EAAE;AAAK,CAAC,CAAC,GAAGJ,MAAM,EAC/Ga,GACF,CAAC,CAAC;AACF,IAAII,YAAY,GAAIJ,GAAG,IAAKR,WAAW,CAACjB,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAE4B,KAAK,EAAE;AAAK,CAAC,CAAC,EAAEH,GAAG,CAAC;AAC1F,IAAIK,aAAa,GAAG,CAAC,CAAC;AACtBnB,QAAQ,CAACmB,aAAa,EAAE;EACtBC,WAAW,EAAEA,CAAA,KAAMA;AACrB,CAAC,CAAC;AACFC,MAAM,CAACC,OAAO,GAAGJ,YAAY,CAACC,aAAa,CAAC;AAC5C,IAAII,KAAK,GAAGV,OAAO,CAACW,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACxC,SAASJ,WAAWA,CAACH,KAAK,EAAE;EAC1B,IAAIQ,GAAG,GAAGF,KAAK,CAACG,MAAM,CAAC;IACrBT,KAAK;IACLU,QAAQ,EAAEV;EACZ,CAAC,CAAC;EACF,OAAOM,KAAK,CAACK,OAAO,CAAC,YAAW;IAC9B,IAAIH,GAAG,CAACI,OAAO,CAACZ,KAAK,KAAKA,KAAK,EAAE;MAC/BQ,GAAG,CAACI,OAAO,CAACF,QAAQ,GAAGF,GAAG,CAACI,OAAO,CAACZ,KAAK;MACxCQ,GAAG,CAACI,OAAO,CAACZ,KAAK,GAAGA,KAAK;IAC3B;IACA,OAAOQ,GAAG,CAACI,OAAO,CAACF,QAAQ;EAC7B,CAAC,EAAE,CACDV,KAAK,CACN,CAAC;AACJ","ignoreList":[]}
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
function usePrevious(value) {
|
|
3
|
-
const ref = React.useRef({
|
|
4
|
-
value,
|
|
5
|
-
previous: value
|
|
6
|
-
});
|
|
7
|
-
return React.useMemo(() => {
|
|
8
|
-
if (ref.current.value !== value) {
|
|
9
|
-
ref.current.previous = ref.current.value;
|
|
10
|
-
ref.current.value = value;
|
|
11
|
-
}
|
|
12
|
-
return ref.current.previous;
|
|
13
|
-
}, [value]);
|
|
14
|
-
}
|
|
15
|
-
export { usePrevious };
|
|
16
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","usePrevious","value","ref","useRef","previous","useMemo","current"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAEhB,SAASC,YAAeC,KAAA,EAAa;EAC1C,MAAMC,GAAA,GAAMH,KAAA,CAAMI,MAAA,CAAO;IAAEF,KAAA;IAAOG,QAAA,EAAUH;EAAM,CAAC;EAKnD,OAAOF,KAAA,CAAMM,OAAA,CAAQ,MAAM;IACzB,IAAIH,GAAA,CAAII,OAAA,CAAQL,KAAA,KAAUA,KAAA,EAAO;MAC/BC,GAAA,CAAII,OAAA,CAAQF,QAAA,GAAWF,GAAA,CAAII,OAAA,CAAQL,KAAA;MACnCC,GAAA,CAAII,OAAA,CAAQL,KAAA,GAAQA,KAAA;IACtB;IACA,OAAOC,GAAA,CAAII,OAAA,CAAQF,QAAA;EACrB,GAAG,CAACH,KAAK,CAAC;AACZ","ignoreList":[]}
|
package/dist/esm/index.native.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
function usePrevious(value) {
|
|
3
|
-
var ref = React.useRef({
|
|
4
|
-
value,
|
|
5
|
-
previous: value
|
|
6
|
-
});
|
|
7
|
-
return React.useMemo(function () {
|
|
8
|
-
if (ref.current.value !== value) {
|
|
9
|
-
ref.current.previous = ref.current.value;
|
|
10
|
-
ref.current.value = value;
|
|
11
|
-
}
|
|
12
|
-
return ref.current.previous;
|
|
13
|
-
}, [value]);
|
|
14
|
-
}
|
|
15
|
-
export { usePrevious };
|
|
16
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","usePrevious","value","ref","useRef","previous","useMemo","current"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAEhB,SAASC,YAAeC,KAAA,EAAa;EAC1C,IAAAC,GAAM,GAAAH,KAAM,CAAAI,MAAM;IAKlBF,KAAO;IACLG,QAAQ,EAAAH;EACN;EACA,OAAAF,KAAI,CAAAM,OAAQ,aAAQ;IACtB,IAAAH,GAAA,CAAAI,OAAA,CAAAL,KAAA,KAAAA,KAAA;MACAC,GAAA,CAAAI,OAAW,CAAAF,QAAQ,GAAAF,GAAA,CAAAI,OAAA,CAAAL,KAAA;MACjBC,GAAA,CAAAI,OAAM,CAAAL,KAAA,GAAAA,KAAA;IACZ","ignoreList":[]}
|