@tamagui/compose-refs 1.0.1-beta.18 → 1.0.1-beta.181
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/compose-refs.js +5 -5
- package/dist/cjs/compose-refs.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/compose-refs.js +0 -5
- package/dist/esm/compose-refs.js.map +1 -1
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/compose-refs.js +1 -5
- package/dist/jsx/compose-refs.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +11 -3
- package/src/compose-refs.tsx +37 -0
- package/src/index.ts +1 -0
- package/types/compose-refs.d.ts +8 -0
- package/types/index.d.ts +0 -0
- package/types/compose-refs.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
package/dist/cjs/compose-refs.js
CHANGED
|
@@ -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(
|
|
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, {
|
|
@@ -34,15 +37,12 @@ function setRef(ref, value) {
|
|
|
34
37
|
ref.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,
|
|
@@ -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": "
|
|
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;AAAC,IAAC,IAAkC,UAAU;AAAA,EAChD;AACF;AAMA,SAAS,eAAkB,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,SAAS,mBAAsB,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
package/dist/esm/compose-refs.js
CHANGED
|
@@ -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": "
|
|
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;AAAC,IAAC,IAAkC,UAAU;AAAA,EAChD;AACF;AAMA,SAAS,eAAkB,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,SAAS,mBAAsB,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
File without changes
|
package/dist/esm/index.js.map
CHANGED
package/dist/jsx/compose-refs.js
CHANGED
|
@@ -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,YAAY,WAAW;AAQvB,SAAS,OAAU,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,SAAS,eAAkB,MAAwB;AACjD,SAAO,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAMA,SAAS,mBAAsB,MAAwB;AAErD,SAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/jsx/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/compose-refs",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.181",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
|
-
"
|
|
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.
|
|
23
|
+
"@tamagui/build": "^1.0.1-beta.181",
|
|
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,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'
|
package/types/compose-refs.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare type PossibleRef<T> = React.Ref<T> | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* A utility to compose multiple refs together
|
|
5
|
+
* Accepts callback refs and RefObject(s)
|
|
6
|
+
*/
|
|
3
7
|
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
|
+
*/
|
|
4
12
|
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
|
|
5
13
|
export { composeRefs, useComposedRefs };
|
|
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"}
|
package/types/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|