@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.
@@ -3361,7 +3361,7 @@ var NATIVE_PAGE_HEALTH_PRODUCER_ID = "sdk-native/page-health";
3361
3361
  function defaultProducer() {
3362
3362
  return {
3363
3363
  id: NATIVE_PAGE_HEALTH_PRODUCER_ID,
3364
- version: "0.7.0"
3364
+ version: "0.7.1"
3365
3365
  };
3366
3366
  }
3367
3367
  function pageHealthUnknown(code, detail, options = {}) {
@@ -3403,14 +3403,7 @@ var LOADING_PHRASES = [
3403
3403
  "initializing",
3404
3404
  "fetching"
3405
3405
  ];
3406
- var EMPTY_PHRASES = [
3407
- "no data",
3408
- "no results",
3409
- "nothing here",
3410
- "empty",
3411
- "no items",
3412
- "get started"
3413
- ];
3406
+ var EMPTY_PHRASES = ["no data", "no results", "nothing here", "empty", "no items", "get started"];
3414
3407
  function severityRank(s) {
3415
3408
  if (s === "CRITICAL") return 3;
3416
3409
  if (s === "WARNING") return 2;
@@ -3485,20 +3478,44 @@ function observe(input, producer, evaluatedAt) {
3485
3478
  }
3486
3479
  return analyze(elements, viewport, base);
3487
3480
  }
3481
+ function nothingOnScreenDetail(elements, visibleCount, visibilityUnstated) {
3482
+ if (visibilityUnstated === 0 && visibleCount > 0) {
3483
+ return `all ${visibleCount} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`;
3484
+ }
3485
+ if (visibilityUnstated > 0) {
3486
+ const geometry = visibleCount > 0 ? ` and none of the ${visibleCount} visible one(s) has a measured layout` : "";
3487
+ 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`;
3488
+ }
3489
+ const unmounted = elements.filter((el) => el.state?.mounted === false).length;
3490
+ 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`;
3491
+ }
3488
3492
  function analyze(elements, viewport, base) {
3489
3493
  const findings = [];
3490
- const considered = elements.filter((el) => el.state.visible);
3491
- const visible = considered.flatMap((el) => {
3494
+ const onScreen = elements.filter((el) => el.state?.visible === true);
3495
+ const visibilityUnstated = elements.filter(
3496
+ (el) => typeof el.state?.visible !== "boolean"
3497
+ ).length;
3498
+ const visible = onScreen.flatMap((el) => {
3492
3499
  const rect = normalizeRect(el.state, viewport);
3493
3500
  return rect ? [{ el, rect }] : [];
3494
3501
  });
3495
- const withoutGeometry = considered.length - visible.length;
3496
- const unmeasured = withoutGeometry > 0 ? [{ dimension: "geometry", count: withoutGeometry, code: "input_missing" }] : [];
3497
- const coverage = { considered: considered.length, measured: visible.length, unmeasured };
3498
- if (considered.length > 0 && visible.length === 0) {
3502
+ const withoutGeometry = onScreen.length - visible.length;
3503
+ const unmeasured = [];
3504
+ if (withoutGeometry > 0) {
3505
+ unmeasured.push({ dimension: "geometry", count: withoutGeometry, code: "input_missing" });
3506
+ }
3507
+ if (visibilityUnstated > 0) {
3508
+ unmeasured.push({ dimension: "visibility", count: visibilityUnstated, code: "input_missing" });
3509
+ }
3510
+ const coverage = {
3511
+ considered: onScreen.length + visibilityUnstated,
3512
+ measured: visible.length,
3513
+ unmeasured
3514
+ };
3515
+ if (elements.length > 0 && visible.length === 0) {
3499
3516
  return Observation.unknown(
3500
3517
  "input_missing",
3501
- `all ${considered.length} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`,
3518
+ nothingOnScreenDetail(elements, onScreen.length, visibilityUnstated),
3502
3519
  Observation.provenance({ ...base, coverage })
3503
3520
  );
3504
3521
  }
@@ -3588,7 +3605,7 @@ function analyze(elements, viewport, base) {
3588
3605
  for (const el of elements) {
3589
3606
  const elType = el.type ?? "";
3590
3607
  if (SKIP_TEXT_TYPES.has(elType)) continue;
3591
- const text = (el.state.textContent ?? "").toString();
3608
+ const text = (el.state?.textContent ?? "").toString();
3592
3609
  if (!text) continue;
3593
3610
  const textLower = text.toLowerCase();
3594
3611
  for (const p of ERROR_PHRASES) {
@@ -3629,7 +3646,7 @@ function analyze(elements, viewport, base) {
3629
3646
  for (const el of elements) {
3630
3647
  if (!INTERACTIVE_TYPES2.has(el.type)) continue;
3631
3648
  interactiveTotal++;
3632
- if (el.state.enabled === false) interactiveDisabled++;
3649
+ if (el.state?.enabled === false) interactiveDisabled++;
3633
3650
  }
3634
3651
  const interactiveSeverity = interactiveTotal > 0 && interactiveDisabled / interactiveTotal > 0.5 ? "WARNING" : "OK";
3635
3652
  findings.push({
@@ -3653,9 +3670,7 @@ function analyze(elements, viewport, base) {
3653
3670
  detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport} (horizontal-overflow only; below/above-fold scrollable content is not an anomaly)`,
3654
3671
  data: { zero_size: zeroSize, outside_viewport: outsideViewport }
3655
3672
  });
3656
- const heatmap = grid.map(
3657
- (row) => row.map((cell) => cell ? "#" : ".").join("")
3658
- );
3673
+ const heatmap = grid.map((row) => row.map((cell) => cell ? "#" : ".").join(""));
3659
3674
  return Observation.measured(
3660
3675
  {
3661
3676
  summary: worstSeverity(findings),
@@ -4641,7 +4656,7 @@ function createServerHandlers(registry, executor, config) {
4641
4656
  };
4642
4657
  if (config?.appInfo) {
4643
4658
  response.uiBridge = {
4644
- version: "0.7.0",
4659
+ version: "0.7.1",
4645
4660
  ...config.appInfo,
4646
4661
  capabilities: ["elements", "components", "actions", "design"],
4647
4662
  elementCount: stats.elements,