react-native-debug-toolkit 2.0.0 → 2.1.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 (228) hide show
  1. package/README.md +72 -72
  2. package/README.zh-CN.md +209 -0
  3. package/lib/commonjs/components/ClipboardTab.js +15 -16
  4. package/lib/commonjs/components/ClipboardTab.js.map +1 -1
  5. package/lib/commonjs/components/ConsoleLogTab.js +69 -202
  6. package/lib/commonjs/components/ConsoleLogTab.js.map +1 -1
  7. package/lib/commonjs/components/DebugPanel.js +230 -0
  8. package/lib/commonjs/components/DebugPanel.js.map +1 -0
  9. package/lib/commonjs/components/DebugView.js +66 -0
  10. package/lib/commonjs/components/DebugView.js.map +1 -0
  11. package/lib/commonjs/components/EnvironmentTab.js +22 -23
  12. package/lib/commonjs/components/EnvironmentTab.js.map +1 -1
  13. package/lib/commonjs/components/FeatureTabBar.js +182 -0
  14. package/lib/commonjs/components/FeatureTabBar.js.map +1 -0
  15. package/lib/commonjs/components/FloatIcon.js +187 -0
  16. package/lib/commonjs/components/FloatIcon.js.map +1 -0
  17. package/lib/commonjs/components/FloatPanelView.js +140 -723
  18. package/lib/commonjs/components/FloatPanelView.js.map +1 -1
  19. package/lib/commonjs/components/NavigationLogTab.js +8 -8
  20. package/lib/commonjs/components/NavigationLogTab.js.map +1 -1
  21. package/lib/commonjs/components/NetworkLogTab.js +179 -350
  22. package/lib/commonjs/components/NetworkLogTab.js.map +1 -1
  23. package/lib/commonjs/components/ThirdPartyLibsTab.js +8 -8
  24. package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -1
  25. package/lib/commonjs/components/TrackLogTab.js +106 -248
  26. package/lib/commonjs/components/TrackLogTab.js.map +1 -1
  27. package/lib/commonjs/components/ZustandLogTab.js +148 -288
  28. package/lib/commonjs/components/ZustandLogTab.js.map +1 -1
  29. package/lib/commonjs/components/shared/CollapsibleSection.js +4 -4
  30. package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -1
  31. package/lib/commonjs/components/shared/CopyButton.js +3 -3
  32. package/lib/commonjs/components/shared/CopyButton.js.map +1 -1
  33. package/lib/commonjs/components/shared/LogListScreen.js +174 -0
  34. package/lib/commonjs/components/shared/LogListScreen.js.map +1 -0
  35. package/lib/commonjs/core/DebugToolkit.js +92 -112
  36. package/lib/commonjs/core/DebugToolkit.js.map +1 -1
  37. package/lib/commonjs/core/DebugToolkitProvider.js +30 -28
  38. package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -1
  39. package/lib/commonjs/features/ClipboardFeature.js +6 -2
  40. package/lib/commonjs/features/ClipboardFeature.js.map +1 -1
  41. package/lib/commonjs/features/ConsoleLogFeature.js +66 -49
  42. package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -1
  43. package/lib/commonjs/features/EnvironmentFeature.js +5 -13
  44. package/lib/commonjs/features/EnvironmentFeature.js.map +1 -1
  45. package/lib/commonjs/features/NavigationLogFeature.js +17 -38
  46. package/lib/commonjs/features/NavigationLogFeature.js.map +1 -1
  47. package/lib/commonjs/features/NetworkFeature.js +35 -256
  48. package/lib/commonjs/features/NetworkFeature.js.map +1 -1
  49. package/lib/commonjs/features/TrackFeature.js +17 -38
  50. package/lib/commonjs/features/TrackFeature.js.map +1 -1
  51. package/lib/commonjs/features/ZustandLogFeature.js +21 -38
  52. package/lib/commonjs/features/ZustandLogFeature.js.map +1 -1
  53. package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -1
  54. package/lib/commonjs/index.js +7 -20
  55. package/lib/commonjs/index.js.map +1 -1
  56. package/lib/commonjs/initialize.js +19 -96
  57. package/lib/commonjs/initialize.js.map +1 -1
  58. package/lib/commonjs/interceptors/networkInterceptor.js +466 -0
  59. package/lib/commonjs/interceptors/networkInterceptor.js.map +1 -0
  60. package/lib/commonjs/utils/colors.js +48 -0
  61. package/lib/commonjs/utils/colors.js.map +1 -0
  62. package/lib/commonjs/utils/createChannelFeature.js +48 -0
  63. package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
  64. package/lib/commonjs/utils/layout.js +8 -0
  65. package/lib/commonjs/utils/layout.js.map +1 -0
  66. package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
  67. package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
  68. package/lib/module/components/ClipboardTab.js +8 -8
  69. package/lib/module/components/ClipboardTab.js.map +1 -1
  70. package/lib/module/components/ConsoleLogTab.js +66 -199
  71. package/lib/module/components/ConsoleLogTab.js.map +1 -1
  72. package/lib/module/components/DebugPanel.js +225 -0
  73. package/lib/module/components/DebugPanel.js.map +1 -0
  74. package/lib/module/components/DebugView.js +61 -0
  75. package/lib/module/components/DebugView.js.map +1 -0
  76. package/lib/module/components/EnvironmentTab.js +3 -3
  77. package/lib/module/components/EnvironmentTab.js.map +1 -1
  78. package/lib/module/components/FeatureTabBar.js +177 -0
  79. package/lib/module/components/FeatureTabBar.js.map +1 -0
  80. package/lib/module/components/FloatIcon.js +182 -0
  81. package/lib/module/components/FloatIcon.js.map +1 -0
  82. package/lib/module/components/FloatPanelView.js +141 -723
  83. package/lib/module/components/FloatPanelView.js.map +1 -1
  84. package/lib/module/components/NavigationLogTab.js +1 -1
  85. package/lib/module/components/NavigationLogTab.js.map +1 -1
  86. package/lib/module/components/NetworkLogTab.js +167 -338
  87. package/lib/module/components/NetworkLogTab.js.map +1 -1
  88. package/lib/module/components/ThirdPartyLibsTab.js +1 -1
  89. package/lib/module/components/ThirdPartyLibsTab.js.map +1 -1
  90. package/lib/module/components/TrackLogTab.js +94 -236
  91. package/lib/module/components/TrackLogTab.js.map +1 -1
  92. package/lib/module/components/ZustandLogTab.js +136 -276
  93. package/lib/module/components/ZustandLogTab.js.map +1 -1
  94. package/lib/module/components/shared/CollapsibleSection.js +1 -1
  95. package/lib/module/components/shared/CollapsibleSection.js.map +1 -1
  96. package/lib/module/components/shared/CopyButton.js +1 -1
  97. package/lib/module/components/shared/CopyButton.js.map +1 -1
  98. package/lib/module/components/shared/LogListScreen.js +169 -0
  99. package/lib/module/components/shared/LogListScreen.js.map +1 -0
  100. package/lib/module/core/DebugToolkit.js +92 -111
  101. package/lib/module/core/DebugToolkit.js.map +1 -1
  102. package/lib/module/core/DebugToolkitProvider.js +31 -29
  103. package/lib/module/core/DebugToolkitProvider.js.map +1 -1
  104. package/lib/module/features/ClipboardFeature.js +6 -2
  105. package/lib/module/features/ClipboardFeature.js.map +1 -1
  106. package/lib/module/features/ConsoleLogFeature.js +65 -49
  107. package/lib/module/features/ConsoleLogFeature.js.map +1 -1
  108. package/lib/module/features/EnvironmentFeature.js +5 -13
  109. package/lib/module/features/EnvironmentFeature.js.map +1 -1
  110. package/lib/module/features/NavigationLogFeature.js +16 -38
  111. package/lib/module/features/NavigationLogFeature.js.map +1 -1
  112. package/lib/module/features/NetworkFeature.js +34 -255
  113. package/lib/module/features/NetworkFeature.js.map +1 -1
  114. package/lib/module/features/TrackFeature.js +16 -38
  115. package/lib/module/features/TrackFeature.js.map +1 -1
  116. package/lib/module/features/ZustandLogFeature.js +22 -38
  117. package/lib/module/features/ZustandLogFeature.js.map +1 -1
  118. package/lib/module/hooks/useNavigationLogger.js.map +1 -1
  119. package/lib/module/index.js +2 -3
  120. package/lib/module/index.js.map +1 -1
  121. package/lib/module/initialize.js +19 -95
  122. package/lib/module/initialize.js.map +1 -1
  123. package/lib/module/interceptors/networkInterceptor.js +460 -0
  124. package/lib/module/interceptors/networkInterceptor.js.map +1 -0
  125. package/lib/module/utils/colors.js +43 -0
  126. package/lib/module/utils/colors.js.map +1 -0
  127. package/lib/module/utils/createChannelFeature.js +44 -0
  128. package/lib/module/utils/createChannelFeature.js.map +1 -0
  129. package/lib/module/utils/layout.js +4 -0
  130. package/lib/module/utils/layout.js.map +1 -0
  131. package/lib/module/utils/urlRewriterRegistry.js +10 -0
  132. package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
  133. package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -1
  134. package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -1
  135. package/lib/typescript/src/components/DebugPanel.d.ts +9 -0
  136. package/lib/typescript/src/components/DebugPanel.d.ts.map +1 -0
  137. package/lib/typescript/src/components/DebugView.d.ts +19 -0
  138. package/lib/typescript/src/components/DebugView.d.ts.map +1 -0
  139. package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -1
  140. package/lib/typescript/src/components/FeatureTabBar.d.ts +13 -0
  141. package/lib/typescript/src/components/FeatureTabBar.d.ts.map +1 -0
  142. package/lib/typescript/src/components/FloatIcon.d.ts +12 -0
  143. package/lib/typescript/src/components/FloatIcon.d.ts.map +1 -0
  144. package/lib/typescript/src/components/FloatPanelView.d.ts +4 -59
  145. package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -1
  146. package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -1
  147. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -1
  148. package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -1
  149. package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -1
  150. package/lib/typescript/src/components/shared/LogListScreen.d.ts +21 -0
  151. package/lib/typescript/src/components/shared/LogListScreen.d.ts.map +1 -0
  152. package/lib/typescript/src/core/DebugToolkit.d.ts +11 -18
  153. package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -1
  154. package/lib/typescript/src/core/DebugToolkitProvider.d.ts +2 -5
  155. package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -1
  156. package/lib/typescript/src/features/ClipboardFeature.d.ts +4 -0
  157. package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -1
  158. package/lib/typescript/src/features/ConsoleLogFeature.d.ts +2 -0
  159. package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -1
  160. package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -1
  161. package/lib/typescript/src/features/NavigationLogFeature.d.ts +2 -0
  162. package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -1
  163. package/lib/typescript/src/features/NetworkFeature.d.ts +7 -20
  164. package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -1
  165. package/lib/typescript/src/features/TrackFeature.d.ts +2 -0
  166. package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -1
  167. package/lib/typescript/src/features/ZustandLogFeature.d.ts +2 -0
  168. package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -1
  169. package/lib/typescript/src/hooks/useNavigationLogger.d.ts +1 -8
  170. package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -1
  171. package/lib/typescript/src/index.d.ts +5 -5
  172. package/lib/typescript/src/index.d.ts.map +1 -1
  173. package/lib/typescript/src/initialize.d.ts +3 -22
  174. package/lib/typescript/src/initialize.d.ts.map +1 -1
  175. package/lib/typescript/src/interceptors/networkInterceptor.d.ts +18 -0
  176. package/lib/typescript/src/interceptors/networkInterceptor.d.ts.map +1 -0
  177. package/lib/typescript/src/types/index.d.ts +26 -29
  178. package/lib/typescript/src/types/index.d.ts.map +1 -1
  179. package/lib/typescript/src/utils/colors.d.ts +21 -0
  180. package/lib/typescript/src/utils/colors.d.ts.map +1 -0
  181. package/lib/typescript/src/utils/createChannelFeature.d.ts +18 -0
  182. package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
  183. package/lib/typescript/src/utils/layout.d.ts +2 -0
  184. package/lib/typescript/src/utils/layout.d.ts.map +1 -0
  185. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
  186. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
  187. package/package.json +5 -1
  188. package/src/components/ClipboardTab.tsx +8 -8
  189. package/src/components/ConsoleLogTab.tsx +49 -163
  190. package/src/components/DebugPanel.tsx +215 -0
  191. package/src/components/DebugView.tsx +80 -0
  192. package/src/components/EnvironmentTab.tsx +3 -3
  193. package/src/components/FeatureTabBar.tsx +204 -0
  194. package/src/components/FloatIcon.tsx +171 -0
  195. package/src/components/FloatPanelView.tsx +135 -647
  196. package/src/components/NavigationLogTab.tsx +1 -1
  197. package/src/components/NetworkLogTab.tsx +128 -269
  198. package/src/components/ThirdPartyLibsTab.tsx +3 -3
  199. package/src/components/TrackLogTab.tsx +53 -188
  200. package/src/components/ZustandLogTab.tsx +79 -181
  201. package/src/components/shared/CollapsibleSection.tsx +1 -1
  202. package/src/components/shared/CopyButton.tsx +1 -1
  203. package/src/components/shared/LogListScreen.tsx +164 -0
  204. package/src/core/DebugToolkit.tsx +114 -138
  205. package/src/core/DebugToolkitProvider.tsx +32 -38
  206. package/src/features/ClipboardFeature.ts +6 -2
  207. package/src/features/ConsoleLogFeature.ts +66 -68
  208. package/src/features/EnvironmentFeature.ts +5 -13
  209. package/src/features/NavigationLogFeature.ts +12 -42
  210. package/src/features/NetworkFeature.ts +43 -405
  211. package/src/features/TrackFeature.ts +14 -49
  212. package/src/features/ZustandLogFeature.ts +16 -42
  213. package/src/hooks/useNavigationLogger.ts +1 -6
  214. package/src/index.ts +5 -9
  215. package/src/initialize.ts +28 -120
  216. package/src/interceptors/networkInterceptor.ts +646 -0
  217. package/src/types/index.ts +25 -36
  218. package/src/utils/colors.ts +38 -0
  219. package/src/utils/createChannelFeature.ts +55 -0
  220. package/src/utils/layout.ts +1 -0
  221. package/src/utils/urlRewriterRegistry.ts +10 -0
  222. package/lib/commonjs/utils/constants.js +0 -135
  223. package/lib/commonjs/utils/constants.js.map +0 -1
  224. package/lib/module/utils/constants.js +0 -130
  225. package/lib/module/utils/constants.js.map +0 -1
  226. package/lib/typescript/src/utils/constants.d.ts +0 -96
  227. package/lib/typescript/src/utils/constants.d.ts.map +0 -1
  228. package/src/utils/constants.ts +0 -91
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.NetworkLogTab = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
- var _constants = require("../utils/constants");
9
+ var _colors = require("../utils/colors");
10
10
  var _CollapsibleSection = require("./shared/CollapsibleSection");
