@tamagui/compose-refs 1.0.1-beta.99 → 1.0.1-rc.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.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
16
17
  }
17
18
  return to;
18
19
  };
19
- 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
+ ));
20
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
25
  var compose_refs_exports = {};
22
26
  __export(compose_refs_exports, {
@@ -29,8 +33,8 @@ function setRef(ref, value) {
29
33
  if (typeof ref === "function") {
30
34
  ref(value);
31
35
  } else if (ref !== null && ref !== void 0) {
32
- ;
33
- ref.current = value;
36
+ const next = ref;
37
+ next.current = value;
34
38
  }
35
39
  }
36
40
  function composeRefs(...refs) {
@@ -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;AAMA,wBAA2B,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,4BAA+B,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
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
  }
@@ -3,8 +3,8 @@ function setRef(ref, value) {
3
3
  if (typeof ref === "function") {
4
4
  ref(value);
5
5
  } else if (ref !== null && ref !== void 0) {
6
- ;
7
- ref.current = value;
6
+ const next = ref;
7
+ next.current = value;
8
8
  }
9
9
  }
10
10
  function composeRefs(...refs) {
@@ -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;AAMA,wBAA2B,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,4BAA+B,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
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
  }
@@ -3,8 +3,8 @@ function setRef(ref, value) {
3
3
  if (typeof ref === "function") {
4
4
  ref(value);
5
5
  } else if (ref !== null && ref !== void 0) {
6
- ;
7
- ref.current = value;
6
+ const next = ref;
7
+ next.current = value;
8
8
  }
9
9
  }
10
10
  function composeRefs(...refs) {
@@ -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;AAMA,wBAA2B,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,4BAA+B,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
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/jsx/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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/compose-refs",
3
- "version": "1.0.1-beta.99",
3
+ "version": "1.0.1-rc.0",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -17,14 +17,21 @@
17
17
  "watch": "tamagui-build --watch"
18
18
  },
19
19
  "peerDependencies": {
20
- "react": "*"
20
+ "react": ">=18"
21
21
  },
22
22
  "devDependencies": {
23
- "@tamagui/build": "^1.0.1-beta.99",
24
- "react": "*"
23
+ "@tamagui/build": "^1.0.1-rc.0",
24
+ "react": ">=18"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
+ "exports": {
30
+ "./package.json": "./package.json",
31
+ ".": {
32
+ "import": "./dist/esm/index.js",
33
+ "require": "./dist/cjs/index.js"
34
+ }
35
+ },
29
36
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
30
37
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  import * as React from 'react'
5
5
 
6
- type PossibleRef<T> = React.Ref<T> | undefined
6
+ type PossibleRef<T> = React.Ref<T> | React.ForwardedRef<T> | React.RefObject<T> | undefined
7
7
 
8
8
  /**
9
9
  * Set a given ref to a given value
@@ -13,7 +13,8 @@ function setRef<T>(ref: PossibleRef<T>, value: T) {
13
13
  if (typeof ref === 'function') {
14
14
  ref(value)
15
15
  } else if (ref !== null && ref !== undefined) {
16
- ;(ref as React.MutableRefObject<T>).current = value
16
+ const next = ref as React.MutableRefObject<T>
17
+ next.current = value
17
18
  }
18
19
  }
19
20
 
@@ -21,7 +22,7 @@ function setRef<T>(ref: PossibleRef<T>, value: T) {
21
22
  * A utility to compose multiple refs together
22
23
  * Accepts callback refs and RefObject(s)
23
24
  */
24
- function composeRefs<T>(...refs: PossibleRef<T>[]) {
25
+ export function composeRefs<T>(...refs: PossibleRef<T>[]) {
25
26
  return (node: T) => refs.forEach((ref) => setRef(ref, node))
26
27
  }
27
28
 
@@ -29,9 +30,7 @@ function composeRefs<T>(...refs: PossibleRef<T>[]) {
29
30
  * A custom hook that composes multiple refs
30
31
  * Accepts callback refs and RefObject(s)
31
32
  */
32
- function useComposedRefs<T>(...refs: PossibleRef<T>[]) {
33
+ export function useComposedRefs<T>(...refs: PossibleRef<T>[]) {
33
34
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
35
  return React.useCallback(composeRefs(...refs), refs)
35
36
  }
36
-
37
- export { composeRefs, useComposedRefs }
@@ -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
@@ -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"}