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