@tamagui/use-callback-ref 2.0.0-rc.4 → 2.0.0-rc.40

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.
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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);
32
34
  var index_exports = {};
33
35
  __export(index_exports, {
34
36
  useCallbackRef: () => useCallbackRef
@@ -37,7 +39,8 @@ module.exports = __toCommonJS(index_exports);
37
39
  var React = __toESM(require("react"), 1);
38
40
  function useCallbackRef(callback) {
39
41
  const callbackRef = React.useRef(callback);
40
- return React.useEffect(() => {
42
+ React.useEffect(() => {
41
43
  callbackRef.current = callback;
42
- }), React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
44
+ });
45
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
43
46
  }
@@ -4,33 +4,35 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  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: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
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);
34
36
  var index_exports = {};
35
37
  __export(index_exports, {
36
38
  useCallbackRef: () => useCallbackRef
@@ -39,11 +41,14 @@ module.exports = __toCommonJS(index_exports);
39
41
  var React = __toESM(require("react"), 1);
40
42
  function useCallbackRef(callback) {
41
43
  var callbackRef = React.useRef(callback);
42
- return React.useEffect(function () {
44
+ React.useEffect(function () {
43
45
  callbackRef.current = callback;
44
- }), React.useMemo(function () {
46
+ });
47
+ return React.useMemo(function () {
45
48
  return function () {
46
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
49
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
+ args[_key] = arguments[_key];
51
+ }
47
52
  var _callbackRef_current;
48
53
  return (_callbackRef_current = callbackRef.current) === null || _callbackRef_current === void 0 ? void 0 : _callbackRef_current.call(callbackRef, ...args);
49
54
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","useCallbackRef","module","exports","React","__toESM","require","callback","callbackRef","useRef","useEffect","current","useMemo"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAuB,GAAAT,YAAA,CAAAK,aAAA;AAMhB,IAAAK,KAAS,GAAAC,OAAA,CAAAC,OACd,QACG;AACH,SAAML,cAAcA,CAAAM,QAAM;EAE1B,IAAAC,WAAM,GAAAJ,KAAU,CAAAK,MAAM,CAAAF,QAAA;EACpB,OAAAH,KAAA,CAAAM,SAAY,aAAU;IACvBF,WAGY,CAAAG,OAAQ,GAAAJ,QAAW;EAClC,IAAAH,KAAA,CAAAQ,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","useCallbackRef","module","exports","React","__toESM","require","callback","callbackRef","useRef","useEffect","current","useMemo"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAuB,GAAAT,YAAA,CAAAK,aAAA;AAMhB,IAAAK,KAAS,GAAAC,OAAA,CAAAC,OACd,QACG;AACH,SAAML,cAAcA,CAAAM,QAAM;EAE1B,IAAAC,WAAM,GAAUJ,KAAM,CAAAK,MAAA,CAAAF,QAAA;EACpBH,KAAA,CAAAM,SAAY,aAAU;IACvBF,WAAA,CAAAG,OAAA,GAAAJ,QAAA;EAGD;EACF,OAAAH,KAAA,CAAAQ,OAAA","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as React from "react";
2
2
  function useCallbackRef(callback) {
3
3
  const callbackRef = React.useRef(callback);
4
- return React.useEffect(() => {
4
+ React.useEffect(() => {
5
5
  callbackRef.current = callback;
6
- }), React.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
6
+ });
7
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
7
8
  }
8
- export {
9
- useCallbackRef
10
- };
9
+ export { useCallbackRef };
11
10
  //# sourceMappingURL=index.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": "AAEA,YAAY,WAAW;AAMhB,SAAS,eACd,UACG;AACH,QAAM,cAAc,MAAM,OAAO,QAAQ;AAEzC,eAAM,UAAU,MAAM;AACpB,gBAAY,UAAU;AAAA,EACxB,CAAC,GAGM,MAAM,QAAQ,OAAO,IAAI,SAAS,YAAY,UAAU,GAAG,IAAI,IAAS,CAAC,CAAC;AACnF;",
5
- "names": []
6
- }
1
+ {"version":3,"names":["React","useCallbackRef","callback","callbackRef","useRef","useEffect","current","useMemo","args"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAMhB,SAASC,eACdC,QAAA,EACG;EACH,MAAMC,WAAA,GAAcH,KAAA,CAAMI,MAAA,CAAOF,QAAQ;EAEzCF,KAAA,CAAMK,SAAA,CAAU,MAAM;IACpBF,WAAA,CAAYG,OAAA,GAAUJ,QAAA;EACxB,CAAC;EAGD,OAAOF,KAAA,CAAMO,OAAA,CAAQ,MAAO,IAAIC,IAAA,KAASL,WAAA,CAAYG,OAAA,GAAU,GAAGE,IAAI,GAAS,EAAE;AACnF","ignoreList":[]}
@@ -1,9 +1,10 @@
1
1
  import * as React from "react";
2
2
  function useCallbackRef(callback) {
3
3
  const callbackRef = React.useRef(callback);
4
- return React.useEffect(() => {
4
+ React.useEffect(() => {
5
5
  callbackRef.current = callback;
6
- }), React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
6
+ });
7
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
7
8
  }
8
9
  export { useCallbackRef };
9
10
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallbackRef","callback","callbackRef","useRef","useEffect","current","useMemo","args"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAMhB,SAASC,eACdC,QAAA,EACG;EACH,MAAMC,WAAA,GAAcH,KAAA,CAAMI,MAAA,CAAOF,QAAQ;EAEzC,OAAAF,KAAA,CAAMK,SAAA,CAAU,MAAM;IACpBF,WAAA,CAAYG,OAAA,GAAUJ,QAAA;EACxB,CAAC,GAGMF,KAAA,CAAMO,OAAA,CAAQ,MAAO,IAAIC,IAAA,KAASL,WAAA,CAAYG,OAAA,GAAU,GAAGE,IAAI,GAAS,EAAE;AACnF","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallbackRef","callback","callbackRef","useRef","useEffect","current","useMemo","args"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAMhB,SAASC,eACdC,QAAA,EACG;EACH,MAAMC,WAAA,GAAcH,KAAA,CAAMI,MAAA,CAAOF,QAAQ;EAEzCF,KAAA,CAAMK,SAAA,CAAU,MAAM;IACpBF,WAAA,CAAYG,OAAA,GAAUJ,QAAA;EACxB,CAAC;EAGD,OAAOF,KAAA,CAAMO,OAAA,CAAQ,MAAO,IAAIC,IAAA,KAASL,WAAA,CAAYG,OAAA,GAAU,GAAGE,IAAI,GAAS,EAAE;AACnF","ignoreList":[]}
@@ -1,11 +1,14 @@
1
1
  import * as React from "react";
2
2
  function useCallbackRef(callback) {
3
3
  var callbackRef = React.useRef(callback);
4
- return React.useEffect(function () {
4
+ React.useEffect(function () {
5
5
  callbackRef.current = callback;
6
- }), React.useMemo(function () {
6
+ });
7
+ return React.useMemo(function () {
7
8
  return function () {
8
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
9
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
+ args[_key] = arguments[_key];
11
+ }
9
12
  var _callbackRef_current;
10
13
  return (_callbackRef_current = callbackRef.current) === null || _callbackRef_current === void 0 ? void 0 : _callbackRef_current.call(callbackRef, ...args);
11
14
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallbackRef","callback","callbackRef","useRef","useEffect","current","useMemo"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAMhB,SAASC,eACdC,QAAA,EACG;EACH,IAAAC,WAAM,GAAAH,KAAc,CAAAI,MAAM,CAAAF,QAAO;EAEjC,OAAAF,KAAA,CAAMK,SAAA,CAAU,YAAM;IACpBF,WAAA,CAAYG,OAAA,GAAUJ,QAAA;EACxB,CAAC,GAGMF,KAAA,CAAMO,OAAA,CAAQ,YAAW;IAClC","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallbackRef","callback","callbackRef","useRef","useEffect","current","useMemo"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAMhB,SAASC,eACdC,QAAA,EACG;EACH,IAAAC,WAAM,GAAAH,KAAc,CAAAI,MAAM,CAAAF,QAAO;EAEjCF,KAAA,CAAMK,SAAA,CAAU,YAAM;IACpBF,WAAA,CAAYG,OAAA,GAAUJ,QAAA;EACxB,CAAC;EAGD,OAAOF,KAAA,CAAMO,OAAA,CAAQ,YAAW;IAClC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-callback-ref",
3
- "version": "2.0.0-rc.4",
3
+ "version": "2.0.0-rc.40",
4
4
  "files": [
5
5
  "src",
6
6
  "types",
@@ -15,15 +15,12 @@
15
15
  "./package.json": "./package.json",
16
16
  ".": {
17
17
  "types": "./types/index.d.ts",
18
- "react-native": {
19
- "module": "./dist/esm/index.native.js",
20
- "import": "./dist/esm/index.native.js",
21
- "require": "./dist/cjs/index.native.js"
22
- },
18
+ "react-native": "./dist/esm/index.native.js",
19
+ "browser": "./dist/esm/index.mjs",
23
20
  "module": "./dist/esm/index.mjs",
24
21
  "import": "./dist/esm/index.mjs",
25
22
  "require": "./dist/cjs/index.cjs",
26
- "default": "./dist/cjs/index.native.js"
23
+ "default": "./dist/esm/index.mjs"
27
24
  }
28
25
  },
29
26
  "publishConfig": {
@@ -36,7 +33,7 @@
36
33
  "clean:build": "tamagui-build clean:build"
37
34
  },
38
35
  "devDependencies": {
39
- "@tamagui/build": "2.0.0-rc.4",
36
+ "@tamagui/build": "2.0.0-rc.40",
40
37
  "react": ">=19"
41
38
  },
42
39
  "peerDependencies": {
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/index.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
9
  "// via radix-ui\n\nimport * as React from 'react'\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nexport function useCallbackRef<T extends (...args: any[]) => any>(\n callback: T | undefined\n): T {\n const callbackRef = React.useRef(callback)\n\n React.useEffect(() => {\n callbackRef.current = callback\n })\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, [])\n}\n"
9
- ],
10
- "version": 3
10
+ ]
11
11
  }
package/dist/cjs/index.js DELETED
@@ -1,35 +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, __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 index_exports = {};
24
- __export(index_exports, {
25
- useCallbackRef: () => useCallbackRef
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
- var React = __toESM(require("react"), 1);
29
- function useCallbackRef(callback) {
30
- const callbackRef = React.useRef(callback);
31
- return React.useEffect(() => {
32
- callbackRef.current = callback;
33
- }), React.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
34
- }
35
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAMhB,SAAS,eACd,UACG;AACH,QAAM,cAAc,MAAM,OAAO,QAAQ;AAEzC,eAAM,UAAU,MAAM;AACpB,gBAAY,UAAU;AAAA,EACxB,CAAC,GAGM,MAAM,QAAQ,OAAO,IAAI,SAAS,YAAY,UAAU,GAAG,IAAI,IAAS,CAAC,CAAC;AACnF;",
5
- "names": []
6
- }