11
11
  var _JsonView = require("./shared/JsonView");
12
12
  var _CopyButton = require("./shared/CopyButton");
13
13
  var _copyToComputer = require("../utils/copyToComputer");
14
+ var _LogListScreen = require("./shared/LogListScreen");
14
15
  var _jsxRuntime = require("react/jsx-runtime");
15
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
17
  const formatSize = data => {
@@ -24,215 +25,46 @@ const formatSize = data => {
24
25
  return '';
25
26
  }
26
27
  };
27
-
28
- // --- Detail view (in-panel push) ---
29
- const NetworkLogDetail = ({
30
- log,
31
- onBack
32
- }) => {
33
- const statusColor = log.error || log.response && log.response.status >= 400 ? _constants.Colors.error : _constants.Colors.success;
34
- const curl = () => {
35
- let c = `curl -X ${log.request.method} '${log.request.url}'`;
36
- if (log.request.headers) {
37
- Object.entries(log.request.headers).forEach(([k, v]) => c += ` \\\n -H '${k}: ${v}'`);
38
- }
39
- if (log.request.body) {
40
- c += ` \\\n -d '${typeof log.request.body === 'string' ? log.request.body : JSON.stringify(log.request.body)}'`;
41
- }
42
- return c;
43
- };
44
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
45
- style: s.detailWrap,
46
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
47
- style: s.detailHeader,
48
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
49
- onPress: onBack,
50
- style: s.backBtn,
51
- activeOpacity: 0.6,
52
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
53
- style: s.backIcon,
54
- children: "\u2039"
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
- style: s.backText,
57
- children: "Back"
58
- })]
59
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
60
- style: s.detailHeaderCenter,
61
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
62
- style: [s.methodBadge, {
63
- backgroundColor: (0, _constants.getMethodColor)(log.request.method)
64
- }],
65
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
66
- style: s.methodBadgeText,
67
- children: log.request.method
68
- })
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
70
- style: [s.statusPill, {
71
- backgroundColor: statusColor
72
- }],
73
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
74
- style: s.statusPillText,
75
- children: log.response?.status ?? 'ERR'
76
- })
77
- }), log.duration != null && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
78
- style: s.durationText,
79
- children: [log.duration, "ms"]
80
- })]
81
- })]
82
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
83
- style: s.detailBody,
84
- contentContainerStyle: s.detailBodyContent,
85
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
86
- style: s.urlCard,
87
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
88
- style: s.urlText,
89
- selectable: true,
90
- numberOfLines: 3,
91
- children: log.request.url
92
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
93
- text: log.request.url,
94
- label: "URL"
95
- })]
96
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
97
- title: "Request Body",
98
- initiallyExpanded: true,
99
- children: log.request.body != null ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
100
- style: s.sectionWithCopy,
101
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
102
- text: (0, _copyToComputer.fmt)(log.request.body),
103
- label: "Request Body"
104
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
105
- data: log.request.body,
106
- maxHeight: 250
107
- })]
108
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
109
- style: s.emptySection,
110
- children: "No request body"
111
- })
112
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
113
- title: "Request Headers",
114
- children: log.request.headers ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
115
- style: s.sectionWithCopy,
116
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
117
- text: (0, _copyToComputer.fmt)(log.request.headers),
118
- label: "Request Headers"
119
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
120
- data: log.request.headers,
121
- maxHeight: 200
122
- })]
123
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
124
- style: s.emptySection,
125
- children: "No headers"
126
- })
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CollapsibleSection.CollapsibleSection, {
128
- title: `Response ${formatSize(log.response?.data)}`,
129
- initiallyExpanded: true,
130
- children: [log.error && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
131
- style: s.errorBox,
132
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
133
- style: s.errorIcon,
134
- children: "\u26A0"
135
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
136
- style: s.errorText,
137
- children: log.error
138
- })]
139
- }), log.response?.data != null ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
140
- style: s.sectionWithCopy,
141
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
142
- text: (0, _copyToComputer.fmt)(log.response.data),
143
- label: "Response Body"
144
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
145
- data: log.response.data,
146
- maxHeight: 300
147
- })]
148
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
149
- style: s.emptySection,
150
- children: "No response body"
151
- })]
152
- }), log.response?.headers && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
153
- title: "Response Headers",
154
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
155
- style: s.sectionWithCopy,
156
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
157
- text: (0, _copyToComputer.fmt)(log.response.headers),
158
- label: "Response Headers"
159
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
160
- data: log.response.headers,
161
- maxHeight: 200
162
- })]
163
- })
164
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
165
- title: "cURL",
166
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
167
- style: s.sectionWithCopy,
168
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
169
- text: curl(),
170
- label: "cURL"
171
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
172
- style: s.codeBlock,
173
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
174
- style: s.codeText,
175
- selectable: true,
176
- children: curl()
177
- })
178
- })]
179
- })
180
- })]
181
- })]
182
- });
28
+ const buildCurl = log => {
29
+ let c = `curl -X ${log.request.method} '${log.request.url}'`;
30
+ if (log.request.headers) {
31
+ Object.entries(log.request.headers).forEach(([k, v]) => c += ` \\\n -H '${k}: ${v}'`);
32
+ }
33
+ if (log.request.body) {
34
+ c += ` \\\n -d '${typeof log.request.body === 'string' ? log.request.body : JSON.stringify(log.request.body)}'`;
35
+ }
36
+ return c;
183
37
  };
