@buoy-gg/highlight-updates 7.0.56 → 7.0.58

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.
@@ -1 +1 @@
1
- "use strict";import{getDOMControlProps as oe,getDOMNodeHandle as re,getDOMPublicInstance as ie,isDOMElement as se}from"@buoy-gg/shared-ui/utils";import{Dimensions as L,UIManager as le,findNodeHandle as $}from"react-native";import{isRectCenterOnScreen as V,scoreTapMatch as W}from"./tapMatch";const Le=5;const ae=22;const z=new Set(["View","RCTView","ScrollView","RCTScrollView","RCTScrollContentView","SafeAreaView","RCTSafeAreaView","AndroidHorizontalScrollContentView","KeyboardAvoidingView","Pressable","PlatformPressable","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","TouchableNativeFeedback","AnimatedComponent","Wrapper"]);function B(){if(typeof global==="undefined")return null;return global.__REACT_DEVTOOLS_GLOBAL_HOOK__??null}let R=0;let U=false;function ce(){if(U)return;const e=B();if(!e)return;const t=e.onCommitFiberRoot;e.onCommitFiberRoot=function(...n){R++;return typeof t==="function"?t.apply(e,n):void 0};U=true}const ue=250;function j(){const e=new Map;return t=>{const n=[];let i=t;let l=0;let s=false;while(i&&l<400){const a=e.get(i);if(a!==void 0){s=a;break}if(I(i)?.__buoyDevToolsRoot){s=true;e.set(i,true);break}n.push(i);i=i.return;l++}for(const a of n)e.set(a,s);return s}}function A(){const e=B();if(!e)return[];const t=[];try{if(e.renderers&&typeof e.renderers.forEach==="function"){e.renderers.forEach((n,i)=>{try{const l=e.getFiberRoots?.(i);if(l)l.forEach(s=>t.push(s))}catch{}})}if(t.length===0&&e.getFiberRoots){const n=e.getFiberRoots(1);if(n)n.forEach(i=>t.push(i))}}catch{}return t}function fe(e){return e.tag===ae&&e.memoizedState!==null}function de(e){const t=e.memoizedProps?.activityState;if(t===0||t===1)return true;if(e.memoizedProps?.isPageFocused===false)return true;return false}function S(e,t,n=0,i=new Set){if(!e||i.has(e)||n>500)return;i.add(e);if(fe(e)||de(e)){if(e.sibling)S(e.sibling,t,n,i);return}t(e);if(e.child)S(e.child,t,n+1,i);if(e.sibling)S(e.sibling,t,n,i)}function G(e){const t=ie(e);if(t)return t;if(!e)return null;const n=e;if(n.canonical?.publicInstance)return n.canonical.publicInstance;if(n.canonical&&typeof n.canonical.measure==="function"){return n.canonical}if(typeof n.measure==="function"||typeof n.measureInWindow==="function"){return n}return null}function O(e){const t=re(e);if(t!==null)return t;if(e==null)return null;const n=e;if(typeof n.__nativeTag==="number")return n.__nativeTag;if(typeof n._nativeTag==="number")return n._nativeTag;if(typeof n.nativeTag==="number")return n.nativeTag;if(n.canonical){if(typeof n.canonical.__nativeTag==="number")return n.canonical.__nativeTag;if(typeof n.canonical._nativeTag==="number")return n.canonical._nativeTag;if(typeof n.canonical.nativeTag==="number")return n.canonical.nativeTag}return null}function q(e){const t=G(e.stateNode);if(t){return{instance:t,nativeTag:O(e.stateNode),stateNode:e.stateNode}}const n=[];if(e.child)n.push(e.child);let i=0;while(n.length>0&&i<4e3){i++;const l=n.pop();if(!l)continue;const s=G(l.stateNode);if(s)return{instance:s,nativeTag:O(l.stateNode),stateNode:l.stateNode};if(l.child)n.push(l.child);if(l.sibling)n.push(l.sibling)}return null}function he(e){let t=e;let n=0;while(t&&n++<200){const i=t.stateNode;if(i&&typeof i.scrollTo==="function"){const l=typeof i.getNativeScrollRef==="function"&&i.getNativeScrollRef()||null;const s=typeof i.getInnerViewNode==="function"&&i.getInnerViewNode()||typeof i.getScrollableNode==="function"&&i.getScrollableNode()||i;return{instance:i,nativeRef:l,innerNode:s}}t=t.return}return null}async function ge(e,t,n,i){try{if(se(n)){n.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});await new Promise(u=>setTimeout(u,16));return true}const l=he(e);if(!l)return false;const s=t;let a=null;const r=u=>new Promise(o=>{let f=false;const d=m=>{if(f)return;f=true;o(m)};const h=setTimeout(()=>d(null),600);try{u(m=>{clearTimeout(h);d(m)})}catch{clearTimeout(h);d(null)}});if(l.nativeRef&&typeof s.measureLayout==="function"){a=await r(u=>s.measureLayout(l.nativeRef,(o,f)=>u(f),()=>u(null)))}if(a==null){const u=$(t);const o=typeof l.innerNode==="number"?l.innerNode:$(l.innerNode);if(u!=null&&o!=null){a=await r(f=>le.measureLayout(u,o,()=>f(null),(d,h)=>f(h)))}}if(a==null)return false;l.instance.scrollTo({y:Math.max(0,a-i),animated:false});await new Promise(u=>setTimeout(u,120));return true}catch{return false}}function N(e){const t=e?.type;if(!t)return null;if(typeof t==="string")return t;return t.displayName||t.name||null}function E(e){let t=e?._debugOwner||e?.return;let n=0;while(t&&n<30){n++;const i=N(t);if(i&&!z.has(i)&&typeof t.type!=="string"){return i}t=t.return}return null}function I(e){return oe(e?.stateNode,e?.memoizedProps??e?.pendingProps??null)}function K(e,t=0){if(typeof e==="string")return e;if(typeof e==="number"&&Number.isFinite(e))return String(e);if(Array.isArray(e)&&t<4){const n=[];for(const i of e){const l=K(i,t+1);if(l)n.push(l)}return n.length>0?n.join(""):void 0}return void 0}function me(e){return e.replace(/\s+/g," ").trim()}function X(e){if(!e)return void 0;const t=n=>{const i=K(n);if(i===void 0)return void 0;const l=me(i);return l?l.slice(0,80):void 0};return t(e.children)??t(e.title)??t(e.label)??t(e.placeholder)??void 0}function pe(e,t){const n=[];const i=(s,a)=>{if(!s||a>t||n.length>=4)return;if(s!==e){const u=I(s);if(u&&(typeof u.onPress==="function"||typeof u.onLongPress==="function"))return}const r=X(I(s));if(r&&!n.includes(r))n.push(r);if(s.child)i(s.child,a+1);if(s!==e&&s.sibling)i(s.sibling,a)};if(e.child)i(e.child,1);const l=n.join(" ").trim();return l?l.slice(0,80):void 0}function ye(e){let t=e;let n=0;let i=null;let l=null;while(t&&n<25&&!(i&&l)){const s=I(t);if(s){if(!i&&typeof s.onPress==="function")i=s.onPress;if(!l&&typeof s.onLongPress==="function")l=s.onLongPress}t=t.return;n++}if(i)return{handler:i,kind:"onPress",longPress:l??void 0};return l?{handler:l,kind:"onLongPress"}:null}function M(e){return new Promise(t=>{let n=false;const i=l=>{if(n)return;n=true;t(l)};setTimeout(()=>i(null),1e3);try{if(typeof e.measureInWindow==="function"){e.measureInWindow((l,s,a,r)=>{if(a>0&&r>0)i({x:l,y:s,width:a,height:r});else i(null)})}else if(typeof e.measure==="function"){e.measure((l,s,a,r,u,o)=>{if(a>0&&r>0&&u!=null&&o!=null){i({x:u,y:o,width:a,height:r})}else{i(null)}})}else{i(null)}}catch{i(null)}})}const we=new Set(["RCTActivityIndicatorView","AndroidProgressBar"]);function F(){const e=A();if(e.length===0)return[];const t=[];const n=new Map;const i=new Map;const l=j();for(const s of e){S(s.current,a=>{const r=I(a);if(!r)return;const u=typeof r.onPress==="function"||typeof r.onLongPress==="function";const o=typeof r.onValueChange==="function";const f=typeof r.onChangeText==="function";const d=r.testID||void 0;const h=r.accessibilityLabel||void 0;const m=r.accessibilityRole||r.role||void 0;let p=X(r);const w=m==="button"||m==="link"||m==="menuitem"||m==="tab"||m==="switch"||m==="checkbox";const T=typeof a.type==="string"&&we.has(a.type)&&r.animating!==false;if(!u&&!o&&!f&&!d&&!h&&!p&&!w&&!T){return}let x=null;let c=null;let g=null;if(o){const H=r.value;const ne=typeof H==="number"||typeof r.minimumValue==="number";c={handler:r.onValueChange,kind:ne?"slider":"toggle",current:H,min:typeof r.minimumValue==="number"?r.minimumValue:void 0,max:typeof r.maximumValue==="number"?r.maximumValue:void 0}}else if(f){g={handler:r.onChangeText,current:typeof r.value==="string"?r.value:void 0}}else{x=ye(a)}const v=N(a);let D=v??"Unknown";if(!v||z.has(v)||typeof a.type==="string"){D=E(a)??v??"Unknown"}const C=q(a);if(!C&&!d)return;if(!p&&!h&&u){p=pe(a,6)}const b=C?.instance??null;const P=C?.nativeTag??null;const y=(b?n.get(b):void 0)??(P!=null?i.get(P):void 0);if(y){if(!y.press&&x)y.press=x;else if(y.press&&x?.longPress&&!y.press.longPress){y.press.longPress=x.longPress}if(!y.valueControl&&c)y.valueControl=c;if(!y.textControl&&g)y.textControl=g;if(!y.testID&&d)y.testID=d;if(!y.label&&h)y.label=h;if(!y.text&&p)y.text=p;if(b&&!n.has(b))n.set(b,y);if(P!=null&&!i.has(P))i.set(P,y);return}const k={nativeTag:P,name:D,role:m??(T?"progressbar":void 0),testID:d,label:h,text:p,instance:b,stateNode:C?.stateNode??null,fiber:a,press:x,valueControl:c,textControl:g,rect:null,buoy:l(a)};t.push(k);if(b)n.set(b,k);if(P!=null)i.set(P,k)})}return t}function ve(e,t){if(t.nativeTag!=null)return e.nativeTag===t.nativeTag;if(t.testID&&e.testID)return e.testID.toLowerCase()===t.testID.toLowerCase();return false}function J(e){const t=F();if(e.includeBuoy)return t;return t.filter(n=>!n.buoy||ve(n,e))}async function Y(e){await Promise.all(e.map(async t=>{if(t.instance)t.rect=await M(t.instance)}))}const Te=/^(FlatList|SectionList|VirtualizedSectionList|VirtualizedList|Animated\(.*\)|AnimatedComponent.*)$/;async function xe(e,t){const n=[];const i=j();for(const s of A()){S(s.current,a=>{if(N(a)!=="VirtualizedList")return;const r=a.memoizedProps;if(!r||typeof r.getItemCount!=="function")return;if(!e&&i(a))return;let u;try{u=Number(r.getItemCount(r.data))}catch{return}if(!Number.isFinite(u)||u<=0)return;const o=[];const f=(m,p)=>{for(let w=m?.child;w;w=w.sibling){const T=N(w);if(T==="VirtualizedList")continue;if(T==="CellRenderer"){o.push(w);continue}if(p<40)f(w,p+1)}};f(a,0);let d=a;let h=E(d);for(let m=0;m<6&&h&&Te.test(h);m++){d=d._debugOwner||d.return;h=E(d)}n.push({owner:h,items:u,cells:o})})}const l=[];for(const s of n){const a=await Promise.all(s.cells.map(async u=>{const o=q(u);return o?M(o.instance):null}));const r=a.filter(t).length;if(r>0&&s.items>r)l.push({owner:s.owner,items:s.items,listed:r})}return l}export async function describeScreen(e={}){const t=F();const n=e.includeBuoy?t:t.filter(o=>!o.buoy);const i=t.length-n.length;await Y(n);const l=L.get("window");const s=Math.round(l.width)||1;const a=Math.round(l.height)||1;const r=[];for(const o of n){const f=o.rect;if(!f&&!o.testID)continue;let d;let h;if(f){const w=f.x+f.width/2;const T=f.y+f.height/2;if(T<-a*.1||T>a*1.1||w<-s*.1||w>s*1.1){continue}d={x:_(w/s),y:_(T/a)};h={x:_(f.x/s),y:_(f.y/a),width:_(f.width/s),height:_(f.height/a)}}const m=o.valueControl?o.valueControl.kind:o.textControl?"text":void 0;const p=o.valueControl?o.valueControl.current:o.textControl?.current;r.push({nativeTag:o.nativeTag,name:o.name,role:o.role,testID:o.testID,label:o.label,text:o.text,interactive:!!(o.press||o.valueControl||o.textControl),longPressable:o.press&&(o.press.kind==="onLongPress"||o.press.longPress)?true:void 0,control:m,value:p,tap:d,frame:h})}r.sort((o,f)=>{const d=o.tap?.y??2;const h=f.tap?.y??2;if(Math.abs(d-h)>.02)return d-h;return(o.tap?.x??2)-(f.tap?.x??2)});const u=await xe(!!e.includeBuoy,o=>{if(!o)return false;const f=o.x+o.width/2;return o.y<=a*1.1&&o.y+o.height>=-a*.1&&f>=-s*.1&&f<=s*1.1});return{screen:{width:s,height:a},count:r.length,elements:r,...i>0?{hiddenBuoy:i}:{},...u.length?{lists:u}:{}}}function _(e){return Math.round(e*100)/100}function Q(e){return{nativeTag:e.nativeTag,testID:e.testID,label:e.label,text:e.text,name:e.name}}function Z(e,t){return W(Q(e),t)}function ee(e,t,n){if(!e||!t||!n)return void 0;return{x:(e.x+e.width/2)/t,y:(e.y+e.height/2)/n}}function te(e){const t=e?e.x+e.width/2:0;const n=e?e.y+e.height/2:0;const i={locationX:e?e.width/2:0,locationY:e?e.height/2:0,pageX:t,pageY:n,timestamp:0,target:null,identifier:1,touches:[],changedTouches:[]};return{nativeEvent:i,persist:()=>{},preventDefault:()=>{},stopPropagation:()=>{},isDefaultPrevented:()=>false,isPropagationStopped:()=>false,target:null,currentTarget:null,type:"press",timeStamp:0}}export async function tapElement(e){const t=J(e);if(t.length===0){return{tapped:false,reason:"No React fiber roots / elements found on screen."}}const n=t.map(c=>({c,score:Z(c,e)})).filter(c=>c.score>0).sort((c,g)=>g.score-c.score);const i=c=>!!(c.press||c.valueControl||c.textControl);if(n.length===0){return{tapped:false,reason:"No element matched. Call describe_screen to see available elements (match by testID, text, or name).",candidates:t.filter(i).slice(0,12).map(c=>({nativeTag:c.nativeTag,name:c.name,testID:c.testID,text:c.text}))}}const l=L.get("window");const s=l.width||1;const a=l.height||1;const r=n.slice(0,15);await Promise.all(r.map(async c=>{if(c.c.instance&&!c.c.rect)c.c.rect=await M(c.c.instance)}));for(const c of r){c.score=W({...Q(c.c),tap:ee(c.c.rect,s,a)},e)}r.sort((c,g)=>g.score-c.score);const u=r.find(c=>i(c.c))??n.find(c=>i(c.c))??r[0];const o=u.c;const f=(c,g)=>c.press&&c.press.handler===g.press?.handler||c.valueControl&&c.valueControl.handler===g.valueControl?.handler||c.textControl&&c.textControl.handler===g.textControl?.handler;const d=r.filter(c=>c!==u&&i(c.c)&&c.score===u.score).filter(c=>!f(c.c,o)).filter((c,g,v)=>v.findIndex(D=>f(D.c,c.c))===g).slice(0,3).map(c=>({nativeTag:c.c.nativeTag,name:c.c.name,testID:c.c.testID,text:c.c.text,tap:ee(c.c.rect,s,a)}));if(!i(o)){return{tapped:false,reason:`Matched "${o.name}"${o.text?` ("${o.text}")`:""} but it has no onPress / onValueChange / onChangeText handler (e.g. a react-native-gesture-handler GestureDetector). This element can't be driven in JS.`,matched:{nativeTag:o.nativeTag,name:o.name,testID:o.testID,label:o.label,text:o.text,via:"onPress"}}}if(o.instance&&!o.rect)o.rect=await M(o.instance);let h=false;const m=o.rect==null||!V(o.rect,s,a);if(m&&e.scrollIntoView!==false&&o.instance){h=await ge(o.fiber,o.instance,o.stateNode,80);if(h)o.rect=await M(o.instance)}const p={nativeTag:o.nativeTag,name:o.name,testID:o.testID,label:o.label,text:o.text};ce();const w=R;const T=Date.now();const x=async c=>{await new Promise(g=>setTimeout(g,ue));return{tapped:true,scrolled:h,matched:c,effect:{commits:R-w,observedMs:Date.now()-T},...d.length?{alsoMatched:d}:{}}};try{if(o.press){if(e.longPress){const g=o.press.kind==="onLongPress"?o.press.handler:o.press.longPress;if(!g){return{tapped:false,scrolled:h,reason:`Matched "${o.name}"${o.text?` ("${o.text}")`:""} but it has no onLongPress handler \u2014 call tap_element without longPress to tap it normally.`,matched:{...p,via:"onPress"}}}g(te(o.rect));return await x({...p,via:"onLongPress"})}o.press.handler(te(o.rect));return await x({...p,via:o.press.kind})}if(o.valueControl){const g=o.valueControl;let v;if(g.kind==="toggle"){v=typeof e.value==="boolean"?e.value:!g.current}else{const D=g.min??0;const C=g.max??1;if(typeof e.value==="number"){v=Math.min(C,Math.max(D,e.value))}else{v=g.current===C?D:C}}g.handler(v);return await x({...p,via:"onValueChange",value:v})}const c=e.text??(typeof e.value==="string"?e.value:"");o.textControl.handler(c);return await x({...p,via:"onChangeText",value:c})}catch(c){return{tapped:false,scrolled:h,reason:`handler threw: ${c instanceof Error?c.message:String(c)}`,matched:{...p,via:o.press?o.press.kind:o.valueControl?"onValueChange":"onChangeText"}}}}const Ce=5e3;const be=3e4;const Pe=50;const Ie=150;export async function waitFor(e){const t=e.nativeTag!=null||!!String(e.testID??"").trim()||!!String(e.query??"").trim();if(!t){return{ok:false,waitedMs:0,polls:0,reason:"Nothing to wait for \u2014 pass nativeTag, testID or query."}}const n=Math.min(Math.max(e.timeoutMs??Ce,0),be);const i=Math.max(e.pollMs??Ie,Pe);const l=e.gone===true;const s=Date.now();let a=0;for(;;){a+=1;const{hit:r,closest:u}=await De(e);if(l?!r:!!r){return{ok:true,waitedMs:Date.now()-s,polls:a,matched:r??void 0}}if(Date.now()-s>=n){const o=u?.length?u:void 0;const f=l?`Still on screen after ${n}ms.`:o?`Not on screen after ${n}ms \u2014 ${o.length===1?"one element":`${o.length} elements`} matched but ${o.some(d=>d.onScreen)?"not well enough":"none is visible"}. See \`closest\`; do not retry with different words, call describeScreen.`:`Not on screen after ${n}ms, and nothing matched those words at all. Call describeScreen to see what is there.`;return{ok:false,waitedMs:Date.now()-s,polls:a,reason:f,matched:r??void 0,closest:o}}await new Promise(o=>setTimeout(o,i))}}async function De(e){const t=J(e).map(r=>({c:r,score:Z(r,e)})).filter(r=>r.score>0).sort((r,u)=>u.score-r.score).slice(0,8);if(t.length===0)return{hit:null,closest:void 0};await Y(t.map(r=>r.c));const n=L.get("window");const i=Math.round(n.width)||1;const l=Math.round(n.height)||1;let s=null;for(const{c:r}of t){if(!V(r.rect,i,l))continue;s={nativeTag:r.nativeTag,name:r.name,testID:r.testID,label:r.label,text:r.text,interactive:!!(r.press||r.valueControl||r.textControl)};break}const a=t.slice(0,3).map(({c:r})=>({name:r.name,testID:r.testID,text:r.text,onScreen:V(r.rect,i,l)}));return{hit:s,closest:a}}function Se(e){let t=e;let n=0;while(t&&n<400){if(I(t)?.__buoyDevToolsRoot)return true;t=t.return;n++}return false}function _e(e,t){const n=I(e.fiber);if(typeof n?.onPress==="function"||typeof n?.onValueChange==="function"||typeof n?.onChangeText==="function"){return e}let i=null;let l=e.fiber?.return;let s=0;while(l&&s<25){if(typeof I(l)?.onPress==="function"){i=l;break}l=l.return;s++}if(!i)return e;let a=i;for(let r=0;r<6&&a;r++){const u=t.get(a);if(u)return u;a=a.return}return e}export function resolveTouchTarget(e){const t=F();if(t.length===0)return null;const n=new Map;for(const r of t)n.set(r.fiber,r);const i=t.find(r=>r.nativeTag===e);let l=null;if(!i){for(const r of A()){S(r.current,u=>{if(l)return;if(u.stateNode&&O(u.stateNode)===e){l=u}});if(l)break}}let s=i??null;if(!s&&l){let r=l;let u=0;let o=null;while(r&&u<25){const f=n.get(r);if(f){if(f.press||f.valueControl||f.textControl){s=f;break}if(!o)o=f}r=r.return;u++}if(!s)s=o}if(!s)return null;s=_e(s,n);if(!s.press&&!s.valueControl&&!s.textControl)return null;if(Se(s.fiber))return null;const a=s.valueControl?s.valueControl.kind:s.textControl?"text":"press";return{nativeTag:s.nativeTag,name:s.name,role:s.role,testID:s.testID,label:s.label,text:s.text,control:a,value:s.valueControl?s.valueControl.current:s.textControl?s.textControl.current:void 0}}
1
+ "use strict";import{getDOMControlProps as le,getDOMNodeHandle as ae,getDOMPublicInstance as ce,isDOMElement as ue}from"@buoy-gg/shared-ui/utils";import{Dimensions as R,UIManager as fe,findNodeHandle as U}from"react-native";import{isRectCenterOnScreen as A,scoreTapMatch as j}from"./tapMatch";const Fe=5;const de=22;const G=new Set(["View","RCTView","ScrollView","RCTScrollView","RCTScrollContentView","SafeAreaView","RCTSafeAreaView","AndroidHorizontalScrollContentView","KeyboardAvoidingView","Pressable","PlatformPressable","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","TouchableNativeFeedback","AnimatedComponent","Wrapper"]);function K(){if(typeof global==="undefined")return null;return global.__REACT_DEVTOOLS_GLOBAL_HOOK__??null}let H=0;let J=false;function he(){if(J)return;const e=K();if(!e)return;const t=e.onCommitFiberRoot;e.onCommitFiberRoot=function(...n){H++;return typeof t==="function"?t.apply(e,n):void 0};J=true}const ge=250;function X(){const e=new Map;return t=>{const n=[];let r=t;let l=0;let s=false;while(r&&l<400){const c=e.get(r);if(c!==void 0){s=c;break}if(P(r)?.__buoyDevToolsRoot){s=true;e.set(r,true);break}n.push(r);r=r.return;l++}for(const c of n)e.set(c,s);return s}}function O(){const e=K();if(!e)return[];const t=[];try{if(e.renderers&&typeof e.renderers.forEach==="function"){e.renderers.forEach((n,r)=>{try{const l=e.getFiberRoots?.(r);if(l)l.forEach(s=>t.push(s))}catch{}})}if(t.length===0&&e.getFiberRoots){const n=e.getFiberRoots(1);if(n)n.forEach(r=>t.push(r))}}catch{}return t}function me(e){return e.tag===de&&e.memoizedState!==null}let S=false;let F=0;let k=false;function Y(e,t){const n=S;S=e;try{return t()}finally{S=n}}function pe(e){const t=e.memoizedProps;if(!t)return false;if(t["aria-hidden"]===true&&(t.activityState!==void 0||"shouldFreeze"in t))return true;if(t.isFocused===false&&(t.routeKey!==void 0||"freezeContents"in t))return true;return false}function ye(e){const t=e.memoizedProps?.activityState;if(t===0||t===1)return true;if(e.memoizedProps?.isPageFocused===false)return true;if(!S&&pe(e)){F++;return true}return false}function _(e,t,n=0,r=new Set){if(!e||r.has(e)||n>500)return;r.add(e);if(me(e)||ye(e)){if(e.sibling)_(e.sibling,t,n,r);return}t(e);if(e.child)_(e.child,t,n+1,r);if(e.sibling)_(e.sibling,t,n,r)}function Q(e){const t=ce(e);if(t)return t;if(!e)return null;const n=e;if(n.canonical?.publicInstance)return n.canonical.publicInstance;if(n.canonical&&typeof n.canonical.measure==="function"){return n.canonical}if(typeof n.measure==="function"||typeof n.measureInWindow==="function"){return n}return null}function E(e){const t=ae(e);if(t!==null)return t;if(e==null)return null;const n=e;if(typeof n.__nativeTag==="number")return n.__nativeTag;if(typeof n._nativeTag==="number")return n._nativeTag;if(typeof n.nativeTag==="number")return n.nativeTag;if(n.canonical){if(typeof n.canonical.__nativeTag==="number")return n.canonical.__nativeTag;if(typeof n.canonical._nativeTag==="number")return n.canonical._nativeTag;if(typeof n.canonical.nativeTag==="number")return n.canonical.nativeTag}return null}function Z(e){const t=Q(e.stateNode);if(t){return{instance:t,nativeTag:E(e.stateNode),stateNode:e.stateNode}}const n=[];if(e.child)n.push(e.child);let r=0;while(n.length>0&&r<4e3){r++;const l=n.pop();if(!l)continue;const s=Q(l.stateNode);if(s)return{instance:s,nativeTag:E(l.stateNode),stateNode:l.stateNode};if(l.child)n.push(l.child);if(l.sibling)n.push(l.sibling)}return null}function we(e){let t=e;let n=0;while(t&&n++<200){const r=t.stateNode;if(r&&typeof r.scrollTo==="function"){const l=typeof r.getNativeScrollRef==="function"&&r.getNativeScrollRef()||null;const s=typeof r.getInnerViewNode==="function"&&r.getInnerViewNode()||typeof r.getScrollableNode==="function"&&r.getScrollableNode()||r;return{instance:r,nativeRef:l,innerNode:s}}t=t.return}return null}async function ve(e,t,n,r){try{if(ue(n)){n.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});await new Promise(f=>setTimeout(f,16));return true}const l=we(e);if(!l)return false;const s=t;let c=null;const o=f=>new Promise(i=>{let u=false;const d=g=>{if(u)return;u=true;i(g)};const m=setTimeout(()=>d(null),600);try{f(g=>{clearTimeout(m);d(g)})}catch{clearTimeout(m);d(null)}});if(l.nativeRef&&typeof s.measureLayout==="function"){c=await o(f=>s.measureLayout(l.nativeRef,(i,u)=>f(u),()=>f(null)))}if(c==null){const f=U(t);const i=typeof l.innerNode==="number"?l.innerNode:U(l.innerNode);if(f!=null&&i!=null){c=await o(u=>fe.measureLayout(f,i,()=>u(null),(d,m)=>u(m)))}}if(c==null)return false;l.instance.scrollTo({y:Math.max(0,c-r),animated:false});await new Promise(f=>setTimeout(f,120));return true}catch{return false}}function V(e){const t=e?.type;if(!t)return null;if(typeof t==="string")return t;return t.displayName||t.name||null}function $(e){let t=e?._debugOwner||e?.return;let n=0;while(t&&n<30){n++;const r=V(t);if(r&&!G.has(r)&&typeof t.type!=="string"){return r}t=t.return}return null}function P(e){return le(e?.stateNode,e?.memoizedProps??e?.pendingProps??null)}function ee(e,t=0){if(typeof e==="string")return e;if(typeof e==="number"&&Number.isFinite(e))return String(e);if(Array.isArray(e)&&t<4){const n=[];for(const r of e){const l=ee(r,t+1);if(l)n.push(l)}return n.length>0?n.join(""):void 0}return void 0}function Te(e){return e.replace(/\s+/g," ").trim()}function te(e){if(!e)return void 0;const t=n=>{const r=ee(n);if(r===void 0)return void 0;const l=Te(r);return l?k?l:l.slice(0,80):void 0};return t(e.children)??t(e.title)??t(e.label)??t(e.placeholder)??void 0}function xe(e,t){const n=[];const r=(s,c)=>{if(!s||c>t||n.length>=4)return;if(s!==e){const f=P(s);if(f&&(typeof f.onPress==="function"||typeof f.onLongPress==="function"))return}const o=te(P(s));if(o&&!n.includes(o))n.push(o);if(s.child)r(s.child,c+1);if(s!==e&&s.sibling)r(s.sibling,c)};if(e.child)r(e.child,1);const l=n.join(" ").trim();return l?l.slice(0,80):void 0}function Ce(e){let t=e;let n=0;let r=null;let l=null;while(t&&n<25&&!(r&&l)){const s=P(t);if(s){if(!r&&typeof s.onPress==="function")r=s.onPress;if(!l&&typeof s.onLongPress==="function")l=s.onLongPress}t=t.return;n++}if(r)return{handler:r,kind:"onPress",longPress:l??void 0};return l?{handler:l,kind:"onLongPress"}:null}function M(e){return new Promise(t=>{let n=false;const r=l=>{if(n)return;n=true;t(l)};setTimeout(()=>r(null),1e3);try{if(typeof e.measureInWindow==="function"){e.measureInWindow((l,s,c,o)=>{if(c>0&&o>0)r({x:l,y:s,width:c,height:o});else r(null)})}else if(typeof e.measure==="function"){e.measure((l,s,c,o,f,i)=>{if(c>0&&o>0&&f!=null&&i!=null){r({x:f,y:i,width:c,height:o})}else{r(null)}})}else{r(null)}}catch{r(null)}})}const be=new Set(["RCTActivityIndicatorView","AndroidProgressBar"]);function z(){const e=O();if(e.length===0)return[];const t=[];const n=new Map;const r=new Map;const l=X();for(const s of e){_(s.current,c=>{const o=P(c);if(!o)return;const f=typeof o.onPress==="function"||typeof o.onLongPress==="function";const i=typeof o.onValueChange==="function";const u=typeof o.onChangeText==="function";const d=o.testID||void 0;const m=o.accessibilityLabel||void 0;const g=o.accessibilityRole||o.role||void 0;let y=te(o);const x=g==="button"||g==="link"||g==="menuitem"||g==="tab"||g==="switch"||g==="checkbox";const w=typeof c.type==="string"&&be.has(c.type)&&o.animating!==false;if(!f&&!i&&!u&&!d&&!m&&!y&&!x&&!w){return}let C=null;let D=null;let I=null;if(i){const q=o.value;const se=typeof q==="number"||typeof o.minimumValue==="number";D={handler:o.onValueChange,kind:se?"slider":"toggle",current:q,min:typeof o.minimumValue==="number"?o.minimumValue:void 0,max:typeof o.maximumValue==="number"?o.maximumValue:void 0}}else if(u){I={handler:o.onChangeText,current:typeof o.value==="string"?o.value:void 0}}else{C=Ce(c)}const a=V(c);let h=a??"Unknown";if(!a||G.has(a)||typeof c.type==="string"){h=$(c)??a??"Unknown"}const v=Z(c);if(!v&&!d)return;if(!y&&!m&&f){y=xe(c,6)}const T=v?.instance??null;const b=v?.nativeTag??null;const p=(T?n.get(T):void 0)??(b!=null?r.get(b):void 0);if(p){if(!p.press&&C)p.press=C;else if(p.press&&C?.longPress&&!p.press.longPress){p.press.longPress=C.longPress}if(!p.valueControl&&D)p.valueControl=D;if(!p.textControl&&I)p.textControl=I;if(!p.testID&&d)p.testID=d;if(!p.label&&m)p.label=m;if(!p.text&&y)p.text=y;if(T&&!n.has(T))n.set(T,p);if(b!=null&&!r.has(b))r.set(b,p);return}const L={nativeTag:b,name:h,role:g??(w?"progressbar":void 0),testID:d,label:m,text:y,instance:T,stateNode:v?.stateNode??null,fiber:c,press:C,valueControl:D,textControl:I,rect:null,buoy:l(c)};t.push(L);if(T)n.set(T,L);if(b!=null)r.set(b,L)})}return t}function Ie(e,t){if(t.nativeTag!=null)return e.nativeTag===t.nativeTag;if(t.testID&&e.testID)return e.testID.toLowerCase()===t.testID.toLowerCase();return false}function W(e){const t=z();if(e.includeBuoy)return t;return t.filter(n=>!n.buoy||Ie(n,e))}async function ne(e){await Promise.all(e.map(async t=>{if(t.instance)t.rect=await M(t.instance)}))}const Pe=/^(FlatList|SectionList|VirtualizedSectionList|VirtualizedList|Animated\(.*\)|AnimatedComponent.*)$/;async function Se(e,t){const n=[];const r=X();for(const s of O()){_(s.current,c=>{if(V(c)!=="VirtualizedList")return;const o=c.memoizedProps;if(!o||typeof o.getItemCount!=="function")return;if(!e&&r(c))return;let f;try{f=Number(o.getItemCount(o.data))}catch{return}if(!Number.isFinite(f)||f<=0)return;const i=[];const u=(g,y)=>{for(let x=g?.child;x;x=x.sibling){const w=V(x);if(w==="VirtualizedList")continue;if(w==="CellRenderer"){i.push(x);continue}if(y<40)u(x,y+1)}};u(c,0);let d=c;let m=$(d);for(let g=0;g<6&&m&&Pe.test(m);g++){d=d._debugOwner||d.return;m=$(d)}n.push({owner:m,items:f,cells:i})})}const l=[];for(const s of n){const c=await Promise.all(s.cells.map(async f=>{const i=Z(f);return i?M(i.instance):null}));const o=c.filter(t).length;if(o>0&&s.items>o)l.push({owner:s.owner,items:s.items,listed:o})}return l}export async function describeScreen(e={}){const t=S;const n=k;S=!!e.includeHidden;k=!!e.fullText;try{return await De(e)}finally{S=t;k=n}}async function De(e){F=0;const t=z();const n=F;const r=e.includeBuoy?t:t.filter(u=>!u.buoy);const l=t.length-r.length;await ne(r);const s=R.get("window");const c=Math.round(s.width)||1;const o=Math.round(s.height)||1;const f=[];for(const u of r){const d=u.rect;if(!d&&!u.testID)continue;let m;let g;if(d){const w=d.x+d.width/2;const C=d.y+d.height/2;if(C<-o*.1||C>o*1.1||w<-c*.1||w>c*1.1){continue}m={x:N(w/c),y:N(C/o)};g={x:N(d.x/c),y:N(d.y/o),width:N(d.width/c),height:N(d.height/o)}}const y=u.valueControl?u.valueControl.kind:u.textControl?"text":void 0;const x=u.valueControl?u.valueControl.current:u.textControl?.current;f.push({nativeTag:u.nativeTag,name:u.name,role:u.role,testID:u.testID,label:u.label,text:u.text,interactive:!!(u.press||u.valueControl||u.textControl),longPressable:u.press&&(u.press.kind==="onLongPress"||u.press.longPress)?true:void 0,control:y,value:x,tap:m,frame:g})}f.sort((u,d)=>{const m=u.tap?.y??2;const g=d.tap?.y??2;if(Math.abs(m-g)>.02)return m-g;return(u.tap?.x??2)-(d.tap?.x??2)});const i=await Se(!!e.includeBuoy,u=>{if(!u)return false;const d=u.x+u.width/2;return u.y<=o*1.1&&u.y+u.height>=-o*.1&&d>=-c*.1&&d<=c*1.1});return{screen:{width:c,height:o},count:f.length,elements:f,...l>0?{hiddenBuoy:l}:{},...n>0?{hiddenScreens:n}:{},...i.length?{lists:i}:{}}}function N(e){return Math.round(e*100)/100}function oe(e){return{nativeTag:e.nativeTag,testID:e.testID,label:e.label,text:e.text,name:e.name}}function B(e,t){return j(oe(e),t)}function re(e,t,n){if(!e||!t||!n)return void 0;return{x:(e.x+e.width/2)/t,y:(e.y+e.height/2)/n}}function ie(e){const t=e?e.x+e.width/2:0;const n=e?e.y+e.height/2:0;const r={locationX:e?e.width/2:0,locationY:e?e.height/2:0,pageX:t,pageY:n,timestamp:0,target:null,identifier:1,touches:[],changedTouches:[]};return{nativeEvent:r,persist:()=>{},preventDefault:()=>{},stopPropagation:()=>{},isDefaultPrevented:()=>false,isPropagationStopped:()=>false,target:null,currentTarget:null,type:"press",timeStamp:0}}export async function tapElement(e){const t=Y(!!e.includeHidden,()=>W(e));if(t.length===0){return{tapped:false,reason:"No React fiber roots / elements found on screen."}}const n=t.map(a=>({c:a,score:B(a,e)})).filter(a=>a.score>0).sort((a,h)=>h.score-a.score);const r=a=>!!(a.press||a.valueControl||a.textControl);if(n.length===0&&!e.includeHidden){const a=Y(true,()=>W(e)).map(h=>({c:h,score:B(h,e)})).filter(h=>h.score>0);if(a.length>0){return{tapped:false,reason:"That element is only on a screen that isn't showing (another tab, or a screen under the current one). Navigate to it first, or pass includeHidden:true if you really mean the hidden one."}}}if(n.length===0){return{tapped:false,reason:"No element matched. Call describe_screen to see available elements (match by testID, text, or name).",candidates:t.filter(r).slice(0,12).map(a=>({nativeTag:a.nativeTag,name:a.name,testID:a.testID,text:a.text}))}}const l=R.get("window");const s=l.width||1;const c=l.height||1;const o=n.slice(0,15);await Promise.all(o.map(async a=>{if(a.c.instance&&!a.c.rect)a.c.rect=await M(a.c.instance)}));for(const a of o){a.score=j({...oe(a.c),tap:re(a.c.rect,s,c)},e)}o.sort((a,h)=>h.score-a.score);const f=o.find(a=>r(a.c))??n.find(a=>r(a.c))??o[0];const i=f.c;const u=(a,h)=>a.press&&a.press.handler===h.press?.handler||a.valueControl&&a.valueControl.handler===h.valueControl?.handler||a.textControl&&a.textControl.handler===h.textControl?.handler;const d=o.filter(a=>a!==f&&r(a.c)&&a.score===f.score).filter(a=>!u(a.c,i)).filter((a,h,v)=>v.findIndex(T=>u(T.c,a.c))===h).slice(0,3).map(a=>({nativeTag:a.c.nativeTag,name:a.c.name,testID:a.c.testID,text:a.c.text,tap:re(a.c.rect,s,c)}));const m=e.nativeTag==null&&!(e.testID&&!e.query);if(m&&d.length>0){const a=[i,...d.map(h=>o.find(v=>v.c.nativeTag===h.nativeTag)?.c).filter(Boolean)];return{tapped:false,reason:`"${e.query}" matches ${a.length} different controls equally well, so nothing was tapped. Tap one by its nativeTag.`,candidates:a.map(h=>({nativeTag:h.nativeTag,name:h.name,testID:h.testID,text:h.text}))}}const g=o[0];if(m&&g&&g!==f&&!r(g.c)&&g.score>=90&&f.score<g.score-40){return{tapped:false,reason:`The best match for "${e.query}" is "${g.c.text??g.c.label??g.c.name}", which has no JS press handler (it may be native, like a tab bar button). The closest pressable match, "${i.text??i.label??i.name}", is a much weaker match, so nothing was tapped. Use navigate, or tap a specific element by nativeTag.`,candidates:[{nativeTag:i.nativeTag,name:i.name,testID:i.testID,text:i.text}]}}if(!r(i)){return{tapped:false,reason:`Matched "${i.name}"${i.text?` ("${i.text}")`:""} but it has no onPress / onValueChange / onChangeText handler (e.g. a react-native-gesture-handler GestureDetector). This element can't be driven in JS.`,matched:{nativeTag:i.nativeTag,name:i.name,testID:i.testID,label:i.label,text:i.text,via:"onPress"}}}if(i.instance&&!i.rect)i.rect=await M(i.instance);let y=false;const x=i.rect==null||!A(i.rect,s,c);if(x&&e.scrollIntoView!==false&&i.instance){y=await ve(i.fiber,i.instance,i.stateNode,80);if(y)i.rect=await M(i.instance)}const w={nativeTag:i.nativeTag,name:i.name,testID:i.testID,label:i.label,text:i.text};he();const C=H;const D=Date.now();const I=async a=>{await new Promise(h=>setTimeout(h,ge));return{tapped:true,scrolled:y,matched:a,effect:{commits:H-C,observedMs:Date.now()-D},...d.length?{alsoMatched:d}:{}}};try{if(i.press){if(e.longPress){const h=i.press.kind==="onLongPress"?i.press.handler:i.press.longPress;if(!h){return{tapped:false,scrolled:y,reason:`Matched "${i.name}"${i.text?` ("${i.text}")`:""} but it has no onLongPress handler \u2014 call tap_element without longPress to tap it normally.`,matched:{...w,via:"onPress"}}}h(ie(i.rect));return await I({...w,via:"onLongPress"})}i.press.handler(ie(i.rect));return await I({...w,via:i.press.kind})}if(i.valueControl){const h=i.valueControl;let v;if(h.kind==="toggle"){v=typeof e.value==="boolean"?e.value:!h.current}else{const T=h.min??0;const b=h.max??1;if(typeof e.value==="number"){v=Math.min(b,Math.max(T,e.value))}else{v=h.current===b?T:b}}h.handler(v);return await I({...w,via:"onValueChange",value:v})}const a=e.text??(typeof e.value==="string"?e.value:"");i.textControl.handler(a);return await I({...w,via:"onChangeText",value:a})}catch(a){return{tapped:false,scrolled:y,reason:`handler threw: ${a instanceof Error?a.message:String(a)}`,matched:{...w,via:i.press?i.press.kind:i.valueControl?"onValueChange":"onChangeText"}}}}const _e=5e3;const Ne=3e4;const Me=50;const ke=150;export async function waitFor(e){const t=e.nativeTag!=null||!!String(e.testID??"").trim()||!!String(e.query??"").trim();if(!t){return{ok:false,waitedMs:0,polls:0,reason:"Nothing to wait for \u2014 pass nativeTag, testID or query."}}const n=Math.min(Math.max(e.timeoutMs??_e,0),Ne);const r=Math.max(e.pollMs??ke,Me);const l=e.gone===true;const s=Date.now();let c=0;for(;;){c+=1;const{hit:o,closest:f}=await Ve(e);if(l?!o:!!o){return{ok:true,waitedMs:Date.now()-s,polls:c,matched:o??void 0}}if(Date.now()-s>=n){const i=f?.length?f:void 0;const u=l?`Still on screen after ${n}ms.`:i?`Not on screen after ${n}ms \u2014 ${i.length===1?"one element":`${i.length} elements`} matched but ${i.some(d=>d.onScreen)?"not well enough":"none is visible"}. See \`closest\`; do not retry with different words, call describeScreen.`:`Not on screen after ${n}ms, and nothing matched those words at all. Call describeScreen to see what is there.`;return{ok:false,waitedMs:Date.now()-s,polls:c,reason:u,matched:o??void 0,closest:i}}await new Promise(i=>setTimeout(i,r))}}async function Ve(e){const t=W(e).map(o=>({c:o,score:B(o,e)})).filter(o=>o.score>0).sort((o,f)=>f.score-o.score).slice(0,8);if(t.length===0)return{hit:null,closest:void 0};await ne(t.map(o=>o.c));const n=R.get("window");const r=Math.round(n.width)||1;const l=Math.round(n.height)||1;let s=null;for(const{c:o}of t){if(!A(o.rect,r,l))continue;s={nativeTag:o.nativeTag,name:o.name,testID:o.testID,label:o.label,text:o.text,interactive:!!(o.press||o.valueControl||o.textControl)};break}const c=t.slice(0,3).map(({c:o})=>({name:o.name,testID:o.testID,text:o.text,onScreen:A(o.rect,r,l)}));return{hit:s,closest:c}}function Le(e){let t=e;let n=0;while(t&&n<400){if(P(t)?.__buoyDevToolsRoot)return true;t=t.return;n++}return false}function Re(e,t){const n=P(e.fiber);if(typeof n?.onPress==="function"||typeof n?.onValueChange==="function"||typeof n?.onChangeText==="function"){return e}let r=null;let l=e.fiber?.return;let s=0;while(l&&s<25){if(typeof P(l)?.onPress==="function"){r=l;break}l=l.return;s++}if(!r)return e;let c=r;for(let o=0;o<6&&c;o++){const f=t.get(c);if(f)return f;c=c.return}return e}export function resolveTouchTarget(e){const t=z();if(t.length===0)return null;const n=new Map;for(const o of t)n.set(o.fiber,o);const r=t.find(o=>o.nativeTag===e);let l=null;if(!r){for(const o of O()){_(o.current,f=>{if(l)return;if(f.stateNode&&E(f.stateNode)===e){l=f}});if(l)break}}let s=r??null;if(!s&&l){let o=l;let f=0;let i=null;while(o&&f<25){const u=n.get(o);if(u){if(u.press||u.valueControl||u.textControl){s=u;break}if(!i)i=u}o=o.return;f++}if(!s)s=i}if(!s)return null;s=Re(s,n);if(!s.press&&!s.valueControl&&!s.textControl)return null;if(Le(s.fiber))return null;const c=s.valueControl?s.valueControl.kind:s.textControl?"text":"press";return{nativeTag:s.nativeTag,name:s.name,role:s.role,testID:s.testID,label:s.label,text:s.text,control:c,value:s.valueControl?s.valueControl.current:s.textControl?s.textControl.current:void 0}}
@@ -1 +1 @@
1
- "use strict";export function isOnScreenTap(t){if(!t)return false;return t.x>=-.1&&t.x<=1.1&&t.y>=-.1&&t.y<=1.1}export function isRectCenterOnScreen(t,o,s){if(!t||o<=0||s<=0)return false;const r=t.x+t.width/2;const e=t.y+t.height/2;const i=o*.1;const a=s*.1;return r>=-i&&r<=o+i&&e>=-a&&e<=s+a}export function looseText(t){return String(t??"").toLowerCase().replace(/\s+/g," ").replace(/(\d)[,\u00a0\u202f](?=\d{3}\b)/g,"$1").trim()}export function scoreTapMatch(t,o){if(o.nativeTag!=null&&t.nativeTag===o.nativeTag)return 1e3;const s=String(o.query??o.testID??"").trim().toLowerCase();if(!s)return 0;const r=[t.testID,t.label,t.text,t.name].filter(Boolean).map(n=>n.toLowerCase());let e=0;for(const n of r){if(n===s)e=Math.max(e,100);else if(n.startsWith(s))e=Math.max(e,50);else if(n.includes(s))e=Math.max(e,25)}const i=looseText(s);if(i){for(const n of r){const f=looseText(n);if(f===i)e=Math.max(e,90);else if(f.startsWith(i))e=Math.max(e,45);else if(f.includes(i))e=Math.max(e,22)}}if(o.testID&&t.testID&&t.testID.toLowerCase()===o.testID.toLowerCase()){e=Math.max(e,200)}if(e===0)return 0;const a=(t.testID??"").toLowerCase();if(a.startsWith("buoy-dial-"))e+=40;if(t.tap){if(isOnScreenTap(t.tap))e+=20;else e-=40}return e}
1
+ "use strict";export function isOnScreenTap(t){if(!t)return false;return t.x>=-.1&&t.x<=1.1&&t.y>=-.1&&t.y<=1.1}export function isRectCenterOnScreen(t,o,i){if(!t||o<=0||i<=0)return false;const r=t.x+t.width/2;const e=t.y+t.height/2;const n=o*.1;const f=i*.1;return r>=-n&&r<=o+n&&e>=-f&&e<=i+f}export function looseText(t){return String(t??"").toLowerCase().replace(/\s+/g," ").replace(/(\d)[,\u00a0\u202f](?=\d{3}\b)/g,"$1").trim()}export function scoreTapMatch(t,o){if(o.nativeTag!=null&&t.nativeTag===o.nativeTag)return 1e3;if(o.testID&&!o.query){if(!t.testID||t.testID.toLowerCase()!==o.testID.trim().toLowerCase())return 0;let s=200;if(t.tap)s+=isOnScreenTap(t.tap)?20:-40;return s}const i=String(o.query??o.testID??"").trim().toLowerCase();if(!i)return 0;const r=[t.testID,t.label,t.text,t.name].filter(Boolean).map(s=>s.toLowerCase());let e=0;for(const s of r){if(s===i)e=Math.max(e,100);else if(s.startsWith(i))e=Math.max(e,50);else if(s.includes(i))e=Math.max(e,25)}const n=looseText(i);if(n){for(const s of r){const a=looseText(s);if(a===n)e=Math.max(e,90);else if(a.startsWith(n))e=Math.max(e,45);else if(a.includes(n))e=Math.max(e,22)}}if(o.testID&&t.testID&&t.testID.toLowerCase()===o.testID.toLowerCase()){e=Math.max(e,200)}if(e===0)return 0;const f=(t.testID??"").toLowerCase();if(f.startsWith("buoy-dial-"))e+=40;if(t.tap){if(isOnScreenTap(t.tap))e+=20;else e-=40}return e}
@@ -1 +1 @@
1
- "use strict";import t from"../highlight-updates/utils/HighlightUpdatesController";import{RenderTracker as s}from"../highlight-updates/utils/RenderTracker";import{describeScreen as d,tapElement as l,waitFor as p}from"../highlight-updates/utils/screenElements";import{clearTouchCapture as g,getTouchCaptureStatus as b,readTouchCapture as f,startTouchCapture as h,stopTouchCapture as m}from"../highlight-updates/utils/touchCapture";import{CommitProfiler as o}from"../highlight-updates/utils/CommitProfiler";function a(){if(!t.isInitialized()){t.initialize()}}function i(e){if(!e)return void 0;const{hookChanges:r,...n}=e;return n}function C(e){const{renderHistory:r,lastRenderCause:n,...u}=e;return{...u,lastRenderCause:i(n),historyCount:r?.length??0}}function S(e){try{JSON.stringify(e);return e}catch{return{...e,lastRenderCause:i(e.lastRenderCause),renderHistory:e.renderHistory?.map(r=>({...r,capturedProps:void 0,capturedState:void 0,cause:i(r.cause)??r.cause}))}}}function T(){if(!o.isSupported()){return{ok:false,reason:"render capture needs a dev build with the React DevTools hook available"}}o.startCapture({detail:true});return{ok:true}}function R(){return{summary:o.stopCapture()}}export const highlightUpdatesSyncAdapter={version:3,getSnapshot:()=>({enabled:t.isEnabled(),frozen:t.getFrozen(),highlightsSuppressed:t.getHighlightsSuppressed(),renders:s.getRenders().map(C),trackerState:s.getState()}),subscribe:e=>{const r=t.subscribe(e);const n=t.subscribeToFreeze(e);const u=s.subscribe(e);const c=s.subscribeToState(e);return()=>{r();n();u();c()}},actions:{beginMeasurement:()=>T(),endMeasurement:()=>R(),getRenderDetail:e=>{const{nativeTag:r}=e??{};if(r==null){return{found:false,reason:"missing nativeTag"}}const n=s.getRender(String(r));if(!n)return{found:false,reason:"unknown nativeTag"};return{found:true,nativeTag:r,render:S(n)}},toggle:()=>{a();t.toggle()},setEnabled:e=>{a();t.setEnabled(e.enabled)},toggleFreeze:()=>{t.toggleFreeze()},clearRenderCounts:()=>{t.clearRenderCounts()},setSpotlight:e=>{t.setSpotlight(e.nativeTag)},locateComponent:e=>{a();return t.locateComponent(e??{})},setSilentTracking:e=>{a();t.setSilentTracking(e.enabled??false)},describeScreen:e=>d(e??{}),tapElement:e=>l(e??{}),waitFor:e=>p(e??{}),startTouchCapture:()=>h(),stopTouchCapture:()=>{m();return b()},clearTouchCapture:()=>{g();return{ok:true}},readTouchCapture:e=>f(e?.sinceSeq??0)}};
1
+ "use strict";import r from"../highlight-updates/utils/HighlightUpdatesController";import{getComponentSource as d}from"../highlight-updates/utils/componentSource";import{RenderTracker as s}from"../highlight-updates/utils/RenderTracker";import{describeScreen as l,tapElement as p,waitFor as g}from"../highlight-updates/utils/screenElements";import{clearTouchCapture as f,getTouchCaptureStatus as b,readTouchCapture as h,startTouchCapture as m,stopTouchCapture as C}from"../highlight-updates/utils/touchCapture";import{CommitProfiler as u}from"../highlight-updates/utils/CommitProfiler";function o(){if(!r.isInitialized()){r.initialize()}}function i(e){if(!e)return void 0;const{hookChanges:t,...n}=e;return n}function S(e){const{renderHistory:t,lastRenderCause:n,...a}=e;return{...a,lastRenderCause:i(n),historyCount:t?.length??0}}function T(e){try{JSON.stringify(e);return e}catch{return{...e,lastRenderCause:i(e.lastRenderCause),renderHistory:e.renderHistory?.map(t=>({...t,capturedProps:void 0,capturedState:void 0,cause:i(t.cause)??t.cause}))}}}function R(){if(!u.isSupported()){return{ok:false,reason:"render capture needs a dev build with the React DevTools hook available"}}u.startCapture({detail:true});return{ok:true}}function k(){return{summary:u.stopCapture()}}export const highlightUpdatesSyncAdapter={version:3,getSnapshot:()=>({enabled:r.isEnabled(),frozen:r.getFrozen(),highlightsSuppressed:r.getHighlightsSuppressed(),renders:s.getRenders().map(S),trackerState:s.getState()}),subscribe:e=>{const t=r.subscribe(e);const n=r.subscribeToFreeze(e);const a=s.subscribe(e);const c=s.subscribeToState(e);return()=>{t();n();a();c()}},actions:{getComponentSource:async e=>{try{return await d(e)}catch(t){return{found:false,reason:`Could not read the component's source: ${t instanceof Error?t.message:String(t)}`}}},beginMeasurement:()=>R(),endMeasurement:()=>k(),getRenderDetail:e=>{const{nativeTag:t}=e??{};if(t==null){return{found:false,reason:"missing nativeTag"}}const n=s.getRender(String(t));if(!n)return{found:false,reason:"unknown nativeTag"};return{found:true,nativeTag:t,render:T(n)}},toggle:()=>{o();r.toggle()},setEnabled:e=>{o();r.setEnabled(e.enabled)},toggleFreeze:()=>{r.toggleFreeze()},clearRenderCounts:()=>{r.clearRenderCounts()},setSpotlight:e=>{r.setSpotlight(e.nativeTag)},locateComponent:e=>{o();return r.locateComponent(e??{})},setSilentTracking:e=>{o();r.setSilentTracking(e.enabled??false)},describeScreen:e=>l(e??{}),tapElement:e=>p(e??{}),waitFor:e=>g(e??{}),startTouchCapture:()=>m(),stopTouchCapture:()=>{C();return b()},clearTouchCapture:()=>{f();return{ok:true}},readTouchCapture:e=>h(e?.sinceSeq??0)}};
@@ -0,0 +1,38 @@
1
+ type Fiber = any;
2
+ export interface ComponentSourceEntry {
3
+ name: string;
4
+ /** Where this component is USED: the JSX call site, in its parent's file. */
5
+ source?: {
6
+ fileName: string;
7
+ lineNumber?: number;
8
+ columnNumber?: number;
9
+ };
10
+ rawStack?: string;
11
+ /**
12
+ * Where it is DEFINED: JSX the component itself renders lives in its own
13
+ * file, so the first child it owns points inside the definition.
14
+ */
15
+ definedIn?: {
16
+ source?: {
17
+ fileName: string;
18
+ lineNumber?: number;
19
+ columnNumber?: number;
20
+ };
21
+ rawStack?: string;
22
+ };
23
+ memo: boolean;
24
+ forwardRef: boolean;
25
+ }
26
+ export type ComponentSourceResult = {
27
+ found: false;
28
+ reason: string;
29
+ } | {
30
+ found: true;
31
+ component: ComponentSourceEntry;
32
+ owners: ComponentSourceEntry[];
33
+ };
34
+ export declare function sourceFromFiber(fiber: Fiber): ComponentSourceResult;
35
+ export declare function fiberFromStateNode(node: any): Fiber | null;
36
+ export declare function getComponentSource(params?: unknown): Promise<ComponentSourceResult>;
37
+ export {};
38
+ //# sourceMappingURL=componentSource.d.ts.map
@@ -37,6 +37,10 @@ export interface DescribeScreenParams {
37
37
  * chrome echoing the caller's own words back is how taps went astray.
38
38
  */
39
39
  includeBuoy?: boolean;
40
+ /** Also list screens that are mounted but not showing (other tabs, screens under the top one). */
41
+ includeHidden?: boolean;
42
+ /** Return each element's whole text instead of the first 80 characters. */
43
+ fullText?: boolean;
40
44
  }
