@buoy-gg/highlight-updates 7.0.62 → 7.0.64
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/README.md +9 -0
- package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -1
- package/lib/commonjs/highlight-updates/utils/CommitProfiler.js +1 -1
- package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1
- package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +2 -2
- package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -1
- package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +4 -4
- package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -1
- package/lib/commonjs/highlight-updates/utils/namedComposite.js +1 -1
- package/lib/commonjs/highlight-updates/utils/screenElements.js +1 -1
- package/lib/commonjs/sync/highlightUpdatesSyncAdapter.js +1 -1
- package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -1
- package/lib/module/highlight-updates/utils/CommitProfiler.js +1 -1
- package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1
- package/lib/module/highlight-updates/utils/PerformanceLogger.js +2 -2
- package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -1
- package/lib/module/highlight-updates/utils/RenderCauseDetector.js +4 -4
- package/lib/module/highlight-updates/utils/RenderTracker.js +1 -1
- package/lib/module/highlight-updates/utils/namedComposite.js +1 -1
- package/lib/module/highlight-updates/utils/screenElements.js +1 -1
- package/lib/module/sync/highlightUpdatesSyncAdapter.js +1 -1
- package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts +12 -0
- package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts +3 -0
- package/lib/typescript/highlight-updates/utils/namedComposite.d.ts +1 -0
- package/lib/typescript/highlight-updates/utils/screenElements.d.ts +64 -0
- package/lib/typescript/sync/highlightUpdatesSyncAdapter.d.ts +4 -0
- package/lib/web/index.mjs +28 -28
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{getComponentDisplayName as o}from"./ViewTypeMapper";import{PerformanceLogger as u}from"./PerformanceLogger";import{isNamedComposite as h}from"./namedComposite";const l=200;const f=150;class m{renders=new Map;listeners=new Set;stateListeners=new Set;settingsListeners=new Set;filterListeners=new Set;renderEventCallbacks=new Set;isTracking=false;isPaused=false;settings={batchSize:f,showRenderCount:true,performanceLogging:false,trackRenderCauses:false,enableRenderHistory:false,maxRenderHistoryPerComponent:20,capturePropsOnRender:false,captureStateOnRender:false,debugLogLevel:"off",excludeDevTools:true,showHostViews:false};isBatchMode=false;batchDirty=false;filters={includeTestID:new Set,includeNativeID:new Set,includeViewType:new Set,includeComponent:new Set,excludeTestID:new Set,excludeNativeID:new Set,excludeViewType:new Set,excludeComponent:new Set,includePatterns:[],excludePatterns:[]};trackRender(e){if(this.isPaused)return;const t=String(e.nativeTag);const s=Date.now();const i=this.renders.get(t);if(i){i.renderCount=e.count;i.lastRenderTime=s;i.color=e.color;if(e.measurements){i.measurements=e.measurements}if(e.testID&&!i.testID)i.testID=e.testID;if(e.nativeID&&!i.nativeID)i.nativeID=e.nativeID;if(e.accessibilityLabel&&!i.accessibilityLabel){i.accessibilityLabel=e.accessibilityLabel}if(e.componentName&&!i.componentName){i.componentName=e.componentName}if(e.renderCause){i.lastRenderCause=e.renderCause}if(this.settings.enableRenderHistory){const n=e.renderCause||{type:"unknown",timestamp:s};this.addRenderEvent(i,n,e.capturedProps,e.capturedState)}}else{const n={id:t,nativeTag:e.nativeTag,viewType:e.viewType,displayName:o(e.viewType),testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,componentName:e.componentName,renderCount:e.count,firstRenderTime:s,lastRenderTime:s,measurements:e.measurements,color:e.color,lastRenderCause:e.renderCause};if(this.settings.enableRenderHistory){n.renderHistory=[];const r=e.renderCause||{type:e.count===1?"mount":"unknown",timestamp:s};this.addRenderEvent(n,r,e.capturedProps,e.capturedState)}this.renders.set(t,n);if(this.renders.size>l){const r=Array.from(this.renders.values()).sort((a,d)=>a.lastRenderTime-d.lastRenderTime);const c=r.slice(0,this.renders.size-l);for(const a of c){this.renders.delete(a.id)}}}if(this.isBatchMode){this.batchDirty=true}else{this.notifyListeners()}}addRenderEvent(e,t,s,i){if(!e.renderHistory){e.renderHistory=[]}const n={id:`${e.nativeTag}-${t.timestamp}`,timestamp:t.timestamp,cause:t,renderNumber:e.renderCount,capturedProps:this.settings.capturePropsOnRender?s:void 0,capturedState:this.settings.captureStateOnRender?i:void 0};e.renderHistory.push(n);const r=Math.max(5,Math.min(50,this.settings.maxRenderHistoryPerComponent));if(e.renderHistory.length>r){e.renderHistory=e.renderHistory.slice(-r)}this.notifyRenderEventCallbacks(n,e)}notifyRenderEventCallbacks(e,t){this.renderEventCallbacks.forEach(s=>{try{s(e,t)}catch{}})}emitRenderEvent(e){if(this.renderEventCallbacks.size===0)return;const t=Date.now();const s=e.renderCause||{type:"unknown",timestamp:t};const i={id:String(e.nativeTag),nativeTag:e.nativeTag,viewType:e.viewType,displayName:o(e.viewType),testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,componentName:e.componentName,renderCount:e.count,firstRenderTime:t,lastRenderTime:t,measurements:e.measurements,color:e.color,lastRenderCause:s,renderHistory:[]};const n={id:`${e.nativeTag}-${t}-${e.count}`,timestamp:t,renderNumber:e.count,cause:s,capturedProps:void 0,capturedState:void 0};this.notifyRenderEventCallbacks(n,i)}startBatch(){this.isBatchMode=true;this.batchDirty=false}endBatch(){this.isBatchMode=false;if(this.batchDirty){this.batchDirty=false;this.notifyListeners()}}getRenders(){return Array.from(this.renders.values()).map(e=>({...e}))}passesFilters(e){if(this.filters.includePatterns.length>0){const t=this.matchesAnyPatternForInfo(e,this.filters.includePatterns);if(!t)return false}if(this.filters.excludePatterns.length>0){const t=this.matchesAnyPatternForInfo(e,this.filters.excludePatterns);if(t)return false}if(this.filters.includeViewType.size>0){const t=e.viewType||"";const s=e.displayName||"";if(!this.matchesPattern(t,this.filters.includeViewType)&&!this.matchesPattern(s,this.filters.includeViewType)){return false}}if(this.filters.includeTestID.size>0){if(!e.testID||!this.matchesPattern(e.testID,this.filters.includeTestID)){return false}}if(this.filters.includeNativeID.size>0){if(!e.nativeID||!this.matchesPattern(e.nativeID,this.filters.includeNativeID)){return false}}if(this.filters.includeComponent.size>0){if(!e.componentName||!this.matchesPattern(e.componentName,this.filters.includeComponent)){return false}}if(this.filters.excludeViewType.size>0){const t=e.viewType||"";const s=e.displayName||"";if(this.matchesPattern(t,this.filters.excludeViewType)||this.matchesPattern(s,this.filters.excludeViewType)){return false}}if(this.filters.excludeTestID.size>0){if(e.testID&&this.matchesPattern(e.testID,this.filters.excludeTestID)){return false}}if(this.filters.excludeNativeID.size>0){if(e.nativeID&&this.matchesPattern(e.nativeID,this.filters.excludeNativeID)){return false}}if(this.filters.excludeComponent.size>0){if(e.componentName&&this.matchesPattern(e.componentName,this.filters.excludeComponent)){return false}}return true}matchesAnyPatternForInfo(e,t){for(const s of t){const i=s.value.toLowerCase();switch(s.type){case"any":if(e.viewType.toLowerCase().includes(i)||e.displayName?.toLowerCase().includes(i)||e.testID?.toLowerCase().includes(i)||e.nativeID?.toLowerCase().includes(i)||e.componentName?.toLowerCase().includes(i)||e.accessibilityLabel?.toLowerCase().includes(i)){return true}break;case"viewType":if(e.viewType.toLowerCase().includes(i)||e.displayName?.toLowerCase().includes(i)){return true}break;case"testID":if(e.testID?.toLowerCase().includes(i)){return true}break;case"nativeID":if(e.nativeID?.toLowerCase().includes(i)){return true}break;case"component":if(e.componentName?.toLowerCase().includes(i)){return true}break;case"accessibilityLabel":if(e.accessibilityLabel?.toLowerCase().includes(i)){return true}break}}return false}hasActiveFilters(){return this.filters.includePatterns.length>0||this.filters.excludePatterns.length>0||this.filters.includeViewType.size>0||this.filters.includeTestID.size>0||this.filters.includeNativeID.size>0||this.filters.includeComponent.size>0||this.filters.excludeViewType.size>0||this.filters.excludeTestID.size>0||this.filters.excludeNativeID.size>0||this.filters.excludeComponent.size>0||this.filters.minRenderCount!==void 0||this.filters.maxRenderCount!==void 0}getFilteredRenders(e=""){let t=this.getRenders();if(!this.settings.showHostViews){t=t.filter(h)}if(e.trim()){const s=e.toLowerCase();t=t.filter(i=>{return i.viewType.toLowerCase().includes(s)||i.displayName.toLowerCase().includes(s)||i.testID?.toLowerCase().includes(s)||i.nativeID?.toLowerCase().includes(s)||i.accessibilityLabel?.toLowerCase().includes(s)||i.componentName?.toLowerCase().includes(s)||String(i.nativeTag).includes(s)})}t=t.filter(s=>this.passesFilters(s));if(this.filters.minRenderCount!==void 0){t=t.filter(s=>s.renderCount>=this.filters.minRenderCount)}if(this.filters.maxRenderCount!==void 0){t=t.filter(s=>s.renderCount<=this.filters.maxRenderCount)}return t.sort((s,i)=>i.lastRenderTime-s.lastRenderTime)}matchesPattern(e,t){const s=e.toLowerCase();for(const i of t){const n=i.toLowerCase();if(s.includes(n)){return true}}return false}getRender(e){return this.renders.get(e)}clear(){this.renders.clear();this.notifyListeners()}resetRenderCount(e){const t=this.renders.get(e);if(t){t.renderCount=0;this.notifyListeners()}}start(){this.isTracking=true;this.isPaused=false;this.notifyStateListeners()}stop(){this.isTracking=false;this.isPaused=false;this.notifyStateListeners()}pause(){this.isPaused=true;this.notifyStateListeners()}resume(){this.isPaused=false;this.notifyStateListeners()}togglePause(){this.isPaused=!this.isPaused;this.notifyStateListeners()}getState(){return{isTracking:this.isTracking,isPaused:this.isPaused}}replaceRenders(e,t){const s=new Map;for(const[i,n]of this.renders){if(n.renderHistory&&n.renderHistory.length>0){s.set(i,n.renderHistory)}}this.renders=new Map(e.map(i=>{const n=s.get(i.id);const r=n&&!(i.renderHistory&&i.renderHistory.length>0)?{...i,renderHistory:n}:i;return[r.id,r]}));if(t&&(this.isTracking!==t.isTracking||this.isPaused!==t.isPaused)){this.isTracking=t.isTracking;this.isPaused=t.isPaused;this.notifyStateListeners()}this.notifyListeners()}hydrateRender(e){const t=this.renders.get(e.id);this.renders.set(e.id,t?{...t,...e}:e);this.notifyListeners()}getFilters(){return this.filters}setFilters(e){this.filters={...this.filters,...e};this.notifyListeners();this.notifyFilterListeners()}addIncludePattern(e,t){const s=`include${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].add(t);this.notifyListeners()}removeIncludePattern(e,t){const s=`include${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].delete(t);this.notifyListeners()}addExcludePattern(e,t){const s=`exclude${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].add(t);this.notifyListeners()}removeExcludePattern(e,t){const s=`exclude${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].delete(t);this.notifyListeners()}clearFilters(){this.filters={includeTestID:new Set,includeNativeID:new Set,includeViewType:new Set,includeComponent:new Set,excludeTestID:new Set,excludeNativeID:new Set,excludeViewType:new Set,excludeComponent:new Set,includePatterns:[],excludePatterns:[],minRenderCount:void 0,maxRenderCount:void 0};this.notifyListeners()}getAvailableProps(){const e=new Set;const t=new Set;const s=new Set;const i=new Set;const n=new Set;for(const r of this.renders.values()){if(r.viewType)e.add(r.viewType);if(r.testID)t.add(r.testID);if(r.nativeID)s.add(r.nativeID);if(r.componentName)i.add(r.componentName);if(r.accessibilityLabel)n.add(r.accessibilityLabel)}return{viewTypes:Array.from(e).sort(),testIDs:Array.from(t).sort(),nativeIDs:Array.from(s).sort(),componentNames:Array.from(i).sort(),accessibilityLabels:Array.from(n).sort()}}getStats(){let e=0;for(const t of this.renders.values()){e+=t.renderCount}return{totalComponents:this.renders.size,totalRenders:e}}subscribe(e){this.listeners.add(e);e(this.getRenders());return()=>{this.listeners.delete(e)}}subscribeToState(e){this.stateListeners.add(e);e(this.getState());return()=>{this.stateListeners.delete(e)}}subscribeToSettings(e){this.settingsListeners.add(e);e(this.settings);return()=>{this.settingsListeners.delete(e)}}subscribeToFilters(e){this.filterListeners.add(e);e(this.filters);return()=>{this.filterListeners.delete(e)}}onRenderEvent(e){this.renderEventCallbacks.add(e);return()=>{this.renderEventCallbacks.delete(e)}}getRenderEventCallbackCount(){return this.renderEventCallbacks.size}shouldShowRender(e){const t=this.filters;if(t.includePatterns.length>0){if(!this.matchesAnyPatternForInfo(e,t.includePatterns)){return false}}if(t.excludePatterns.length>0){if(this.matchesAnyPatternForInfo(e,t.excludePatterns)){return false}}const s=t.includeViewType.size>0||t.includeTestID.size>0||t.includeNativeID.size>0||t.includeComponent.size>0;if(s){const i=t.includeViewType.size>0&&t.includeViewType.has(e.viewType)||t.includeTestID.size>0&&e.testID&&t.includeTestID.has(e.testID)||t.includeNativeID.size>0&&e.nativeID&&t.includeNativeID.has(e.nativeID)||t.includeComponent.size>0&&e.componentName&&t.includeComponent.has(e.componentName);if(!i){return false}}if(t.excludeViewType.has(e.viewType))return false;if(e.testID&&t.excludeTestID.has(e.testID))return false;if(e.nativeID&&t.excludeNativeID.has(e.nativeID))return false;if(e.componentName&&t.excludeComponent.has(e.componentName))return false;return true}getSettings(){return{...this.settings}}setSettings(e){if(e.batchSize!==void 0){e.batchSize=Math.max(10,Math.min(500,e.batchSize))}if(e.maxRenderHistoryPerComponent!==void 0){e.maxRenderHistoryPerComponent=Math.max(5,Math.min(50,e.maxRenderHistoryPerComponent))}if(e.enableRenderHistory&&!this.settings.trackRenderCauses){e.trackRenderCauses=true}if(e.trackRenderCauses===false&&this.settings.enableRenderHistory){e.enableRenderHistory=false}this.settings={...this.settings,...e};if(e.performanceLogging!==void 0){u.setEnabled(e.performanceLogging)}this.notifySettingsListeners()}clearAllRenderHistory(){for(const e of this.renders.values()){e.renderHistory=[]}this.notifyListeners()}clearRenderHistory(e){const t=this.renders.get(e);if(t){t.renderHistory=[];this.notifyListeners()}}getRenderHistoryStats(){let e=0;let t=0;for(const s of this.renders.values()){if(s.renderHistory&&s.renderHistory.length>0){e+=s.renderHistory.length;t++}}return{totalEvents:e,componentsWithHistory:t,averageEventsPerComponent:t>0?e/t:0}}getBatchSize(){return this.settings.batchSize}setBatchSize(e){this.setSettings({batchSize:e})}notifyListeners(){const e=this.getRenders();for(const t of this.listeners){try{t(e)}catch(s){console.error("[RenderTracker] Error in listener:",s)}}}notifyStateListeners(){const e=this.getState();for(const t of this.stateListeners){try{t(e)}catch(s){console.error("[RenderTracker] Error in state listener:",s)}}}notifySettingsListeners(){const e=this.getSettings();for(const t of this.settingsListeners){try{t(e)}catch(s){console.error("[RenderTracker] Error in settings listener:",s)}}}notifyFilterListeners(){const e=this.getFilters();for(const t of this.filterListeners){try{t(e)}catch(s){console.error("[RenderTracker] Error in filter listener:",s)}}}}export const RenderTracker=new m;export default RenderTracker;
|
|
1
|
+
"use strict";import{getComponentDisplayName as o}from"./ViewTypeMapper";import{PerformanceLogger as u}from"./PerformanceLogger";import{isNamedComposite as h}from"./namedComposite";const l=200;const f=150;class m{renders=new Map;listeners=new Set;stateListeners=new Set;settingsListeners=new Set;filterListeners=new Set;renderEventCallbacks=new Set;isTracking=false;isPaused=false;settings={batchSize:f,showRenderCount:true,performanceLogging:false,trackRenderCauses:false,enableRenderHistory:false,maxRenderHistoryPerComponent:20,capturePropsOnRender:false,captureStateOnRender:false,debugLogLevel:"off",excludeDevTools:true,showHostViews:false};isBatchMode=false;batchDirty=false;filters={includeTestID:new Set,includeNativeID:new Set,includeViewType:new Set,includeComponent:new Set,excludeTestID:new Set,excludeNativeID:new Set,excludeViewType:new Set,excludeComponent:new Set,includePatterns:[],excludePatterns:[]};trackRender(e){if(this.isPaused)return;const t=String(e.nativeTag);const s=Date.now();const i=this.renders.get(t);if(i){i.renderCount=e.count;i.lastRenderTime=s;i.color=e.color;if(e.measurements){i.measurements=e.measurements}if(e.testID&&!i.testID)i.testID=e.testID;if(e.nativeID&&!i.nativeID)i.nativeID=e.nativeID;if(e.accessibilityLabel&&!i.accessibilityLabel){i.accessibilityLabel=e.accessibilityLabel}if(e.componentName&&!i.componentName){i.componentName=e.componentName}if(e.renderCause){i.lastRenderCause=e.renderCause}if(this.settings.enableRenderHistory){const n=e.renderCause||{type:"unknown",timestamp:s};this.addRenderEvent(i,n,e.capturedProps,e.capturedState)}}else{const n={id:t,nativeTag:e.nativeTag,viewType:e.viewType,displayName:o(e.viewType),testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,componentName:e.componentName,...e.isComponent===void 0?{}:{isComponent:e.isComponent},renderCount:e.count,firstRenderTime:s,lastRenderTime:s,measurements:e.measurements,color:e.color,lastRenderCause:e.renderCause};if(this.settings.enableRenderHistory){n.renderHistory=[];const r=e.renderCause||{type:e.count===1?"mount":"unknown",timestamp:s};this.addRenderEvent(n,r,e.capturedProps,e.capturedState)}this.renders.set(t,n);if(this.renders.size>l){const r=Array.from(this.renders.values()).sort((a,d)=>a.lastRenderTime-d.lastRenderTime);const c=r.slice(0,this.renders.size-l);for(const a of c){this.renders.delete(a.id)}}}if(this.isBatchMode){this.batchDirty=true}else{this.notifyListeners()}}addRenderEvent(e,t,s,i){if(!e.renderHistory){e.renderHistory=[]}const n={id:`${e.nativeTag}-${t.timestamp}`,timestamp:t.timestamp,cause:t,renderNumber:e.renderCount,capturedProps:this.settings.capturePropsOnRender?s:void 0,capturedState:this.settings.captureStateOnRender?i:void 0};e.renderHistory.push(n);const r=Math.max(5,Math.min(50,this.settings.maxRenderHistoryPerComponent));if(e.renderHistory.length>r){e.renderHistory=e.renderHistory.slice(-r)}this.notifyRenderEventCallbacks(n,e)}notifyRenderEventCallbacks(e,t){this.renderEventCallbacks.forEach(s=>{try{s(e,t)}catch{}})}emitRenderEvent(e){if(this.renderEventCallbacks.size===0)return;const t=Date.now();const s=e.renderCause||{type:"unknown",timestamp:t};const i={id:String(e.nativeTag),nativeTag:e.nativeTag,viewType:e.viewType,displayName:o(e.viewType),testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,componentName:e.componentName,renderCount:e.count,firstRenderTime:t,lastRenderTime:t,measurements:e.measurements,color:e.color,lastRenderCause:s,renderHistory:[]};const n={id:`${e.nativeTag}-${t}-${e.count}`,timestamp:t,renderNumber:e.count,cause:s,capturedProps:void 0,capturedState:void 0};this.notifyRenderEventCallbacks(n,i)}startBatch(){this.isBatchMode=true;this.batchDirty=false}endBatch(){this.isBatchMode=false;if(this.batchDirty){this.batchDirty=false;this.notifyListeners()}}getRenders(){return Array.from(this.renders.values()).map(e=>({...e}))}passesFilters(e){if(this.filters.includePatterns.length>0){const t=this.matchesAnyPatternForInfo(e,this.filters.includePatterns);if(!t)return false}if(this.filters.excludePatterns.length>0){const t=this.matchesAnyPatternForInfo(e,this.filters.excludePatterns);if(t)return false}if(this.filters.includeViewType.size>0){const t=e.viewType||"";const s=e.displayName||"";if(!this.matchesPattern(t,this.filters.includeViewType)&&!this.matchesPattern(s,this.filters.includeViewType)){return false}}if(this.filters.includeTestID.size>0){if(!e.testID||!this.matchesPattern(e.testID,this.filters.includeTestID)){return false}}if(this.filters.includeNativeID.size>0){if(!e.nativeID||!this.matchesPattern(e.nativeID,this.filters.includeNativeID)){return false}}if(this.filters.includeComponent.size>0){if(!e.componentName||!this.matchesPattern(e.componentName,this.filters.includeComponent)){return false}}if(this.filters.excludeViewType.size>0){const t=e.viewType||"";const s=e.displayName||"";if(this.matchesPattern(t,this.filters.excludeViewType)||this.matchesPattern(s,this.filters.excludeViewType)){return false}}if(this.filters.excludeTestID.size>0){if(e.testID&&this.matchesPattern(e.testID,this.filters.excludeTestID)){return false}}if(this.filters.excludeNativeID.size>0){if(e.nativeID&&this.matchesPattern(e.nativeID,this.filters.excludeNativeID)){return false}}if(this.filters.excludeComponent.size>0){if(e.componentName&&this.matchesPattern(e.componentName,this.filters.excludeComponent)){return false}}return true}matchesAnyPatternForInfo(e,t){for(const s of t){const i=s.value.toLowerCase();switch(s.type){case"any":if(e.viewType.toLowerCase().includes(i)||e.displayName?.toLowerCase().includes(i)||e.testID?.toLowerCase().includes(i)||e.nativeID?.toLowerCase().includes(i)||e.componentName?.toLowerCase().includes(i)||e.accessibilityLabel?.toLowerCase().includes(i)){return true}break;case"viewType":if(e.viewType.toLowerCase().includes(i)||e.displayName?.toLowerCase().includes(i)){return true}break;case"testID":if(e.testID?.toLowerCase().includes(i)){return true}break;case"nativeID":if(e.nativeID?.toLowerCase().includes(i)){return true}break;case"component":if(e.componentName?.toLowerCase().includes(i)){return true}break;case"accessibilityLabel":if(e.accessibilityLabel?.toLowerCase().includes(i)){return true}break}}return false}hasActiveFilters(){return this.filters.includePatterns.length>0||this.filters.excludePatterns.length>0||this.filters.includeViewType.size>0||this.filters.includeTestID.size>0||this.filters.includeNativeID.size>0||this.filters.includeComponent.size>0||this.filters.excludeViewType.size>0||this.filters.excludeTestID.size>0||this.filters.excludeNativeID.size>0||this.filters.excludeComponent.size>0||this.filters.minRenderCount!==void 0||this.filters.maxRenderCount!==void 0}getFilteredRenders(e=""){let t=this.getRenders();if(!this.settings.showHostViews){t=t.filter(h)}if(e.trim()){const s=e.toLowerCase();t=t.filter(i=>{return i.viewType.toLowerCase().includes(s)||i.displayName.toLowerCase().includes(s)||i.testID?.toLowerCase().includes(s)||i.nativeID?.toLowerCase().includes(s)||i.accessibilityLabel?.toLowerCase().includes(s)||i.componentName?.toLowerCase().includes(s)||String(i.nativeTag).includes(s)})}t=t.filter(s=>this.passesFilters(s));if(this.filters.minRenderCount!==void 0){t=t.filter(s=>s.renderCount>=this.filters.minRenderCount)}if(this.filters.maxRenderCount!==void 0){t=t.filter(s=>s.renderCount<=this.filters.maxRenderCount)}return t.sort((s,i)=>i.lastRenderTime-s.lastRenderTime)}matchesPattern(e,t){const s=e.toLowerCase();for(const i of t){const n=i.toLowerCase();if(s.includes(n)){return true}}return false}getRender(e){return this.renders.get(e)}clear(){this.renders.clear();this.notifyListeners()}resetRenderCount(e){const t=this.renders.get(e);if(t){t.renderCount=0;this.notifyListeners()}}start(){this.isTracking=true;this.isPaused=false;this.notifyStateListeners()}stop(){this.isTracking=false;this.isPaused=false;this.notifyStateListeners()}pause(){this.isPaused=true;this.notifyStateListeners()}resume(){this.isPaused=false;this.notifyStateListeners()}togglePause(){this.isPaused=!this.isPaused;this.notifyStateListeners()}getState(){return{isTracking:this.isTracking,isPaused:this.isPaused}}replaceRenders(e,t){const s=new Map;for(const[i,n]of this.renders){if(n.renderHistory&&n.renderHistory.length>0){s.set(i,n.renderHistory)}}this.renders=new Map(e.map(i=>{const n=s.get(i.id);const r=n&&!(i.renderHistory&&i.renderHistory.length>0)?{...i,renderHistory:n}:i;return[r.id,r]}));if(t&&(this.isTracking!==t.isTracking||this.isPaused!==t.isPaused)){this.isTracking=t.isTracking;this.isPaused=t.isPaused;this.notifyStateListeners()}this.notifyListeners()}hydrateRender(e){const t=this.renders.get(e.id);this.renders.set(e.id,t?{...t,...e}:e);this.notifyListeners()}getFilters(){return this.filters}setFilters(e){this.filters={...this.filters,...e};this.notifyListeners();this.notifyFilterListeners()}addIncludePattern(e,t){const s=`include${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].add(t);this.notifyListeners()}removeIncludePattern(e,t){const s=`include${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].delete(t);this.notifyListeners()}addExcludePattern(e,t){const s=`exclude${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].add(t);this.notifyListeners()}removeExcludePattern(e,t){const s=`exclude${e.charAt(0).toUpperCase()+e.slice(1)}`;this.filters[s].delete(t);this.notifyListeners()}clearFilters(){this.filters={includeTestID:new Set,includeNativeID:new Set,includeViewType:new Set,includeComponent:new Set,excludeTestID:new Set,excludeNativeID:new Set,excludeViewType:new Set,excludeComponent:new Set,includePatterns:[],excludePatterns:[],minRenderCount:void 0,maxRenderCount:void 0};this.notifyListeners()}getAvailableProps(){const e=new Set;const t=new Set;const s=new Set;const i=new Set;const n=new Set;for(const r of this.renders.values()){if(r.viewType)e.add(r.viewType);if(r.testID)t.add(r.testID);if(r.nativeID)s.add(r.nativeID);if(r.componentName)i.add(r.componentName);if(r.accessibilityLabel)n.add(r.accessibilityLabel)}return{viewTypes:Array.from(e).sort(),testIDs:Array.from(t).sort(),nativeIDs:Array.from(s).sort(),componentNames:Array.from(i).sort(),accessibilityLabels:Array.from(n).sort()}}getStats(){let e=0;for(const t of this.renders.values()){e+=t.renderCount}return{totalComponents:this.renders.size,totalRenders:e}}subscribe(e){this.listeners.add(e);e(this.getRenders());return()=>{this.listeners.delete(e)}}subscribeToState(e){this.stateListeners.add(e);e(this.getState());return()=>{this.stateListeners.delete(e)}}subscribeToSettings(e){this.settingsListeners.add(e);e(this.settings);return()=>{this.settingsListeners.delete(e)}}subscribeToFilters(e){this.filterListeners.add(e);e(this.filters);return()=>{this.filterListeners.delete(e)}}onRenderEvent(e){this.renderEventCallbacks.add(e);return()=>{this.renderEventCallbacks.delete(e)}}getRenderEventCallbackCount(){return this.renderEventCallbacks.size}shouldShowRender(e){const t=this.filters;if(t.includePatterns.length>0){if(!this.matchesAnyPatternForInfo(e,t.includePatterns)){return false}}if(t.excludePatterns.length>0){if(this.matchesAnyPatternForInfo(e,t.excludePatterns)){return false}}const s=t.includeViewType.size>0||t.includeTestID.size>0||t.includeNativeID.size>0||t.includeComponent.size>0;if(s){const i=t.includeViewType.size>0&&t.includeViewType.has(e.viewType)||t.includeTestID.size>0&&e.testID&&t.includeTestID.has(e.testID)||t.includeNativeID.size>0&&e.nativeID&&t.includeNativeID.has(e.nativeID)||t.includeComponent.size>0&&e.componentName&&t.includeComponent.has(e.componentName);if(!i){return false}}if(t.excludeViewType.has(e.viewType))return false;if(e.testID&&t.excludeTestID.has(e.testID))return false;if(e.nativeID&&t.excludeNativeID.has(e.nativeID))return false;if(e.componentName&&t.excludeComponent.has(e.componentName))return false;return true}getSettings(){return{...this.settings}}setSettings(e){if(e.batchSize!==void 0){e.batchSize=Math.max(10,Math.min(500,e.batchSize))}if(e.maxRenderHistoryPerComponent!==void 0){e.maxRenderHistoryPerComponent=Math.max(5,Math.min(50,e.maxRenderHistoryPerComponent))}if(e.enableRenderHistory&&!this.settings.trackRenderCauses){e.trackRenderCauses=true}if(e.trackRenderCauses===false&&this.settings.enableRenderHistory){e.enableRenderHistory=false}this.settings={...this.settings,...e};if(e.performanceLogging!==void 0){u.setEnabled(e.performanceLogging)}this.notifySettingsListeners()}clearAllRenderHistory(){for(const e of this.renders.values()){e.renderHistory=[]}this.notifyListeners()}clearRenderHistory(e){const t=this.renders.get(e);if(t){t.renderHistory=[];this.notifyListeners()}}getRenderHistoryStats(){let e=0;let t=0;for(const s of this.renders.values()){if(s.renderHistory&&s.renderHistory.length>0){e+=s.renderHistory.length;t++}}return{totalEvents:e,componentsWithHistory:t,averageEventsPerComponent:t>0?e/t:0}}getBatchSize(){return this.settings.batchSize}setBatchSize(e){this.setSettings({batchSize:e})}notifyListeners(){const e=this.getRenders();for(const t of this.listeners){try{t(e)}catch(s){console.error("[Buoy]","[RenderTracker] Error in listener:",s)}}}notifyStateListeners(){const e=this.getState();for(const t of this.stateListeners){try{t(e)}catch(s){console.error("[Buoy]","[RenderTracker] Error in state listener:",s)}}}notifySettingsListeners(){const e=this.getSettings();for(const t of this.settingsListeners){try{t(e)}catch(s){console.error("[Buoy]","[RenderTracker] Error in settings listener:",s)}}}notifyFilterListeners(){const e=this.getFilters();for(const t of this.filterListeners){try{t(e)}catch(s){console.error("[Buoy]","[RenderTracker] Error in filter listener:",s)}}}}export const RenderTracker=new m;export default RenderTracker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=new Set(["View","RCTView","Text","RCTText","RawText","RCTRawText","VirtualText","RCTVirtualText","ScrollView","RCTScrollView","RCTScrollContentView","SafeAreaView","RCTSafeAreaView","Pressable","TouchableOpacity","Image","RCTImageView"]);const n=new Set(["Unknown","Anonymous","CellRenderer","NativeComponent"]);export function isNamedComposite(e){if(e.testID&&e.testID.trim())return true;const t=(e.componentName??"").trim();if(!t)return false;if(i.has(t))return false;if(n.has(t))return false;const r=(e.viewType??"").trim();if(r&&i.has(r)&&t===r)return false;if(/^comp(\s|$)/i.test(t))return false;if(t.startsWith("_"))return false;return true}export function isHostViewName(e){return!!e&&i.has(e)}
|
|
1
|
+
"use strict";const i=new Set(["View","RCTView","Text","RCTText","RawText","RCTRawText","VirtualText","RCTVirtualText","ScrollView","RCTScrollView","RCTScrollContentView","SafeAreaView","RCTSafeAreaView","Pressable","TouchableOpacity","Image","RCTImageView"]);const n=new Set(["Unknown","Anonymous","CellRenderer","NativeComponent"]);export function isNamedComposite(e){if(e.isComponent===true)return true;if(e.testID&&e.testID.trim())return true;const t=(e.componentName??"").trim();if(!t)return false;if(i.has(t))return false;if(n.has(t))return false;const r=(e.viewType??"").trim();if(r&&i.has(r)&&t===r)return false;if(/^comp(\s|$)/i.test(t))return false;if(t.startsWith("_"))return false;return true}export function isHostViewName(e){return!!e&&i.has(e)}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"use strict";import{getDOMControlProps as ge,getDOMNodeHandle as pe,getDOMPublicInstance as ye,isDOMElement as we}from"@buoy-gg/shared-ui/utils";import{Dimensions as L,UIManager as H,findNodeHandle as O}from"react-native";import{isRectCenterOnScreen as z,scoreTapMatch as ee}from"./tapMatch";const F=5;const ve=22;const $=new Set(["View","RCTView","ScrollView","RCTScrollView","RCTScrollContentView","SafeAreaView","RCTSafeAreaView","AndroidHorizontalScrollContentView","KeyboardAvoidingView","Pressable","PlatformPressable","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","TouchableNativeFeedback","AnimatedComponent","Wrapper"]);function te(){if(typeof global==="undefined")return null;return global.__REACT_DEVTOOLS_GLOBAL_HOOK__??null}let W=0;let ne=false;function Te(){if(ne)return;const e=te();if(!e)return;const t=e.onCommitFiberRoot;e.onCommitFiberRoot=function(...n){W++;return typeof t==="function"?t.apply(e,n):void 0};ne=true}const be=250;function oe(){const e=new Map;return t=>{const n=[];let r=t;let s=0;let i=false;while(r&&s<400){const a=e.get(r);if(a!==void 0){i=a;break}if(v(r)?.__buoyDevToolsRoot){i=true;e.set(r,true);break}n.push(r);r=r.return;s++}for(const a of n)e.set(a,i);return i}}function D(){const e=te();if(!e)return[];const t=[];try{if(e.renderers&&typeof e.renderers.forEach==="function"){e.renderers.forEach((n,r)=>{try{const s=e.getFiberRoots?.(r);if(s)s.forEach(i=>t.push(i))}catch{}})}if(t.length===0&&e.getFiberRoots){const n=e.getFiberRoots(1);if(n)n.forEach(r=>t.push(r))}}catch{}return t}function re(e){return e.tag===ve&&e.memoizedState!==null}let _=false;let B=0;let R=false;function ie(e,t){const n=_;_=e;try{return t()}finally{_=n}}function xe(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 se(e){const t=e.memoizedProps?.activityState;if(t===0||t===1)return true;if(e.memoizedProps?.isPageFocused===false)return true;if(!_&&xe(e)){B++;return true}return false}function N(e,t,n=0,r=new Set){if(!e||r.has(e)||n>500)return;r.add(e);if(re(e)||se(e)){if(e.sibling)N(e.sibling,t,n,r);return}t(e);if(e.child)N(e.child,t,n+1,r);if(e.sibling)N(e.sibling,t,n,r)}function U(e){const t=ye(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 A(e){const t=pe(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 j(e){const t=U(e.stateNode);if(t){return{instance:t,nativeTag:A(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 s=n.pop();if(!s)continue;const i=U(s.stateNode);if(i)return{instance:i,nativeTag:A(s.stateNode),stateNode:s.stateNode};if(s.child)n.push(s.child);if(s.sibling)n.push(s.sibling)}return null}function Ce(e){let t=e;let n=0;while(t&&n++<200){const r=t.stateNode;if(r&&typeof r.scrollTo==="function"){const s=typeof r.getNativeScrollRef==="function"&&r.getNativeScrollRef()||null;const i=typeof r.getInnerViewNode==="function"&&r.getInnerViewNode()||typeof r.getScrollableNode==="function"&&r.getScrollableNode()||r;return{instance:r,nativeRef:s,innerNode:i}}t=t.return}return null}async function Pe(e,t,n,r){try{if(we(n)){n.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});await new Promise(c=>setTimeout(c,16));return true}const s=Ce(e);if(!s)return false;const i=t;let a=null;const o=c=>new Promise(l=>{let f=false;const d=m=>{if(f)return;f=true;l(m)};const g=setTimeout(()=>d(null),600);try{c(m=>{clearTimeout(g);d(m)})}catch{clearTimeout(g);d(null)}});if(s.nativeRef&&typeof i.measureLayout==="function"){a=await o(c=>i.measureLayout(s.nativeRef,(l,f)=>c(f),()=>c(null)))}if(a==null){const c=O(t);const l=typeof s.innerNode==="number"?s.innerNode:O(s.innerNode);if(c!=null&&l!=null){a=await o(f=>H.measureLayout(c,l,()=>f(null),(d,g)=>f(g)))}}if(a==null)return false;s.instance.scrollTo({y:Math.max(0,a-r),animated:false});await new Promise(c=>setTimeout(c,120));return true}catch{return false}}function M(e){const t=e?.type;if(!t)return null;if(typeof t==="string")return t;return t.displayName||t.name||null}function q(e){let t=e?._debugOwner||e?.return;let n=0;while(t&&n<30){n++;const r=M(t);if(r&&!$.has(r)&&typeof t.type!=="string"){return r}t=t.return}return null}function v(e){return ge(e?.stateNode,e?.memoizedProps??e?.pendingProps??null)}function le(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 s=le(r,t+1);if(s)n.push(s)}return n.length>0?n.join(""):void 0}return void 0}function Ie(e){return e.replace(/\s+/g," ").trim()}function G(e){if(!e)return void 0;const t=n=>{const r=le(n);if(r===void 0)return void 0;const s=Ie(r);return s?R?s:s.slice(0,80):void 0};return t(e.children)??t(e.title)??t(e.label)??t(e.placeholder)??void 0}function Se(e,t){const n=[];const r=(i,a)=>{if(!i||a>t||n.length>=4)return;if(i!==e){const c=v(i);if(c&&(typeof c.onPress==="function"||typeof c.onLongPress==="function"))return}const o=G(v(i));if(o&&!n.includes(o))n.push(o);if(i.child)r(i.child,a+1);if(i!==e&&i.sibling)r(i.sibling,a)};if(e.child)r(e.child,1);const s=n.join(" ").trim();return s?s.slice(0,80):void 0}function Ne(e){let t=e;let n=0;let r=null;let s=null;while(t&&n<25&&!(r&&s)){const i=v(t);if(i){if(!r&&typeof i.onPress==="function")r=i.onPress;if(!s&&typeof i.onLongPress==="function")s=i.onLongPress}t=t.return;n++}if(r)return{handler:r,kind:"onPress",longPress:s??void 0};return s?{handler:s,kind:"onLongPress"}:null}function k(e){return new Promise(t=>{let n=false;const r=s=>{if(n)return;n=true;t(s)};setTimeout(()=>r(null),1e3);try{if(typeof e.measureInWindow==="function"){e.measureInWindow((s,i,a,o)=>{if(a>0&&o>0)r({x:s,y:i,width:a,height:o});else r(null)})}else if(typeof e.measure==="function"){e.measure((s,i,a,o,c,l)=>{if(a>0&&o>0&&c!=null&&l!=null){r({x:c,y:l,width:a,height:o})}else{r(null)}})}else{r(null)}}catch{r(null)}})}const De=new Set(["RCTActivityIndicatorView","AndroidProgressBar"]);function K(){const e=D();if(e.length===0)return[];const t=[];const n=new Map;const r=new Map;const s=oe();for(const i of e){N(i.current,a=>{const o=v(a);if(!o)return;const c=typeof o.onPress==="function"||typeof o.onLongPress==="function";const l=typeof o.onValueChange==="function";const f=typeof o.onChangeText==="function";const d=o.testID||void 0;const g=o.accessibilityLabel||void 0;const m=o.accessibilityRole||o.role||void 0;let p=G(o);const T=m==="button"||m==="link"||m==="menuitem"||m==="tab"||m==="switch"||m==="checkbox";const y=typeof a.type==="string"&&De.has(a.type)&&o.animating!==false;if(!c&&!l&&!f&&!d&&!g&&!p&&!T&&!y){return}let C=null;let V=null;let S=null;if(l){const Q=o.value;const me=typeof Q==="number"||typeof o.minimumValue==="number";V={handler:o.onValueChange,kind:me?"slider":"toggle",current:Q,min:typeof o.minimumValue==="number"?o.minimumValue:void 0,max:typeof o.maximumValue==="number"?o.maximumValue:void 0}}else if(f){S={handler:o.onChangeText,current:typeof o.value==="string"?o.value:void 0}}else{C=Ne(a)}const u=M(a);let h=u??"Unknown";if(!u||$.has(u)||typeof a.type==="string"){h=q(a)??u??"Unknown"}const b=j(a);if(!b&&!d)return;if(!p&&!g&&c){p=Se(a,6)}const x=b?.instance??null;const P=b?.nativeTag??null;const w=(x?n.get(x):void 0)??(P!=null?r.get(P):void 0);if(w){if(!w.press&&C)w.press=C;else if(w.press&&C?.longPress&&!w.press.longPress){w.press.longPress=C.longPress}if(!w.valueControl&&V)w.valueControl=V;if(!w.textControl&&S)w.textControl=S;if(!w.testID&&d)w.testID=d;if(!w.label&&g)w.label=g;if(!w.text&&p)w.text=p;if(x&&!n.has(x))n.set(x,w);if(P!=null&&!r.has(P))r.set(P,w);return}const E={nativeTag:P,name:h,role:m??(y?"progressbar":void 0),testID:d,label:g,text:p,instance:x,stateNode:b?.stateNode??null,fiber:a,press:C,valueControl:V,textControl:S,rect:null,buoy:s(a)};t.push(E);if(x)n.set(x,E);if(P!=null)r.set(P,E)})}return t}function _e(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=K();if(e.includeBuoy)return t;return t.filter(n=>!n.buoy||_e(n,e))}async function ae(e){await Promise.all(e.map(async t=>{if(t.instance)t.rect=await k(t.instance)}))}const Me=/^(FlatList|SectionList|VirtualizedSectionList|VirtualizedList|Animated\(.*\)|AnimatedComponent.*)$/;async function ke(e,t){const n=[];const r=oe();for(const i of D()){N(i.current,a=>{if(M(a)!=="VirtualizedList")return;const o=a.memoizedProps;if(!o||typeof o.getItemCount!=="function")return;if(!e&&r(a))return;let c;try{c=Number(o.getItemCount(o.data))}catch{return}if(!Number.isFinite(c)||c<=0)return;const l=[];const f=(m,p)=>{for(let T=m?.child;T;T=T.sibling){const y=M(T);if(y==="VirtualizedList")continue;if(y==="CellRenderer"){l.push(T);continue}if(p<40)f(T,p+1)}};f(a,0);let d=a;let g=q(d);for(let m=0;m<6&&g&&Me.test(g);m++){d=d._debugOwner||d.return;g=q(d)}n.push({owner:g,items:c,cells:l})})}const s=[];for(const i of n){const a=await Promise.all(i.cells.map(async c=>{const l=j(c);return l?k(l.instance):null}));const o=a.filter(t).length;if(o>0&&i.items>o)s.push({owner:i.owner,items:i.items,listed:o})}return s}export async function describeScreen(e={}){const t=_;const n=R;_=!!e.includeHidden;R=!!e.fullText;try{return await Ve(e)}finally{_=t;R=n}}async function Ve(e){B=0;const t=K();const n=B;const r=e.includeBuoy?t:t.filter(f=>!f.buoy);const s=t.length-r.length;await ae(r);const i=L.get("window");const a=Math.round(i.width)||1;const o=Math.round(i.height)||1;const c=[];for(const f of r){const d=f.rect;if(!d&&!f.testID)continue;let g;let m;if(d){const y=d.x+d.width/2;const C=d.y+d.height/2;if(C<-o*.1||C>o*1.1||y<-a*.1||y>a*1.1){continue}g={x:I(y/a),y:I(C/o)};m={x:I(d.x/a),y:I(d.y/o),width:I(d.width/a),height:I(d.height/o)}}const p=f.valueControl?f.valueControl.kind:f.textControl?"text":void 0;const T=f.valueControl?f.valueControl.current:f.textControl?.current;c.push({nativeTag:f.nativeTag,name:f.name,role:f.role,testID:f.testID,label:f.label,text:f.text,interactive:!!(f.press||f.valueControl||f.textControl),longPressable:f.press&&(f.press.kind==="onLongPress"||f.press.longPress)?true:void 0,control:p,value:T,tap:g,frame:m})}c.sort((f,d)=>{const g=f.tap?.y??2;const m=d.tap?.y??2;if(Math.abs(g-m)>.02)return g-m;return(f.tap?.x??2)-(d.tap?.x??2)});const l=await ke(!!e.includeBuoy,f=>{if(!f)return false;const d=f.x+f.width/2;return f.y<=o*1.1&&f.y+f.height>=-o*.1&&d>=-a*.1&&d<=a*1.1});return{screen:{width:a,height:o},count:c.length,elements:c,...s>0?{hiddenBuoy:s}:{},...n>0?{hiddenScreens:n}:{},...l.length?{lists:l}:{}}}function I(e){return Math.round(e*100)/100}function ce(e){return{nativeTag:e.nativeTag,testID:e.testID,label:e.label,text:e.text,name:e.name}}function X(e,t){return ee(ce(e),t)}function ue(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 fe(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=ie(!!e.includeHidden,()=>J(e));if(t.length===0){return{tapped:false,reason:"No React fiber roots / elements found on screen."}}const n=t.map(u=>({c:u,score:X(u,e)})).filter(u=>u.score>0).sort((u,h)=>h.score-u.score);const r=u=>!!(u.press||u.valueControl||u.textControl);if(n.length===0&&!e.includeHidden){const u=ie(true,()=>J(e)).map(h=>({c:h,score:X(h,e)})).filter(h=>h.score>0);if(u.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(u=>({nativeTag:u.nativeTag,name:u.name,testID:u.testID,text:u.text}))}}const s=L.get("window");const i=s.width||1;const a=s.height||1;const o=n.slice(0,15);await Promise.all(o.map(async u=>{if(u.c.instance&&!u.c.rect)u.c.rect=await k(u.c.instance)}));for(const u of o){u.score=ee({...ce(u.c),tap:ue(u.c.rect,i,a)},e)}o.sort((u,h)=>h.score-u.score);const c=o.find(u=>r(u.c))??n.find(u=>r(u.c))??o[0];const l=c.c;const f=(u,h)=>u.press&&u.press.handler===h.press?.handler||u.valueControl&&u.valueControl.handler===h.valueControl?.handler||u.textControl&&u.textControl.handler===h.textControl?.handler;const d=o.filter(u=>u!==c&&r(u.c)&&u.score===c.score).filter(u=>!f(u.c,l)).filter((u,h,b)=>b.findIndex(x=>f(x.c,u.c))===h).slice(0,3).map(u=>({nativeTag:u.c.nativeTag,name:u.c.name,testID:u.c.testID,text:u.c.text,tap:ue(u.c.rect,i,a)}));const g=e.nativeTag==null&&!(e.testID&&!e.query);if(g&&d.length>0){const u=[l,...d.map(h=>o.find(b=>b.c.nativeTag===h.nativeTag)?.c).filter(Boolean)];return{tapped:false,reason:`"${e.query}" matches ${u.length} different controls equally well, so nothing was tapped. Tap one by its nativeTag.`,candidates:u.map(h=>({nativeTag:h.nativeTag,name:h.name,testID:h.testID,text:h.text}))}}const m=o[0];if(g&&m&&m!==c&&!r(m.c)&&m.score>=90&&c.score<m.score-40){return{tapped:false,reason:`The best match for "${e.query}" is "${m.c.text??m.c.label??m.c.name}", which has no JS press handler (it may be native, like a tab bar button). The closest pressable match, "${l.text??l.label??l.name}", is a much weaker match, so nothing was tapped. Use navigate, or tap a specific element by nativeTag.`,candidates:[{nativeTag:l.nativeTag,name:l.name,testID:l.testID,text:l.text}]}}if(!r(l)){return{tapped:false,reason:`Matched "${l.name}"${l.text?` ("${l.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:l.nativeTag,name:l.name,testID:l.testID,label:l.label,text:l.text,via:"onPress"}}}if(l.instance&&!l.rect)l.rect=await k(l.instance);let p=false;const T=l.rect==null||!z(l.rect,i,a);if(T&&e.scrollIntoView!==false&&l.instance){p=await Pe(l.fiber,l.instance,l.stateNode,80);if(p)l.rect=await k(l.instance)}const y={nativeTag:l.nativeTag,name:l.name,testID:l.testID,label:l.label,text:l.text};Te();const C=W;const V=Date.now();const S=async u=>{await new Promise(h=>setTimeout(h,be));return{tapped:true,scrolled:p,matched:u,effect:{commits:W-C,observedMs:Date.now()-V},...d.length?{alsoMatched:d}:{}}};try{if(l.press){if(e.longPress){const h=l.press.kind==="onLongPress"?l.press.handler:l.press.longPress;if(!h){return{tapped:false,scrolled:p,reason:`Matched "${l.name}"${l.text?` ("${l.text}")`:""} but it has no onLongPress handler \u2014 call tap_element without longPress to tap it normally.`,matched:{...y,via:"onPress"}}}h(fe(l.rect));return await S({...y,via:"onLongPress"})}l.press.handler(fe(l.rect));return await S({...y,via:l.press.kind})}if(l.valueControl){const h=l.valueControl;let b;if(h.kind==="toggle"){b=typeof e.value==="boolean"?e.value:!h.current}else{const x=h.min??0;const P=h.max??1;if(typeof e.value==="number"){b=Math.min(P,Math.max(x,e.value))}else{b=h.current===P?x:P}}h.handler(b);return await S({...y,via:"onValueChange",value:b})}const u=e.text??(typeof e.value==="string"?e.value:"");l.textControl.handler(u);return await S({...y,via:"onChangeText",value:u})}catch(u){return{tapped:false,scrolled:p,reason:`handler threw: ${u instanceof Error?u.message:String(u)}`,matched:{...y,via:l.press?l.press.kind:l.valueControl?"onValueChange":"onChangeText"}}}}const Ae=5e3;const Le=3e4;const Fe=50;const Re=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??Ae,0),Le);const r=Math.max(e.pollMs??Re,Fe);const s=e.gone===true;const i=Date.now();let a=0;for(;;){a+=1;const{hit:o,closest:c}=await Ee(e);if(s?!o:!!o){return{ok:true,waitedMs:Date.now()-i,polls:a,matched:o??void 0}}if(Date.now()-i>=n){const l=c?.length?c:void 0;const f=s?`Still on screen after ${n}ms.`:l?`Not on screen after ${n}ms \u2014 ${l.length===1?"one element":`${l.length} elements`} matched but ${l.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()-i,polls:a,reason:f,matched:o??void 0,closest:l}}await new Promise(l=>setTimeout(l,r))}}async function Ee(e){const t=J(e).map(o=>({c:o,score:X(o,e)})).filter(o=>o.score>0).sort((o,c)=>c.score-o.score).slice(0,8);if(t.length===0)return{hit:null,closest:void 0};await ae(t.map(o=>o.c));const n=L.get("window");const r=Math.round(n.width)||1;const s=Math.round(n.height)||1;let i=null;for(const{c:o}of t){if(!z(o.rect,r,s))continue;i={nativeTag:o.nativeTag,name:o.name,testID:o.testID,label:o.label,text:o.text,interactive:!!(o.press||o.valueControl||o.textControl)};break}const a=t.slice(0,3).map(({c:o})=>({name:o.name,testID:o.testID,text:o.text,onScreen:z(o.rect,r,s)}));return{hit:i,closest:a}}function Y(e){let t=e;let n=0;while(t&&n<400){if(v(t)?.__buoyDevToolsRoot)return true;t=t.return;n++}return false}function He(e,t){const n=v(e.fiber);if(typeof n?.onPress==="function"||typeof n?.onValueChange==="function"||typeof n?.onChangeText==="function"){return e}let r=null;let s=e.fiber?.return;let i=0;while(s&&i<25){if(typeof v(s)?.onPress==="function"){r=s;break}s=s.return;i++}if(!r)return e;let a=r;for(let o=0;o<6&&a;o++){const c=t.get(a);if(c)return c;a=a.return}return e}export function resolveTouchTarget(e){const t=K();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 s=null;if(!r){for(const o of D()){N(o.current,c=>{if(s)return;if(c.stateNode&&A(c.stateNode)===e){s=c}});if(s)break}}let i=r??null;if(!i&&s){let o=s;let c=0;let l=null;while(o&&c<25){const f=n.get(o);if(f){if(f.press||f.valueControl||f.textControl){i=f;break}if(!l)l=f}o=o.return;c++}if(!i)i=l}if(!i)return null;i=He(i,n);if(!i.press&&!i.valueControl&&!i.textControl)return null;if(Y(i.fiber))return null;const a=i.valueControl?i.valueControl.kind:i.textControl?"text":"press";return{nativeTag:i.nativeTag,name:i.name,role:i.role,testID:i.testID,label:i.label,text:i.text,control:a,value:i.valueControl?i.valueControl.current:i.textControl?i.textControl.current:void 0}}function Oe(e){let t=null;for(const n of D()){N(n.current,r=>{if(!t&&r.stateNode&&A(r.stateNode)===e)t=r});if(t)break}return t}function de(){const e=[];for(const t of D()){let n=t.current?.child;let r=0;while(n&&r++<200){if(n.tag===F&&n.stateNode){e.push(n);break}n=n.child}}return e}function ze(e,t){const n=global.nativeFabricUIManager;if(!n||typeof n.findNodeAtPoint!=="function")return null;const r=de().filter(s=>s.stateNode?.node);if(!r.length)return null;return new Promise(s=>{const i=setTimeout(()=>s(null),1e3);let a=r.length;let o=null;r.forEach((c,l)=>{try{n.findNodeAtPoint(c.stateNode.node,e,t,f=>{if(f&&(!o||l>=o.i))o={i:l,fiber:f};if(--a===0){clearTimeout(i);s(o?.fiber??null)}})}catch{if(--a===0){clearTimeout(i);s(o?.fiber??null)}}})})}function $e(e,t){const n=H?.findSubviewIn;if(typeof n!=="function")return null;const r=de()[0];const s=r?A(r.stateNode)??O(r.stateNode):null;if(s==null)return null;return new Promise(i=>{const a=setTimeout(()=>i(null),1e3);try{n.call(H,s,[e,t],o=>{clearTimeout(a);i(typeof o==="number"?Oe(o):null)})}catch{clearTimeout(a);i(null)}})}function We(){const e=[];const t=new Set;const n=s=>{const i=[];const a=(o,c)=>{for(let l=o;l&&i.length<5e3;l=l.sibling){if(t.has(l)||c>500)continue;if(re(l)||se(l))continue;if(l.tag===F&&l.stateNode)i.push(l);else if(l.child)a(l.child,c+1)}};if(s.child)a(s.child,0);return i};const r=(s,i)=>{if(t.has(s)||i>500)return;t.add(s);e.push(s);he(n(s)).forEach(a=>r(a,i+1))};for(const s of D())he(n(s.current)).forEach(i=>r(i,0));return e}function he(e){const t=e.map(n=>{const r=Number(Z(v(n)?.style).zIndex);return Number.isFinite(r)?r:0});return e.map((n,r)=>({h:n,i:r})).sort((n,r)=>t[n.i]-t[r.i]||n.i-r.i).map(({h:n})=>n)}function Z(e,t=0){if(!e||typeof e!=="object"||t>10)return{};if(Array.isArray(e))return Object.assign({},...e.map(n=>Z(n,t+1)));return e}const Be=new Set(["RCTScrollView","AndroidHorizontalScrollView","RCTScrollContentView"]);function Ue(e){if(typeof e.type==="string"&&Be.has(e.type)&&e.type!=="RCTScrollContentView")return true;const t=Z(v(e)?.style).overflow;return t==="hidden"||t==="scroll"}function je(e){let t=v(e)?.pointerEvents??v(e)?.style?.pointerEvents;if(t==="none")return"all";let n=e.return;let r=0;while(n&&r++<200){const s=v(n)?.pointerEvents??v(n)?.style?.pointerEvents;if(s==="none")return"all";if(s==="box-only"&&n.tag===F)return"all";n=n.return}return t==="box-none"?"self":null}async function qe(e,t,n){const r=await Promise.all(n.map(o=>{const c=U(o.stateNode);return c?k(c):Promise.resolve(null)}));const s=new Map;n.forEach((o,c)=>s.set(o,r[c]));const i=o=>!!o&&e>=o.x&&e<=o.x+o.width&&t>=o.y&&t<=o.y+o.height;const a=o=>{for(let c=o.return,l=0;c&&l<300;c=c.return,l++){if(c.tag===F&&s.has(c)&&Ue(c)&&!i(s.get(c)))return true}return false};for(let o=n.length-1;o>=0;o--){if(!i(r[o])||je(n[o])||a(n[o]))continue;return n[o]}return null}function Ge(e,t){const n=global.document;const r=global.window;if(!n?.elementFromPoint||!r)return null;let s=n.elementFromPoint(e*r.innerWidth,t*r.innerHeight);while(s){const i=Object.keys(s).find(a=>a.startsWith("__reactFiber$"));if(i)return s[i];s=s.parentElement}return null}export async function hitTest(e){const t=Math.min(1,Math.max(0,Number(e?.x)));const n=Math.min(1,Math.max(0,Number(e?.y)));if(!Number.isFinite(t)||!Number.isFinite(n))return{found:false,method:"none",reason:"x and y must be numbers from 0 to 1."};const r=L.get("window");const s=t*r.width;const i=n*r.height;let a="none";let o=null;const c=Ge(t,n);if(c){a="dom";o=c}else{const p=ze(s,i);if(p){a="fabric";o=await p}else{const y=$e(s,i);if(y){a="paper";o=await y}}const T=We();if(!o||!new Set(T).has(o)){o=await qe(s,i,T);a="measured"}}if(!o)return{found:false,method:a};const l=v(o)??{};const f=A(o.stateNode);const d=[];let g=o;let m=0;while(g&&m++<80&&d.length<6){const p=M(g);if(p&&typeof g.type!=="string"&&!$.has(p)&&d[d.length-1]!==p)d.push(p);g=g.return}return{found:true,method:a,buoy:Y(o),view:{name:M(o)??"Unknown",nativeTag:f,testID:l.testID||void 0,label:l.accessibilityLabel||l["aria-label"]||void 0,text:G(l)},path:d,target:f!=null?resolveTouchTarget(f):null}}export async function readMaps(){const e=[];for(const s of D()){N(s.current,i=>{const a=i.stateNode;if(i.tag===1&&a&&typeof a.getCamera==="function"&&!Y(i))e.push(i)})}const t=L.get("window");const n=s=>Promise.race([s,new Promise(i=>setTimeout(()=>i(null),1e3))]);const r=await Promise.all(e.slice(0,5).map(async s=>{try{const i=await n(Promise.resolve(s.stateNode.getCamera()));if(!i)return null;const a=j(s);const o=a?await k(a.instance):null;const c=v(s)??{};return{name:M(s)??"Map",testID:typeof c.testID==="string"?c.testID:void 0,frame:o&&t.width&&t.height?{x:I(o.x/t.width),y:I(o.y/t.height),width:I(o.width/t.width),height:I(o.height/t.height)}:void 0,camera:{heading:typeof i.heading==="number"?i.heading:void 0,pitch:typeof i.pitch==="number"?i.pitch:void 0,altitude:typeof i.altitude==="number"?i.altitude:void 0,zoom:typeof i.zoom==="number"?i.zoom:void 0,center:i.center}}}catch{return null}}));return{maps:r.filter(s=>!!s)}}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,readMaps as p,hitTest as g,tapElement as f,waitFor as h}from"../highlight-updates/utils/screenElements";import{clearTouchCapture as b,getTouchCaptureStatus as m,readTouchCapture as C,startTouchCapture as S,stopTouchCapture as T}from"../highlight-updates/utils/touchCapture";import{CommitProfiler as u}from"../highlight-updates/utils/CommitProfiler";function a(){if(!r.isInitialized()){r.initialize()}}function i(e){if(!e)return void 0;const{hookChanges:t,...n}=e;return n}function R(e){const{renderHistory:t,lastRenderCause:n,...o}=e;return{...o,lastRenderCause:i(n),historyCount:t?.length??0}}function k(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 y(){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 z(){return{summary:u.stopCapture()}}export const highlightUpdatesSyncAdapter={version:3,getSnapshot:()=>({enabled:r.isEnabled(),frozen:r.getFrozen(),highlightsSuppressed:r.getHighlightsSuppressed(),renders:s.getRenders().map(R),trackerState:s.getState()}),subscribe:e=>{const t=r.subscribe(e);const n=r.subscribeToFreeze(e);const o=s.subscribe(e);const c=s.subscribeToState(e);return()=>{t();n();o();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:()=>y(),endMeasurement:()=>z(),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:k(n)}},toggle:()=>{a();r.toggle()},setEnabled:e=>{a();r.setEnabled(e.enabled)},toggleFreeze:()=>{r.toggleFreeze()},clearRenderCounts:()=>{r.clearRenderCounts()},setSpotlight:e=>{r.setSpotlight(e.nativeTag)},locateComponent:e=>{a();return r.locateComponent(e??{})},setSilentTracking:e=>{a();r.setSilentTracking(e.enabled??false)},describeScreen:e=>l(e??{}),tapElement:e=>f(e??{}),waitFor:e=>h(e??{}),hitTest:e=>g(e??{x:.5,y:.5}),readMaps:()=>p(),startTouchCapture:()=>S(),stopTouchCapture:()=>{T();return m()},clearTouchCapture:()=>{b();return{ok:true}},readTouchCapture:e=>C(e?.sinceSeq??0)}};
|
|
@@ -120,6 +120,16 @@ declare function replaceRemoteState(state: {
|
|
|
120
120
|
*/
|
|
121
121
|
declare function getSpotlight(): number | null;
|
|
122
122
|
declare function subscribe(listener: (enabled: boolean) => void): () => void;
|
|
123
|
+
/** A host renderer can feed the same boxes and list without a React hook. */
|
|
124
|
+
declare function connectRenderSource(available: boolean): {
|
|
125
|
+
recordRenders: (renders: Array<{
|
|
126
|
+
host: HTMLElement;
|
|
127
|
+
name: string;
|
|
128
|
+
count: number;
|
|
129
|
+
}>) => void;
|
|
130
|
+
disconnect: () => void;
|
|
131
|
+
};
|
|
132
|
+
declare function getRenderSourceStatus(): "ready" | "unavailable" | undefined;
|
|
123
133
|
declare function initialize(): boolean;
|
|
124
134
|
declare function enable(): void;
|
|
125
135
|
declare function disable(): void;
|
|
@@ -182,6 +192,8 @@ declare function toggleFreeze(): void;
|
|
|
182
192
|
declare function getFrozen(): boolean;
|
|
183
193
|
declare function destroy(): void;
|
|
184
194
|
interface HighlightUpdatesControllerAPI {
|
|
195
|
+
connectRenderSource: typeof connectRenderSource;
|
|
196
|
+
getRenderSourceStatus: typeof getRenderSourceStatus;
|
|
185
197
|
subscribe: typeof subscribe;
|
|
186
198
|
enable: typeof enable;
|
|
187
199
|
disable: typeof disable;
|
|
@@ -66,6 +66,8 @@ export interface TrackedRender {
|
|
|
66
66
|
nativeID?: string;
|
|
67
67
|
accessibilityLabel?: string;
|
|
68
68
|
componentName?: string;
|
|
69
|
+
/** A host renderer has verified that this is an app component. */
|
|
70
|
+
isComponent?: boolean;
|
|
69
71
|
renderCount: number;
|
|
70
72
|
firstRenderTime: number;
|
|
71
73
|
lastRenderTime: number;
|
|
@@ -222,6 +224,7 @@ declare class RenderTrackerSingleton {
|
|
|
222
224
|
nativeID?: string;
|
|
223
225
|
accessibilityLabel?: string;
|
|
224
226
|
componentName?: string;
|
|
227
|
+
isComponent?: boolean;
|
|
225
228
|
measurements?: {
|
|
226
229
|
x: number;
|
|
227
230
|
y: number;
|
|
@@ -227,4 +227,68 @@ export interface TouchTarget {
|
|
|
227
227
|
value?: number | boolean | string;
|
|
228
228
|
}
|
|
229
229
|
export declare function resolveTouchTarget(nativeTag: number): TouchTarget | null;
|
|
230
|
+
export interface HitTestParams {
|
|
231
|
+
/** Horizontal position as a fraction of the app's window, 0 to 1. */
|
|
232
|
+
x: number;
|
|
233
|
+
/** Vertical position as a fraction of the app's window, 0 to 1. */
|
|
234
|
+
y: number;
|
|
235
|
+
}
|
|
236
|
+
export interface HitTestResult {
|
|
237
|
+
/** False when nothing in React's tree is at that point (or this renderer can't say). */
|
|
238
|
+
found: boolean;
|
|
239
|
+
/** How the point was resolved: the renderer's own hit test, the browser's, or measured frames. */
|
|
240
|
+
method: "fabric" | "paper" | "dom" | "measured" | "none";
|
|
241
|
+
/** The point is on Buoy's own overlay (bubble, dial, tool sheet), not the app. */
|
|
242
|
+
buoy?: boolean;
|
|
243
|
+
/** The deepest view at the point. */
|
|
244
|
+
view?: {
|
|
245
|
+
name: string;
|
|
246
|
+
nativeTag: number | null;
|
|
247
|
+
testID?: string;
|
|
248
|
+
label?: string;
|
|
249
|
+
text?: string;
|
|
250
|
+
};
|
|
251
|
+
/** Named components around that view, innermost first. */
|
|
252
|
+
path?: string[];
|
|
253
|
+
/** What a person would say they tapped, when the view sits in something tappable. Never Buoy's own UI. */
|
|
254
|
+
target?: TouchTarget | null;
|
|
255
|
+
reason?: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* What is on top at a point of the app's window: the view a real touch there
|
|
259
|
+
* would land on, the components around it, and whether it is Buoy's own
|
|
260
|
+
* overlay. The MCP's native_tap asks before a real touch, so a tap aimed at
|
|
261
|
+
* the app doesn't land on a Buoy panel sitting over it.
|
|
262
|
+
*/
|
|
263
|
+
export declare function hitTest(params: HitTestParams): Promise<HitTestResult>;
|
|
264
|
+
export interface MapCamera {
|
|
265
|
+
heading?: number;
|
|
266
|
+
pitch?: number;
|
|
267
|
+
altitude?: number;
|
|
268
|
+
zoom?: number;
|
|
269
|
+
center?: {
|
|
270
|
+
latitude: number;
|
|
271
|
+
longitude: number;
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export interface MapReading {
|
|
275
|
+
name: string;
|
|
276
|
+
testID?: string;
|
|
277
|
+
/** Fractions of the window, like describeScreen frames. */
|
|
278
|
+
frame?: {
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
width: number;
|
|
282
|
+
height: number;
|
|
283
|
+
};
|
|
284
|
+
camera: MapCamera;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The camera of every map on screen: any mounted component with a
|
|
288
|
+
* getCamera() method (react-native-maps MapView has one). A pinch can't say
|
|
289
|
+
* how far a map really turned or zoomed; the map itself can.
|
|
290
|
+
*/
|
|
291
|
+
export declare function readMaps(): Promise<{
|
|
292
|
+
maps: MapReading[];
|
|
293
|
+
}>;
|
|
230
294
|
//# sourceMappingURL=screenElements.d.ts.map
|
|
@@ -62,6 +62,10 @@ export declare const highlightUpdatesSyncAdapter: {
|
|
|
62
62
|
describeScreen: (params?: unknown) => Promise<import("../highlight-updates/utils/screenElements").DescribeScreenResult>;
|
|
63
63
|
tapElement: (params?: unknown) => Promise<import("../highlight-updates/utils/screenElements").TapElementResult>;
|
|
64
64
|
waitFor: (params?: unknown) => Promise<import("../highlight-updates/utils/screenElements").WaitForResult>;
|
|
65
|
+
hitTest: (params?: unknown) => Promise<import("../highlight-updates/utils/screenElements").HitTestResult>;
|
|
66
|
+
readMaps: () => Promise<{
|
|
67
|
+
maps: import("../highlight-updates/utils/screenElements").MapReading[];
|
|
68
|
+
}>;
|
|
65
69
|
startTouchCapture: () => {
|
|
66
70
|
status: import("../highlight-updates/utils/touchCapture").CaptureStatus;
|
|
67
71
|
reason: string | null;
|