184
-
185
- // --- List view ---
186
38
  const NetworkLogTab = exports.NetworkLogTab = /*#__PURE__*/_react.default.memo(({
187
39
  data
188
40
  }) => {
189
- const [selectedLog, setSelectedLog] = (0, _react.useState)(null);
190
41
  const [search, setSearch] = (0, _react.useState)('');
191
- const slideAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
192
- const listSlideAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
193
- (0, _react.useEffect)(() => {
194
- if (selectedLog) {
195
- listSlideAnim.setValue(0);
196
- _reactNative.Animated.parallel([_reactNative.Animated.spring(slideAnim, {
197
- toValue: 1,
198
- friction: 9,
199
- tension: 60,
200
- useNativeDriver: true
201
- }), _reactNative.Animated.spring(listSlideAnim, {
202
- toValue: 1,
203
- friction: 9,
204
- tension: 60,
205
- useNativeDriver: true
206
- })]).start();
207
- } else {
208
- slideAnim.setValue(0);
209
- listSlideAnim.setValue(0);
210
- }
211
- }, [selectedLog]);
212
- const detailTranslateX = slideAnim.interpolate({
213
- inputRange: [0, 1],
214
- outputRange: [300, 0]
215
- });
216
- const listTranslateX = listSlideAnim.interpolate({
217
- inputRange: [0, 1],
218
- outputRange: [0, -60]
219
- });
220
- const listOpacity = listSlideAnim.interpolate({
221
- inputRange: [0, 1],
222
- outputRange: [1, 0]
223
- });
224
42
  const filtered = search ? data.filter(l => l.request.url.toLowerCase().includes(search.toLowerCase()) || l.request.method.toLowerCase().includes(search.toLowerCase())) : data;
225
43
  const sorted = [...filtered].sort((a, b) => b.timestamp - a.timestamp);
226
- const renderItem = ({
227
- item
228
- }) => {
229
- const ok = !item.error && (!item.response || item.response.status < 400);
230
- const sc = ok ? _constants.Colors.success : _constants.Colors.error;
231
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
232
- style: s.card,
233
- onPress: () => setSelectedLog(item),
234
- activeOpacity: 0.6,
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LogListScreen.LogListScreen, {
45
+ data: sorted,
46
+ reversed: false,
47
+ emptyText: "No HTTP requests logged",
48
+ renderListHeader: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
49
+ style: s.searchContainer,
235
50
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
51
+ style: s.searchBar,
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
53
+ style: s.searchIcon,
54
+ children: "\u2315"
55
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
56
+ style: s.search,
57
+ placeholder: "Search URLs...",
58
+ placeholderTextColor: _colors.Colors.textLight,
59
+ value: search,
60
+ onChangeText: setSearch
61
+ })]
62
+ })
63
+ }),
64
+ renderRow: item => {
65
+ const ok = !item.error && (!item.response || item.response.status < 400);
66
+ const sc = ok ? _colors.Colors.success : _colors.Colors.error;
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
236
68
  style: s.cardRow,
237
69
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
238
70
  style: [s.statusIndicator, {
@@ -244,7 +76,7 @@ const NetworkLogTab = exports.NetworkLogTab = /*#__PURE__*/_react.default.memo((
244
76
  style: s.cardMeta,
245
77
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
246
78
  style: [s.methodText, {
247
- color: (0, _constants.getMethodColor)(item.request.method)
79
+ color: (0, _colors.getMethodColor)(item.request.method)
248
80
  }],
249
81
  children: item.request.method
250
82
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -261,7 +93,7 @@ const NetworkLogTab = exports.NetworkLogTab = /*#__PURE__*/_react.default.memo((
261
93
  })]
262
94
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
263
95
  style: [s.url, !ok && {
264
- color: _constants.Colors.error
96
+ color: _colors.Colors.error
265
97
  }],
266
98
  numberOfLines: 2,
267
99
  children: item.request.url
@@ -270,129 +102,167 @@ const NetworkLogTab = exports.NetworkLogTab = /*#__PURE__*/_react.default.memo((
270
102
  children: new Date(item.timestamp).toLocaleTimeString()
271
103
  })]
272
104
  })]
