@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
@@ -764,6 +764,13 @@ function computeVisibility(state, clip) {
764
764
  const onScreen = spansOverlap(rect.left, rect.right, clip.left, clip.right) && spansOverlap(rect.top, rect.bottom, clip.top, clip.bottom);
765
765
  return onScreen ? { visibility: "visible" } : { visibility: "hidden", visibilityReason: "off-screen" };
766
766
  }
767
+ function copyRouteInfo(info) {
768
+ const copy = { ...info };
769
+ if (info.params) copy.params = { ...info.params };
770
+ if (info.queryParams) copy.queryParams = { ...info.queryParams };
771
+ if (info.routeStack) copy.routeStack = [...info.routeStack];
772
+ return copy;
773
+ }
767
774
  function inferActions(type, scrollAncestorId) {
768
775
  const baseActions = scrollAncestorId ? ["focus", "blur", "scrollIntoView"] : ["focus", "blur"];
769
776
  switch (type) {
@@ -828,6 +835,16 @@ var NativeUIBridgeRegistry = class {
828
835
  * already installs.
829
836
  */
830
837
  this.routeProvider = null;
838
+ /**
839
+ * The route TEMPLATE the app last reported through `useRouteAwareness`
840
+ * (via {@link setRouteInfo}), emitted on every snapshot as `page.route`.
841
+ *
842
+ * Deliberately NOT named `routeInfo`: `createSnapshot`'s parameter of that
843
+ * name is the CONCRETE `{currentRoute, segments, activeTab}` read from the
844
+ * route provider. The two must never be confused — the concrete path is
845
+ * user input, and this slot is the router-asserted template.
846
+ */
847
+ this.reportedRoute = void 0;
831
848
  /**
832
849
  * Device pixel ratio used to project `state.layout` (logical dp) into the
833
850
  * physical-pixel `bbox` emitted on each snapshot element. Defaults to `1`
@@ -886,6 +903,22 @@ var NativeUIBridgeRegistry = class {
886
903
  getRouteProvider() {
887
904
  return this.routeProvider;
888
905
  }
906
+ /**
907
+ * Set the route info emitted as `page.route` on every snapshot — the
908
+ * router-asserted TEMPLATE, normally reported by `useRouteAwareness`.
909
+ * Pass `undefined` to clear it (the hook does so on unmount), after which
910
+ * snapshots omit `page` again.
911
+ *
912
+ * The value is copied, so a later mutation by the caller cannot alter what
913
+ * is stored or what an already-emitted snapshot holds.
914
+ */
915
+ setRouteInfo(info) {
916
+ this.reportedRoute = info ? copyRouteInfo(info) : void 0;
917
+ }
918
+ /** Read-only accessor for the reported route info, if any (a copy). */
919
+ getRouteInfo() {
920
+ return this.reportedRoute ? copyRouteInfo(this.reportedRoute) : void 0;
921
+ }
889
922
  /**
890
923
  * Resolve the snapshot's `activeTab`: an explicit `getActiveTab()` on the
891
924
  * route provider wins, otherwise derive it from the Expo Router segments the
@@ -1726,6 +1759,12 @@ var NativeUIBridgeRegistry = class {
1726
1759
  // hosts that wire no route provider.
1727
1760
  ...resolvedRoute.currentRoute ? { route: resolvedRoute.currentRoute } : {},
1728
1761
  ...resolvedRoute.activeTab ? { activeTab: resolvedRoute.activeTab } : {},
1762
+ // The router-asserted route TEMPLATE, spelled as the web SDK's
1763
+ // `snapshot.page.route`. Emitted on the ONE assembly point both route
1764
+ // branches above share (the explicit-`routeInfo` branch the server's
1765
+ // `getSnapshot` override uses, and the provider fallback). Omitted, not
1766
+ // nulled, when unset — the same convention as the aliases above.
1767
+ ...this.reportedRoute ? { page: { route: copyRouteInfo(this.reportedRoute) } } : {},
1729
1768
  registration: this.getRegistrationCoverage()
1730
1769
  };
1731
1770
  if (this.appInfo) {
@@ -1772,6 +1811,9 @@ var NativeUIBridgeRegistry = class {
1772
1811
  }
1773
1812
  }
1774
1813
  }
1814
+ if (this.reportedRoute) {
1815
+ snapshot.page = { route: copyRouteInfo(this.reportedRoute) };
1816
+ }
1775
1817
  }
1776
1818
  return snapshot;
1777
1819
  }