@tamagui/use-event 1.116.1 → 1.116.3
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 +16 -0
- package/dist/cjs/useEvent.js +27 -0
- package/dist/cjs/useGet.js +38 -0
- package/package.json +3 -3
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{useEvent.cjs.map → useEvent.js.map} +0 -0
- /package/dist/cjs/{useGet.cjs.map → useGet.js.map} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
+
return to;
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
+
var src_exports = {};
|
|
13
|
+
module.exports = __toCommonJS(src_exports);
|
|
14
|
+
__reExport(src_exports, require("./useEvent"), module.exports);
|
|
15
|
+
__reExport(src_exports, require("./useGet"), module.exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var useEvent_exports = {};
|
|
16
|
+
__export(useEvent_exports, {
|
|
17
|
+
useEvent: () => useEvent
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(useEvent_exports);
|
|
20
|
+
var import_useGet = require("./useGet");
|
|
21
|
+
function useEvent(callback) {
|
|
22
|
+
return (0, import_useGet.useGet)(callback, defaultValue, !0);
|
|
23
|
+
}
|
|
24
|
+
const defaultValue = () => {
|
|
25
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useEvent.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
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, __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 __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);
|
|
23
|
+
var useGet_exports = {};
|
|
24
|
+
__export(useGet_exports, {
|
|
25
|
+
useGet: () => useGet
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useGet_exports);
|
|
28
|
+
var import_constants = require("@tamagui/constants"), React = __toESM(require("react"));
|
|
29
|
+
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
30
|
+
const curRef = React.useRef(initialValue ?? currentValue);
|
|
31
|
+
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
32
|
+
curRef.current = currentValue;
|
|
33
|
+
}), React.useCallback(
|
|
34
|
+
forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
|
|
35
|
+
[]
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useGet.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-event",
|
|
3
|
-
"version": "1.116.
|
|
3
|
+
"version": "1.116.3",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "1.116.
|
|
21
|
+
"@tamagui/build": "1.116.3",
|
|
22
22
|
"react": "^18.2.0 || ^19.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tamagui/constants": "1.116.
|
|
25
|
+
"@tamagui/constants": "1.116.3"
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
"./package.json": "./package.json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|