@buoy-gg/route-events 2.1.3 → 2.1.4-beta.3

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 (33) hide show
  1. package/lib/commonjs/RouteTracker.js +31 -5
  2. package/lib/commonjs/components/NavigationStack.js +24 -33
  3. package/lib/commonjs/components/ReactNavigationRoutes.js +829 -0
  4. package/lib/commonjs/components/RouteEventsModalWithTabs.js +83 -6
  5. package/lib/commonjs/components/RoutesSitemap.js +1 -2
  6. package/lib/commonjs/index.js +7 -0
  7. package/lib/commonjs/useNavigationStack.js +201 -104
  8. package/lib/commonjs/useRouteObserverReactNavigation.js +109 -0
  9. package/lib/module/RouteTracker.js +31 -5
  10. package/lib/module/components/NavigationStack.js +24 -33
  11. package/lib/module/components/ReactNavigationRoutes.js +825 -0
  12. package/lib/module/components/RouteEventsModalWithTabs.js +85 -7
  13. package/lib/module/components/RoutesSitemap.js +2 -2
  14. package/lib/module/index.js +1 -0
  15. package/lib/module/useNavigationStack.js +203 -106
  16. package/lib/module/useRouteObserverReactNavigation.js +106 -0
  17. package/lib/typescript/RouteTracker.d.ts +18 -5
  18. package/lib/typescript/RouteTracker.d.ts.map +1 -1
  19. package/lib/typescript/components/NavigationStack.d.ts.map +1 -1
  20. package/lib/typescript/components/ReactNavigationRoutes.d.ts +14 -0
  21. package/lib/typescript/components/ReactNavigationRoutes.d.ts.map +1 -0
  22. package/lib/typescript/components/RouteEventsModalWithTabs.d.ts.map +1 -1
  23. package/lib/typescript/index.d.ts +1 -0
  24. package/lib/typescript/index.d.ts.map +1 -1
  25. package/lib/typescript/useNavigationStack.d.ts +9 -3
  26. package/lib/typescript/useNavigationStack.d.ts.map +1 -1
  27. package/lib/typescript/useRouteObserverReactNavigation.d.ts +19 -0
  28. package/lib/typescript/useRouteObserverReactNavigation.d.ts.map +1 -0
  29. package/package.json +6 -6
  30. package/lib/commonjs/utils/safeExpoRouter.js +0 -129
  31. package/lib/module/utils/safeExpoRouter.js +0 -120
  32. package/lib/typescript/utils/safeExpoRouter.d.ts +0 -13
  33. package/lib/typescript/utils/safeExpoRouter.d.ts.map +0 -1
@@ -4,19 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RouteTracker = RouteTracker;
7
+ var _sharedUi = require("@buoy-gg/shared-ui");
7
8
  var _useRouteObserver = require("./useRouteObserver");
9
+ var _useRouteObserverReactNavigation = require("./useRouteObserverReactNavigation");
10
+ var _jsxRuntime = require("react/jsx-runtime");
8
11
  /**
9
12
  * RouteTracker - A component to place inside your navigation tree
10
13
  *
11
- * This component calls useRouteObserver() which uses expo-router hooks
12
- * (usePathname, useSegments, etc.) to track navigation changes.
14
+ * Automatically detects whether Expo Router or React Navigation is available
15
+ * and uses the appropriate route observation method.
13
16
  *
14
17
  * IMPORTANT: This component MUST be placed inside your navigation tree
15
- * (as a child of Stack, Tabs, or Slot) for route tracking to work.
18
+ * (as a child of Stack, Tabs, Slot, or NavigationContainer) for route tracking to work.
16
19
  *
17
20
  * @example
18
21
  * ```tsx
19
- * // In your _layout.tsx
22
+ * // Expo Router - in your _layout.tsx
20
23
  * import { RouteTracker } from '@buoy-gg/route-events';
21
24
  *
22
25
  * export default function RootLayout() {
@@ -30,10 +33,33 @@ var _useRouteObserver = require("./useRouteObserver");
30
33
  * </>
31
34
  * );
32
35
  * }
36
+ *
37
+ * // React Navigation (RN CLI) - inside NavigationContainer
38
+ * import { RouteTracker } from '@buoy-gg/route-events';
39
+ *
40
+ * function App() {
41
+ * return (
42
+ * <NavigationContainer>
43
+ * <RootNavigator />
44
+ * <RouteTracker />
45
+ * <FloatingDevTools ... />
46
+ * </NavigationContainer>
47
+ * );
48
+ * }
33
49
  * ```
34
50
  */
35
51
 
