@qontinui/ui-bridge-native 0.6.15 → 0.7.0

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.
Files changed (43) hide show
  1. package/README.md +17 -0
  2. package/dist/control/index.js.map +1 -1
  3. package/dist/control/index.mjs.map +1 -1
  4. package/dist/core/index.js +42 -0
  5. package/dist/core/index.js.map +1 -1
  6. package/dist/core/index.mjs +42 -0
  7. package/dist/core/index.mjs.map +1 -1
  8. package/dist/core/registry.d.ts +23 -1
  9. package/dist/core/registry.d.ts.map +1 -1
  10. package/dist/core/types.d.ts +66 -2
  11. package/dist/core/types.d.ts.map +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +425 -24
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +421 -25
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/observation/index.d.ts +12 -0
  19. package/dist/observation/index.d.ts.map +1 -0
  20. package/dist/observation/observation.d.ts +233 -0
  21. package/dist/observation/observation.d.ts.map +1 -0
  22. package/dist/react/index.d.ts +4 -0
  23. package/dist/react/index.d.ts.map +1 -1
  24. package/dist/react/index.js +425 -24
  25. package/dist/react/index.js.map +1 -1
  26. package/dist/react/index.mjs +421 -25
  27. package/dist/react/index.mjs.map +1 -1
  28. package/dist/react/routePattern.d.ts +145 -0
  29. package/dist/react/routePattern.d.ts.map +1 -0
  30. package/dist/react/useRouteAwareness.d.ts +106 -0
  31. package/dist/react/useRouteAwareness.d.ts.map +1 -0
  32. package/dist/server/handlers.d.ts.map +1 -1
  33. package/dist/server/index.d.ts +2 -0
  34. package/dist/server/index.d.ts.map +1 -1
  35. package/dist/server/index.js +314 -21
  36. package/dist/server/index.js.map +1 -1
  37. package/dist/server/index.mjs +308 -22
  38. package/dist/server/index.mjs.map +1 -1
  39. package/dist/server/page-health.d.ts +50 -7
  40. package/dist/server/page-health.d.ts.map +1 -1
  41. package/dist/server/types.d.ts +5 -3
  42. package/dist/server/types.d.ts.map +1 -1
  43. package/package.json +1 -1
@@ -762,6 +762,13 @@ function computeVisibility(state, clip) {
762
762
  const onScreen = spansOverlap(rect.left, rect.right, clip.left, clip.right) && spansOverlap(rect.top, rect.bottom, clip.top, clip.bottom);
763
763
  return onScreen ? { visibility: "visible" } : { visibility: "hidden", visibilityReason: "off-screen" };
764
764
  }
765
+ function copyRouteInfo(info) {
766
+ const copy = { ...info };
767
+ if (info.params) copy.params = { ...info.params };
768
+ if (info.queryParams) copy.queryParams = { ...info.queryParams };
769
+ if (info.routeStack) copy.routeStack = [...info.routeStack];
770
+ return copy;
771
+ }
765
772
  function inferActions(type, scrollAncestorId) {
766
773
  const baseActions = scrollAncestorId ? ["focus", "blur", "scrollIntoView"] : ["focus", "blur"];
767
774
  switch (type) {
@@ -826,6 +833,16 @@ var NativeUIBridgeRegistry = class {
826
833
  * already installs.
827
834
  */
828
835
  this.routeProvider = null;
836
+ /**
837
+ * The route TEMPLATE the app last reported through `useRouteAwareness`
838
+ * (via {@link setRouteInfo}), emitted on every snapshot as `page.route`.
839
+ *
840
+ * Deliberately NOT named `routeInfo`: `createSnapshot`'s parameter of that
841
+ * name is the CONCRETE `{currentRoute, segments, activeTab}` read from the
842
+ * route provider. The two must never be confused — the concrete path is
843
+ * user input, and this slot is the router-asserted template.
844
+ */
845
+ this.reportedRoute = void 0;
829
846
  /**
830
847
  * Device pixel ratio used to project `state.layout` (logical dp) into the
831
848
  * physical-pixel `bbox` emitted on each snapshot element. Defaults to `1`
@@ -884,6 +901,22 @@ var NativeUIBridgeRegistry = class {
884
901
  getRouteProvider() {
885
902
  return this.routeProvider;
886
903
  }
904
+ /**
905
+ * Set the route info emitted as `page.route` on every snapshot — the
906
+ * router-asserted TEMPLATE, normally reported by `useRouteAwareness`.
907
+ * Pass `undefined` to clear it (the hook does so on unmount), after which
908
+ * snapshots omit `page` again.
909
+ *
910
+ * The value is copied, so a later mutation by the caller cannot alter what
911
+ * is stored or what an already-emitted snapshot holds.
912
+ */
913
+ setRouteInfo(info) {
914
+ this.reportedRoute = info ? copyRouteInfo(info) : void 0;
915
+ }
916
+ /** Read-only accessor for the reported route info, if any (a copy). */
917
+ getRouteInfo() {
918
+ return this.reportedRoute ? copyRouteInfo(this.reportedRoute) : void 0;
919
+ }
887
920
  /**
888
921
  * Resolve the snapshot's `activeTab`: an explicit `getActiveTab()` on the
889
922
  * route provider wins, otherwise derive it from the Expo Router segments the
@@ -1724,6 +1757,12 @@ var NativeUIBridgeRegistry = class {
1724
1757
  // hosts that wire no route provider.
1725
1758
  ...resolvedRoute.currentRoute ? { route: resolvedRoute.currentRoute } : {},
1726
1759
  ...resolvedRoute.activeTab ? { activeTab: resolvedRoute.activeTab } : {},
1760
+ // The router-asserted route TEMPLATE, spelled as the web SDK's
1761
+ // `snapshot.page.route`. Emitted on the ONE assembly point both route
1762
+ // branches above share (the explicit-`routeInfo` branch the server's
1763
+ // `getSnapshot` override uses, and the provider fallback). Omitted, not
1764
+ // nulled, when unset — the same convention as the aliases above.
1765
+ ...this.reportedRoute ? { page: { route: copyRouteInfo(this.reportedRoute) } } : {},
1727
1766
  registration: this.getRegistrationCoverage()
1728
1767
  };
1729
1768
  if (this.appInfo) {
@@ -1770,6 +1809,9 @@ var NativeUIBridgeRegistry = class {
1770
1809
  }
1771
1810
  }
1772
1811
  }
1812
+ if (this.reportedRoute) {
1813
+ snapshot.page = { route: copyRouteInfo(this.reportedRoute) };
1814
+ }
1773
1815
  }
1774
1816
  return snapshot;
1775
1817
  }