@tamagui/compose-refs 1.0.0-beta.8 → 1.0.1-beta.100

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.
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -34,15 +33,12 @@ function setRef(ref, value) {
34
33
  ref.current = value;
35
34
  }
36
35
  }
37
- __name(setRef, "setRef");
38
36
  function composeRefs(...refs) {
39
37
  return (node) => refs.forEach((ref) => setRef(ref, node));
40
38
  }
41
- __name(composeRefs, "composeRefs");
42
39
  function useComposedRefs(...refs) {
43
40
  return React.useCallback(composeRefs(...refs), refs);
44
41
  }
45
- __name(useComposedRefs, "useComposedRefs");
46
42
  // Annotate the CommonJS export names for ESM import in node:
47
43
  0 && (module.exports = {
48
44
  composeRefs,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/compose-refs.tsx"],
4
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;",
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;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,3 @@
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") {
@@ -9,15 +7,12 @@ function setRef(ref, value) {
9
7
  ref.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
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/compose-refs.tsx"],
4
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;",
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;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,3 @@
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") {
@@ -9,16 +7,14 @@ function setRef(ref, value) {
9
7
  ref.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> | 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;",
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;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tamagui/compose-refs",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.1-beta.100",
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,7 +20,7 @@
19
20
  "react": "*"
20
21
  },
21
22
  "devDependencies": {
22
- "@tamagui/build": "^1.0.0-beta.8",
23
+ "@tamagui/build": "^1.0.1-beta.100",
23
24
  "react": "*"
24
25
  },
25
26
  "publishConfig": {
@@ -0,0 +1,37 @@
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> | 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
+ ;(ref as React.MutableRefObject<T>).current = value
17
+ }
18
+ }
19
+
20
+ /**
21
+ * A utility to compose multiple refs together
22
+ * Accepts callback refs and RefObject(s)
23
+ */
24
+ function composeRefs<T>(...refs: PossibleRef<T>[]) {
25
+ return (node: T) => refs.forEach((ref) => setRef(ref, node))
26
+ }
27
+
28
+ /**
29
+ * A custom hook that composes multiple refs
30
+ * Accepts callback refs and RefObject(s)
31
+ */
32
+ function useComposedRefs<T>(...refs: PossibleRef<T>[]) {
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ return React.useCallback(composeRefs(...refs), refs)
35
+ }
36
+
37
+ export { composeRefs, useComposedRefs }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './compose-refs'
File without changes
File without changes
package/types/index.d.ts CHANGED
File without changes
File without changes