@tamagui/compose-refs 1.0.1-beta.21 → 1.0.1-beta.210

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.
@@ -1,10 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
8
  var __export = (target, all) => {
9
9
  for (var name in all)
10
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var compose_refs_exports = {};
23
26
  __export(compose_refs_exports, {
@@ -30,19 +33,16 @@ function setRef(ref, value) {
30
33
  if (typeof ref === "function") {
31
34
  ref(value);
32
35
  } else if (ref !== null && ref !== void 0) {
33
- ;
34
- ref.current = value;
36
+ const next = ref;
37
+ next.current = value;
35
38
  }
36
39
  }
37
- __name(setRef, "setRef");
38
40
  function composeRefs(...refs) {
39
41
  return (node) => refs.forEach((ref) => setRef(ref, node));
40
42
  }
41
- __name(composeRefs, "composeRefs");
42
43
  function useComposedRefs(...refs) {
43
44
  return React.useCallback(composeRefs(...refs), refs);
44
45
  }
45
- __name(useComposedRefs, "useComposedRefs");
46
46
  // Annotate the CommonJS export names for ESM import in node:
47
47
  0 && (module.exports = {
48
48
  composeRefs,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/compose-refs.tsx"],
4
- "sourcesContent": ["// from radix\n// https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx\n\nimport * as React from 'react'\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null && ref !== undefined) {\n ;(ref as React.MutableRefObject<T>).current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node))\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n\nexport { composeRefs, useComposedRefs }\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,YAAuB;AAQvB,gBAAmB,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C;AAAC,IAAC,IAAkC,UAAU;AAAA,EAChD;AACF;AANS;AAYT,wBAA2B,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAFS;AAQT,4BAA+B,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;AAHS;",
4
+ "sourcesContent": ["// from radix\n// https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx\n\nimport * as React from 'react'\n\ntype PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null && ref !== undefined) {\n const next = ref as React.MutableRefObject<T>\n next.current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nexport function composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node))\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nexport function useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,YAAuB;AAQvB,SAAS,OAAU,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,UAAM,OAAO;AACb,SAAK,UAAU;AAAA,EACjB;AACF;AAMO,SAAS,eAAkB,MAAwB;AACxD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMO,SAAS,mBAAsB,MAAwB;AAE5D,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["export * from './compose-refs'\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,2BAAd;",
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,2BAAd;",
6
6
  "names": []
7
7
  }
@@ -1,23 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  import * as React from "react";
4
2
  function setRef(ref, value) {
5
3
  if (typeof ref === "function") {
6
4
  ref(value);
7
5
  } else if (ref !== null && ref !== void 0) {
8
- ;
9
- ref.current = value;
6
+ const next = ref;
7
+ next.current = value;
10
8
  }
11
9
  }
12
- __name(setRef, "setRef");
13
10
  function composeRefs(...refs) {
14
11
  return (node) => refs.forEach((ref) => setRef(ref, node));
15
12
  }
16
- __name(composeRefs, "composeRefs");
17
13
  function useComposedRefs(...refs) {
18
14
  return React.useCallback(composeRefs(...refs), refs);
19
15
  }
20
- __name(useComposedRefs, "useComposedRefs");
21
16
  export {
22
17
  composeRefs,
23
18
  useComposedRefs
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/compose-refs.tsx"],
4
- "sourcesContent": ["// from radix\n// https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx\n\nimport * as React from 'react'\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null && ref !== undefined) {\n ;(ref as React.MutableRefObject<T>).current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node))\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n\nexport { composeRefs, useComposedRefs }\n"],
5
- "mappings": ";;AAGA;AAQA,gBAAmB,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C;AAAC,IAAC,IAAkC,UAAU;AAAA,EAChD;AACF;AANS;AAYT,wBAA2B,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAFS;AAQT,4BAA+B,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;AAHS;",
4
+ "sourcesContent": ["// from radix\n// https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx\n\nimport * as React from 'react'\n\ntype PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null && ref !== undefined) {\n const next = ref as React.MutableRefObject<T>\n next.current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nexport function composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node))\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nexport function useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n"],
5
+ "mappings": "AAGA,YAAY,WAAW;AAQvB,SAAS,OAAU,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,UAAM,OAAO;AACb,SAAK,UAAU;AAAA,EACjB;AACF;AAMO,SAAS,eAAkB,MAAwB;AACxD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMO,SAAS,mBAAsB,MAAwB;AAE5D,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
File without changes
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["export * from './compose-refs'\n"],
5
- "mappings": "AAAA;",
5
+ "mappings": "AAAA,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,24 +1,20 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  import * as React from "react";
4
2
  function setRef(ref, value) {
5
3
  if (typeof ref === "function") {
6
4
  ref(value);
7
5
  } else if (ref !== null && ref !== void 0) {
8
- ;
9
- ref.current = value;
6
+ const next = ref;
7
+ next.current = value;
10
8
  }
11
9
  }
12
- __name(setRef, "setRef");
13
10
  function composeRefs(...refs) {
14
11
  return (node) => refs.forEach((ref) => setRef(ref, node));
15
12
  }
16
- __name(composeRefs, "composeRefs");
17
13
  function useComposedRefs(...refs) {
18
14
  return React.useCallback(composeRefs(...refs), refs);
19
15
  }
20
- __name(useComposedRefs, "useComposedRefs");
21
16
  export {
22
17
  composeRefs,
23
18
  useComposedRefs
24
19
  };
20
+ //# sourceMappingURL=compose-refs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/compose-refs.tsx"],
4
+ "sourcesContent": ["// from radix\n// https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx\n\nimport * as React from 'react'\n\ntype PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null && ref !== undefined) {\n const next = ref as React.MutableRefObject<T>\n next.current = value\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nexport function composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node))\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nexport function useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs)\n}\n"],
5
+ "mappings": "AAGA,YAAY,WAAW;AAQvB,SAAS,OAAU,KAAqB,OAAU;AAChD,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACX,WAAW,QAAQ,QAAQ,QAAQ,QAAW;AAC5C,UAAM,OAAO;AACb,SAAK,UAAU;AAAA,EACjB;AACF;AAMO,SAAS,eAAkB,MAAwB;AACxD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMO,SAAS,mBAAsB,MAAwB;AAE5D,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
6
+ "names": []
7
+ }
package/dist/jsx/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./compose-refs";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["export * from './compose-refs'\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tamagui/compose-refs",
3
- "version": "1.0.1-beta.21",
3
+ "version": "1.0.1-beta.210",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
- "typings": "types",
6
+ "types": "./types/index.d.ts",
7
7
  "main": "dist/cjs",
8
8
  "module": "dist/esm",
9
9
  "module:jsx": "dist/jsx",
10
10
  "files": [
11
+ "src",
11
12
  "types",
12
13
  "dist"
13
14
  ],
@@ -19,11 +20,18 @@
19
20
  "react": "*"
20
21
  },
21
22
  "devDependencies": {
22
- "@tamagui/build": "^1.0.1-beta.21",
23
+ "@tamagui/build": "^1.0.1-beta.210",
23
24
  "react": "*"
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public"
27
28
  },
29
+ "exports": {
30
+ "./package.json": "./package.json",
31
+ ".": {
32
+ "import": "./dist/esm/index.js",
33
+ "require": "./dist/cjs/index.js"
34
+ }
35
+ },
28
36
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
29
37
  }
@@ -0,0 +1,36 @@
1
+ // from radix
2
+ // https://raw.githubusercontent.com/radix-ui/primitives/main/packages/react/compose-refs/src/composeRefs.tsx
3
+
4
+ import * as React from 'react'
5
+
6
+ type PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined
7
+
8
+ /**
9
+ * Set a given ref to a given value
10
+ * This utility takes care of different types of refs: callback refs and RefObject(s)
11
+ */
12
+ function setRef<T>(ref: PossibleRef<T>, value: T) {
13
+ if (typeof ref === 'function') {
14
+ ref(value)
15
+ } else if (ref !== null && ref !== undefined) {
16
+ const next = ref as React.MutableRefObject<T>
17
+ next.current = value
18
+ }
19
+ }
20
+
21
+ /**
22
+ * A utility to compose multiple refs together
23
+ * Accepts callback refs and RefObject(s)
24
+ */
25
+ export function composeRefs<T>(...refs: PossibleRef<T>[]) {
26
+ return (node: T) => refs.forEach((ref) => setRef(ref, node))
27
+ }
28
+
29
+ /**
30
+ * A custom hook that composes multiple refs
31
+ * Accepts callback refs and RefObject(s)
32
+ */
33
+ export function useComposedRefs<T>(...refs: PossibleRef<T>[]) {
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ return React.useCallback(composeRefs(...refs), refs)
36
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './compose-refs'
@@ -1,6 +1,14 @@
1
1
  import * as React from 'react';
2
- declare type PossibleRef<T> = React.Ref<T> | undefined;
3
- declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
4
- declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
5
- export { composeRefs, useComposedRefs };
2
+ declare type PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined;
3
+ /**
4
+ * A utility to compose multiple refs together
5
+ * Accepts callback refs and RefObject(s)
6
+ */
7
+ export declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
8
+ /**
9
+ * A custom hook that composes multiple refs
10
+ * Accepts callback refs and RefObject(s)
11
+ */
12
+ export declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
13
+ export {};
6
14
  //# sourceMappingURL=compose-refs.d.ts.map
package/types/index.d.ts CHANGED
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"file":"compose-refs.d.ts","sourceRoot":"","sources":["../src/compose-refs.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,aAAK,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AAkB9C,iBAAS,WAAW,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,UACjC,CAAC,UAChB;AAMD,iBAAS,eAAe,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,qBAGpD;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}