@tamagui/element 2.0.0-1769464790617

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/getWebElement.cjs +30 -0
  3. package/dist/cjs/getWebElement.js +27 -0
  4. package/dist/cjs/getWebElement.js.map +6 -0
  5. package/dist/cjs/getWebElement.native.js +36 -0
  6. package/dist/cjs/getWebElement.native.js.map +1 -0
  7. package/dist/cjs/index.cjs +21 -0
  8. package/dist/cjs/index.js +18 -0
  9. package/dist/cjs/index.js.map +6 -0
  10. package/dist/cjs/index.native.js +36 -0
  11. package/dist/cjs/index.native.js.map +1 -0
  12. package/dist/cjs/types.cjs +16 -0
  13. package/dist/cjs/types.js +14 -0
  14. package/dist/cjs/types.js.map +6 -0
  15. package/dist/cjs/types.native.js +19 -0
  16. package/dist/cjs/types.native.js.map +1 -0
  17. package/dist/cjs/useNativeRef.cjs +55 -0
  18. package/dist/cjs/useNativeRef.js +38 -0
  19. package/dist/cjs/useNativeRef.js.map +6 -0
  20. package/dist/cjs/useNativeRef.native.js +58 -0
  21. package/dist/cjs/useNativeRef.native.js.map +1 -0
  22. package/dist/cjs/useWebRef.cjs +46 -0
  23. package/dist/cjs/useWebRef.js +33 -0
  24. package/dist/cjs/useWebRef.js.map +6 -0
  25. package/dist/cjs/useWebRef.native.js +49 -0
  26. package/dist/cjs/useWebRef.native.js.map +1 -0
  27. package/dist/esm/getWebElement.js +11 -0
  28. package/dist/esm/getWebElement.js.map +6 -0
  29. package/dist/esm/getWebElement.mjs +7 -0
  30. package/dist/esm/getWebElement.mjs.map +1 -0
  31. package/dist/esm/getWebElement.native.js +10 -0
  32. package/dist/esm/getWebElement.native.js.map +1 -0
  33. package/dist/esm/index.js +5 -0
  34. package/dist/esm/index.js.map +6 -0
  35. package/dist/esm/index.mjs +5 -0
  36. package/dist/esm/index.mjs.map +1 -0
  37. package/dist/esm/index.native.js +8 -0
  38. package/dist/esm/index.native.js.map +1 -0
  39. package/dist/esm/types.js +1 -0
  40. package/dist/esm/types.js.map +6 -0
  41. package/dist/esm/types.mjs +2 -0
  42. package/dist/esm/types.mjs.map +1 -0
  43. package/dist/esm/types.native.js +2 -0
  44. package/dist/esm/types.native.js.map +1 -0
  45. package/dist/esm/useNativeRef.js +15 -0
  46. package/dist/esm/useNativeRef.js.map +6 -0
  47. package/dist/esm/useNativeRef.mjs +20 -0
  48. package/dist/esm/useNativeRef.mjs.map +1 -0
  49. package/dist/esm/useNativeRef.native.js +20 -0
  50. package/dist/esm/useNativeRef.native.js.map +1 -0
  51. package/dist/esm/useWebRef.js +10 -0
  52. package/dist/esm/useWebRef.js.map +6 -0
  53. package/dist/esm/useWebRef.mjs +12 -0
  54. package/dist/esm/useWebRef.mjs.map +1 -0
  55. package/dist/esm/useWebRef.native.js +12 -0
  56. package/dist/esm/useWebRef.native.js.map +1 -0
  57. package/package.json +50 -0
  58. package/src/getWebElement.ts +23 -0
  59. package/src/index.native.ts +8 -0
  60. package/src/index.ts +4 -0
  61. package/src/types.ts +56 -0
  62. package/src/useNativeRef.ts +36 -0
  63. package/src/useWebRef.ts +23 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var getWebElement_exports = {};
