@qontinui/ui-bridge-native 0.6.15 → 0.6.16
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/README.md +17 -0
- package/dist/control/index.js.map +1 -1
- package/dist/control/index.mjs.map +1 -1
- package/dist/core/index.js +42 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +42 -0
- package/dist/core/index.mjs.map +1 -1
- package/dist/core/registry.d.ts +23 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/types.d.ts +66 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +116 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +112 -2
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/routePattern.d.ts +145 -0
- package/dist/react/routePattern.d.ts.map +1 -0
- package/dist/react/useRouteAwareness.d.ts +106 -0
- package/dist/react/useRouteAwareness.d.ts.map +1 -0
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/core/index.mjs
CHANGED
|
@@ -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
|
}
|