@tamagui/use-callback-ref 2.0.0-rc.3 → 2.0.0-rc.30

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 CHANGED
@@ -2,24 +2,33 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  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
- };
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "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);
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
32
  var index_exports = {};
24
33
  __export(index_exports, {
25
34
  useCallbackRef: () => useCallbackRef
@@ -30,6 +39,5 @@ function useCallbackRef(callback) {
30
39
  const callbackRef = React.useRef(callback);
31
40
  return React.useEffect(() => {
32
41
  callbackRef.current = callback;
33
- }), React.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
34
- }
35
- //# sourceMappingURL=index.js.map
42
+ }), React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
43
+ }
package/dist/esm/index.js CHANGED
@@ -3,9 +3,7 @@ function useCallbackRef(callback) {
3
3
  const callbackRef = React.useRef(callback);
4
4
  return React.useEffect(() => {
5
5
  callbackRef.current = callback;
6
- }), React.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
6
+ }), React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
7
7
  }
8
- export {
9
- useCallbackRef
10
- };
8
+ export { useCallbackRef };
11
9
  //# 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;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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-callback-ref",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0-rc.30",
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.3",
36
+ "@tamagui/build": "2.0.0-rc.30",
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
  }