@buoy-gg/route-events 1.7.2
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 +654 -0
- package/lib/commonjs/RouteObserver.js +54 -0
- package/lib/commonjs/RouteParser.js +310 -0
- package/lib/commonjs/RouteTracker.js +39 -0
- package/lib/commonjs/components/NavigationStack.js +584 -0
- package/lib/commonjs/components/RouteEventDetailContent.js +492 -0
- package/lib/commonjs/components/RouteEventExpandedContent.js +187 -0
- package/lib/commonjs/components/RouteEventItemCompact.js +175 -0
- package/lib/commonjs/components/RouteEventsModalWithTabs.js +560 -0
- package/lib/commonjs/components/RouteEventsTimeline.js +82 -0
- package/lib/commonjs/components/RouteFilterViewV2.js +42 -0
- package/lib/commonjs/components/RoutesSitemap.js +948 -0
- package/lib/commonjs/expoRouterStore.js +104 -0
- package/lib/commonjs/index.js +99 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +83 -0
- package/lib/commonjs/useNavigationStack.js +241 -0
- package/lib/commonjs/useRouteObserver.js +73 -0
- package/lib/commonjs/useRouteSitemap.js +234 -0
- package/lib/commonjs/utils/safeExpoRouter.js +129 -0
- package/lib/commonjs/utils/safeReactNavigation.js +104 -0
- package/lib/module/RouteObserver.js +49 -0
- package/lib/module/RouteParser.js +305 -0
- package/lib/module/RouteTracker.js +35 -0
- package/lib/module/components/NavigationStack.js +580 -0
- package/lib/module/components/RouteEventDetailContent.js +487 -0
- package/lib/module/components/RouteEventExpandedContent.js +183 -0
- package/lib/module/components/RouteEventItemCompact.js +171 -0
- package/lib/module/components/RouteEventsModalWithTabs.js +557 -0
- package/lib/module/components/RouteEventsTimeline.js +78 -0
- package/lib/module/components/RouteFilterViewV2.js +38 -0
- package/lib/module/components/RoutesSitemap.js +944 -0
- package/lib/module/expoRouterStore.js +98 -0
- package/lib/module/index.js +23 -0
- package/lib/module/preset.js +79 -0
- package/lib/module/useNavigationStack.js +238 -0
- package/lib/module/useRouteObserver.js +70 -0
- package/lib/module/useRouteSitemap.js +229 -0
- package/lib/module/utils/safeExpoRouter.js +120 -0
- package/lib/module/utils/safeReactNavigation.js +98 -0
- package/lib/typescript/RouteObserver.d.ts +37 -0
- package/lib/typescript/RouteObserver.d.ts.map +1 -0
- package/lib/typescript/RouteParser.d.ts +129 -0
- package/lib/typescript/RouteParser.d.ts.map +1 -0
- package/lib/typescript/RouteTracker.d.ts +29 -0
- package/lib/typescript/RouteTracker.d.ts.map +1 -0
- package/lib/typescript/components/NavigationStack.d.ts +11 -0
- package/lib/typescript/components/NavigationStack.d.ts.map +1 -0
- package/lib/typescript/components/RouteEventDetailContent.d.ts +21 -0
- package/lib/typescript/components/RouteEventDetailContent.d.ts.map +1 -0
- package/lib/typescript/components/RouteEventExpandedContent.d.ts +16 -0
- package/lib/typescript/components/RouteEventExpandedContent.d.ts.map +1 -0
- package/lib/typescript/components/RouteEventItemCompact.d.ts +15 -0
- package/lib/typescript/components/RouteEventItemCompact.d.ts.map +1 -0
- package/lib/typescript/components/RouteEventsModalWithTabs.d.ts +15 -0
- package/lib/typescript/components/RouteEventsModalWithTabs.d.ts.map +1 -0
- package/lib/typescript/components/RouteEventsTimeline.d.ts +17 -0
- package/lib/typescript/components/RouteEventsTimeline.d.ts.map +1 -0
- package/lib/typescript/components/RouteFilterViewV2.d.ts +9 -0
- package/lib/typescript/components/RouteFilterViewV2.d.ts.map +1 -0
- package/lib/typescript/components/RoutesSitemap.d.ts +15 -0
- package/lib/typescript/components/RoutesSitemap.d.ts.map +1 -0
- package/lib/typescript/expoRouterStore.d.ts +28 -0
- package/lib/typescript/expoRouterStore.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +76 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/useNavigationStack.d.ts +48 -0
- package/lib/typescript/useNavigationStack.d.ts.map +1 -0
- package/lib/typescript/useRouteObserver.d.ts +27 -0
- package/lib/typescript/useRouteObserver.d.ts.map +1 -0
- package/lib/typescript/useRouteSitemap.d.ts +102 -0
- package/lib/typescript/useRouteSitemap.d.ts.map +1 -0
- package/lib/typescript/utils/safeExpoRouter.d.ts +13 -0
- package/lib/typescript/utils/safeExpoRouter.d.ts.map +1 -0
- package/lib/typescript/utils/safeReactNavigation.d.ts +10 -0
- package/lib/typescript/utils/safeReactNavigation.d.ts.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RouteEventItemCompact = RouteEventItemCompact;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
var _RouteEventExpandedContent = require("./RouteEventExpandedContent");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* RouteEventItemCompact - Compact list item for route events
|
|
14
|
+
*
|
|
15
|
+
* Uses CompactRow pattern matching network/storage components
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Route type for color coding
|
|
19
|
+
|
|
20
|
+
// Infer route template from pathname and segments
|
|
21
|
+
function getRouteTemplate(pathname, segments) {
|
|
22
|
+
if (!segments || segments.length === 0) return null;
|
|
23
|
+
const templateParts = segments.map(segment => {
|
|
24
|
+
// Check if this segment appears to be a dynamic parameter
|
|
25
|
+
if (/^\d+$/.test(segment)) {
|
|
26
|
+
return "[id]";
|
|
27
|
+
}
|
|
28
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(segment)) {
|
|
29
|
+
return "[id]";
|
|
30
|
+
}
|
|
31
|
+
return segment;
|
|
32
|
+
});
|
|
33
|
+
const template = "/" + templateParts.join("/");
|
|
34
|
+
return template !== pathname ? template : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Get route type for color coding
|
|
38
|
+
function getRouteType(event) {
|
|
39
|
+
if (event.pathname === "/") {
|
|
40
|
+
return "home";
|
|
41
|
+
}
|
|
42
|
+
if (getRouteTemplate(event.pathname, event.segments)) {
|
|
43
|
+
return "dynamic";
|
|
44
|
+
}
|
|
45
|
+
if (event.params && Object.keys(event.params).length > 0) {
|
|
46
|
+
return "with-params";
|
|
47
|
+
}
|
|
48
|
+
return "default";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Get color for route type
|
|
52
|
+
function getRouteTypeColor(routeType) {
|
|
53
|
+
switch (routeType) {
|
|
54
|
+
case "home":
|
|
55
|
+
return _sharedUi.buoyColors.success;
|
|
56
|
+
// Teal
|
|
57
|
+
case "dynamic":
|
|
58
|
+
return _sharedUi.buoyColors.primary;
|
|
59
|
+
// Teal
|
|
60
|
+
case "with-params":
|
|
61
|
+
return _sharedUi.buoyColors.warning;
|
|
62
|
+
// Orange
|
|
63
|
+
default:
|
|
64
|
+
return _sharedUi.buoyColors.border;
|
|
65
|
+
// Gray
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Get status label (route type name)
|
|
70
|
+
function getStatusLabel(routeType) {
|
|
71
|
+
switch (routeType) {
|
|
72
|
+
case "home":
|
|
73
|
+
return "Home";
|
|
74
|
+
case "dynamic":
|
|
75
|
+
return "Dynamic";
|
|
76
|
+
case "with-params":
|
|
77
|
+
return "Params";
|
|
78
|
+
default:
|
|
79
|
+
return "Static";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Get secondary text (param count + route type)
|
|
84
|
+
function getSecondaryText(event, routeType) {
|
|
85
|
+
const hasParams = event.params && Object.keys(event.params).length > 0;
|
|
86
|
+
if (!hasParams) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const paramCount = Object.keys(event.params).length;
|
|
90
|
+
const paramText = `${paramCount} param${paramCount !== 1 ? 's' : ''}`;
|
|
91
|
+
return `${paramText} • ${getStatusLabel(routeType)}`;
|
|
92
|
+
}
|
|
93
|
+
function RouteEventItemCompact({
|
|
94
|
+
event,
|
|
95
|
+
visitNumber,
|
|
96
|
+
isExpanded,
|
|
97
|
+
onPress,
|
|
98
|
+
onNavigate
|
|
99
|
+
}) {
|
|
100
|
+
const routeType = (0, _react.useMemo)(() => getRouteType(event), [event]);
|
|
101
|
+
const routeTemplate = (0, _react.useMemo)(() => getRouteTemplate(event.pathname, event.segments), [event.pathname, event.segments]);
|
|
102
|
+
const statusColor = (0, _react.useMemo)(() => getRouteTypeColor(routeType), [routeType]);
|
|
103
|
+
const statusLabel = (0, _react.useMemo)(() => getStatusLabel(routeType), [routeType]);
|
|
104
|
+
const secondaryText = (0, _react.useMemo)(() => getSecondaryText(event, routeType), [event, routeType]);
|
|
105
|
+
const timeLabel = (0, _react.useMemo)(() => (0, _sharedUi.formatRelativeTime)(new Date(event.timestamp)), [event.timestamp]);
|
|
106
|
+
const expandedContent = (0, _react.useMemo)(() => {
|
|
107
|
+
if (!isExpanded) return undefined;
|
|
108
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RouteEventExpandedContent.RouteEventExpandedContent, {
|
|
109
|
+
event: event,
|
|
110
|
+
visitNumber: visitNumber,
|
|
111
|
+
routeTemplate: routeTemplate
|
|
112
|
+
});
|
|
113
|
+
}, [isExpanded, event, visitNumber, routeTemplate]);
|
|
114
|
+
const customBadge = (0, _react.useMemo)(() => {
|
|
115
|
+
if (!onNavigate) {
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
117
|
+
style: styles.timeText,
|
|
118
|
+
children: timeLabel
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
122
|
+
style: styles.badgeContainer,
|
|
123
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
124
|
+
style: styles.timeText,
|
|
125
|
+
children: timeLabel
|
|
126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
127
|
+
style: styles.goButton,
|
|
128
|
+
onPress: e => {
|
|
129
|
+
e.stopPropagation();
|
|
130
|
+
onNavigate(event.pathname);
|
|
131
|
+
},
|
|
132
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
133
|
+
style: styles.goButtonText,
|
|
134
|
+
children: "Go"
|
|
135
|
+
})
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
}, [timeLabel, onNavigate, event.pathname]);
|
|
139
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompactRow, {
|
|
140
|
+
statusDotColor: statusColor,
|
|
141
|
+
statusLabel: statusLabel,
|
|
142
|
+
primaryText: event.pathname,
|
|
143
|
+
secondaryText: secondaryText,
|
|
144
|
+
customBadge: customBadge,
|
|
145
|
+
showChevron: true,
|
|
146
|
+
expandedContent: expandedContent,
|
|
147
|
+
isExpanded: isExpanded,
|
|
148
|
+
expandedGlowColor: statusColor,
|
|
149
|
+
onPress: onPress
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const styles = _reactNative.StyleSheet.create({
|
|
153
|
+
badgeContainer: {
|
|
154
|
+
flexDirection: "row",
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
gap: 6
|
|
157
|
+
},
|
|
158
|
+
timeText: {
|
|
159
|
+
fontSize: 10,
|
|
160
|
+
color: _sharedUi.buoyColors.textMuted,
|
|
161
|
+
fontFamily: "monospace"
|
|
162
|
+
},
|
|
163
|
+
goButton: {
|
|
164
|
+
backgroundColor: _sharedUi.buoyColors.primary,
|
|
165
|
+
paddingHorizontal: 8,
|
|
166
|
+
paddingVertical: 4,
|
|
167
|
+
borderRadius: 4
|
|
168
|
+
},
|
|
169
|
+
goButtonText: {
|
|
170
|
+
fontSize: 10,
|
|
171
|
+
fontWeight: "600",
|
|
172
|
+
color: "#FFFFFF",
|
|
173
|
+
fontFamily: "monospace"
|
|
174
|
+
}
|
|
175
|
+
});
|