@tamagui/use-event 1.61.2 → 1.62.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.
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +22 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/useEvent.js +6 -10
- package/dist/cjs/useEvent.js.map +1 -1
- package/dist/cjs/useEvent.native.js +32 -0
- package/dist/cjs/useEvent.native.js.map +6 -0
- package/dist/cjs/useGet.js +9 -19
- package/dist/cjs/useGet.js.map +1 -1
- package/dist/cjs/useGet.native.js +36 -0
- package/dist/cjs/useGet.native.js.map +6 -0
- package/dist/esm/useEvent.js +1 -1
- package/dist/esm/useEvent.js.map +1 -1
- package/dist/esm/useGet.js +4 -10
- package/dist/esm/useGet.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
7
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
9
|
return to;
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
12
|
var src_exports = {};
|
|
17
13
|
module.exports = __toCommonJS(src_exports);
|
|
18
14
|
__reExport(src_exports, require("./useEvent"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./useEvent"), module.exports);
|
|
16
|
+
__reExport(src_exports, require("./useGet"), module.exports);
|
|
17
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
18
|
+
0 && (module.exports = {
|
|
19
|
+
...require("./useEvent"),
|
|
20
|
+
...require("./useGet")
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/dist/cjs/useEvent.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var useEvent_exports = {};
|
|
20
16
|
__export(useEvent_exports, {
|
|
21
17
|
useEvent: () => useEvent
|
|
@@ -23,7 +19,7 @@ __export(useEvent_exports, {
|
|
|
23
19
|
module.exports = __toCommonJS(useEvent_exports);
|
|
24
20
|
var import_useGet = require("./useGet");
|
|
25
21
|
function useEvent(callback) {
|
|
26
|
-
return (0, import_useGet.useGet)(callback, defaultValue,
|
|
22
|
+
return (0, import_useGet.useGet)(callback, defaultValue, !0);
|
|
27
23
|
}
|
|
28
24
|
const defaultValue = () => {
|
|
29
25
|
throw new Error("Cannot call an event handler while rendering.");
|
package/dist/cjs/useEvent.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useEvent.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAIhB,SAAS,SAAgC,UAAiB;AAC/D,aAAO,sBAAO,UAAU,cAAc,EAAI;AAC5C;AAEA,MAAM,eAAe,MAAM;AACzB,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var useEvent_exports = {};
|
|
17
|
+
__export(useEvent_exports, {
|
|
18
|
+
useEvent: () => useEvent
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(useEvent_exports);
|
|
21
|
+
var import_useGet = require("./useGet");
|
|
22
|
+
function useEvent(callback) {
|
|
23
|
+
return (0, import_useGet.useGet)(callback, defaultValue, !0);
|
|
24
|
+
}
|
|
25
|
+
const defaultValue = () => {
|
|
26
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
27
|
+
};
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
useEvent
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=useEvent.js.map
|
package/dist/cjs/useGet.js
CHANGED
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var useGet_exports = {};
|
|
20
16
|
__export(useGet_exports, {
|
|
21
17
|
useGet: () => useGet
|
|
22
18
|
});
|
|
23
19
|
module.exports = __toCommonJS(useGet_exports);
|
|
24
20
|
var import_react = require("react");
|
|
25
|
-
const isWeb =
|
|
26
|
-
const isClient = typeof window !== "undefined";
|
|
27
|
-
const useIsomorphicLayoutEffect = !isWeb || isClient ? import_react.useLayoutEffect : import_react.useEffect;
|
|
21
|
+
const isWeb = !0, isClient = typeof window < "u", useIsomorphicLayoutEffect = !isWeb || isClient ? import_react.useLayoutEffect : import_react.useEffect;
|
|
28
22
|
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
29
23
|
const curRef = (0, import_react.useRef)(initialValue ?? currentValue);
|
|
30
|
-
useIsomorphicLayoutEffect(() => {
|
|
24
|
+
return useIsomorphicLayoutEffect(() => {
|
|
31
25
|
curRef.current = currentValue;
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
forwardToFunction ? (...args) => {
|
|
35
|
-
var _a;
|
|
36
|
-
return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
|
|
37
|
-
} : () => curRef.current,
|
|
26
|
+
}), (0, import_react.useCallback)(
|
|
27
|
+
forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
|
|
38
28
|
[]
|
|
39
29
|
);
|
|
40
30
|
}
|
package/dist/cjs/useGet.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGet.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgE;AAEhE,MAAM,QAAQ,IACR,WAAW,OAAO,SAAW,KAC7B,4BAA4B,CAAC,SAAS,WAAW,+BAAkB;AAIlE,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,aAAS,qBAAY,gBAAgB,YAAY;AACvD,mCAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC,OAEM;AAAA,IACL,oBACI,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAC7C,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var useGet_exports = {};
|
|
17
|
+
__export(useGet_exports, {
|
|
18
|
+
useGet: () => useGet
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(useGet_exports);
|
|
21
|
+
var import_react = require("react");
|
|
22
|
+
const isWeb = !1, isClient = typeof window < "u", useIsomorphicLayoutEffect = !isWeb || isClient ? import_react.useLayoutEffect : import_react.useEffect;
|
|
23
|
+
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
24
|
+
const curRef = (0, import_react.useRef)(initialValue ?? currentValue);
|
|
25
|
+
return useIsomorphicLayoutEffect(() => {
|
|
26
|
+
curRef.current = currentValue;
|
|
27
|
+
}), (0, import_react.useCallback)(
|
|
28
|
+
forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
|
|
29
|
+
[]
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
useGet
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=useGet.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useGet.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgE;AAEhE,MAAM,QAAQ,IACR,WAAW,OAAO,SAAW,KAC7B,4BAA4B,CAAC,SAAS,WAAW,+BAAkB;AAIlE,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,aAAS,qBAAY,gBAAgB,YAAY;AACvD,mCAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC,OAEM;AAAA,IACL,oBACI,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAC7C,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/esm/useEvent.js
CHANGED
package/dist/esm/useEvent.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useEvent.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,cAAc;AAIhB,SAAS,SAAgC,UAAiB;AAC/D,SAAO,OAAO,UAAU,cAAc,
|
|
4
|
+
"mappings": "AAAA,SAAS,cAAc;AAIhB,SAAS,SAAgC,UAAiB;AAC/D,SAAO,OAAO,UAAU,cAAc,EAAI;AAC5C;AAEA,MAAM,eAAe,MAAM;AACzB,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/useGet.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
2
|
-
const isWeb =
|
|
3
|
-
const isClient = typeof window !== "undefined";
|
|
4
|
-
const useIsomorphicLayoutEffect = !isWeb || isClient ? useLayoutEffect : useEffect;
|
|
2
|
+
const isWeb = !0, isClient = typeof window < "u", useIsomorphicLayoutEffect = !isWeb || isClient ? useLayoutEffect : useEffect;
|
|
5
3
|
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
6
4
|
const curRef = useRef(initialValue ?? currentValue);
|
|
7
|
-
useIsomorphicLayoutEffect(() => {
|
|
5
|
+
return useIsomorphicLayoutEffect(() => {
|
|
8
6
|
curRef.current = currentValue;
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
forwardToFunction ? (...args) => {
|
|
12
|
-
var _a;
|
|
13
|
-
return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
|
|
14
|
-
} : () => curRef.current,
|
|
7
|
+
}), useCallback(
|
|
8
|
+
forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
|
|
15
9
|
[]
|
|
16
10
|
);
|
|
17
11
|
}
|
package/dist/esm/useGet.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGet.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,aAAa,WAAW,iBAAiB,cAAc;AAEhE,MAAM,QAAQ,
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa,WAAW,iBAAiB,cAAc;AAEhE,MAAM,QAAQ,IACR,WAAW,OAAO,SAAW,KAC7B,4BAA4B,CAAC,SAAS,WAAW,kBAAkB;AAIlE,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,SAAS,OAAY,gBAAgB,YAAY;AACvD,mCAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC,GAEM;AAAA,IACL,oBACI,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAC7C,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-event",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
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.
|
|
21
|
+
"@tamagui/build": "1.62.0",
|
|
22
22
|
"react": "^18.2.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|