@tamagui/core 1.13.3 → 1.13.4
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/helpers/getBoundingClientRect.js +1 -33
- package/dist/cjs/helpers/getBoundingClientRect.js.map +2 -2
- package/dist/cjs/helpers/getRect.js +1 -35
- package/dist/cjs/helpers/getRect.js.map +2 -2
- package/dist/cjs/hooks/useElementLayout.js +1 -83
- package/dist/cjs/hooks/useElementLayout.js.map +2 -2
- package/dist/cjs/hooks/usePlatformMethods.js +1 -47
- package/dist/cjs/hooks/usePlatformMethods.js.map +2 -2
- package/dist/cjs/index.js +1 -163
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/inject-styles.js +1 -39
- package/dist/cjs/inject-styles.js.map +2 -2
- package/dist/cjs/reactNativeTypes.js +1 -16
- package/dist/cjs/reactNativeTypes.js.map +2 -2
- package/dist/cjs/vendor/Pressability.js +1 -31
- package/dist/cjs/vendor/Pressability.js.map +2 -2
- package/dist/cjs/vendor/Pressability.native.js +1 -31
- package/dist/cjs/vendor/Pressability.native.js.map +2 -2
- package/dist/esm/helpers/getBoundingClientRect.js +1 -9
- package/dist/esm/helpers/getBoundingClientRect.js.map +2 -2
- package/dist/esm/helpers/getBoundingClientRect.mjs +1 -9
- package/dist/esm/helpers/getBoundingClientRect.mjs.map +2 -2
- package/dist/esm/helpers/getRect.js +1 -11
- package/dist/esm/helpers/getRect.js.map +2 -2
- package/dist/esm/helpers/getRect.mjs +1 -11
- package/dist/esm/helpers/getRect.mjs.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +1 -58
- package/dist/esm/hooks/useElementLayout.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.mjs +1 -58
- package/dist/esm/hooks/useElementLayout.mjs.map +2 -2
- package/dist/esm/hooks/usePlatformMethods.js +1 -23
- package/dist/esm/hooks/usePlatformMethods.js.map +2 -2
- package/dist/esm/hooks/usePlatformMethods.mjs +1 -23
- package/dist/esm/hooks/usePlatformMethods.mjs.map +2 -2
- package/dist/esm/index.js +1 -144
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +1 -144
- package/dist/esm/index.mjs.map +2 -2
- package/dist/esm/inject-styles.js +1 -15
- package/dist/esm/inject-styles.js.map +2 -2
- package/dist/esm/inject-styles.mjs +1 -15
- package/dist/esm/inject-styles.mjs.map +2 -2
- package/dist/esm/vendor/Pressability.js +1 -6
- package/dist/esm/vendor/Pressability.js.map +2 -2
- package/dist/esm/vendor/Pressability.mjs +1 -6
- package/dist/esm/vendor/Pressability.mjs.map +2 -2
- package/dist/esm/vendor/Pressability.native.js +1 -6
- package/dist/esm/vendor/Pressability.native.js.map +2 -2
- package/dist/esm/vendor/Pressability.native.mjs +1 -6
- package/dist/esm/vendor/Pressability.native.mjs.map +2 -2
- package/package.json +6 -6
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getBoundingClientRect_exports = {};
|
|
20
|
-
__export(getBoundingClientRect_exports, {
|
|
21
|
-
getBoundingClientRect: () => getBoundingClientRect
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getBoundingClientRect_exports);
|
|
24
|
-
const getBoundingClientRect = (node) => {
|
|
25
|
-
var _a;
|
|
26
|
-
if (!node || node.nodeType !== 1)
|
|
27
|
-
return;
|
|
28
|
-
return (_a = node.getBoundingClientRect) == null ? void 0 : _a.call(node);
|
|
29
|
-
};
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
getBoundingClientRect
|
|
33
|
-
});
|
|
1
|
+
"use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var R=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!g.call(t,i)&&i!==n&&l(t,i,{get:()=>e[i],enumerable:!(r=u(e,i))||r.enumerable});return t};var B=t=>p(l({},"__esModule",{value:!0}),t);var M={};R(M,{getBoundingClientRect:()=>C});module.exports=B(M);const C=t=>{var e;if(!(!t||t.nodeType!==1))return(e=t.getBoundingClientRect)==null?void 0:e.call(t)};0&&(module.exports={getBoundingClientRect});
|
|
34
2
|
//# sourceMappingURL=getBoundingClientRect.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/getBoundingClientRect.tsx"],
|
|
4
4
|
"sourcesContent": ["export const getBoundingClientRect = (node: HTMLElement | null): void | DOMRect => {\n if (!node || node.nodeType !== 1) return\n return node.getBoundingClientRect?.()\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAyBE,GAA6C,CAAnF,IAAAC,EACE,GAAI,GAACD,GAAQA,EAAK,WAAa,GAC/B,OAAOC,EAAAD,EAAK,wBAAL,YAAAC,EAAA,KAAAD,EACT",
|
|
6
|
+
"names": ["getBoundingClientRect_exports", "__export", "getBoundingClientRect", "__toCommonJS", "node", "_a"]
|
|
7
7
|
}
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getRect_exports = {};
|
|
20
|
-
__export(getRect_exports, {
|
|
21
|
-
getRect: () => getRect
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getRect_exports);
|
|
24
|
-
var import_getBoundingClientRect = require("./getBoundingClientRect");
|
|
25
|
-
const getRect = (node) => {
|
|
26
|
-
const rect = (0, import_getBoundingClientRect.getBoundingClientRect)(node);
|
|
27
|
-
if (!rect)
|
|
28
|
-
return;
|
|
29
|
-
const { x, y, top, left } = rect;
|
|
30
|
-
return { x, y, width: node.offsetWidth, height: node.offsetHeight, top, left };
|
|
31
|
-
};
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
getRect
|
|
35
|
-
});
|
|
1
|
+
"use strict";var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},m=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of h(t))!s.call(e,i)&&i!==o&&f(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e};var p=e=>m(f({},"__esModule",{value:!0}),e);var x={};l(x,{getRect:()=>u});module.exports=p(x);var n=require("./getBoundingClientRect");const u=e=>{const t=(0,n.getBoundingClientRect)(e);if(!t)return;const{x:o,y:r,top:i,left:c}=t;return{x:o,y:r,width:e.offsetWidth,height:e.offsetHeight,top:i,left:c}};0&&(module.exports={getRect});
|
|
36
2
|
//# sourceMappingURL=getRect.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/getRect.tsx"],
|
|
4
4
|
"sourcesContent": ["import { getBoundingClientRect } from './getBoundingClientRect'\n\nexport const getRect = (node: HTMLElement) => {\n const rect = getBoundingClientRect(node)\n if (!rect) return\n const { x, y, top, left } = rect\n return { x, y, width: node.offsetWidth, height: node.offsetHeight, top, left }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsC,mCAE/B,MAAMF,EAAWG,GAAsB,CAC5C,MAAMC,KAAO,yBAAsBD,CAAI,EACvC,GAAI,CAACC,EAAM,OACX,KAAM,CAAE,EAAAC,EAAG,EAAAC,EAAG,IAAAC,EAAK,KAAAC,CAAK,EAAIJ,EAC5B,MAAO,CAAE,EAAAC,EAAG,EAAAC,EAAG,MAAOH,EAAK,YAAa,OAAQA,EAAK,aAAc,IAAAI,EAAK,KAAAC,CAAK,CAC/E",
|
|
6
|
+
"names": ["getRect_exports", "__export", "getRect", "__toCommonJS", "import_getBoundingClientRect", "node", "rect", "x", "y", "top", "left"]
|
|
7
7
|
}
|
|
@@ -1,84 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useElementLayout_exports = {};
|
|
20
|
-
__export(useElementLayout_exports, {
|
|
21
|
-
measureLayout: () => measureLayout,
|
|
22
|
-
useElementLayout: () => useElementLayout
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useElementLayout_exports);
|
|
25
|
-
var import_constants = require("@tamagui/constants");
|
|
26
|
-
var import_use_event = require("@tamagui/use-event");
|
|
27
|
-
var import_getBoundingClientRect = require("../helpers/getBoundingClientRect");
|
|
28
|
-
var import_getRect = require("../helpers/getRect");
|
|
29
|
-
const LayoutHandlers = /* @__PURE__ */ new WeakMap();
|
|
30
|
-
let resizeObserver = null;
|
|
31
|
-
if (typeof window !== "undefined" && "ResizeObserver" in window) {
|
|
32
|
-
resizeObserver = new ResizeObserver((entries) => {
|
|
33
|
-
for (const { target } of entries) {
|
|
34
|
-
const onLayout = LayoutHandlers.get(target);
|
|
35
|
-
if (typeof onLayout !== "function")
|
|
36
|
-
return;
|
|
37
|
-
measureLayout(target, null, (x, y, width, height, left, top) => {
|
|
38
|
-
onLayout({
|
|
39
|
-
nativeEvent: {
|
|
40
|
-
layout: { x, y, width, height, left, top },
|
|
41
|
-
target
|
|
42
|
-
},
|
|
43
|
-
timeStamp: Date.now()
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const measureLayout = (node, relativeTo, callback) => {
|
|
50
|
-
const relativeNode = relativeTo || (node == null ? void 0 : node.parentNode);
|
|
51
|
-
if (relativeNode instanceof HTMLElement) {
|
|
52
|
-
setTimeout(() => {
|
|
53
|
-
const relativeRect = (0, import_getBoundingClientRect.getBoundingClientRect)(relativeNode);
|
|
54
|
-
const { height, left, top, width } = (0, import_getRect.getRect)(node);
|
|
55
|
-
const x = left - relativeRect.left;
|
|
56
|
-
const y = top - relativeRect.top;
|
|
57
|
-
callback(x, y, width, height, left, top);
|
|
58
|
-
}, 0);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const idFn = () => {
|
|
62
|
-
};
|
|
63
|
-
function useElementLayout(ref, onLayout) {
|
|
64
|
-
const hasLayoutEvent = !!onLayout;
|
|
65
|
-
const onLayoutEvent = (0, import_use_event.useEvent)(onLayout || idFn);
|
|
66
|
-
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
67
|
-
if (!resizeObserver || !hasLayoutEvent)
|
|
68
|
-
return;
|
|
69
|
-
const node = ref.current;
|
|
70
|
-
if (!node)
|
|
71
|
-
return;
|
|
72
|
-
LayoutHandlers.set(node, onLayoutEvent);
|
|
73
|
-
resizeObserver.observe(node);
|
|
74
|
-
return () => {
|
|
75
|
-
resizeObserver == null ? void 0 : resizeObserver.unobserve(node);
|
|
76
|
-
};
|
|
77
|
-
}, [ref, hasLayoutEvent]);
|
|
78
|
-
}
|
|
79
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
-
0 && (module.exports = {
|
|
81
|
-
measureLayout,
|
|
82
|
-
useElementLayout
|
|
83
|
-
});
|
|
1
|
+
"use strict";var l=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var o in t)l(e,o,{get:t[o],enumerable:!0})},R=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!g.call(e,n)&&n!==o&&l(e,n,{get:()=>t[n],enumerable:!(r=w(t,n))||r.enumerable});return e};var x=e=>R(l({},"__esModule",{value:!0}),e);var T={};h(T,{measureLayout:()=>E,useElementLayout:()=>M});module.exports=x(T);var f=require("@tamagui/constants"),p=require("@tamagui/use-event"),y=require("../helpers/getBoundingClientRect"),v=require("../helpers/getRect");const c=new WeakMap;let u=null;typeof window<"u"&&"ResizeObserver"in window&&(u=new ResizeObserver(e=>{for(const{target:t}of e){const o=c.get(t);if(typeof o!="function")return;E(t,null,(r,n,m,i,a,s)=>{o({nativeEvent:{layout:{x:r,y:n,width:m,height:i,left:a,top:s},target:t},timeStamp:Date.now()})})}}));const E=(e,t,o)=>{const r=t||(e==null?void 0:e.parentNode);r instanceof HTMLElement&&setTimeout(()=>{const n=(0,y.getBoundingClientRect)(r),{height:m,left:i,top:a,width:s}=(0,v.getRect)(e),L=i-n.left,b=a-n.top;o(L,b,s,m,i,a)},0)},H=()=>{};function M(e,t){const o=!!t,r=(0,p.useEvent)(t||H);(0,f.useIsomorphicLayoutEffect)(()=>{if(!u||!o)return;const n=e.current;if(n)return c.set(n,r),u.observe(n),()=>{u==null||u.unobserve(n)}},[e,o])}0&&(module.exports={measureLayout,useElementLayout});
|
|
84
2
|
//# sourceMappingURL=useElementLayout.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useElementLayout.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { useEvent } from '@tamagui/use-event'\nimport { RefObject } from 'react'\n\nimport { getBoundingClientRect } from '../helpers/getBoundingClientRect'\nimport { getRect } from '../helpers/getRect'\n\nconst LayoutHandlers = new WeakMap<Element, Function>()\n\nexport type LayoutValue = {\n x: number\n y: number\n width: number\n height: number\n left: number\n top: number\n}\n\nexport type LayoutEvent = {\n nativeEvent: {\n layout: LayoutValue\n target: any\n }\n timeStamp: number\n}\n\nlet resizeObserver: ResizeObserver | null = null\n\nif (typeof window !== 'undefined' && 'ResizeObserver' in window) {\n resizeObserver = new ResizeObserver((entries) => {\n for (const { target } of entries) {\n const onLayout = LayoutHandlers.get(target)\n if (typeof onLayout !== 'function') return\n measureLayout(target as HTMLElement, null, (x, y, width, height, left, top) => {\n onLayout({\n nativeEvent: {\n layout: { x, y, width, height, left, top },\n target,\n },\n timeStamp: Date.now(),\n })\n })\n }\n })\n}\n\nexport const measureLayout = (\n node: HTMLElement,\n relativeTo: HTMLElement | null,\n callback: Function\n) => {\n const relativeNode = relativeTo || node?.parentNode\n if (relativeNode instanceof HTMLElement) {\n setTimeout(() => {\n const relativeRect = getBoundingClientRect(relativeNode)!\n const { height, left, top, width } = getRect(node)!\n const x = left - relativeRect.left\n const y = top - relativeRect.top\n callback(x, y, width, height, left, top)\n }, 0)\n }\n}\n\nconst idFn = () => {}\n\nexport function useElementLayout(\n ref: RefObject<Element>,\n onLayout?: ((e: LayoutEvent) => void) | null\n) {\n const hasLayoutEvent = !!onLayout\n const onLayoutEvent = useEvent(onLayout || idFn)\n\n // Observing is done in a separate effect to avoid this effect running\n // when 'onLayout' changes.\n useIsomorphicLayoutEffect(() => {\n if (!resizeObserver || !hasLayoutEvent) return\n const node = ref.current\n if (!node) return\n LayoutHandlers.set(node, onLayoutEvent)\n resizeObserver.observe(node)\n return () => {\n resizeObserver?.unobserve(node)\n }\n }, [ref, hasLayoutEvent])\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,qBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA0C,8BAC1CC,EAAyB,8BAGzBC,EAAsC,4CACtCC,EAAwB,8BAExB,MAAMC,EAAiB,IAAI,QAmB3B,IAAIC,EAAwC,KAExC,OAAO,OAAW,KAAe,mBAAoB,SACvDA,EAAiB,IAAI,eAAgBC,GAAY,CAC/C,SAAW,CAAE,OAAAC,CAAO,IAAKD,EAAS,CAChC,MAAME,EAAWJ,EAAe,IAAIG,CAAM,EAC1C,GAAI,OAAOC,GAAa,WAAY,OACpCX,EAAcU,EAAuB,KAAM,CAACE,EAAGC,EAAGC,EAAOC,EAAQC,EAAMC,IAAQ,CAC7EN,EAAS,CACP,YAAa,CACX,OAAQ,CAAE,EAAAC,EAAG,EAAAC,EAAG,MAAAC,EAAO,OAAAC,EAAQ,KAAAC,EAAM,IAAAC,CAAI,EACzC,OAAAP,CACF,EACA,UAAW,KAAK,IAAI,CACtB,CAAC,CACH,CAAC,CACH,CACF,CAAC,GAGI,MAAMV,EAAgB,CAC3BkB,EACAC,EACAC,IACG,CACH,MAAMC,EAAeF,IAAcD,GAAA,YAAAA,EAAM,YACrCG,aAAwB,aAC1B,WAAW,IAAM,CACf,MAAMC,KAAe,yBAAsBD,CAAY,EACjD,CAAE,OAAAN,EAAQ,KAAAC,EAAM,IAAAC,EAAK,MAAAH,CAAM,KAAI,WAAQI,CAAI,EAC3CN,EAAII,EAAOM,EAAa,KACxBT,EAAII,EAAMK,EAAa,IAC7BF,EAASR,EAAGC,EAAGC,EAAOC,EAAQC,EAAMC,CAAG,CACzC,EAAG,CAAC,CAER,EAEMM,EAAO,IAAM,CAAC,EAEb,SAAStB,EACduB,EACAb,EACA,CACA,MAAMc,EAAiB,CAAC,CAACd,EACnBe,KAAgB,YAASf,GAAYY,CAAI,KAI/C,6BAA0B,IAAM,CAC9B,GAAI,CAACf,GAAkB,CAACiB,EAAgB,OACxC,MAAMP,EAAOM,EAAI,QACjB,GAAKN,EACL,OAAAX,EAAe,IAAIW,EAAMQ,CAAa,EACtClB,EAAe,QAAQU,CAAI,EACpB,IAAM,CACXV,GAAA,MAAAA,EAAgB,UAAUU,EAC5B,CACF,EAAG,CAACM,EAAKC,CAAc,CAAC,CAC1B",
|
|
6
|
+
"names": ["useElementLayout_exports", "__export", "measureLayout", "useElementLayout", "__toCommonJS", "import_constants", "import_use_event", "import_getBoundingClientRect", "import_getRect", "LayoutHandlers", "resizeObserver", "entries", "target", "onLayout", "x", "y", "width", "height", "left", "top", "node", "relativeTo", "callback", "relativeNode", "relativeRect", "idFn", "ref", "hasLayoutEvent", "onLayoutEvent"]
|
|
7
7
|
}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var usePlatformMethods_exports = {};
|
|
20
|
-
__export(usePlatformMethods_exports, {
|
|
21
|
-
usePlatformMethods: () => usePlatformMethods
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(usePlatformMethods_exports);
|
|
24
|
-
var import_web = require("@tamagui/web");
|
|
25
|
-
var import_getRect = require("../helpers/getRect");
|
|
26
|
-
var import_useElementLayout = require("./useElementLayout");
|
|
27
|
-
function usePlatformMethods(hostRef) {
|
|
28
|
-
(0, import_web.useIsomorphicLayoutEffect)(() => {
|
|
29
|
-
const node = hostRef.current;
|
|
30
|
-
if (!node)
|
|
31
|
-
return;
|
|
32
|
-
node.measure = (callback) => (0, import_useElementLayout.measureLayout)(node, null, callback);
|
|
33
|
-
node.measureLayout = (relativeToNode, success) => (0, import_useElementLayout.measureLayout)(node, relativeToNode, success);
|
|
34
|
-
node.measureInWindow = (callback) => {
|
|
35
|
-
if (!node)
|
|
36
|
-
return;
|
|
37
|
-
setTimeout(() => {
|
|
38
|
-
const { height, left, top, width } = (0, import_getRect.getRect)(node);
|
|
39
|
-
callback(left, top, width, height);
|
|
40
|
-
}, 0);
|
|
41
|
-
};
|
|
42
|
-
}, [hostRef]);
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
usePlatformMethods
|
|
47
|
-
});
|
|
1
|
+
"use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var o in e)u(t,o,{get:e[o],enumerable:!0})},d=(t,e,o,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!p.call(t,r)&&r!==o&&u(t,r,{get:()=>e[r],enumerable:!(m=c(e,r))||m.enumerable});return t};var h=t=>d(u({},"__esModule",{value:!0}),t);var y={};L(y,{usePlatformMethods:()=>E});module.exports=h(y);var f=require("@tamagui/web"),i=require("../helpers/getRect"),n=require("./useElementLayout");function E(t){(0,f.useIsomorphicLayoutEffect)(()=>{const e=t.current;e&&(e.measure=o=>(0,n.measureLayout)(e,null,o),e.measureLayout=(o,m)=>(0,n.measureLayout)(e,o,m),e.measureInWindow=o=>{e&&setTimeout(()=>{const{height:m,left:r,top:s,width:a}=(0,i.getRect)(e);o(r,s,a,m)},0)})},[t])}0&&(module.exports={usePlatformMethods});
|
|
48
2
|
//# sourceMappingURL=usePlatformMethods.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/usePlatformMethods.ts"],
|
|
4
4
|
"sourcesContent": ["import { useIsomorphicLayoutEffect } from '@tamagui/web'\nimport { RefObject } from 'react'\n\nimport { getRect } from '../helpers/getRect'\nimport { measureLayout } from './useElementLayout'\n\n// react native compat (web only)\nexport function usePlatformMethods(hostRef: RefObject<Element>) {\n useIsomorphicLayoutEffect(() => {\n const node = hostRef.current\n if (!node) return\n // @ts-ignore\n node.measure = (callback) => measureLayout(node, null, callback)\n // @ts-ignore\n node.measureLayout = (relativeToNode, success) =>\n measureLayout(node as HTMLElement, relativeToNode, success)\n // @ts-ignore\n node.measureInWindow = (callback) => {\n if (!node) return\n setTimeout(() => {\n const { height, left, top, width } = getRect(node as HTMLElement)!\n callback(left, top, width, height)\n }, 0)\n }\n }, [hostRef])\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0C,wBAG1CC,EAAwB,8BACxBC,EAA8B,8BAGvB,SAASJ,EAAmBK,EAA6B,IAC9D,6BAA0B,IAAM,CAC9B,MAAMC,EAAOD,EAAQ,QAChBC,IAELA,EAAK,QAAWC,MAAa,iBAAcD,EAAM,KAAMC,CAAQ,EAE/DD,EAAK,cAAgB,CAACE,EAAgBC,OACpC,iBAAcH,EAAqBE,EAAgBC,CAAO,EAE5DH,EAAK,gBAAmBC,GAAa,CAC9BD,GACL,WAAW,IAAM,CACf,KAAM,CAAE,OAAAI,EAAQ,KAAAC,EAAM,IAAAC,EAAK,MAAAC,CAAM,KAAI,WAAQP,CAAmB,EAChEC,EAASI,EAAMC,EAAKC,EAAOH,CAAM,CACnC,EAAG,CAAC,CACN,EACF,EAAG,CAACL,CAAO,CAAC,CACd",
|
|
6
|
+
"names": ["usePlatformMethods_exports", "__export", "usePlatformMethods", "__toCommonJS", "import_web", "import_getRect", "import_useElementLayout", "hostRef", "node", "callback", "relativeToNode", "success", "height", "left", "top", "width"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,164 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var src_exports = {};
|
|
21
|
-
__export(src_exports, {
|
|
22
|
-
Stack: () => Stack,
|
|
23
|
-
Text: () => Text
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_react_native_use_responder_events = require("@tamagui/react-native-use-responder-events");
|
|
27
|
-
var import_web = require("@tamagui/web");
|
|
28
|
-
var import_useElementLayout = require("./hooks/useElementLayout");
|
|
29
|
-
var import_usePlatformMethods = require("./hooks/usePlatformMethods");
|
|
30
|
-
var import_Pressability = require("./vendor/Pressability");
|
|
31
|
-
__reExport(src_exports, require("@tamagui/web"), module.exports);
|
|
32
|
-
const Stack = import_web.Stack;
|
|
33
|
-
const Text = import_web.Text;
|
|
34
|
-
(0, import_web.setupHooks)({
|
|
35
|
-
getBaseViews() {
|
|
36
|
-
const native = require("react-native");
|
|
37
|
-
return {
|
|
38
|
-
View: native.View || native.default.View,
|
|
39
|
-
Text: native.Text || native.default.Text
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
usePropsTransform(elementType, propsIn, hostRef) {
|
|
43
|
-
const {
|
|
44
|
-
// event props
|
|
45
|
-
onMoveShouldSetResponder,
|
|
46
|
-
onMoveShouldSetResponderCapture,
|
|
47
|
-
onResponderEnd,
|
|
48
|
-
onResponderGrant,
|
|
49
|
-
onResponderMove,
|
|
50
|
-
onResponderReject,
|
|
51
|
-
onResponderRelease,
|
|
52
|
-
onResponderStart,
|
|
53
|
-
onResponderTerminate,
|
|
54
|
-
onResponderTerminationRequest,
|
|
55
|
-
onScrollShouldSetResponder,
|
|
56
|
-
onScrollShouldSetResponderCapture,
|
|
57
|
-
onSelectionChangeShouldSetResponder,
|
|
58
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
59
|
-
onStartShouldSetResponder,
|
|
60
|
-
onStartShouldSetResponderCapture,
|
|
61
|
-
// android
|
|
62
|
-
collapsable,
|
|
63
|
-
focusable,
|
|
64
|
-
// deprecated,
|
|
65
|
-
accessible,
|
|
66
|
-
accessibilityDisabled,
|
|
67
|
-
onLayout,
|
|
68
|
-
hrefAttrs,
|
|
69
|
-
...viewProps
|
|
70
|
-
} = propsIn;
|
|
71
|
-
if (!import_web.isRSC) {
|
|
72
|
-
(0, import_usePlatformMethods.usePlatformMethods)(hostRef);
|
|
73
|
-
(0, import_useElementLayout.useElementLayout)(hostRef, onLayout);
|
|
74
|
-
(0, import_react_native_use_responder_events.useResponderEvents)(hostRef, {
|
|
75
|
-
onMoveShouldSetResponder,
|
|
76
|
-
onMoveShouldSetResponderCapture,
|
|
77
|
-
onResponderEnd,
|
|
78
|
-
onResponderGrant,
|
|
79
|
-
onResponderMove,
|
|
80
|
-
onResponderReject,
|
|
81
|
-
onResponderRelease,
|
|
82
|
-
onResponderStart,
|
|
83
|
-
onResponderTerminate,
|
|
84
|
-
onResponderTerminationRequest,
|
|
85
|
-
onScrollShouldSetResponder,
|
|
86
|
-
onScrollShouldSetResponderCapture,
|
|
87
|
-
onSelectionChangeShouldSetResponder,
|
|
88
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
89
|
-
onStartShouldSetResponder,
|
|
90
|
-
onStartShouldSetResponderCapture
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
if (viewProps.href !== void 0 && hrefAttrs !== void 0) {
|
|
94
|
-
const { download, rel, target } = hrefAttrs;
|
|
95
|
-
if (download != null) {
|
|
96
|
-
viewProps.download = download;
|
|
97
|
-
}
|
|
98
|
-
if (rel != null) {
|
|
99
|
-
viewProps.rel = rel;
|
|
100
|
-
}
|
|
101
|
-
if (typeof target === "string") {
|
|
102
|
-
viewProps.target = target.charAt(0) !== "_" ? `_${target}` : target;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (!viewProps.tabIndex) {
|
|
106
|
-
const _focusable = focusable !== void 0 ? focusable : accessible;
|
|
107
|
-
const role = viewProps.role;
|
|
108
|
-
if (_focusable === false) {
|
|
109
|
-
viewProps.tabIndex = "-1";
|
|
110
|
-
}
|
|
111
|
-
if (
|
|
112
|
-
// These native elements are focusable by default
|
|
113
|
-
elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea"
|
|
114
|
-
) {
|
|
115
|
-
if (_focusable === false || accessibilityDisabled === true) {
|
|
116
|
-
viewProps.tabIndex = "-1";
|
|
117
|
-
}
|
|
118
|
-
} else if (
|
|
119
|
-
// These roles are made focusable by default
|
|
120
|
-
role === "button" || role === "checkbox" || role === "link" || role === "radio" || role === "textbox" || role === "switch"
|
|
121
|
-
) {
|
|
122
|
-
if (_focusable !== false) {
|
|
123
|
-
viewProps.tabIndex = "0";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (_focusable === true) {
|
|
127
|
-
viewProps.tabIndex = "0";
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return viewProps;
|
|
131
|
-
},
|
|
132
|
-
useEvents(viewProps, events, { pseudos }, setStateShallow) {
|
|
133
|
-
if (process.env.TAMAGUI_TARGET === "native") {
|
|
134
|
-
const attachFocus = !!(pseudos == null ? void 0 : pseudos.focusStyle);
|
|
135
|
-
if (attachFocus) {
|
|
136
|
-
viewProps.onFocus = (0, import_web.mergeEvent)(viewProps.onFocus, () => {
|
|
137
|
-
setStateShallow({ focus: true });
|
|
138
|
-
});
|
|
139
|
-
viewProps.onBlur = (0, import_web.mergeEvent)(viewProps.onBlur, () => {
|
|
140
|
-
setStateShallow({ focus: false });
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const pressability = (0, import_Pressability.usePressability)(
|
|
144
|
-
events ? { ...events, hitSlop: viewProps.hitSlop } : {}
|
|
145
|
-
);
|
|
146
|
-
if (events == null ? void 0 : events.onPress) {
|
|
147
|
-
for (const key in pressability) {
|
|
148
|
-
const og = viewProps[key];
|
|
149
|
-
const val = pressability[key];
|
|
150
|
-
viewProps[key] = og && !dontComposePressabilityKeys[key] ? (0, import_web.composeEventHandlers)(og, val) : val;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
const dontComposePressabilityKeys = {
|
|
157
|
-
onClick: true
|
|
158
|
-
};
|
|
159
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
160
|
-
0 && (module.exports = {
|
|
161
|
-
Stack,
|
|
162
|
-
Text
|
|
163
|
-
});
|
|
1
|
+
"use strict";var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var v=(e,o)=>{for(var t in o)m(e,t,{get:o[t],enumerable:!0})},S=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of O(o))!q.call(e,a)&&a!==t&&m(e,a,{get:()=>o[a],enumerable:!(i=G(o,a))||i.enumerable});return e},x=(e,o,t)=>(S(e,o,"default"),t&&S(t,o,"default"));var H=e=>S(m({},"__esModule",{value:!0}),e);var R={};v(R,{Stack:()=>L,Text:()=>W});module.exports=H(R);var h=require("@tamagui/react-native-use-responder-events"),n=require("@tamagui/web"),P=require("./hooks/useElementLayout"),k=require("./hooks/usePlatformMethods"),C=require("./vendor/Pressability");x(R,require("@tamagui/web"),module.exports);const L=n.Stack,W=n.Text;(0,n.setupHooks)({getBaseViews(){const e=require("react-native");return{View:e.View||e.default.View,Text:e.Text||e.default.Text}},usePropsTransform(e,o,t){const{onMoveShouldSetResponder:i,onMoveShouldSetResponderCapture:a,onResponderEnd:p,onResponderGrant:l,onResponderMove:u,onResponderReject:f,onResponderRelease:g,onResponderStart:y,onResponderTerminate:N,onResponderTerminationRequest:V,onScrollShouldSetResponder:E,onScrollShouldSetResponderCapture:w,onSelectionChangeShouldSetResponder:B,onSelectionChangeShouldSetResponderCapture:I,onStartShouldSetResponder:A,onStartShouldSetResponderCapture:M,collapsable:K,focusable:b,accessible:j,accessibilityDisabled:F,onLayout:_,hrefAttrs:T,...r}=o;if(n.isRSC||((0,k.usePlatformMethods)(t),(0,P.useElementLayout)(t,_),(0,h.useResponderEvents)(t,{onMoveShouldSetResponder:i,onMoveShouldSetResponderCapture:a,onResponderEnd:p,onResponderGrant:l,onResponderMove:u,onResponderReject:f,onResponderRelease:g,onResponderStart:y,onResponderTerminate:N,onResponderTerminationRequest:V,onScrollShouldSetResponder:E,onScrollShouldSetResponderCapture:w,onSelectionChangeShouldSetResponder:B,onSelectionChangeShouldSetResponderCapture:I,onStartShouldSetResponder:A,onStartShouldSetResponderCapture:M})),r.href!==void 0&&T!==void 0){const{download:c,rel:s,target:d}=T;c!=null&&(r.download=c),s!=null&&(r.rel=s),typeof d=="string"&&(r.target=d.charAt(0)!=="_"?`_${d}`:d)}if(!r.tabIndex){const c=b!==void 0?b:j,s=r.role;c===!1&&(r.tabIndex="-1"),e==="a"||e==="button"||e==="input"||e==="select"||e==="textarea"?(c===!1||F===!0)&&(r.tabIndex="-1"):(s==="button"||s==="checkbox"||s==="link"||s==="radio"||s==="textbox"||s==="switch")&&c!==!1&&(r.tabIndex="0"),c===!0&&(r.tabIndex="0")}return r},useEvents(e,o,{pseudos:t},i){if(process.env.TAMAGUI_TARGET==="native"){!!(t!=null&&t.focusStyle)&&(e.onFocus=(0,n.mergeEvent)(e.onFocus,()=>{i({focus:!0})}),e.onBlur=(0,n.mergeEvent)(e.onBlur,()=>{i({focus:!1})}));const p=(0,C.usePressability)(o?{...o,hitSlop:e.hitSlop}:{});if(o!=null&&o.onPress)for(const l in p){const u=e[l],f=p[l];e[l]=u&&!D[l]?(0,n.composeEventHandlers)(u,f):f}}}});const D={onClick:!0};0&&(module.exports={Stack,Text});
|
|
164
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { useResponderEvents } from '@tamagui/react-native-use-responder-events'\nimport {\n StackProps,\n StackPropsBase,\n TamaguiComponent,\n TextProps,\n TextPropsBase,\n Stack as WebStack,\n Text as WebText,\n composeEventHandlers,\n isRSC,\n mergeEvent,\n setupHooks,\n} from '@tamagui/web'\nimport { RefObject } from 'react'\nimport type { Text as RNText, View as RNView } from 'react-native'\n\nimport { useElementLayout } from './hooks/useElementLayout'\nimport { usePlatformMethods } from './hooks/usePlatformMethods'\nimport type { RNTextProps, RNViewProps } from './reactNativeTypes'\nimport { usePressability } from './vendor/Pressability'\n\n// re-exports all of @tamagui/web just adds hooks\nexport * from '@tamagui/web'\n\n// adds extra types to Stack/Text:\n\nexport const Stack = WebStack as TamaguiComponent<\n StackProps & RNViewProps,\n RNView,\n StackPropsBase & RNViewProps\n>\n\nexport const Text = WebText as TamaguiComponent<\n TextProps & RNTextProps,\n RNText,\n TextPropsBase & RNTextProps\n>\n\n// setup internal hooks:\n\nsetupHooks({\n getBaseViews() {\n const native = require('react-native')\n return {\n View: native.View || native.default.View,\n Text: native.Text || native.default.Text,\n }\n },\n\n usePropsTransform(elementType, propsIn, hostRef) {\n // otherwise replicate react-native-web functionality\n const {\n // event props\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n\n // android\n collapsable,\n focusable,\n\n // deprecated,\n accessible,\n accessibilityDisabled,\n\n onLayout,\n hrefAttrs,\n\n ...viewProps\n } = propsIn\n\n if (!isRSC) {\n usePlatformMethods(hostRef as RefObject<Element>)\n useElementLayout(hostRef as RefObject<Element>, onLayout as any)\n useResponderEvents(hostRef, {\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n } as any)\n }\n\n // TODO move into getSplitStyles inital `if (process.env.TAMAGUI_TARGET === 'web')` block\n\n if (viewProps.href !== undefined && hrefAttrs !== undefined) {\n const { download, rel, target } = hrefAttrs\n if (download != null) {\n viewProps.download = download\n }\n if (rel != null) {\n viewProps.rel = rel\n }\n if (typeof target === 'string') {\n viewProps.target = target.charAt(0) !== '_' ? `_${target}` : target\n }\n }\n\n // FOCUS\n // \"focusable\" indicates that an element may be a keyboard tab-stop.\n // ported from RNW: TODO move into getSplitStyles\n if (!viewProps.tabIndex) {\n const _focusable = focusable !== undefined ? focusable : accessible\n const role = viewProps.role\n if (_focusable === false) {\n viewProps.tabIndex = '-1'\n }\n if (\n // These native elements are focusable by default\n elementType === 'a' ||\n elementType === 'button' ||\n elementType === 'input' ||\n elementType === 'select' ||\n elementType === 'textarea'\n ) {\n if (_focusable === false || accessibilityDisabled === true) {\n viewProps.tabIndex = '-1'\n }\n } else if (\n // These roles are made focusable by default\n role === 'button' ||\n role === 'checkbox' ||\n role === 'link' ||\n role === 'radio' ||\n role === 'textbox' ||\n role === 'switch'\n ) {\n if (_focusable !== false) {\n viewProps.tabIndex = '0'\n }\n }\n // Everything else must explicitly set the prop\n if (_focusable === true) {\n viewProps.tabIndex = '0'\n }\n }\n\n return viewProps\n },\n\n useEvents(viewProps, events, { pseudos }, setStateShallow) {\n if (process.env.TAMAGUI_TARGET === 'native') {\n const attachFocus = !!pseudos?.focusStyle\n if (attachFocus) {\n viewProps.onFocus = mergeEvent(viewProps.onFocus, () => {\n setStateShallow({ focus: true })\n })\n viewProps.onBlur = mergeEvent(viewProps.onBlur, () => {\n setStateShallow({ focus: false })\n })\n }\n\n // use Pressability to get smooth unPress when you press + hold + move out\n // only ever create once, use .configure() to update later\n const pressability = usePressability(\n events ? { ...events, hitSlop: viewProps.hitSlop } : {}\n )\n if (events?.onPress) {\n for (const key in pressability) {\n const og = viewProps[key]\n const val = pressability[key]\n viewProps[key] =\n og && !dontComposePressabilityKeys[key] ? composeEventHandlers(og, val) : val\n }\n }\n }\n },\n})\n\nconst dontComposePressabilityKeys = {\n onClick: true,\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["WebStack", "WebText"]
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["src_exports", "__export", "Stack", "Text", "__toCommonJS", "import_react_native_use_responder_events", "import_web", "import_useElementLayout", "import_usePlatformMethods", "import_Pressability", "__reExport", "WebStack", "WebText", "native", "elementType", "propsIn", "hostRef", "onMoveShouldSetResponder", "onMoveShouldSetResponderCapture", "onResponderEnd", "onResponderGrant", "onResponderMove", "onResponderReject", "onResponderRelease", "onResponderStart", "onResponderTerminate", "onResponderTerminationRequest", "onScrollShouldSetResponder", "onScrollShouldSetResponderCapture", "onSelectionChangeShouldSetResponder", "onSelectionChangeShouldSetResponderCapture", "onStartShouldSetResponder", "onStartShouldSetResponderCapture", "collapsable", "focusable", "accessible", "accessibilityDisabled", "onLayout", "hrefAttrs", "viewProps", "download", "rel", "target", "_focusable", "role", "events", "pseudos", "setStateShallow", "pressability", "key", "og", "val", "dontComposePressabilityKeys"]
|
|
7
7
|
}
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var inject_styles_exports = {};
|
|
20
|
-
__export(inject_styles_exports, {
|
|
21
|
-
injectStyles: () => injectStyles
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(inject_styles_exports);
|
|
24
|
-
const stylesheets = {};
|
|
25
|
-
const injectStyles = ({ filePath, css }) => {
|
|
26
|
-
let stylesheet = stylesheets[filePath];
|
|
27
|
-
if (!stylesheet) {
|
|
28
|
-
const styleEl = document.createElement("style");
|
|
29
|
-
styleEl.setAttribute("data-file", filePath);
|
|
30
|
-
styleEl.setAttribute("type", "text/css");
|
|
31
|
-
stylesheet = stylesheets[filePath] = styleEl;
|
|
32
|
-
document.head.appendChild(styleEl);
|
|
33
|
-
}
|
|
34
|
-
stylesheet.innerHTML = css;
|
|
35
|
-
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
injectStyles
|
|
39
|
-
});
|
|
1
|
+
"use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var s in e)i(t,s,{get:e[s],enumerable:!0})},p=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of o(e))!y.call(t,c)&&c!==s&&i(t,c,{get:()=>e[c],enumerable:!(n=r(e,c))||n.enumerable});return t};var a=t=>p(i({},"__esModule",{value:!0}),t);var u={};d(u,{injectStyles:()=>m});module.exports=a(u);const l={},m=({filePath:t,css:e})=>{let s=l[t];if(!s){const n=document.createElement("style");n.setAttribute("data-file",t),n.setAttribute("type","text/css"),s=l[t]=n,document.head.appendChild(n)}s.innerHTML=e};0&&(module.exports={injectStyles});
|
|
40
2
|
//# sourceMappingURL=inject-styles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/inject-styles.ts"],
|
|
4
4
|
"sourcesContent": ["// for vite dev mode\n\nconst stylesheets: Record<string, HTMLElement> = {}\n\ninterface InjectStylesOptions {\n filePath: string\n css: string\n}\n\nexport const injectStyles = ({ filePath, css }: InjectStylesOptions) => {\n let stylesheet = stylesheets[filePath]\n if (!stylesheet) {\n const styleEl = document.createElement('style')\n styleEl.setAttribute('data-file', filePath)\n styleEl.setAttribute('type', 'text/css')\n stylesheet = stylesheets[filePath] = styleEl\n document.head.appendChild(styleEl)\n }\n stylesheet.innerHTML = css\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAEA,MAAMI,EAA2C,CAAC,EAOrCF,EAAe,CAAC,CAAE,SAAAG,EAAU,IAAAC,CAAI,IAA2B,CACtE,IAAIC,EAAaH,EAAYC,CAAQ,EACrC,GAAI,CAACE,EAAY,CACf,MAAMC,EAAU,SAAS,cAAc,OAAO,EAC9CA,EAAQ,aAAa,YAAaH,CAAQ,EAC1CG,EAAQ,aAAa,OAAQ,UAAU,EACvCD,EAAaH,EAAYC,CAAQ,EAAIG,EACrC,SAAS,KAAK,YAAYA,CAAO,CACnC,CACAD,EAAW,UAAYD,CACzB",
|
|
6
|
+
"names": ["inject_styles_exports", "__export", "injectStyles", "__toCommonJS", "stylesheets", "filePath", "css", "stylesheet", "styleEl"]
|
|
7
7
|
}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var reactNativeTypes_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(reactNativeTypes_exports);
|
|
1
|
+
"use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(n,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!l.call(n,o)&&o!==s&&r(n,o,{get:()=>e[o],enumerable:!(t=a(e,o))||t.enumerable});return n};var d=n=>u(r({},"__esModule",{value:!0}),n);var p={};module.exports=d(p);
|
|
17
2
|
//# sourceMappingURL=reactNativeTypes.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/reactNativeTypes.ts"],
|
|
4
4
|
"sourcesContent": ["import type { GestureResponderHandlers, LayoutChangeEvent } from 'react-native'\n\n// The following list is sourced from:\n// - https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/types/styles.js#L76\ntype RNWCursorValue =\n | 'alias'\n | 'all-scroll'\n | 'auto'\n | 'cell'\n | 'context-menu'\n | 'copy'\n | 'crosshair'\n | 'default'\n | 'grab'\n | 'grabbing'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'text'\n | 'vertical-text'\n | 'move'\n | 'none'\n | 'no-drop'\n | 'not-allowed'\n | 'zoom-in'\n | 'zoom-out'\n | 'col-resize'\n | 'e-resize'\n | 'ew-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'ns-resize'\n | 'nw-resize'\n | 'row-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n\n// This list is the combination of the following two lists:\n// - https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/modules/AccessibilityUtil/propsToAriaRole.js#L10\n// - https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js#L12\n// Plus the single hard-coded value \"label\" from here:\n// - https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js#L36\ntype RNWWebAccessibilityRole =\n | 'adjustable'\n | 'article'\n | 'banner'\n | 'blockquote'\n | 'button'\n | 'code'\n | 'complementary'\n | 'contentinfo'\n | 'deletion'\n | 'emphasis'\n | 'figure'\n | 'form'\n | 'header'\n | 'image'\n | 'imagebutton'\n | 'insertion'\n | 'keyboardkey'\n | 'label'\n | 'link'\n | 'list'\n | 'listitem'\n | 'main'\n | 'navigation'\n | 'none'\n | 'region'\n | 'search'\n | 'strong'\n | 'summary'\n | 'text'\n\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined\n\ntype RNExtraProps = {\n dataSet?: Record<string, string | number | undefined | null>\n onScrollShouldSetResponder?: unknown\n onScrollShouldSetResponderCapture?: unknown\n onSelectionChangeShouldSetResponder?: unknown\n onSelectionChangeShouldSetResponderCapture?: unknown\n onLayout?: OnLayout\n href?: string\n hrefAttrs?: {\n target?: '_blank' | '_self' | '_top' | 'blank' | 'self' | 'top'\n rel?: string\n download?: boolean\n }\n}\n\nexport interface RNViewProps extends GestureResponderHandlers, RNExtraProps {\n rel?: any\n download?: any\n}\n\nexport interface RNTextProps extends RNExtraProps {\n dir?: 'ltr' | 'rtl' | 'auto'\n focusable?: boolean\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["reactNativeTypes_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var Pressability_exports = {};
|
|
20
|
-
__export(Pressability_exports, {
|
|
21
|
-
Pressability: () => Pressability,
|
|
22
|
-
usePressability: () => usePressability
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(Pressability_exports);
|
|
25
|
-
const Pressability = {};
|
|
26
|
-
const usePressability = {};
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
Pressability,
|
|
30
|
-
usePressability
|
|
31
|
-
});
|
|
1
|
+
"use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var y=(t,s)=>{for(var e in s)i(t,e,{get:s[e],enumerable:!0})},b=(t,s,e,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of r(s))!c.call(t,a)&&a!==e&&i(t,a,{get:()=>s[a],enumerable:!(n=o(s,a))||n.enumerable});return t};var l=t=>b(i({},"__esModule",{value:!0}),t);var x={};y(x,{Pressability:()=>p,usePressability:()=>u});module.exports=l(x);const p={},u={};0&&(module.exports={Pressability,usePressability});
|
|
32
2
|
//# sourceMappingURL=Pressability.js.map
|