@buoy-gg/highlight-updates 4.0.1 → 5.0.0

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.highlightUpdatesSyncAdapter = void 0;
7
7
  var _HighlightUpdatesController = _interopRequireDefault(require("../highlight-updates/utils/HighlightUpdatesController"));
8
8
  var _RenderTracker = require("../highlight-updates/utils/RenderTracker");
9
+ var _screenElements = require("../highlight-updates/utils/screenElements");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  function ensureInitialized() {
11
12
  if (!_HighlightUpdatesController.default.isInitialized()) {
@@ -78,6 +79,14 @@ const highlightUpdatesSyncAdapter = exports.highlightUpdatesSyncAdapter = {
78
79
  setSilentTracking: params => {
79
80
  ensureInitialized();
80
81
  _HighlightUpdatesController.default.setSilentTracking(params.enabled ?? false);
81
- }
82
+ },
83
+ // Walk the live fiber tree and return the current screen's meaningful /
84
+ // interactive elements, each with normalized tap coordinates. Powers the
85
+ // MCP `describe_screen` reader — no screenshot, no silent-tracking needed.
86
+ describeScreen: () => (0, _screenElements.describeScreen)(),
87
+ // Tap an element purely in JS: resolve it (by nativeTag / testID / query),
88
+ // find the nearest onPress up its fiber chain, and invoke it with a
89
+ // synthetic press event. Powers the MCP `tap_element` action.
90
+ tapElement: params => (0, _screenElements.tapElement)(params ?? {})
82
91
  }
83
92
  };
@@ -1034,9 +1034,17 @@ function findScrollAncestor(stateNode) {
1034
1034
  while (fiber && guard++ < 200) {
1035
1035
  const inst = fiber.stateNode;
1036
1036
  if (inst && typeof inst.scrollTo === "function") {
1037
+ // getInnerViewNode()/getScrollableNode() return a numeric node handle —
1038
+ // only valid for the legacy UIManager.measureLayout fallback below.
1039
+ // Fabric's ref.measureLayout requires an actual host-component ref
1040
+ // (getNativeScrollRef()); passing it a number trips a dev warning
1041
+ // ("ref.measureLayout must be called with a ref to a native component")
1042
+ // and silently resolves neither callback.
1043
+ const nativeRef = typeof inst.getNativeScrollRef === "function" && inst.getNativeScrollRef() || null;
1037
1044
  const innerNode = typeof inst.getInnerViewNode === "function" && inst.getInnerViewNode() || typeof inst.getScrollableNode === "function" && inst.getScrollableNode() || inst;
1038
1045
  return {
1039
1046
  instance: inst,
1047
+ nativeRef,
1040
1048
  innerNode
1041
1049
  };
1042
1050
  }
@@ -1083,8 +1091,8 @@ async function scrollDescendantIntoView(stateNode, publicInstance, margin) {
1083
1091
  settle(null);
1084
1092
  }
1085
1093
  });
1086
- if (typeof inst.measureLayout === "function") {
1087
- top = await withTimeout(resolve => inst.measureLayout(ancestor.innerNode, (_left, t) => resolve(t), () => resolve(null)));
1094
+ if (ancestor.nativeRef && typeof inst.measureLayout === "function") {
1095
+ top = await withTimeout(resolve => inst.measureLayout(ancestor.nativeRef, (_left, t) => resolve(t), () => resolve(null)));
1088
1096
  }
1089
1097
  if (top == null) {
1090
1098
  const targetHandle = findNodeHandle(publicInstance);