@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.
package/dist/index.js CHANGED
@@ -3444,7 +3444,7 @@ var NATIVE_PAGE_HEALTH_PRODUCER_ID = "sdk-native/page-health";
3444
3444
  function defaultProducer() {
3445
3445
  return {
3446
3446
  id: NATIVE_PAGE_HEALTH_PRODUCER_ID,
3447
- version: "0.7.0"
3447
+ version: "0.7.1"
3448
3448
  };
3449
3449
  }
3450
3450
  function pageHealthUnknown(code, detail, options = {}) {
@@ -3486,14 +3486,7 @@ var LOADING_PHRASES = [
3486
3486
  "initializing",
3487
3487
  "fetching"
3488
3488
  ];
3489
- var EMPTY_PHRASES = [
3490
- "no data",
3491
- "no results",
3492
- "nothing here",
3493
- "empty",
3494
- "no items",
3495
- "get started"
3496
- ];
3489
+ var EMPTY_PHRASES = ["no data", "no results", "nothing here", "empty", "no items", "get started"];
3497
3490
  function severityRank(s) {
3498
3491
  if (s === "CRITICAL") return 3;
3499
3492
  if (s === "WARNING") return 2;
@@ -3568,20 +3561,44 @@ function observe(input, producer, evaluatedAt) {
3568
3561
  }
3569
3562
  return analyze(elements, viewport, base);
3570
3563
  }
3564
+ function nothingOnScreenDetail(elements, visibleCount, visibilityUnstated) {
3565
+ if (visibilityUnstated === 0 && visibleCount > 0) {
3566
+ return `all ${visibleCount} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`;
3567
+ }
3568
+ if (visibilityUnstated > 0) {
3569
+ const geometry = visibleCount > 0 ? ` and none of the ${visibleCount} visible one(s) has a measured layout` : "";
3570
+ 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`;
3571
+ }
3572
+ const unmounted = elements.filter((el) => el.state?.mounted === false).length;
3573
+ 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`;
3574
+ }
3571
3575
  function analyze(elements, viewport, base) {
3572
3576
  const findings = [];
3573
- const considered = elements.filter((el) => el.state.visible);
3574
- const visible = considered.flatMap((el) => {
3577
+ const onScreen = elements.filter((el) => el.state?.visible === true);
3578
+ const visibilityUnstated = elements.filter(
3579
+ (el) => typeof el.state?.visible !== "boolean"
3580
+ ).length;
3581
+ const visible = onScreen.flatMap((el) => {
3575
3582
  const rect = normalizeRect(el.state, viewport);
3576
3583
  return rect ? [{ el, rect }] : [];
3577
3584
  });
3578
- const withoutGeometry = considered.length - visible.length;
3579
- const unmeasured = withoutGeometry > 0 ? [{ dimension: "geometry", count: withoutGeometry, code: "input_missing" }] : [];
3580
- const coverage = { considered: considered.length, measured: visible.length, unmeasured };
3581
- if (considered.length > 0 && visible.length === 0) {
3585
+ const withoutGeometry = onScreen.length - visible.length;
3586
+ const unmeasured = [];
3587
+ if (withoutGeometry > 0) {
3588
+ unmeasured.push({ dimension: "geometry", count: withoutGeometry, code: "input_missing" });
3589
+ }
3590
+ if (visibilityUnstated > 0) {
3591
+ unmeasured.push({ dimension: "visibility", count: visibilityUnstated, code: "input_missing" });
3592
+ }
3593
+ const coverage = {
3594
+ considered: onScreen.length + visibilityUnstated,
3595
+ measured: visible.length,
3596
+ unmeasured
3597
+ };
3598
+ if (elements.length > 0 && visible.length === 0) {
3582
3599
  return Observation.unknown(
3583
3600
  "input_missing",
3584
- `all ${considered.length} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`,
3601
+ nothingOnScreenDetail(elements, onScreen.length, visibilityUnstated),
3585
3602
  Observation.provenance({ ...base, coverage })
3586
3603
  );
3587
3604
  }
@@ -3671,7 +3688,7 @@ function analyze(elements, viewport, base) {
3671
3688
  for (const el of elements) {
3672
3689
  const elType = el.type ?? "";
3673
3690
  if (SKIP_TEXT_TYPES.has(elType)) continue;
3674
- const text = (el.state.textContent ?? "").toString();
3691
+ const text = (el.state?.textContent ?? "").toString();
3675
3692
  if (!text) continue;
3676
3693
  const textLower = text.toLowerCase();
3677
3694
  for (const p of ERROR_PHRASES) {
@@ -3712,7 +3729,7 @@ function analyze(elements, viewport, base) {
3712
3729
  for (const el of elements) {
3713
3730
  if (!INTERACTIVE_TYPES2.has(el.type)) continue;
3714
3731
  interactiveTotal++;
3715
- if (el.state.enabled === false) interactiveDisabled++;
3732
+ if (el.state?.enabled === false) interactiveDisabled++;
3716
3733
  }
3717
3734
  const interactiveSeverity = interactiveTotal > 0 && interactiveDisabled / interactiveTotal > 0.5 ? "WARNING" : "OK";
3718
3735
  findings.push({
@@ -3736,9 +3753,7 @@ function analyze(elements, viewport, base) {
3736
3753
  detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport} (horizontal-overflow only; below/above-fold scrollable content is not an anomaly)`,
3737
3754
  data: { zero_size: zeroSize, outside_viewport: outsideViewport }
3738
3755
  });
3739
- const heatmap = grid.map(
3740
- (row) => row.map((cell) => cell ? "#" : ".").join("")
3741
- );
3756
+ const heatmap = grid.map((row) => row.map((cell) => cell ? "#" : ".").join(""));
3742
3757
  return Observation.measured(
3743
3758
  {
3744
3759
  summary: worstSeverity(findings),
@@ -4724,7 +4739,7 @@ function createServerHandlers(registry, executor, config) {
4724
4739
  };
4725
4740
  if (config?.appInfo) {
4726
4741
  response.uiBridge = {
4727
- version: "0.7.0",
4742
+ version: "0.7.1",
4728
4743
  ...config.appInfo,
4729
4744
  capabilities: ["elements", "components", "actions", "design"],
4730
4745
  elementCount: stats.elements,