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