36
- function RouteTracker() {
52
+ function ExpoRouteTracker() {
37
53
  (0, _useRouteObserver.useRouteObserver)();
38
54
  return null;
55
+ }
56
+ function ReactNavigationRouteTracker() {
57
+ (0, _useRouteObserverReactNavigation.useRouteObserverReactNavigation)();
58
+ return null;
59
+ }
60
+ function RouteTracker() {
61
+ if ((0, _sharedUi.isExpoRouterAvailable)()) {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpoRouteTracker, {});
63
+ }
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ReactNavigationRouteTracker, {});
39
65
  }
@@ -10,7 +10,6 @@ var _sharedUi = require("@buoy-gg/shared-ui");
10
10
  var _license = require("@buoy-gg/license");
11
11
  var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
12
12
  var _useNavigationStack = require("../useNavigationStack");
13
- var _expoRouter = require("expo-router");
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
14
  /**
16
15
  * NavigationStack - Visual representation of current navigation stack
@@ -41,7 +40,6 @@ function NavigationStack({
41
40
  goBack,
42
41
  popToTop
43
42
  } = (0, _useNavigationStack.useNavigationStack)();
44
- const router = (0, _expoRouter.useRouter)();
45
43
  const [expandedIndex, setExpandedIndex] = (0, _react.useState)(null);
46
44
  const [showHelp, setShowHelp] = (0, _react.useState)(false);
47
45
  const [showUpgradeModal, setShowUpgradeModal] = (0, _react.useState)(false);
@@ -230,7 +228,9 @@ function NavigationStack({
230
228
  })]
231
229
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
232
230
  style: styles.stackScroll,
233
- contentContainerStyle: styles.stackContent,
231
+ contentContainerStyle: [styles.stackContent, {
232
+ paddingBottom: showHelp ? 72 : 56
233
+ }],
234
234
  children: [...stack].reverse().map((item, reverseIndex) => {
235
235
  const actualIndex = stack.length - 1 - reverseIndex;
236
236
  const isExpanded = expandedIndex === actualIndex;
@@ -259,17 +259,16 @@ function NavigationStack({
259
259
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InlineCopyButton, {
260
260
  value: item.pathname,
261
261
  buttonStyle: styles.copyRouteButton
262
- }), item.isFocused ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
263
- style: styles.focusedBadge,
262
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
263
+ style: [styles.statusBadge, {
264
+ backgroundColor: item.isFocused ? `${_sharedUi.buoyColors.success}15` : "#3B82F615",
265
+ borderColor: item.isFocused ? `${_sharedUi.buoyColors.success}40` : "#3B82F640"
266
+ }],
264
267
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
265
- style: styles.focusedBadgeText,
266
- children: "VISIBLE"
267
- })
268
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
269
- style: styles.memoryBadge,
270
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
271
- style: styles.memoryBadgeText,
272
- children: "MEMORY"
268
+ style: [styles.statusBadgeText, {
269
+ color: item.isFocused ? _sharedUi.buoyColors.success : "#3B82F6"
270
+ }],
271
+ children: item.isFocused ? "FOCUSED" : "MOUNTED"
273
272
  })
274
273
  })]
275
274
  }), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -476,28 +475,15 @@ const styles = _reactNative.StyleSheet.create({
476
475
  padding: 4,
477
476
  marginLeft: 4
478
477
  },
479
- focusedBadge: {
480
- backgroundColor: _sharedUi.buoyColors.success,
481
- paddingHorizontal: 8,
482
- paddingVertical: 3,
483
- borderRadius: 4
484
- },
485
- focusedBadgeText: {
486
- fontSize: 9,
487
- fontWeight: "700",
488
- color: _sharedUi.buoyColors.base,
489
- fontFamily: "monospace"
490
- },
491
- memoryBadge: {
492
- backgroundColor: _sharedUi.buoyColors.input,
493
- paddingHorizontal: 8,
494
- paddingVertical: 3,
495
- borderRadius: 4
478
+ statusBadge: {
479
+ borderRadius: 4,
480
+ paddingHorizontal: 6,
481
+ paddingVertical: 2,
482
+ borderWidth: 1
496
483
  },
497
- memoryBadgeText: {
498
- fontSize: 9,
484
+ statusBadgeText: {
485
+ fontSize: 10,
499
486
  fontWeight: "600",
500
- color: _sharedUi.buoyColors.textSecondary,
501
487
  fontFamily: "monospace"
502
488
  },
503
489
  expandedContent: {
@@ -527,8 +513,13 @@ const styles = _reactNative.StyleSheet.create({
527
513
  marginBottom: 8
528
514
  },
529
515
  actionsContainer: {
516
+ position: "absolute",
517
+ left: 0,
518
+ right: 0,
519
+ bottom: 0,
530
520
  borderTopWidth: 1,
531
521
  borderTopColor: _sharedUi.buoyColors.border,
522
+ backgroundColor: _sharedUi.buoyColors.base,
532
523
  paddingHorizontal: 8,
533
524
  paddingTop: 8,
534
525
  paddingBottom: 8