41
45
  export interface DescribeScreenResult {
42
46
  screen: {
@@ -47,6 +51,8 @@ export interface DescribeScreenResult {
47
51
  elements: ScreenElement[];
48
52
  /** Elements under Buoy's own overlay that were left out (pass includeBuoy to see them). */
49
53
  hiddenBuoy?: number;
54
+ /** Screens that are mounted but not showing and were left out (pass includeHidden to see them). */
55
+ hiddenScreens?: number;
50
56
  /**
51
57
  * Scrolling lists (FlatList, SectionList) that hold more items than
52
58
  * `elements` shows. Rows below the fold are left out, so a list of 40 can
@@ -68,6 +74,8 @@ export interface TapElementParams {
68
74
  query?: string;
69
75
  /** Let a fuzzy `query` match Buoy's own overlay. Exact nativeTag/testID always may. */
70
76
  includeBuoy?: boolean;
77
+ /** Also match elements on screens that are mounted but not showing. Default false. */
78
+ includeHidden?: boolean;
71
79
  /** Scroll the target into view first if it's off-screen. Default true. */
72
80
  scrollIntoView?: boolean;
73
81
  /** Invoke the element's onLongPress instead of onPress. Fails if it has none. */
@@ -29,6 +29,7 @@ export declare const highlightUpdatesSyncAdapter: {
29
29
  };
30
30
  subscribe: (onChange: () => void) => () => void;
31
31
  actions: {
32
+ getComponentSource: (params?: unknown) => Promise<import("../highlight-updates/utils/componentSource").ComponentSourceResult>;
32
33
  beginMeasurement: () => {
33
34
  ok: boolean;
34
35
  reason?: string;