@qontinui/ui-bridge-native 0.7.0 → 0.7.1

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.
@@ -1266,7 +1266,7 @@ var NATIVE_PAGE_HEALTH_PRODUCER_ID = "sdk-native/page-health";
1266
1266
  function defaultProducer() {
1267
1267
  return {
1268
1268
  id: NATIVE_PAGE_HEALTH_PRODUCER_ID,
1269
- version: "0.7.0"
1269
+ version: "0.7.1"
1270
1270
  };
1271
1271
  }
1272
1272
  function pageHealthUnknown(code, detail, options = {}) {
@@ -1308,14 +1308,7 @@ var LOADING_PHRASES = [
1308
1308
  "initializing",
1309
1309
  "fetching"
1310
1310
  ];
1311
- var EMPTY_PHRASES = [
1312
- "no data",
1313
- "no results",
1314
- "nothing here",
1315
- "empty",
1316
- "no items",
1317
- "get started"
1318
- ];
1311
+ var EMPTY_PHRASES = ["no data", "no results", "nothing here", "empty", "no items", "get started"];
1319
1312
  function severityRank(s) {
1320
1313
  if (s === "CRITICAL") return 3;
1321
1314
  if (s === "WARNING") return 2;
@@ -1390,20 +1383,44 @@ function observe(input, producer, evaluatedAt) {
1390
1383
  }
1391
1384
  return analyze(elements, viewport, base);
1392
1385
  }
1386
+ function nothingOnScreenDetail(elements, visibleCount, visibilityUnstated) {
1387
+ if (visibilityUnstated === 0 && visibleCount > 0) {
1388
+ return `all ${visibleCount} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`;
1389
+ }
1390
+ if (visibilityUnstated > 0) {
1391
+ const geometry = visibleCount > 0 ? ` and none of the ${visibleCount} visible one(s) has a measured layout` : "";
1392
+ return `${visibilityUnstated} of ${elements.length} element(s) carry no boolean \`state.visible\`${geometry}, so no element can be placed on screen; spatial coverage, layout regions and visual anomalies cannot be measured`;
1393
+ }
1394
+ const unmounted = elements.filter((el) => el.state?.mounted === false).length;
1395
+ return `all ${elements.length} registered element(s) report visible: false (unmounted=${unmounted}, off-screen route or otherwise=${elements.length - unmounted}), so whatever is on screen is not a registered element and there is nothing on screen to measure; this says nothing about whether the screen is blank`;
1396
+ }
1393
1397
  function analyze(elements, viewport, base) {
1394
1398
  const findings = [];
1395
- const considered = elements.filter((el) => el.state.visible);
1396
- const visible = considered.flatMap((el) => {
1399
+ const onScreen = elements.filter((el) => el.state?.visible === true);
1400
+ const visibilityUnstated = elements.filter(
1401
+ (el) => typeof el.state?.visible !== "boolean"
1402
+ ).length;
1403
+ const visible = onScreen.flatMap((el) => {
1397
1404
  const rect = normalizeRect(el.state, viewport);
1398
1405
  return rect ? [{ el, rect }] : [];
1399
1406
  });
1400
- const withoutGeometry = considered.length - visible.length;
1401
- const unmeasured = withoutGeometry > 0 ? [{ dimension: "geometry", count: withoutGeometry, code: "input_missing" }] : [];
1402
- const coverage = { considered: considered.length, measured: visible.length, unmeasured };
1403
- if (considered.length > 0 && visible.length === 0) {
1407
+ const withoutGeometry = onScreen.length - visible.length;
1408
+ const unmeasured = [];
1409
+ if (withoutGeometry > 0) {
1410
+ unmeasured.push({ dimension: "geometry", count: withoutGeometry, code: "input_missing" });
1411
+ }
1412
+ if (visibilityUnstated > 0) {
1413
+ unmeasured.push({ dimension: "visibility", count: visibilityUnstated, code: "input_missing" });
1414
+ }
1415
+ const coverage = {
1416
+ considered: onScreen.length + visibilityUnstated,
1417
+ measured: visible.length,
1418
+ unmeasured
1419
+ };
1420
+ if (elements.length > 0 && visible.length === 0) {
1404
1421
  return Observation.unknown(
1405
1422
  "input_missing",
1406
- `all ${considered.length} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`,
1423
+ nothingOnScreenDetail(elements, onScreen.length, visibilityUnstated),
1407
1424
  Observation.provenance({ ...base, coverage })
1408
1425
  );
1409
1426
  }
@@ -1493,7 +1510,7 @@ function analyze(elements, viewport, base) {
1493
1510
  for (const el of elements) {
1494
1511
  const elType = el.type ?? "";
1495
1512
  if (SKIP_TEXT_TYPES.has(elType)) continue;
1496
- const text = (el.state.textContent ?? "").toString();
1513
+ const text = (el.state?.textContent ?? "").toString();
1497
1514
  if (!text) continue;
1498
1515
  const textLower = text.toLowerCase();
1499
1516
  for (const p of ERROR_PHRASES) {
@@ -1534,7 +1551,7 @@ function analyze(elements, viewport, base) {
1534
1551
  for (const el of elements) {
1535
1552
  if (!INTERACTIVE_TYPES2.has(el.type)) continue;
1536
1553
  interactiveTotal++;
1537
- if (el.state.enabled === false) interactiveDisabled++;
1554
+ if (el.state?.enabled === false) interactiveDisabled++;
1538
1555
  }
1539
1556
  const interactiveSeverity = interactiveTotal > 0 && interactiveDisabled / interactiveTotal > 0.5 ? "WARNING" : "OK";
1540
1557
  findings.push({
@@ -1558,9 +1575,7 @@ function analyze(elements, viewport, base) {
1558
1575
  detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport} (horizontal-overflow only; below/above-fold scrollable content is not an anomaly)`,
1559
1576
  data: { zero_size: zeroSize, outside_viewport: outsideViewport }
1560
1577
  });
1561
- const heatmap = grid.map(
1562
- (row) => row.map((cell) => cell ? "#" : ".").join("")
1563
- );
1578
+ const heatmap = grid.map((row) => row.map((cell) => cell ? "#" : ".").join(""));
1564
1579
  return Observation.measured(
1565
1580
  {
1566
1581
  summary: worstSeverity(findings),
@@ -2546,7 +2561,7 @@ function createServerHandlers(registry, executor, config) {
2546
2561
  };
2547
2562
  if (config?.appInfo) {
2548
2563
  response.uiBridge = {
2549
- version: "0.7.0",
2564
+ version: "0.7.1",
2550
2565
  ...config.appInfo,
2551
2566
  capabilities: ["elements", "components", "actions", "design"],
2552
2567
  elementCount: stats.elements,