273
- })
274
- });
275
- };
276
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
277
- style: s.container,
278
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
279
- style: [s.listWrap, selectedLog ? {
280
- opacity: listOpacity,
281
- transform: [{
282
- translateX: listTranslateX
283
- }]
284
- } : null],
285
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
286
- style: s.searchContainer,
287
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
288
- style: s.searchBar,
105
+ });
106
+ },
107
+ renderDetailHeader: log => {
108
+ const statusColor = log.error || log.response && log.response.status >= 400 ? _colors.Colors.error : _colors.Colors.success;
109
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
110
+ style: s.detailHeaderCenter,
111
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
112
+ style: [s.methodBadge, {
113
+ backgroundColor: (0, _colors.getMethodColor)(log.request.method)
114
+ }],
115
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
116
+ style: s.methodBadgeText,
117
+ children: log.request.method
118
+ })
119
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
120
+ style: [s.statusPill, {
121
+ backgroundColor: statusColor
122
+ }],
123
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
124
+ style: s.statusPillText,
125
+ children: log.response?.status ?? 'ERR'
126
+ })
127
+ }), log.duration != null && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
128
+ style: s.durationText,
129
+ children: [log.duration, "ms"]
130
+ })]
131
+ });
132
+ },
133
+ renderDetailBody: log => {
134
+ const curlStr = buildCurl(log);
135
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
136
+ style: s.detailBody,
137
+ contentContainerStyle: s.detailBodyContent,
138
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
139
+ style: s.urlCard,
289
140
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
290
- style: s.searchIcon,
291
- children: "\u2315"
292
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
293
- style: s.search,
294
- placeholder: "Search URLs...",
295
- placeholderTextColor: _constants.Colors.textLight,
296
- value: search,
297
- onChangeText: setSearch
141
+ style: s.urlText,
142
+ selectable: true,
143
+ numberOfLines: 3,
144
+ children: log.request.url
145
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
146
+ text: log.request.url,
147
+ label: "URL"
298
148
  })]