22
+ __export(getWebElement_exports, {
23
+ getWebElement: () => getWebElement
24
+ });
25
+ module.exports = __toCommonJS(getWebElement_exports);
26
+ function getWebElement(element) {
27
+ if (!element) throw new Error("Element is null or undefined");
28
+ if (!(element instanceof HTMLElement)) throw new Error("Element is not an HTMLElement");
29
+ return element;
30
+ }
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var getWebElement_exports = {};
16
+ __export(getWebElement_exports, {
17
+ getWebElement: () => getWebElement
18
+ });
19
+ module.exports = __toCommonJS(getWebElement_exports);
20
+ function getWebElement(element) {
21
+ if (!element)
22
+ throw new Error("Element is null or undefined");
23
+ if (!(element instanceof HTMLElement))
24
+ throw new Error("Element is not an HTMLElement");
25
+ return element;
26
+ }
27
+ //# sourceMappingURL=getWebElement.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/getWebElement.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,cACd,SACG;AACH,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,8BAA8B;AAEhD,MAAI,EAAE,mBAAmB;AACvB,UAAM,IAAI,MAAM,+BAA+B;AAEjD,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var getWebElement_exports = {};
24
+ __export(getWebElement_exports, {
25
+ getWebElement: () => getWebElement
26
+ });
27
+ module.exports = __toCommonJS(getWebElement_exports);
28
+ function _instanceof(left, right) {
29
+ return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
30
+ }
31
+ function getWebElement(element) {
32
+ if (!element) throw new Error("Element is null or undefined");
33
+ if (!_instanceof(element, HTMLElement)) throw new Error("Element is not an HTMLElement");
34
+ return element;
35
+ }
36
+ //# sourceMappingURL=getWebElement.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getWebElement_exports","__export","getWebElement","module","exports","_instanceof","left","right","Symbol","hasInstance","element","Error"],"sources":["../../src/getWebElement.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAYOC,MAAA,CAAAC,OAAS,GAAAT,YACd,CAAAK,qBACG;AACH,SAAKK,YAAAC,IAAA,EAAAC,KAAA;EACH,OAAAA,KAAU,QAAM,WAAAC,MAAA,UAAAD,KAA8B,CAAAC,MAAA,CAAAC,WAAA,MAAAF,KAAA,CAAAC,MAAA,CAAAC,WAAA,EAAAH,IAAA,IAAAA,IAAA,YAAAC,KAAA;AAEhD;AACE,SAAAL,aAAgBA,CAAAQ,OAAA;EAElB,KAAAA,OAAO,EACT,UAAAC,KAAA","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require("./useWebRef.cjs"), module.exports);
19
+ __reExport(index_exports, require("./useNativeRef.cjs"), module.exports);
20
+ __reExport(index_exports, require("./getWebElement.cjs"), module.exports);
21
+ __reExport(index_exports, require("./types.cjs"), module.exports);
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var index_exports = {};
13
+ module.exports = __toCommonJS(index_exports);
14
+ __reExport(index_exports, require("./useWebRef"), module.exports);
15
+ __reExport(index_exports, require("./useNativeRef"), module.exports);
16
+ __reExport(index_exports, require("./getWebElement"), module.exports);
17
+ __reExport(index_exports, require("./types"), module.exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,wBAAd;AACA,0BAAc,2BADd;AAEA,0BAAc,4BAFd;AAGA,0BAAc,oBAHd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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
+ },
20
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: !0
23
+ }), mod);
24
+ var index_native_exports = {};
25
+ __export(index_native_exports, {
26
+ getWebElement: () => getWebElement,
27
+ useWebRef: () => import_useNativeRef.useNativeRef
28
+ });
29
+ module.exports = __toCommonJS(index_native_exports);
30
+ __reExport(index_native_exports, require("./useNativeRef.native.js"), module.exports);
31
+ __reExport(index_native_exports, require("./types.native.js"), module.exports);
32
+ var import_useNativeRef = require("./useNativeRef.native.js");
33
+ function getWebElement() {
34
+ throw new Error("getWebElement is only available on web");
35
+ }
36
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["index_native_exports","__export","getWebElement","useWebRef","import_useNativeRef","useNativeRef","module","exports","__toCommonJS","__reExport","require","Error"],"sources":["../../src/index.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAC,mBAAA,CAAAC;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAR,oBAAA;AAAAS,UAAA,CAAAT,oBAAA,EAAcU,OAAA,8BAAdJ,MAAA,CAAAC,OAAA;AACAE,UAAA,CAAAT,oBAAA,EAAcU,OAAA,uBADdJ,MAAA,CAAAC,OAAA;AAGA,IAAAH,mBAAA,GAA0CM,OAAA;AACnC,SAASR,cAAA,EAAgB;EAC5B,MAAM,IAAIS,KAAA,CAAM,wCAAwC;AAC5D","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ };
12
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
+ value: !0
14
+ }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ };
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var types_exports = {};
13
+ module.exports = __toCommonJS(types_exports);
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/types.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;",
5
+ "names": []
6
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: !0
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
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);
32
+ var useNativeRef_exports = {};
33
+ __export(useNativeRef_exports, {
34
+ useNativeInputRef: () => useNativeInputRef,
35
+ useNativeRef: () => useNativeRef
36
+ });
37
+ module.exports = __toCommonJS(useNativeRef_exports);
38
+ var import_compose_refs = require("@tamagui/compose-refs"),
39
+ React = __toESM(require("react"), 1);
40
+ function useNativeRef(forwardedRef) {
41
+ const ref = React.useRef(null),
42
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
43
+ return {
44
+ ref,
45
+ composedRef
46
+ };
47
+ }
48
+ function useNativeInputRef(forwardedRef) {
49
+ const ref = React.useRef(null),
50
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
51
+ return {
52
+ ref,
53
+ composedRef
54
+ };
55
+ }
@@ -0,0 +1,38 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ 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
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "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);
23
+ var useNativeRef_exports = {};
24
+ __export(useNativeRef_exports, {
25
+ useNativeInputRef: () => useNativeInputRef,
26
+ useNativeRef: () => useNativeRef
27
+ });
28
+ module.exports = __toCommonJS(useNativeRef_exports);
29
+ var import_compose_refs = require("@tamagui/compose-refs"), React = __toESM(require("react"), 1);
30
+ function useNativeRef(forwardedRef) {
31
+ const ref = React.useRef(null), composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
32
+ return { ref, composedRef };
33
+ }
34
+ function useNativeInputRef(forwardedRef) {
35
+ const ref = React.useRef(null), composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
36
+ return { ref, composedRef };
37
+ }
38
+ //# sourceMappingURL=useNativeRef.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useNativeRef.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,QAAuB;AAchB,SAAS,aAAa,cAAwC;AACnE,QAAM,MAAM,MAAM,OAA6B,IAAI,GAC7C,kBAAc,qCAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;AAYO,SAAS,kBAAkB,cAAwC;AACxE,QAAM,MAAM,MAAM,OAAkB,IAAI,GAClC,kBAAc,qCAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var useNativeRef_exports = {};
35
+ __export(useNativeRef_exports, {
36
+ useNativeInputRef: () => useNativeInputRef,
37
+ useNativeRef: () => useNativeRef
38
+ });
39
+ module.exports = __toCommonJS(useNativeRef_exports);
40
+ var import_compose_refs = require("@tamagui/compose-refs"),
41
+ React = __toESM(require("react"), 1);
42
+ function useNativeRef(forwardedRef) {
43
+ var ref = React.useRef(null),
44
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
45
+ return {
46
+ ref,
47
+ composedRef
48
+ };
49
+ }
50
+ function useNativeInputRef(forwardedRef) {
51
+ var ref = React.useRef(null),
52
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
53
+ return {
54
+ ref,
55
+ composedRef
56
+ };
57
+ }
58
+ //# sourceMappingURL=useNativeRef.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useNativeRef_exports","__export","useNativeInputRef","useNativeRef","module","exports","import_compose_refs","require","React","__toESM","forwardedRef","ref","useRef","composedRef","useComposedRefs"],"sources":["../../src/useNativeRef.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAAgC,CAAAK,oBAAA;AAezB,IAAAM,mBAAsB,GAAAC,OAAA,wBAAwC;EAAAC,KAAA,GAAAC,OAAA,CAAAF,OAAA;AACnE,SAAMJ,YAAYA,CAAAO,YACZ;EACN,IAAAC,GAAO,GAAEH,KAAK,CAAAI,MAAA,KAAY;IAAAC,WAAA,OAAAP,mBAAA,CAAAQ,eAAA,EAAAH,GAAA,EAAAD,YAAA;EAC5B;IAYOC,GAAA;IACLE;EAEA;AACF","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
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);
32
+ var useWebRef_exports = {};
33
+ __export(useWebRef_exports, {
34
+ useWebRef: () => useWebRef
35
+ });
36
+ module.exports = __toCommonJS(useWebRef_exports);
37
+ var import_compose_refs = require("@tamagui/compose-refs"),
38
+ React = __toESM(require("react"), 1);
39
+ function useWebRef(forwardedRef) {
40
+ const ref = React.useRef(null),
41
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
42
+ return {
43
+ ref,
44
+ composedRef
45
+ };
46
+ }
@@ -0,0 +1,33 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ 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
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "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);
23
+ var useWebRef_exports = {};
24
+ __export(useWebRef_exports, {
25
+ useWebRef: () => useWebRef
26
+ });
27
+ module.exports = __toCommonJS(useWebRef_exports);
28
+ var import_compose_refs = require("@tamagui/compose-refs"), React = __toESM(require("react"), 1);
29
+ function useWebRef(forwardedRef) {
30
+ const ref = React.useRef(null), composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
31
+ return { ref, composedRef };
32
+ }
33
+ //# sourceMappingURL=useWebRef.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useWebRef.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,QAAuB;AAehB,SAAS,UACd,cACA;AACA,QAAM,MAAM,MAAM,OAAU,IAAI,GAC1B,kBAAc,qCAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var useWebRef_exports = {};
35
+ __export(useWebRef_exports, {
36
+ useWebRef: () => useWebRef
37
+ });
38
+ module.exports = __toCommonJS(useWebRef_exports);
39
+ var import_compose_refs = require("@tamagui/compose-refs"),
40
+ React = __toESM(require("react"), 1);
41
+ function useWebRef(forwardedRef) {
42
+ var ref = React.useRef(null),
43
+ composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
44
+ return {
45
+ ref,
46
+ composedRef
47
+ };
48
+ }
49
+ //# sourceMappingURL=useWebRef.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useWebRef_exports","__export","useWebRef","module","exports","import_compose_refs","require","React","__toESM","forwardedRef","ref","useRef","composedRef","useComposedRefs"],"sources":["../../src/useWebRef.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAgC,CAAAK,iBAAA;AAgBzB,IAAAK,mBACL,GAAAC,OACA;EAAAC,KAAA,GAAAC,OAAA,CAAAF,OAAA;AACA,SAAMJ,SAAMA,CAAAO,YAAoB;EAEhC,IAAAC,GAAO,GAAEH,KAAK,CAAAI,MAAA,KAAY;IAAAC,WAAA,OAAAP,mBAAA,CAAAQ,eAAA,EAAAH,GAAA,EAAAD,YAAA;EAC5B","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ function getWebElement(element) {
2
+ if (!element)
3
+ throw new Error("Element is null or undefined");
4
+ if (!(element instanceof HTMLElement))
5
+ throw new Error("Element is not an HTMLElement");
6
+ return element;
7
+ }
8
+ export {
9
+ getWebElement
10
+ };
11
+ //# sourceMappingURL=getWebElement.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/getWebElement.ts"],
4
+ "mappings": "AAYO,SAAS,cACd,SACG;AACH,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,8BAA8B;AAEhD,MAAI,EAAE,mBAAmB;AACvB,UAAM,IAAI,MAAM,+BAA+B;AAEjD,SAAO;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,7 @@
1
+ function getWebElement(element) {
2
+ if (!element) throw new Error("Element is null or undefined");
3
+ if (!(element instanceof HTMLElement)) throw new Error("Element is not an HTMLElement");
4
+ return element;
5
+ }
6
+ export { getWebElement };
7
+ //# sourceMappingURL=getWebElement.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getWebElement","element","Error","HTMLElement"],"sources":["../../src/getWebElement.ts"],"sourcesContent":[null],"mappings":"AAYO,SAASA,cACdC,OAAA,EACG;EACH,IAAI,CAACA,OAAA,EACH,MAAM,IAAIC,KAAA,CAAM,8BAA8B;EAEhD,IAAI,EAAED,OAAA,YAAmBE,WAAA,GACvB,MAAM,IAAID,KAAA,CAAM,+BAA+B;EAEjD,OAAOD,OAAA;AACT","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ function _instanceof(left, right) {
2
+ return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
3
+ }
4
+ function getWebElement(element) {
5
+ if (!element) throw new Error("Element is null or undefined");
6
+ if (!_instanceof(element, HTMLElement)) throw new Error("Element is not an HTMLElement");
7
+ return element;
8
+ }
9
+ export { getWebElement };
10
+ //# sourceMappingURL=getWebElement.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_instanceof","left","right","Symbol","hasInstance","getWebElement","element","Error","HTMLElement"],"sources":["../../src/getWebElement.ts"],"sourcesContent":[null],"mappings":"AAYO,SAASA,YAAAC,IACd,EAAAC,KACG;EACH,OAAKA,KAAA,mBAAAC,MAAA,UAAAD,KAAA,CAAAC,MAAA,CAAAC,WAAA,MAAAF,KAAA,CAAAC,MAAA,CAAAC,WAAA,EAAAH,IAAA,IAAAA,IAAA,YAAAC,KAAA;AACH;AAEF,SAAMG,cAAAC,OAAmB;EACvB,KAAAA,OAAU,EAEZ,MAAO,IAAAC,KAAA;EACT,KAAAP,WAAA,CAAAM,OAAA,EAAAE,WAAA,G","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export * from "./useWebRef";
2
+ export * from "./useNativeRef";
3
+ export * from "./getWebElement";
4
+ export * from "./types";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./useWebRef.mjs";
2
+ export * from "./useNativeRef.mjs";
3
+ export * from "./getWebElement.mjs";
4
+ export * from "./types.mjs";
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ export * from "./useNativeRef.native.js";
2
+ export * from "./types.native.js";
3
+ import { useNativeRef } from "./useNativeRef.native.js";
4
+ function getWebElement() {
5
+ throw new Error("getWebElement is only available on web");
6
+ }
7
+ export { getWebElement, useNativeRef as useWebRef };
8
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useNativeRef","getWebElement","Error"],"sources":["../../src/index.native.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AAEd,SAAyBA,YAAA,QAAiB;AACnC,SAASC,cAAA,EAAgB;EAC5B,MAAM,IAAIC,KAAA,CAAM,wCAAwC;AAC5D","ignoreList":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useNativeRef(forwardedRef) {
4
+ const ref = React.useRef(null), composedRef = useComposedRefs(ref, forwardedRef);
5
+ return { ref, composedRef };
6
+ }
7
+ function useNativeInputRef(forwardedRef) {
8
+ const ref = React.useRef(null), composedRef = useComposedRefs(ref, forwardedRef);
9
+ return { ref, composedRef };
10
+ }
11
+ export {
12
+ useNativeInputRef,
13
+ useNativeRef
14
+ };
15
+ //# sourceMappingURL=useNativeRef.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useNativeRef.ts"],
4
+ "mappings": "AAAA,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAchB,SAAS,aAAa,cAAwC;AACnE,QAAM,MAAM,MAAM,OAA6B,IAAI,GAC7C,cAAc,gBAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;AAYO,SAAS,kBAAkB,cAAwC;AACxE,QAAM,MAAM,MAAM,OAAkB,IAAI,GAClC,cAAc,gBAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,20 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useNativeRef(forwardedRef) {
4
+ const ref = React.useRef(null),
5
+ composedRef = useComposedRefs(ref, forwardedRef);
6
+ return {
7
+ ref,
8
+ composedRef
9
+ };
10
+ }
11
+ function useNativeInputRef(forwardedRef) {
12
+ const ref = React.useRef(null),
13
+ composedRef = useComposedRefs(ref, forwardedRef);
14
+ return {
15
+ ref,
16
+ composedRef
17
+ };
18
+ }
19
+ export { useNativeInputRef, useNativeRef };
20
+ //# sourceMappingURL=useNativeRef.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useComposedRefs","React","useNativeRef","forwardedRef","ref","useRef","composedRef","useNativeInputRef"],"sources":["../../src/useNativeRef.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,YAAYC,KAAA,MAAW;AAchB,SAASC,aAAaC,YAAA,EAAwC;EACnE,MAAMC,GAAA,GAAMH,KAAA,CAAMI,MAAA,CAA6B,IAAI;IAC7CC,WAAA,GAAcN,eAAA,CAAgBI,GAAA,EAAKD,YAAmB;EAC5D,OAAO;IAAEC,GAAA;IAAKE;EAAY;AAC5B;AAYO,SAASC,kBAAkBJ,YAAA,EAAwC;EACxE,MAAMC,GAAA,GAAMH,KAAA,CAAMI,MAAA,CAAkB,IAAI;IAClCC,WAAA,GAAcN,eAAA,CAAgBI,GAAA,EAAKD,YAAmB;EAC5D,OAAO;IAAEC,GAAA;IAAKE;EAAY;AAC5B","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useNativeRef(forwardedRef) {
4
+ var ref = React.useRef(null),
5
+ composedRef = useComposedRefs(ref, forwardedRef);
6
+ return {
7
+ ref,
8
+ composedRef
9
+ };
10
+ }
11
+ function useNativeInputRef(forwardedRef) {
12
+ var ref = React.useRef(null),
13
+ composedRef = useComposedRefs(ref, forwardedRef);
14
+ return {
15
+ ref,
16
+ composedRef
17
+ };
18
+ }
19
+ export { useNativeInputRef, useNativeRef };
20
+ //# sourceMappingURL=useNativeRef.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useComposedRefs","React","useNativeRef","forwardedRef","ref","useRef","composedRef","useNativeInputRef"],"sources":["../../src/useNativeRef.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,YAAYC,KAAA,MAAW;AAchB,SAASC,aAAaC,YAAA,EAAwC;EACnE,IAAAC,GAAM,GAAAH,KAAM,CAAAI,MAAM,KAA6B;IAAIC,WAC7C,GAAAN,eAAc,CAAAI,GAAgB,EAAAD,YAAK;EACzC,OAAO;IACTC,GAAA;IAYOE;EACL;AAEA;AACF,SAAAC,kBAAAJ,YAAA","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useWebRef(forwardedRef) {
4
+ const ref = React.useRef(null), composedRef = useComposedRefs(ref, forwardedRef);
5
+ return { ref, composedRef };
6
+ }
7
+ export {
8
+ useWebRef
9
+ };
10
+ //# sourceMappingURL=useWebRef.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useWebRef.ts"],
4
+ "mappings": "AAAA,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAehB,SAAS,UACd,cACA;AACA,QAAM,MAAM,MAAM,OAAU,IAAI,GAC1B,cAAc,gBAAgB,KAAK,YAAmB;AAC5D,SAAO,EAAE,KAAK,YAAY;AAC5B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,12 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useWebRef(forwardedRef) {
4
+ const ref = React.useRef(null),
5
+ composedRef = useComposedRefs(ref, forwardedRef);
6
+ return {
7
+ ref,
8
+ composedRef
9
+ };
10
+ }
11
+ export { useWebRef };
12
+ //# sourceMappingURL=useWebRef.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useComposedRefs","React","useWebRef","forwardedRef","ref","useRef","composedRef"],"sources":["../../src/useWebRef.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,YAAYC,KAAA,MAAW;AAehB,SAASC,UACdC,YAAA,EACA;EACA,MAAMC,GAAA,GAAMH,KAAA,CAAMI,MAAA,CAAU,IAAI;IAC1BC,WAAA,GAAcN,eAAA,CAAgBI,GAAA,EAAKD,YAAmB;EAC5D,OAAO;IAAEC,GAAA;IAAKE;EAAY;AAC5B","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import { useComposedRefs } from "@tamagui/compose-refs";
2
+ import * as React from "react";
3
+ function useWebRef(forwardedRef) {
4
+ var ref = React.useRef(null),
5
+ composedRef = useComposedRefs(ref, forwardedRef);
6
+ return {
7
+ ref,
8
+ composedRef
9
+ };
10
+ }
11
+ export { useWebRef };
12
+ //# sourceMappingURL=useWebRef.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useComposedRefs","React","useWebRef","forwardedRef","ref","useRef","composedRef"],"sources":["../../src/useWebRef.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,YAAYC,KAAA,MAAW;AAehB,SAASC,UACdC,YAAA,EACA;EACA,IAAAC,GAAM,GAAAH,KAAM,CAAAI,MAAM,KAAU;IAAIC,WAC1B,GAAAN,eAAc,CAAAI,GAAgB,EAAAD,YAAK;EACzC,OAAO;IACTC,GAAA","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@tamagui/element",
3
+ "version": "2.0.0-1769464790617",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "types": "./src",
7
+ "main": "dist/cjs",
8
+ "module": "dist/esm",
9
+ "files": [
10
+ "src",
11
+ "types",
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "tamagui-build --skip-types",
16
+ "watch": "tamagui-build --skip-types --watch",
17
+ "lint": "biome check src",
18
+ "lint:fix": "biome check --write src",
19
+ "clean": "tamagui-build clean",
20
+ "clean:build": "tamagui-build clean:build"
21
+ },
22
+ "exports": {
23
+ "./package.json": "./package.json",
24
+ ".": {
25
+ "react-native": {
26
+ "module": "./dist/esm/index.native.js",
27
+ "import": "./dist/esm/index.native.js",
28
+ "require": "./dist/cjs/index.native.js"
29
+ },
30
+ "types": "./src/index.ts",
31
+ "module": "./dist/esm/index.mjs",
32
+ "import": "./dist/esm/index.mjs",
33
+ "require": "./dist/cjs/index.cjs",
34
+ "default": "./dist/cjs/index.native.js"
35
+ }
36
+ },
37
+ "devDependencies": {
38
+ "@tamagui/build": "2.0.0-1769464790617"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "@tamagui/compose-refs": "2.0.0-1769464790617"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "*",
48
+ "react-native": "*"
49
+ }
50
+ }
@@ -0,0 +1,23 @@
1
+ import type { TamaguiElement } from './types'
2
+
3
+ /**
4
+ * Narrows a TamaguiElement to an HTMLElement, with optional generic for further casting.
5
+ * Throws if the element is not an instanceof HTMLElement.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const el = getWebElement(ref.current) // HTMLElement
10
+ * const input = getWebElement<HTMLInputElement>(ref.current) // HTMLInputElement
11
+ * ```
12
+ */
13
+ export function getWebElement<T extends HTMLElement = HTMLElement>(
14
+ element: TamaguiElement | null | undefined
15
+ ): T {
16
+ if (!element) {
17
+ throw new Error('Element is null or undefined')
18
+ }
19
+ if (!(element instanceof HTMLElement)) {
20
+ throw new Error('Element is not an HTMLElement')
21
+ }
22
+ return element as unknown as T
23
+ }
@@ -0,0 +1,8 @@
1
+ export * from './useNativeRef'
2
+ export * from './types'
3
+
4
+ // stub for bundler consistency - on native, this is a no-op that just returns ref and composedRef
5
+ export { useNativeRef as useWebRef } from './useNativeRef'
6
+ export function getWebElement(): never {
7
+ throw new Error('getWebElement is only available on web')
8
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './useWebRef'
2
+ export * from './useNativeRef'
3
+ export * from './getWebElement'
4
+ export * from './types'
package/src/types.ts ADDED
@@ -0,0 +1,56 @@
1
+ import type { View } from 'react-native'
2
+
3
+ type MeasureOnSuccessCallback = (
4
+ x: number,
5
+ y: number,
6
+ width: number,
7
+ height: number,
8
+ pageX: number,
9
+ pageY: number
10
+ ) => void
11
+
12
+ type MeasureInWindowOnSuccessCallback = (
13
+ x: number,
14
+ y: number,
15
+ width: number,
16
+ height: number
17
+ ) => void
18
+
19
+ type MeasureLayoutOnSuccessCallback = (
20
+ left: number,
21
+ top: number,
22
+ width: number,
23
+ height: number
24
+ ) => void
25
+
26
+ /**
27
+ * Methods added to element refs that work across web and native.
28
+ * On web these are added at runtime to HTMLElements.
29
+ * On native these exist on View already.
30
+ */
31
+ export interface TamaguiElementMethods {
32
+ measure(callback: MeasureOnSuccessCallback): void
33
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void
34
+ measureLayout(
35
+ relativeToNativeNode: View | HTMLElement,
36
+ onSuccess: MeasureLayoutOnSuccessCallback,
37
+ onFail?: () => void
38
+ ): void
39
+ focus(): void
40
+ blur(): void
41
+ }
42
+
43
+ export type TamaguiElement = (HTMLElement & TamaguiElementMethods) | View
44
+
45
+ /**
46
+ * Web-specific element type that extends HTMLElement with Tamagui methods.
47
+ * Use this when you need an HTMLElement ref in web-only code.
48
+ */
49
+ export type TamaguiWebElement<T extends HTMLElement = HTMLElement> = T &
50
+ TamaguiElementMethods
51
+
52
+ /**
53
+ * Native-specific element type (View).
54
+ * Use this when you need a View ref in native-only code.
55
+ */
56
+ export type TamaguiNativeElement = View
@@ -0,0 +1,36 @@
1
+ import { useComposedRefs } from '@tamagui/compose-refs'
2
+ import * as React from 'react'
3
+ import type { TextInput } from 'react-native'
4
+ import type { TamaguiNativeElement } from './types'
5
+
6
+ /**
7
+ * Creates a ref for native-only code that properly types to View.
8
+ * Returns both ref and composedRef for component usage.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const { ref, composedRef } = useNativeRef(forwardedRef)
13
+ * // ref.current is typed as View
14
+ * ```
15
+ */
16
+ export function useNativeRef(forwardedRef?: React.ForwardedRef<any>) {
17
+ const ref = React.useRef<TamaguiNativeElement>(null)
18
+ const composedRef = useComposedRefs(ref, forwardedRef as any)
19
+ return { ref, composedRef }
20
+ }
21
+
22
+ /**
23
+ * Creates a ref for native TextInput components.
24
+ * Returns both ref and composedRef for component usage.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * const { ref, composedRef } = useNativeInputRef(forwardedRef)
29
+ * // ref.current is typed as TextInput
30
+ * ```
31
+ */
32
+ export function useNativeInputRef(forwardedRef?: React.ForwardedRef<any>) {
33
+ const ref = React.useRef<TextInput>(null)
34
+ const composedRef = useComposedRefs(ref, forwardedRef as any)
35
+ return { ref, composedRef }
36
+ }
@@ -0,0 +1,23 @@
1
+ import { useComposedRefs } from '@tamagui/compose-refs'
2
+ import * as React from 'react'
3
+ import type { TamaguiElement } from './types'
4
+
5
+ /**
6
+ * Creates a ref for web-only code that properly types to HTMLElement.
7
+ * Useful when you need to access HTMLElement-specific properties (like selectionStart)
8
+ * that aren't available on the cross-platform TamaguiElement type.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const { ref, composedRef } = useWebRef<HTMLInputElement>(forwardedRef)
13
+ * // ref.current is typed as HTMLInputElement
14
+ * // composedRef is for passing to components
15
+ * ```
16
+ */
17
+ export function useWebRef<T extends TamaguiElement | HTMLElement>(
18
+ forwardedRef?: React.ForwardedRef<TamaguiElement>
19
+ ) {
20
+ const ref = React.useRef<T>(null)
21
+ const composedRef = useComposedRefs(ref, forwardedRef as any)
22
+ return { ref, composedRef }
23
+ }