@qontinui/ui-bridge-native 0.6.5 → 0.6.7

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.
@@ -195,6 +195,10 @@ function extractHandlerNames(props) {
195
195
  if (!props) return [];
196
196
  return Object.keys(props).filter((k) => typeof props[k] === "function");
197
197
  }
198
+ function matchesCurrentRoute(registrationRoute, currentRoute) {
199
+ if (registrationRoute == null || registrationRoute === "") return true;
200
+ return registrationRoute === currentRoute;
201
+ }
198
202
 
199
203
  // src/design/design-inspector-native.ts
200
204
  function toCssValue(value) {
@@ -454,15 +458,9 @@ function success(data) {
454
458
  function error(message, code) {
455
459
  return { success: false, error: message, code, timestamp: Date.now() };
456
460
  }
457
- function createDesignHandlers(registry) {
461
+ function createDesignHandlers(registry, viewportProvider) {
458
462
  function getScreenDimensions() {
459
- try {
460
- const { Dimensions } = __require("react-native");
461
- const screen = Dimensions.get("screen");
462
- return { width: screen.width, height: screen.height };
463
- } catch {
464
- return { width: 0, height: 0 };
465
- }
463
+ return viewportProvider?.() ?? { width: 0, height: 0 };
466
464
  }
467
465
  return {
468
466
  // 1. GET /design/element/:id/styles
@@ -890,7 +888,7 @@ function diagnosePageHealth(elements, viewport) {
890
888
  let outsideViewport = 0;
891
889
  for (const { rect } of visible) {
892
890
  if (rect.width === 0 || rect.height === 0) zeroSize++;
893
- if (rect.x + rect.width < 0 || rect.y + rect.height < 0 || rect.x > 1 || rect.y > 1) {
891
+ if (rect.x + rect.width < 0 || rect.x > 1) {
894
892
  outsideViewport++;
895
893
  }
896
894
  }
@@ -898,7 +896,7 @@ function diagnosePageHealth(elements, viewport) {
898
896
  findings.push({
899
897
  check: "visual_anomalies",
900
898
  severity: anomalySeverity,
901
- detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport}`,
899
+ detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport} (horizontal-overflow only; below/above-fold scrollable content is not an anomaly)`,
902
900
  data: { zero_size: zeroSize, outside_viewport: outsideViewport }
903
901
  });
904
902
  const heatmap = grid.map(
@@ -1108,7 +1106,7 @@ function error2(message, code) {
1108
1106
  };
1109
1107
  }
1110
1108
  function createServerHandlers(registry, executor, config) {
1111
- const designHandlers = createDesignHandlers(registry);
1109
+ const designHandlers = createDesignHandlers(registry, config?.viewportProvider);
1112
1110
  return {
1113
1111
  // Elements
1114
1112
  getElements: async (ctx) => {
@@ -1116,7 +1114,7 @@ function createServerHandlers(registry, executor, config) {
1116
1114
  const forRoute = ctx.query?.route || ctx.body?.route;
1117
1115
  let allElements = visibleOnly ? registry.getMountedVisibleElements() : registry.getAllElements();
1118
1116
  if (forRoute) {
1119
- allElements = allElements.filter((e) => e.registrationRoute === forRoute);
1117
+ allElements = allElements.filter((e) => matchesCurrentRoute(e.registrationRoute, forRoute));
1120
1118
  }
1121
1119
  const elements = allElements.map((e) => {
1122
1120
  const handlers = extractHandlerNames(e.props);