299
- })
300
- }), sorted.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
301
- style: s.emptyContainer,
302
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
303
- style: s.emptyIcon,
304
- children: "~"
305
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
306
- style: s.empty,
307
- children: "No HTTP requests logged"
149
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
150
+ title: "Request Body",
151
+ initiallyExpanded: true,
152
+ children: log.request.body != null ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
153
+ style: s.sectionWithCopy,
154
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
155
+ text: (0, _copyToComputer.fmt)(log.request.body),
156
+ label: "Request Body"
157
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
158
+ data: log.request.body,
159
+ maxHeight: 250
160
+ })]
161
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
162
+ style: s.emptySection,
163
+ children: "No request body"
164
+ })
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
166
+ title: "Request Headers",
167
+ children: log.request.headers ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
168
+ style: s.sectionWithCopy,
169
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
170
+ text: (0, _copyToComputer.fmt)(log.request.headers),
171
+ label: "Request Headers"
172
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
173
+ data: log.request.headers,
174
+ maxHeight: 200
175
+ })]
176
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
177
+ style: s.emptySection,
178
+ children: "No headers"
179
+ })
180
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CollapsibleSection.CollapsibleSection, {
181
+ title: `Response ${formatSize(log.response?.data)}`,
182
+ initiallyExpanded: true,
183
+ children: [log.error && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
184
+ style: s.errorBox,
185
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
186
+ style: s.errorIcon,
187
+ children: "\u26A0"
188
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
189
+ style: s.errorText,
190
+ children: log.error
191
+ })]
192
+ }), log.response?.data != null ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
193
+ style: s.sectionWithCopy,
194
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
195
+ text: (0, _copyToComputer.fmt)(log.response.data),
196
+ label: "Response Body"
197
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
198
+ data: log.response.data,
199
+ maxHeight: 300
200
+ })]
201
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
202
+ style: s.emptySection,
203
+ children: "No response body"
204
+ })]
205
+ }), log.response?.headers && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
206
+ title: "Response Headers",
207
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
208
+ style: s.sectionWithCopy,
209
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
210
+ text: (0, _copyToComputer.fmt)(log.response.headers),
211
+ label: "Response Headers"
212
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_JsonView.JsonView, {
213
+ data: log.response.headers,
214
+ maxHeight: 200
215
+ })]
216
+ })
217
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollapsibleSection.CollapsibleSection, {
218
+ title: "cURL",
219
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
220
+ style: s.sectionWithCopy,
221
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CopyButton.CopyButton, {
222
+ text: curlStr,
223
+ label: "cURL"
224
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
225
+ style: s.codeBlock,
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
227
+ style: s.codeText,
228
+ selectable: true,
229
+ children: curlStr
230
+ })
231
+ })]
232
+ })
308
233
  })]
