@tamagui/element 2.7.7 → 3.0.0-beta.1091.1
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/getWebElement.cjs +21 -25
- package/dist/cjs/getWebElement.native.cjs +34 -0
- package/dist/cjs/getWebElement.native.js +21 -31
- package/dist/cjs/getWebElement.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +35 -0
- package/dist/cjs/index.native.js +16 -17
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useNativeRef.cjs +30 -37
- package/dist/cjs/useNativeRef.native.cjs +52 -0
- package/dist/cjs/useNativeRef.native.js +30 -36
- package/dist/cjs/useNativeRef.native.js.map +1 -1
- package/dist/cjs/useWebRef.cjs +23 -32
- package/dist/cjs/useWebRef.native.cjs +41 -0
- package/dist/cjs/useWebRef.native.js +23 -31
- package/dist/cjs/useWebRef.native.js.map +1 -1
- package/dist/esm/getWebElement.mjs +8 -7
- package/dist/esm/getWebElement.mjs.map +1 -1
- package/dist/esm/getWebElement.native.js +8 -14
- package/dist/esm/getWebElement.native.js.map +1 -1
- package/dist/esm/index.js +7 -5
- package/dist/esm/index.mjs +7 -5
- package/dist/esm/index.native.js +7 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useNativeRef.mjs +14 -12
- package/dist/esm/useNativeRef.mjs.map +1 -1
- package/dist/esm/useNativeRef.native.js +14 -12
- package/dist/esm/useNativeRef.native.js.map +1 -1
- package/dist/esm/useWebRef.mjs +8 -6
- package/dist/esm/useWebRef.mjs.map +1 -1
- package/dist/esm/useWebRef.native.js +8 -6
- package/dist/esm/useWebRef.native.js.map +1 -1
- package/package.json +10 -8
- package/src/types.ts +1 -1
- package/src/useNativeRef.ts +1 -1
- package/types/getWebElement.d.ts +13 -0
- package/types/index.d.ts +5 -0
- package/types/index.native.d.ts +5 -0
- package/types/types.d.ts +29 -0
- package/types/types.d.ts.map +1 -1
- package/types/useNativeRef.d.ts +31 -0
- package/types/useNativeRef.d.ts.map +1 -1
- package/types/useWebRef.d.ts +19 -0
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
package/dist/cjs/useWebRef.cjs
CHANGED
|
@@ -5,44 +5,35 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
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: true
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
30
25
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
27
|
var useWebRef_exports = {};
|
|
35
|
-
__export(useWebRef_exports, {
|
|
36
|
-
useWebRef: () => useWebRef
|
|
37
|
-
});
|
|
28
|
+
__export(useWebRef_exports, { useWebRef: () => useWebRef });
|
|
38
29
|
module.exports = __toCommonJS(useWebRef_exports);
|
|
39
30
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
40
31
|
var React = __toESM(require("react"), 1);
|
|
41
32
|
function useWebRef(forwardedRef) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
33
|
+
const ref = React.useRef(null);
|
|
34
|
+
const composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
|
|
35
|
+
return {
|
|
36
|
+
ref,
|
|
37
|
+
composedRef
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useWebRef_exports = {};
|
|
30
|
+
__export(useWebRef_exports, { useWebRef: () => useWebRef });
|
|
31
|
+
module.exports = __toCommonJS(useWebRef_exports);
|
|
32
|
+
var import_compose_refs = require("@tamagui/compose-refs");
|
|
33
|
+
var React = __toESM(require("react"), 1);
|
|
34
|
+
function useWebRef(forwardedRef) {
|
|
35
|
+
var ref = React.useRef(null);
|
|
36
|
+
var composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
|
|
37
|
+
return {
|
|
38
|
+
ref,
|
|
39
|
+
composedRef
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -7,45 +7,37 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
23
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
32
27
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
29
|
var useWebRef_exports = {};
|
|
37
|
-
__export(useWebRef_exports, {
|
|
38
|
-
useWebRef: () => useWebRef
|
|
39
|
-
});
|
|
30
|
+
__export(useWebRef_exports, { useWebRef: () => useWebRef });
|
|
40
31
|
module.exports = __toCommonJS(useWebRef_exports);
|
|
41
32
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
42
33
|
var React = __toESM(require("react"), 1);
|
|
43
34
|
function useWebRef(forwardedRef) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
var ref = React.useRef(null);
|
|
36
|
+
var composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);
|
|
37
|
+
return {
|
|
38
|
+
ref,
|
|
39
|
+
composedRef
|
|
40
|
+
};
|
|
50
41
|
}
|
|
42
|
+
|
|
51
43
|
//# sourceMappingURL=useWebRef.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useWebRef.native.js","names":[],"sources":["cjs/useWebRef.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useWebRef_exports = {};\n__export(useWebRef_exports, {\n useWebRef: () => useWebRef\n});\nmodule.exports = __toCommonJS(useWebRef_exports);\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar React = __toESM(require(\"react\"), 1);\nfunction useWebRef(forwardedRef) {\n var ref = React.useRef(null);\n var composedRef = (0, import_compose_refs.useComposedRefs)(ref, forwardedRef);\n return {\n ref,\n composedRef\n };\n}\n//# sourceMappingURL=useWebRef.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,oBAAoB,CAAC;AACzB,SAAS,mBAAmB,EAC1B,iBAAiB,UACnB,CAAC;AACD,OAAO,UAAU,aAAa,iBAAiB;AAC/C,IAAI,sBAAsB,QAAQ,uBAAuB;AACzD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,SAAS,UAAU,cAAc;CAC/B,IAAI,MAAM,MAAM,OAAO,IAAI;CAC3B,IAAI,eAAe,GAAG,oBAAoB,gBAAe,CAAE,KAAK,YAAY;CAC5E,OAAO;EACL;EACA;CACF;AACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
function getWebElement(element) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
if (!element) {
|
|
3
|
+
throw new Error("Element is null or undefined");
|
|
4
|
+
}
|
|
5
|
+
if (!(element instanceof HTMLElement)) {
|
|
6
|
+
throw new Error("Element is not an HTMLElement");
|
|
7
|
+
}
|
|
8
|
+
return element;
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
export { getWebElement };
|
|
11
12
|
//# sourceMappingURL=getWebElement.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getWebElement.js","names":[],"sources":["esm/getWebElement.js"],"sourcesContent":["function getWebElement(element) {\n if (!element) {\n throw new Error(\"Element is null or undefined\");\n }\n if (!(element instanceof HTMLElement)) {\n throw new Error(\"Element is not an HTMLElement\");\n }\n return element;\n}\nexport {\n getWebElement\n};\n//# sourceMappingURL=getWebElement.js.map\n"],"mappings":";AAAA,SAAS,cAAc,SAAS;CAC9B,IAAI,CAAC,SAAS;EACZ,MAAM,IAAI,MAAM,8BAA8B;CAChD;CACA,IAAI,EAAE,mBAAmB,cAAc;EACrC,MAAM,IAAI,MAAM,+BAA+B;CACjD;CACA,OAAO;AACT"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
function _instanceof(left, right) {
|
|
2
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
|
-
return !!right[Symbol.hasInstance](left);
|
|
4
|
-
} else {
|
|
5
|
-
return left instanceof right;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
1
|
function getWebElement(element) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
if (!element) {
|
|
3
|
+
throw new Error("Element is null or undefined");
|
|
4
|
+
}
|
|
5
|
+
if (!(element instanceof HTMLElement)) {
|
|
6
|
+
throw new Error("Element is not an HTMLElement");
|
|
7
|
+
}
|
|
8
|
+
return element;
|
|
16
9
|
}
|
|
10
|
+
|
|
17
11
|
export { getWebElement };
|
|
18
12
|
//# sourceMappingURL=getWebElement.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getWebElement.native.js","names":[],"sources":["esm/getWebElement.native.js"],"sourcesContent":["function getWebElement(element) {\n if (!element) {\n throw new Error(\"Element is null or undefined\");\n }\n if (!(element instanceof HTMLElement)) {\n throw new Error(\"Element is not an HTMLElement\");\n }\n return element;\n}\nexport {\n getWebElement\n};\n//# sourceMappingURL=getWebElement.js.map\n"],"mappings":";AAAA,SAAS,cAAc,SAAS;CAC9B,IAAI,CAAC,SAAS;EACZ,MAAM,IAAI,MAAM,8BAA8B;CAChD;CACA,IAAI,EAAE,mBAAmB,cAAc;EACrC,MAAM,IAAI,MAAM,+BAA+B;CACjD;CACA,OAAO;AACT"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from "./useWebRef.mjs"
|
|
2
|
-
|
|
3
|
-
export * from "./
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * from "./useWebRef.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./useNativeRef.mjs"
|
|
4
|
+
|
|
5
|
+
export * from "./getWebElement.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./types.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from "./useWebRef.mjs"
|
|
2
|
-
|
|
3
|
-
export * from "./
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * from "./useWebRef.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./useNativeRef.mjs"
|
|
4
|
+
|
|
5
|
+
export * from "./getWebElement.mjs"
|
|
6
|
+
|
|
7
|
+
export * from "./types.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export * from "./useNativeRef.native.js";
|
|
2
|
-
export * from "./types.native.js";
|
|
3
1
|
import { useNativeRef } from "./useNativeRef.native.js";
|
|
2
|
+
|
|
3
|
+
export * from "./useNativeRef.native.js"
|
|
4
|
+
|
|
5
|
+
export * from "./types.native.js"
|
|
6
|
+
|
|
4
7
|
function getWebElement() {
|
|
5
|
-
|
|
8
|
+
throw new Error("getWebElement is only available on web");
|
|
6
9
|
}
|
|
10
|
+
|
|
7
11
|
export { getWebElement, useNativeRef as useWebRef };
|
|
8
12
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["esm/index.native.js"],"sourcesContent":["export * from \"./useNativeRef\";\nexport * from \"./types\";\nimport { useNativeRef } from \"./useNativeRef\";\nfunction getWebElement() {\n throw new Error(\"getWebElement is only available on web\");\n}\nexport {\n getWebElement,\n useNativeRef as useWebRef\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;;;;AAGA,SAAS,gBAAgB;CACvB,MAAM,IAAI,MAAM,wCAAwC;AAC1D"}
|
package/dist/esm/types.mjs
CHANGED
package/dist/esm/types.native.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
|
|
3
4
|
function useNativeRef(forwardedRef) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
const composedRef = useComposedRefs(ref, forwardedRef);
|
|
7
|
+
return {
|
|
8
|
+
ref,
|
|
9
|
+
composedRef
|
|
10
|
+
};
|
|
10
11
|
}
|
|
11
12
|
function useNativeInputRef(forwardedRef) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const ref = React.useRef(null);
|
|
14
|
+
const composedRef = useComposedRefs(ref, forwardedRef);
|
|
15
|
+
return {
|
|
16
|
+
ref,
|
|
17
|
+
composedRef
|
|
18
|
+
};
|
|
18
19
|
}
|
|
20
|
+
|
|
19
21
|
export { useNativeInputRef, useNativeRef };
|
|
20
22
|
//# sourceMappingURL=useNativeRef.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useNativeRef.js","names":[],"sources":["esm/useNativeRef.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport * as React from \"react\";\nfunction useNativeRef(forwardedRef) {\n const ref = React.useRef(null);\n const composedRef = useComposedRefs(ref, forwardedRef);\n return { ref, composedRef };\n}\nfunction useNativeInputRef(forwardedRef) {\n const ref = React.useRef(null);\n const composedRef = useComposedRefs(ref, forwardedRef);\n return { ref, composedRef };\n}\nexport {\n useNativeInputRef,\n useNativeRef\n};\n//# sourceMappingURL=useNativeRef.js.map\n"],"mappings":";;;;AAEA,SAAS,aAAa,cAAc;CAClC,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,cAAc,gBAAgB,KAAK,YAAY;CACrD,OAAO;EAAE;EAAK;CAAY;AAC5B;AACA,SAAS,kBAAkB,cAAc;CACvC,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,cAAc,gBAAgB,KAAK,YAAY;CACrD,OAAO;EAAE;EAAK;CAAY;AAC5B"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
|
|
3
4
|
function useNativeRef(forwardedRef) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var ref = React.useRef(null);
|
|
6
|
+
var composedRef = useComposedRefs(ref, forwardedRef);
|
|
7
|
+
return {
|
|
8
|
+
ref,
|
|
9
|
+
composedRef
|
|
10
|
+
};
|
|
10
11
|
}
|
|
11
12
|
function useNativeInputRef(forwardedRef) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
var ref = React.useRef(null);
|
|
14
|
+
var composedRef = useComposedRefs(ref, forwardedRef);
|
|
15
|
+
return {
|
|
16
|
+
ref,
|
|
17
|
+
composedRef
|
|
18
|
+
};
|
|
18
19
|
}
|
|
20
|
+
|
|
19
21
|
export { useNativeInputRef, useNativeRef };
|
|
20
22
|
//# sourceMappingURL=useNativeRef.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useNativeRef.native.js","names":[],"sources":["esm/useNativeRef.native.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport * as React from \"react\";\nfunction useNativeRef(forwardedRef) {\n var ref = React.useRef(null);\n var composedRef = useComposedRefs(ref, forwardedRef);\n return {\n ref,\n composedRef\n };\n}\nfunction useNativeInputRef(forwardedRef) {\n var ref = React.useRef(null);\n var composedRef = useComposedRefs(ref, forwardedRef);\n return {\n ref,\n composedRef\n };\n}\nexport {\n useNativeInputRef,\n useNativeRef\n};\n//# sourceMappingURL=useNativeRef.js.map\n"],"mappings":";;;;AAEA,SAAS,aAAa,cAAc;CAClC,IAAI,MAAM,MAAM,OAAO,IAAI;CAC3B,IAAI,cAAc,gBAAgB,KAAK,YAAY;CACnD,OAAO;EACL;EACA;CACF;AACF;AACA,SAAS,kBAAkB,cAAc;CACvC,IAAI,MAAM,MAAM,OAAO,IAAI;CAC3B,IAAI,cAAc,gBAAgB,KAAK,YAAY;CACnD,OAAO;EACL;EACA;CACF;AACF"}
|
package/dist/esm/useWebRef.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
|
|
3
4
|
function useWebRef(forwardedRef) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
const composedRef = useComposedRefs(ref, forwardedRef);
|
|
7
|
+
return {
|
|
8
|
+
ref,
|
|
9
|
+
composedRef
|
|
10
|
+
};
|
|
10
11
|
}
|
|
12
|
+
|
|
11
13
|
export { useWebRef };
|
|
12
14
|
//# sourceMappingURL=useWebRef.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useWebRef.js","names":[],"sources":["esm/useWebRef.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport * as React from \"react\";\nfunction useWebRef(forwardedRef) {\n const ref = React.useRef(null);\n const composedRef = useComposedRefs(ref, forwardedRef);\n return { ref, composedRef };\n}\nexport {\n useWebRef\n};\n//# sourceMappingURL=useWebRef.js.map\n"],"mappings":";;;;AAEA,SAAS,UAAU,cAAc;CAC/B,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,cAAc,gBAAgB,KAAK,YAAY;CACrD,OAAO;EAAE;EAAK;CAAY;AAC5B"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
|
|
3
4
|
function useWebRef(forwardedRef) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var ref = React.useRef(null);
|
|
6
|
+
var composedRef = useComposedRefs(ref, forwardedRef);
|
|
7
|
+
return {
|
|
8
|
+
ref,
|
|
9
|
+
composedRef
|
|
10
|
+
};
|
|
10
11
|
}
|
|
12
|
+
|
|
11
13
|
export { useWebRef };
|
|
12
14
|
//# sourceMappingURL=useWebRef.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useWebRef.native.js","names":[],"sources":["esm/useWebRef.native.js"],"sourcesContent":["import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport * as React from \"react\";\nfunction useWebRef(forwardedRef) {\n var ref = React.useRef(null);\n var composedRef = useComposedRefs(ref, forwardedRef);\n return {\n ref,\n composedRef\n };\n}\nexport {\n useWebRef\n};\n//# sourceMappingURL=useWebRef.js.map\n"],"mappings":";;;;AAEA,SAAS,UAAU,cAAc;CAC/B,IAAI,MAAM,MAAM,OAAO,IAAI;CAC3B,IAAI,cAAc,gBAAgB,KAAK,YAAY;CACnD,OAAO;EACL;EACA;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/element",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1091.1",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"files": [
|
|
5
6
|
"src",
|
|
6
7
|
"types",
|
|
@@ -10,15 +11,15 @@
|
|
|
10
11
|
"sideEffects": false,
|
|
11
12
|
"main": "dist/cjs",
|
|
12
13
|
"module": "dist/esm",
|
|
13
|
-
"types": "./
|
|
14
|
+
"types": "./types/index.d.ts",
|
|
14
15
|
"exports": {
|
|
15
16
|
"./package.json": "./package.json",
|
|
16
17
|
".": {
|
|
17
18
|
"react-native": {
|
|
18
|
-
"types": "./
|
|
19
|
+
"types": "./types/index.native.d.ts",
|
|
19
20
|
"default": "./dist/esm/index.native.js"
|
|
20
21
|
},
|
|
21
|
-
"types": "./
|
|
22
|
+
"types": "./types/index.d.ts",
|
|
22
23
|
"browser": "./dist/esm/index.mjs",
|
|
23
24
|
"module": "./dist/esm/index.mjs",
|
|
24
25
|
"import": "./dist/esm/index.mjs",
|
|
@@ -30,16 +31,17 @@
|
|
|
30
31
|
"access": "public"
|
|
31
32
|
},
|
|
32
33
|
"scripts": {
|
|
33
|
-
"build": "tamagui-build
|
|
34
|
-
"watch": "tamagui-build --
|
|
34
|
+
"build": "tamagui-build",
|
|
35
|
+
"watch": "tamagui-build --watch",
|
|
35
36
|
"clean": "tamagui-build clean",
|
|
36
37
|
"clean:build": "tamagui-build clean:build"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@tamagui/compose-refs": "
|
|
40
|
+
"@tamagui/compose-refs": "3.0.0-beta.1091.1",
|
|
41
|
+
"@tamagui/react-native-types": "3.0.0-beta.1091.1"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "
|
|
44
|
+
"@tamagui/build": "3.0.0-beta.1091.1"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"react": "*"
|
package/src/types.ts
CHANGED
package/src/useNativeRef.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TamaguiElement } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Narrows a TamaguiElement to an HTMLElement, with optional generic for further casting.
|
|
4
|
+
* Throws if the element is not an instanceof HTMLElement.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const el = getWebElement(ref.current) // HTMLElement
|
|
9
|
+
* const input = getWebElement<HTMLInputElement>(ref.current) // HTMLInputElement
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function getWebElement<T extends HTMLElement = HTMLElement>(element: TamaguiElement | null | undefined): T;
|
|
13
|
+
//# sourceMappingURL=getWebElement.d.ts.map
|
package/types/index.d.ts
ADDED
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { View } from '@tamagui/react-native-types';
|
|
2
|
+
type MeasureOnSuccessCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
|
|
3
|
+
type MeasureInWindowOnSuccessCallback = (x: number, y: number, width: number, height: number) => void;
|
|
4
|
+
type MeasureLayoutOnSuccessCallback = (left: number, top: number, width: number, height: number) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Methods added to element refs that work across web and native.
|
|
7
|
+
* On web these are added at runtime to HTMLElements.
|
|
8
|
+
* On native these exist on View already.
|
|
9
|
+
*/
|
|
10
|
+
export interface TamaguiElementMethods {
|
|
11
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
|
12
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
|
|
13
|
+
measureLayout(relativeToNativeNode: View | HTMLElement, onSuccess: MeasureLayoutOnSuccessCallback, onFail?: () => void): void;
|
|
14
|
+
focus(): void;
|
|
15
|
+
blur(): void;
|
|
16
|
+
}
|
|
17
|
+
export type TamaguiElement = (HTMLElement & TamaguiElementMethods) | View;
|
|
18
|
+
/**
|
|
19
|
+
* Web-specific element type that extends HTMLElement with Tamagui methods.
|
|
20
|
+
* Use this when you need an HTMLElement ref in web-only code.
|
|
21
|
+
*/
|
|
22
|
+
export type TamaguiWebElement<T extends HTMLElement = HTMLElement> = T & TamaguiElementMethods;
|
|
23
|
+
/**
|
|
24
|
+
* Native-specific element type (View).
|
|
25
|
+
* Use this when you need a View ref in native-only code.
|
|
26
|
+
*/
|
|
27
|
+
export type TamaguiNativeElement = View;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAEvD,KAAK,wBAAwB,GAAG,CAC9B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,KACV,IAAI,CAAA;AAET,KAAK,gCAAgC,GAAG,CACtC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,IAAI,CAAA;AAET,KAAK,8BAA8B,GAAG,CACpC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,IAAI,CAAA;AAET;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAAA;IACjD,eAAe,CAAC,QAAQ,EAAE,gCAAgC,GAAG,IAAI,CAAA;IACjE,aAAa,CACX,oBAAoB,EAAE,IAAI,GAAG,WAAW,EACxC,SAAS,EAAE,8BAA8B,EACzC,MAAM,CAAC,EAAE,MAAM,IAAI,GAClB,IAAI,CAAA;IACP,KAAK,IAAI,IAAI,CAAA;IACb,IAAI,IAAI,IAAI,CAAA;CACb;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,WAAW,GAAG,qBAAqB,CAAC,GAAG,IAAI,CAAA;AAEzE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAAC,GACpE,qBAAqB,CAAA;AAEvB;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TextInput } from '@tamagui/react-native-types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a ref for native-only code that properly types to View.
|
|
5
|
+
* Returns both ref and composedRef for component usage.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const { ref, composedRef } = useNativeRef(forwardedRef)
|
|
10
|
+
* // ref.current is typed as View
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function useNativeRef(forwardedRef?: React.ForwardedRef<any>): {
|
|
14
|
+
ref: React.RefObject<import("@tamagui/react-native-types").View | null>;
|
|
15
|
+
composedRef: (node: import("@tamagui/react-native-types").View | null) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates a ref for native TextInput components.
|
|
19
|
+
* Returns both ref and composedRef for component usage.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { ref, composedRef } = useNativeInputRef(forwardedRef)
|
|
24
|
+
* // ref.current is typed as TextInput
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useNativeInputRef(forwardedRef?: React.ForwardedRef<any>): {
|
|
28
|
+
ref: React.RefObject<TextInput | null>;
|
|
29
|
+
composedRef: (node: TextInput | null) => void;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useNativeRef.d.ts.map
|