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