309
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
310
- data: sorted,
311
- renderItem: renderItem,
312
- keyExtractor: item => item.id,
313
- contentContainerStyle: s.listContent,
314
- initialNumToRender: 20,
315
- maxToRenderPerBatch: 10,
316
- windowSize: 5,
317
- removeClippedSubviews: true
318
- })]
319
- }), selectedLog && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
320
- style: [s.detailOverlay, {
321
- transform: [{
322
- translateX: detailTranslateX
323
- }]
324
- }],
325
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NetworkLogDetail, {
326
- log: selectedLog,
327
- onBack: () => setSelectedLog(null)
328
- })
329
- })]
234
+ });
235
+ }
330
236
  });
331
237
  });
332
238
  const s = _reactNative.StyleSheet.create({
333
- container: {
334
- flex: 1,
335
- backgroundColor: _constants.Colors.background
336
- },
337
- listWrap: {
338
- position: 'absolute',
339
- top: 0,
340
- left: 0,
341
- right: 0,
342
- bottom: 0
343
- },
344
239
  // Search
345
240
  searchContainer: {
346
241
  paddingHorizontal: 12,
347
242
  paddingTop: 10,
348
243
  paddingBottom: 6,
349
- backgroundColor: _constants.Colors.background
244
+ backgroundColor: _colors.Colors.background
350
245
  },
351
246
  searchBar: {
352
247
  flexDirection: 'row',
353
248
  alignItems: 'center',
354
- backgroundColor: _constants.Colors.surface,
249
+ backgroundColor: _colors.Colors.surface,
355
250
  borderRadius: 10,
356
251
  paddingHorizontal: 10,
357
252
  height: 38
358
253
  },
359
254
  searchIcon: {
360
255
  fontSize: 16,
361
- color: _constants.Colors.textLight,
256
+ color: _colors.Colors.textLight,
362
257
  marginRight: 6
363
258
  },
364
259
  search: {
365
260
  flex: 1,
366
261
  fontSize: 14,
367
- color: _constants.Colors.text,
262
+ color: _colors.Colors.text,
368
263
  padding: 0
369
264
  },
370
- // Empty
371
- emptyContainer: {
372
- flex: 1,
373
- alignItems: 'center',
374
- justifyContent: 'center'
375
- },
376
- emptyIcon: {
377
- fontSize: 40,
378
- color: _constants.Colors.textLight,
379
- marginBottom: 4
380
- },
381
- empty: {
382
- textAlign: 'center',
383
- color: _constants.Colors.textLight,
384
- fontSize: 14
385
- },
386
- // List
387
- listContent: {
388
- padding: 12
389
- },
390
- card: {
391
- backgroundColor: _constants.Colors.surface,
392
- borderRadius: 12,
393
- marginBottom: 8,
394
- overflow: 'hidden'
395
- },
265
+ // Row
396
266
  cardRow: {
397
267
  flexDirection: 'row',
398
268
  padding: 14
@@ -427,61 +297,20 @@ const s = _reactNative.StyleSheet.create({
427
297
  },
428
298
  durationText: {
429
299
  fontSize: 12,
430
- color: _constants.Colors.textSecondary,
300
+ color: _colors.Colors.textSecondary,
431
301
  fontWeight: '500'
432
302
  },
433
303
  url: {
434
304
  fontSize: 13,
435
- color: _constants.Colors.textSecondary,
305
+ color: _colors.Colors.textSecondary,
436
306
  marginBottom: 4,
437
307
  lineHeight: 18
438
308
  },
439
309
  time: {
440
310
  fontSize: 11,
441
- color: _constants.Colors.textLight
442
- },
443
- // Detail overlay
444
- detailOverlay: {
445
- position: 'absolute',
446
- top: 0,
447
- left: 0,
448
- right: 0,
449
- bottom: 0,
450
- backgroundColor: _constants.Colors.background
451
- },
452
- detailWrap: {
453
- flex: 1,
454
- backgroundColor: _constants.Colors.background
455
- },
456
- detailHeader: {
457
- flexDirection: 'row',
458
- alignItems: 'center',
459
- paddingHorizontal: 8,
460
- paddingVertical: 10,
461
- backgroundColor: _constants.Colors.surface,
462
- borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
463
- borderBottomColor: _constants.Colors.border
464
- },
465
- backBtn: {
466
- flexDirection: 'row',
467
- alignItems: 'center',
468
- paddingHorizontal: 6,
469
- paddingVertical: 4,
470
- borderRadius: 8,
471
- marginRight: 8
472
- },
473
- backIcon: {
474
- fontSize: 24,
475
- fontWeight: '300',
476
- color: _constants.Colors.primary,
477
- marginTop: -2,
478
- marginRight: 2
479
- },
480
- backText: {
481
- fontSize: 16,
482
- color: _constants.Colors.primary,
483
- fontWeight: '500'
311
+ color: _colors.Colors.textLight
484
312
  },
313
+ // Detail header
485
314
  detailHeaderCenter: {
486
315
  flexDirection: 'row',
487
316
  alignItems: 'center',
@@ -508,6 +337,7 @@ const s = _reactNative.StyleSheet.create({
508
337
  fontSize: 11,
509
338
  fontWeight: '700'
510
339
  },
340
+ // Detail body
511
341
  detailBody: {
512
342
  flex: 1
513
343
  },
@@ -515,11 +345,10 @@ const s = _reactNative.StyleSheet.create({
515
345
  padding: 12,
516
346
  paddingBottom: 40
517
347
  },
518
- // Detail content
519
348
  urlCard: {
520
349
  flexDirection: 'row',
521
350
  alignItems: 'center',
522
- backgroundColor: _constants.Colors.surface,
351
+ backgroundColor: _colors.Colors.surface,
523
352
  borderRadius: 12,
524
353
  padding: 14,
525
354
  marginBottom: 8,
@@ -528,7 +357,7 @@ const s = _reactNative.StyleSheet.create({
528
357
  urlText: {
529
358
  flex: 1,
530
359
  fontSize: 13,
531
- color: _constants.Colors.textSecondary,
360
+ color: _colors.Colors.textSecondary,
532
361
  lineHeight: 18
533
362
  },
534
363
  sectionWithCopy: {
@@ -536,7 +365,7 @@ const s = _reactNative.StyleSheet.create({
536
365
  },
537
366
  emptySection: {
538
367
  fontSize: 13,
539
- color: _constants.Colors.textLight,
368
+ color: _colors.Colors.textLight,
540
369
  paddingVertical: 4
541
370
  },
542
371
  errorBox: {
@@ -552,12 +381,12 @@ const s = _reactNative.StyleSheet.create({
552
381
  },
553
382
  errorIcon: {
554
383
  fontSize: 14,
555
- color: _constants.Colors.error
384
+ color: _colors.Colors.error
556
385
  },
557
386
  errorText: {
558
387
  flex: 1,
559
388
  fontSize: 13,
560
- color: _constants.Colors.error,
389
+ color: _colors.Colors.error,
561
390
  lineHeight: 18
562
391
  },
563
392
  codeBlock: {