@tamagui/use-previous 1.108.0 → 1.108.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/cjs/index.js +13 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +13 -5
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +2 -2
- package/src/index.ts +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -11,15 +12,22 @@ var __export = (target, all) => {
|
|
|
11
12
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
13
|
return to;
|
|
13
14
|
};
|
|
14
|
-
var
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
23
|
var src_exports = {};
|
|
16
24
|
__export(src_exports, {
|
|
17
25
|
usePrevious: () => usePrevious
|
|
18
26
|
});
|
|
19
27
|
module.exports = __toCommonJS(src_exports);
|
|
20
|
-
var
|
|
28
|
+
var React = __toESM(require("react"));
|
|
21
29
|
function usePrevious(value) {
|
|
22
|
-
const ref =
|
|
23
|
-
return
|
|
30
|
+
const ref = React.useRef({ value, previous: value });
|
|
31
|
+
return React.useMemo(() => (ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous), [value]);
|
|
24
32
|
}
|
|
25
33
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAEhB,SAAS,YAAe,OAAU;AACvC,QAAM,MAAM,MAAM,OAAO,EAAE,OAAO,UAAU,MAAM,CAAC;AAKnD,SAAO,MAAM,QAAQ,OACf,IAAI,QAAQ,UAAU,UACxB,IAAI,QAAQ,WAAW,IAAI,QAAQ,OACnC,IAAI,QAAQ,QAAQ,QAEf,IAAI,QAAQ,WAClB,CAAC,KAAK,CAAC;AACZ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -12,19 +13,26 @@ var __export = (target, all) => {
|
|
|
12
13
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
14
|
return to;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
24
|
var src_exports = {};
|
|
17
25
|
__export(src_exports, {
|
|
18
26
|
usePrevious: () => usePrevious
|
|
19
27
|
});
|
|
20
28
|
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var
|
|
29
|
+
var React = __toESM(require("react"));
|
|
22
30
|
function usePrevious(value) {
|
|
23
|
-
var ref =
|
|
31
|
+
var ref = React.useRef({
|
|
24
32
|
value,
|
|
25
33
|
previous: value
|
|
26
34
|
});
|
|
27
|
-
return
|
|
35
|
+
return React.useMemo(function() {
|
|
28
36
|
return ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous;
|
|
29
37
|
}, [
|
|
30
38
|
value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/use-previous/src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["usePrevious", "value", "ref", "useRef", "previous", "useMemo", "current"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAEA,YAAuB;AAEhB,SAASA,YAAeC,OAAQ;AACrC,MAAMC,MAAMC,MAAMC,OAAO;IAAEH;IAAOI,UAAUJ;EAAM,CAAA;AAKlD,SAAOE,MAAMG,QAAQ,WAAA;AACnB,WAAIJ,IAAIK,QAAQN,UAAUA,UACxBC,IAAIK,QAAQF,WAAWH,IAAIK,QAAQN,OACnCC,IAAIK,QAAQN,QAAQA,QAEfC,IAAIK,QAAQF;EACrB,GAAG;IAACJ;GAAM;AACZ;",
|
|
5
|
+
"names": ["usePrevious", "value", "ref", "React", "useRef", "previous", "useMemo", "current"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
function usePrevious(value) {
|
|
3
|
-
const ref = useRef({ value, previous: value });
|
|
4
|
-
return useMemo(() => (ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous), [value]);
|
|
3
|
+
const ref = React.useRef({ value, previous: value });
|
|
4
|
+
return React.useMemo(() => (ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous), [value]);
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
usePrevious
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAEA,
|
|
4
|
+
"mappings": "AAEA,YAAY,WAAW;AAEhB,SAAS,YAAe,OAAU;AACvC,QAAM,MAAM,MAAM,OAAO,EAAE,OAAO,UAAU,MAAM,CAAC;AAKnD,SAAO,MAAM,QAAQ,OACf,IAAI,QAAQ,UAAU,UACxB,IAAI,QAAQ,WAAW,IAAI,QAAQ,OACnC,IAAI,QAAQ,QAAQ,QAEf,IAAI,QAAQ,WAClB,CAAC,KAAK,CAAC;AACZ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
function usePrevious(value) {
|
|
3
|
-
const ref = useRef({
|
|
3
|
+
const ref = React.useRef({
|
|
4
4
|
value,
|
|
5
5
|
previous: value
|
|
6
6
|
});
|
|
7
|
-
return useMemo(() => (ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous), [value]);
|
|
7
|
+
return React.useMemo(() => (ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous), [value]);
|
|
8
8
|
}
|
|
9
9
|
export { usePrevious };
|
|
10
10
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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,EAAU;EACvC,MAAMC,GAAA,GAAMH,KAAA,CAAMI,MAAA,CAAO;IAAEF,KAAA;IAAOG,QAAA,EAAUH;EAAM,CAAC;EAKnD,OAAOF,KAAA,CAAMM,OAAA,CAAQ,OACfH,GAAA,CAAII,OAAA,CAAQL,KAAA,KAAUA,KAAA,KACxBC,GAAA,CAAII,OAAA,CAAQF,QAAA,GAAWF,GAAA,CAAII,OAAA,CAAQL,KAAA,EACnCC,GAAA,CAAII,OAAA,CAAQL,KAAA,GAAQA,KAAA,GAEfC,GAAA,CAAII,OAAA,CAAQF,QAAA,GAClB,CAACH,KAAK,CAAC;AACZ","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
function usePrevious(value) {
|
|
3
|
-
var ref = useRef({
|
|
3
|
+
var ref = React.useRef({
|
|
4
4
|
value,
|
|
5
5
|
previous: value
|
|
6
6
|
});
|
|
7
|
-
return useMemo(function() {
|
|
7
|
+
return React.useMemo(function() {
|
|
8
8
|
return ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous;
|
|
9
9
|
}, [
|
|
10
10
|
value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/use-previous/src/index.ts"],
|
|
4
|
-
"mappings": "AAEA,
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": "AAEA,YAAYA,WAAW;AAEhB,SAASC,YAAeC,OAAQ;AACrC,MAAMC,MAAMH,MAAMI,OAAO;IAAEF;IAAOG,UAAUH;EAAM,CAAA;AAKlD,SAAOF,MAAMM,QAAQ,WAAA;AACnB,WAAIH,IAAII,QAAQL,UAAUA,UACxBC,IAAII,QAAQF,WAAWF,IAAII,QAAQL,OACnCC,IAAII,QAAQL,QAAQA,QAEfC,IAAII,QAAQF;EACrB,GAAG;IAACH;GAAM;AACZ;",
|
|
5
|
+
"names": ["React", "usePrevious", "value", "ref", "useRef", "previous", "useMemo", "current"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-previous",
|
|
3
|
-
"version": "1.108.
|
|
3
|
+
"version": "1.108.1",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "1.108.
|
|
21
|
+
"@tamagui/build": "1.108.1"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
"./package.json": "./package.json",
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// via radix-ui
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react'
|
|
4
4
|
|
|
5
5
|
export function usePrevious<T>(value: T) {
|
|
6
|
-
const ref = useRef({ value, previous: value })
|
|
6
|
+
const ref = React.useRef({ value, previous: value })
|
|
7
7
|
|
|
8
8
|
// We compare values before making an update to ensure that
|
|
9
9
|
// a change has been made. This ensures the previous value is
|
|
10
10
|
// persisted correctly between renders.
|
|
11
|
-
return useMemo(() => {
|
|
11
|
+
return React.useMemo(() => {
|
|
12
12
|
if (ref.current.value !== value) {
|
|
13
13
|
ref.current.previous = ref.current.value
|
|
14
14
|
ref.current.value = value
|