react-native-debug-toolkit 0.6.4 → 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 (340) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -211
  3. package/README.zh-CN.md +150 -171
  4. package/lib/commonjs/components/ClipboardTab.js +91 -0
  5. package/lib/commonjs/components/ClipboardTab.js.map +1 -0
  6. package/lib/commonjs/components/ConsoleLogTab.js +162 -0
  7. package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
  8. package/lib/commonjs/components/DebugPanel.js +230 -0
  9. package/lib/commonjs/components/DebugPanel.js.map +1 -0
  10. package/lib/commonjs/components/DebugView.js +66 -0
  11. package/lib/commonjs/components/DebugView.js.map +1 -0
  12. package/lib/commonjs/components/EnvironmentTab.js +287 -0
  13. package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
  14. package/lib/commonjs/components/FeatureTabBar.js +182 -0
  15. package/lib/commonjs/components/FeatureTabBar.js.map +1 -0
  16. package/lib/commonjs/components/FloatIcon.js +187 -0
  17. package/lib/commonjs/components/FloatIcon.js.map +1 -0
  18. package/lib/commonjs/components/FloatPanelView.js +214 -0
  19. package/lib/commonjs/components/FloatPanelView.js.map +1 -0
  20. package/lib/commonjs/components/NavigationLogTab.js +131 -0
  21. package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
  22. package/lib/commonjs/components/NetworkLogTab.js +404 -0
  23. package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
  24. package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
  25. package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
  26. package/lib/commonjs/components/TrackLogTab.js +230 -0
  27. package/lib/commonjs/components/TrackLogTab.js.map +1 -0
  28. package/lib/commonjs/components/ZustandLogTab.js +311 -0
  29. package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
  30. package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
  31. package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
  32. package/lib/commonjs/components/shared/CopyButton.js +64 -0
  33. package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
  34. package/lib/commonjs/components/shared/JsonView.js +157 -0
  35. package/lib/commonjs/components/shared/JsonView.js.map +1 -0
  36. package/lib/commonjs/components/shared/LogListScreen.js +174 -0
  37. package/lib/commonjs/components/shared/LogListScreen.js.map +1 -0
  38. package/lib/commonjs/core/DebugToolkit.js +122 -0
  39. package/lib/commonjs/core/DebugToolkit.js.map +1 -0
  40. package/lib/commonjs/core/DebugToolkitProvider.js +66 -0
  41. package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
  42. package/lib/commonjs/features/ClipboardFeature.js +21 -0
  43. package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
  44. package/lib/commonjs/features/ConsoleLogFeature.js +115 -0
  45. package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
  46. package/lib/commonjs/features/EnvironmentFeature.js +160 -0
  47. package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
  48. package/lib/commonjs/features/NavigationLogFeature.js +39 -0
  49. package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
  50. package/lib/commonjs/features/NetworkFeature.js +107 -0
  51. package/lib/commonjs/features/NetworkFeature.js.map +1 -0
  52. package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
  53. package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
  54. package/lib/commonjs/features/TrackFeature.js +34 -0
  55. package/lib/commonjs/features/TrackFeature.js.map +1 -0
  56. package/lib/commonjs/features/ZustandLogFeature.js +59 -0
  57. package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
  58. package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
  59. package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
  60. package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
  61. package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
  62. package/lib/commonjs/index.js +152 -0
  63. package/lib/commonjs/index.js.map +1 -0
  64. package/lib/commonjs/initialize.js +84 -0
  65. package/lib/commonjs/initialize.js.map +1 -0
  66. package/lib/commonjs/interceptors/networkInterceptor.js +466 -0
  67. package/lib/commonjs/interceptors/networkInterceptor.js.map +1 -0
  68. package/lib/commonjs/native/NativeDebugLibs.js +58 -0
  69. package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
  70. package/lib/commonjs/package.json +1 -0
  71. package/lib/commonjs/types/index.js +6 -0
  72. package/lib/commonjs/types/index.js.map +1 -0
  73. package/lib/commonjs/utils/colors.js +48 -0
  74. package/lib/commonjs/utils/colors.js.map +1 -0
  75. package/lib/commonjs/utils/copyToComputer.js +97 -0
  76. package/lib/commonjs/utils/copyToComputer.js.map +1 -0
  77. package/lib/commonjs/utils/createChannelFeature.js +48 -0
  78. package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
  79. package/lib/commonjs/utils/createEventChannel.js +21 -0
  80. package/lib/commonjs/utils/createEventChannel.js.map +1 -0
  81. package/lib/commonjs/utils/createObservableStore.js +38 -0
  82. package/lib/commonjs/utils/createObservableStore.js.map +1 -0
  83. package/lib/commonjs/utils/layout.js +8 -0
  84. package/lib/commonjs/utils/layout.js.map +1 -0
  85. package/lib/commonjs/utils/safeStringify.js +27 -0
  86. package/lib/commonjs/utils/safeStringify.js.map +1 -0
  87. package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
  88. package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
  89. package/lib/module/components/ClipboardTab.js +86 -0
  90. package/lib/module/components/ClipboardTab.js.map +1 -0
  91. package/lib/module/components/ConsoleLogTab.js +157 -0
  92. package/lib/module/components/ConsoleLogTab.js.map +1 -0
  93. package/lib/module/components/DebugPanel.js +225 -0
  94. package/lib/module/components/DebugPanel.js.map +1 -0
  95. package/lib/module/components/DebugView.js +61 -0
  96. package/lib/module/components/DebugView.js.map +1 -0
  97. package/lib/module/components/EnvironmentTab.js +282 -0
  98. package/lib/module/components/EnvironmentTab.js.map +1 -0
  99. package/lib/module/components/FeatureTabBar.js +177 -0
  100. package/lib/module/components/FeatureTabBar.js.map +1 -0
  101. package/lib/module/components/FloatIcon.js +182 -0
  102. package/lib/module/components/FloatIcon.js.map +1 -0
  103. package/lib/module/components/FloatPanelView.js +209 -0
  104. package/lib/module/components/FloatPanelView.js.map +1 -0
  105. package/lib/module/components/NavigationLogTab.js +126 -0
  106. package/lib/module/components/NavigationLogTab.js.map +1 -0
  107. package/lib/module/components/NetworkLogTab.js +399 -0
  108. package/lib/module/components/NetworkLogTab.js.map +1 -0
  109. package/lib/module/components/ThirdPartyLibsTab.js +91 -0
  110. package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
  111. package/lib/module/components/TrackLogTab.js +225 -0
  112. package/lib/module/components/TrackLogTab.js.map +1 -0
  113. package/lib/module/components/ZustandLogTab.js +306 -0
  114. package/lib/module/components/ZustandLogTab.js.map +1 -0
  115. package/lib/module/components/shared/CollapsibleSection.js +78 -0
  116. package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
  117. package/lib/module/components/shared/CopyButton.js +58 -0
  118. package/lib/module/components/shared/CopyButton.js.map +1 -0
  119. package/lib/module/components/shared/JsonView.js +152 -0
  120. package/lib/module/components/shared/JsonView.js.map +1 -0
  121. package/lib/module/components/shared/LogListScreen.js +169 -0
  122. package/lib/module/components/shared/LogListScreen.js.map +1 -0
  123. package/lib/module/core/DebugToolkit.js +118 -0
  124. package/lib/module/core/DebugToolkit.js.map +1 -0
  125. package/lib/module/core/DebugToolkitProvider.js +60 -0
  126. package/lib/module/core/DebugToolkitProvider.js.map +1 -0
  127. package/lib/module/features/ClipboardFeature.js +16 -0
  128. package/lib/module/features/ClipboardFeature.js.map +1 -0
  129. package/lib/module/features/ConsoleLogFeature.js +109 -0
  130. package/lib/module/features/ConsoleLogFeature.js.map +1 -0
  131. package/lib/module/features/EnvironmentFeature.js +156 -0
  132. package/lib/module/features/EnvironmentFeature.js.map +1 -0
  133. package/lib/module/features/NavigationLogFeature.js +32 -0
  134. package/lib/module/features/NavigationLogFeature.js.map +1 -0
  135. package/lib/module/features/NetworkFeature.js +101 -0
  136. package/lib/module/features/NetworkFeature.js.map +1 -0
  137. package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
  138. package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
  139. package/lib/module/features/TrackFeature.js +27 -0
  140. package/lib/module/features/TrackFeature.js.map +1 -0
  141. package/lib/module/features/ZustandLogFeature.js +53 -0
  142. package/lib/module/features/ZustandLogFeature.js.map +1 -0
  143. package/lib/module/hooks/useNavigationLogger.js +74 -0
  144. package/lib/module/hooks/useNavigationLogger.js.map +1 -0
  145. package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
  146. package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
  147. package/lib/module/index.js +28 -0
  148. package/lib/module/index.js.map +1 -0
  149. package/lib/module/initialize.js +80 -0
  150. package/lib/module/initialize.js.map +1 -0
  151. package/lib/module/interceptors/networkInterceptor.js +460 -0
  152. package/lib/module/interceptors/networkInterceptor.js.map +1 -0
  153. package/lib/module/native/NativeDebugLibs.js +54 -0
  154. package/lib/module/native/NativeDebugLibs.js.map +1 -0
  155. package/lib/module/package.json +1 -0
  156. package/lib/module/types/index.js +4 -0
  157. package/lib/module/types/index.js.map +1 -0
  158. package/lib/module/utils/colors.js +43 -0
  159. package/lib/module/utils/colors.js.map +1 -0
  160. package/lib/module/utils/copyToComputer.js +91 -0
  161. package/lib/module/utils/copyToComputer.js.map +1 -0
  162. package/lib/module/utils/createChannelFeature.js +44 -0
  163. package/lib/module/utils/createChannelFeature.js.map +1 -0
  164. package/lib/module/utils/createEventChannel.js +17 -0
  165. package/lib/module/utils/createEventChannel.js.map +1 -0
  166. package/lib/module/utils/createObservableStore.js +34 -0
  167. package/lib/module/utils/createObservableStore.js.map +1 -0
  168. package/lib/module/utils/layout.js +4 -0
  169. package/lib/module/utils/layout.js.map +1 -0
  170. package/lib/module/utils/safeStringify.js +23 -0
  171. package/lib/module/utils/safeStringify.js.map +1 -0
  172. package/lib/module/utils/urlRewriterRegistry.js +10 -0
  173. package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
  174. package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
  175. package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
  176. package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
  177. package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
  178. package/lib/typescript/src/components/DebugPanel.d.ts +9 -0
  179. package/lib/typescript/src/components/DebugPanel.d.ts.map +1 -0
  180. package/lib/typescript/src/components/DebugView.d.ts +19 -0
  181. package/lib/typescript/src/components/DebugView.d.ts.map +1 -0
  182. package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
  183. package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
  184. package/lib/typescript/src/components/FeatureTabBar.d.ts +13 -0
  185. package/lib/typescript/src/components/FeatureTabBar.d.ts.map +1 -0
  186. package/lib/typescript/src/components/FloatIcon.d.ts +12 -0
  187. package/lib/typescript/src/components/FloatIcon.d.ts.map +1 -0
  188. package/lib/typescript/src/components/FloatPanelView.d.ts +9 -0
  189. package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
  190. package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
  191. package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
  192. package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
  193. package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
  194. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
  195. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
  196. package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
  197. package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
  198. package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
  199. package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
  200. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
  201. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
  202. package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
  203. package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
  204. package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
  205. package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
  206. package/lib/typescript/src/components/shared/LogListScreen.d.ts +21 -0
  207. package/lib/typescript/src/components/shared/LogListScreen.d.ts.map +1 -0
  208. package/lib/typescript/src/core/DebugToolkit.d.ts +20 -0
  209. package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
  210. package/lib/typescript/src/core/DebugToolkitProvider.d.ts +15 -0
  211. package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
  212. package/lib/typescript/src/features/ClipboardFeature.d.ts +7 -0
  213. package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
  214. package/lib/typescript/src/features/ConsoleLogFeature.d.ts +9 -0
  215. package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
  216. package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
  217. package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
  218. package/lib/typescript/src/features/NavigationLogFeature.d.ts +10 -0
  219. package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
  220. package/lib/typescript/src/features/NetworkFeature.d.ts +15 -0
  221. package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
  222. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
  223. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
  224. package/lib/typescript/src/features/TrackFeature.d.ts +14 -0
  225. package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
  226. package/lib/typescript/src/features/ZustandLogFeature.d.ts +31 -0
  227. package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
  228. package/lib/typescript/src/hooks/useNavigationLogger.d.ts +13 -0
  229. package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
  230. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
  231. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
  232. package/lib/typescript/src/index.d.ts +26 -0
  233. package/lib/typescript/src/index.d.ts.map +1 -0
  234. package/lib/typescript/src/initialize.d.ts +32 -0
  235. package/lib/typescript/src/initialize.d.ts.map +1 -0
  236. package/lib/typescript/src/interceptors/networkInterceptor.d.ts +18 -0
  237. package/lib/typescript/src/interceptors/networkInterceptor.d.ts.map +1 -0
  238. package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
  239. package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
  240. package/lib/typescript/src/types/index.d.ts +109 -0
  241. package/lib/typescript/src/types/index.d.ts.map +1 -0
  242. package/lib/typescript/src/utils/colors.d.ts +21 -0
  243. package/lib/typescript/src/utils/colors.d.ts.map +1 -0
  244. package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
  245. package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
  246. package/lib/typescript/src/utils/createChannelFeature.d.ts +18 -0
  247. package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
  248. package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
  249. package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
  250. package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
  251. package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
  252. package/lib/typescript/src/utils/layout.d.ts +2 -0
  253. package/lib/typescript/src/utils/layout.d.ts.map +1 -0
  254. package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
  255. package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
  256. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
  257. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
  258. package/package.json +67 -24
  259. package/src/components/ClipboardTab.tsx +81 -0
  260. package/src/components/ConsoleLogTab.tsx +95 -0
  261. package/src/components/DebugPanel.tsx +215 -0
  262. package/src/components/DebugView.tsx +80 -0
  263. package/src/components/EnvironmentTab.tsx +276 -0
  264. package/src/components/FeatureTabBar.tsx +204 -0
  265. package/src/components/FloatIcon.tsx +171 -0
  266. package/src/components/FloatPanelView.tsx +202 -0
  267. package/src/components/NavigationLogTab.tsx +66 -0
  268. package/src/components/NetworkLogTab.tsx +270 -0
  269. package/src/components/ThirdPartyLibsTab.tsx +63 -0
  270. package/src/components/TrackLogTab.tsx +110 -0
  271. package/src/components/ZustandLogTab.tsx +203 -0
  272. package/src/components/shared/CollapsibleSection.tsx +78 -0
  273. package/src/components/shared/CopyButton.tsx +68 -0
  274. package/src/components/shared/JsonView.tsx +125 -0
  275. package/src/components/shared/LogListScreen.tsx +164 -0
  276. package/src/core/DebugToolkit.tsx +150 -0
  277. package/src/core/DebugToolkitProvider.tsx +83 -0
  278. package/src/features/ClipboardFeature.ts +15 -0
  279. package/src/features/ConsoleLogFeature.ts +116 -0
  280. package/src/features/EnvironmentFeature.ts +186 -0
  281. package/src/features/NavigationLogFeature.ts +44 -0
  282. package/src/features/NetworkFeature.ts +126 -0
  283. package/src/features/ThirdPartyLibsFeature.ts +42 -0
  284. package/src/features/TrackFeature.ts +34 -0
  285. package/src/features/ZustandLogFeature.ts +101 -0
  286. package/src/hooks/useNavigationLogger.ts +102 -0
  287. package/src/hooks/useSlideDetailAnimation.ts +45 -0
  288. package/src/index.ts +48 -0
  289. package/src/initialize.ts +122 -0
  290. package/src/interceptors/networkInterceptor.ts +646 -0
  291. package/src/native/NativeDebugLibs.ts +74 -0
  292. package/src/types/index.ts +127 -0
  293. package/src/utils/colors.ts +38 -0
  294. package/src/utils/copyToComputer.ts +104 -0
  295. package/src/utils/createChannelFeature.ts +55 -0
  296. package/src/utils/createEventChannel.ts +22 -0
  297. package/src/utils/createObservableStore.ts +42 -0
  298. package/src/utils/layout.ts +1 -0
  299. package/src/utils/safeStringify.ts +25 -0
  300. package/src/utils/urlRewriterRegistry.ts +10 -0
  301. package/.cursor/rules/react-native.mdc +0 -41
  302. package/index.js +0 -41
  303. package/ios/BuildTypeModule.h +0 -9
  304. package/ios/BuildTypeModule.m +0 -42
  305. package/ios/RNDebugLibs.h +0 -10
  306. package/ios/RNDebugLibs.m +0 -79
  307. package/lib/DebugToolKit.js +0 -126
  308. package/lib/EnvironmentManager.ts +0 -80
  309. package/lib/NativeDebugLibs.js +0 -67
  310. package/lib/features/ConsoleLogFeature.js +0 -70
  311. package/lib/features/NavigationLogFeature.js +0 -45
  312. package/lib/features/NetworkFeature.js +0 -389
  313. package/lib/features/PerformanceFeature.js +0 -390
  314. package/lib/features/ThirdPartyLibsFeature.js +0 -63
  315. package/lib/features/TrackFeature.js +0 -94
  316. package/lib/features/ZustandLogFeature.js +0 -44
  317. package/lib/hooks/useNavigationLogger.js +0 -92
  318. package/lib/index.js +0 -114
  319. package/lib/navigation/NavigationLogger.js +0 -1
  320. package/lib/types/TrackTypes.ts +0 -92
  321. package/lib/utils/DebugConst.js +0 -67
  322. package/lib/utils/StorageUtils.js +0 -80
  323. package/lib/views/ConsoleLogDetails.js +0 -314
  324. package/lib/views/FloatPanelView.js +0 -697
  325. package/lib/views/HttpLogDetails.js +0 -648
  326. package/lib/views/NavigationLogDetails.js +0 -302
  327. package/lib/views/RestartModal.js +0 -75
  328. package/lib/views/SubViewConsoleLogs.js +0 -209
  329. package/lib/views/SubViewEnvironment.js +0 -73
  330. package/lib/views/SubViewHTTPLogs.js +0 -235
  331. package/lib/views/SubViewNavigationLogs.js +0 -199
  332. package/lib/views/SubViewPerformance.js +0 -515
  333. package/lib/views/SubViewThirdPartyLibs.js +0 -239
  334. package/lib/views/SubViewTrackLogs.js +0 -318
  335. package/lib/views/SubViewZustandLogs.js +0 -279
  336. package/lib/views/TabView.js +0 -66
  337. package/lib/views/TrackLogDetails.js +0 -481
  338. package/lib/views/ZustandLogDetails.js +0 -355
  339. package/react-native-debug-toolkit.podspec +0 -25
  340. package/react-native.config.js +0 -18
@@ -1,648 +0,0 @@
1
- import React, { useState, useCallback } from 'react'
2
- import { View, Text, StyleSheet, Clipboard, Dimensions } from 'react-native'
3
- import { ScrollView, Pressable } from 'react-native'
4
- import JSONTree from 'react-native-json-tree'
5
- const { width: SCREEN_WIDTH } = Dimensions.get('window')
6
- const theme = {
7
- scheme: 'monokai',
8
- author: 'wimer hazenberg (http://www.monokai.nl)',
9
- base00: '#272822',
10
- base01: '#383830',
11
- base02: '#49483e',
12
- base03: '#75715e',
13
- base04: '#a59f85',
14
- base05: '#f8f8f2',
15
- base06: '#f5f4f1',
16
- base07: '#f9f8f5',
17
- base08: '#f92672',
18
- base09: '#fd971f',
19
- base0A: '#f4bf75',
20
- base0B: '#a6e22e',
21
- base0C: '#a1efe4',
22
- base0D: '#66d9ef',
23
- base0E: '#ae81ff',
24
- base0F: '#cc6633'
25
- };
26
-
27
- const CopyButton = ({ text, style }) => {
28
- const [copied, setCopied] = useState(false)
29
-
30
- const handleCopy = async () => {
31
- await Clipboard.setString(text)
32
- setCopied(true)
33
- setTimeout(() => setCopied(false), 2000)
34
- }
35
-
36
- return (
37
- <Pressable style={[styles.copyButton, style]} onPress={handleCopy}>
38
- <Text style={styles.copyButtonText}>{copied ? 'Copied!' : 'Copy'}</Text>
39
- </Pressable>
40
- )
41
- }
42
-
43
- const CollapsibleSection = ({ title, children, initiallyExpanded = false }) => {
44
- const [expanded, setExpanded] = useState(initiallyExpanded)
45
-
46
- return (
47
- <View style={styles.collapsibleSection}>
48
- <Pressable
49
- style={styles.sectionHeader}
50
- onPress={() => setExpanded(!expanded)}>
51
- <Text style={styles.sectionTitle}>{title}</Text>
52
- <Text style={styles.expandIcon}>{expanded ? '▼' : '▶'}</Text>
53
- </Pressable>
54
- {expanded && children}
55
- </View>
56
- )
57
- }
58
-
59
- const LongTextContent = ({ text }) => {
60
- return (
61
- <View style={styles.longTextWrapper}>
62
- <ScrollView
63
- style={styles.longTextContainer}
64
- contentContainerStyle={styles.longTextContent}
65
- showsVerticalScrollIndicator={true}
66
- nestedScrollEnabled={true}
67
- bounces={false}>
68
- <Text style={styles.jsonString} selectable={true}>
69
- {text}
70
- </Text>
71
- </ScrollView>
72
- </View>
73
- )
74
- }
75
-
76
- const JSONValue = ({ value, path = '', level = 0, maxExpandLevel = 2 }) => {
77
- if (value === null) {
78
- return <Text style={styles.jsonNull}>null</Text>
79
- }
80
-
81
- if (value === undefined) {
82
- return <Text style={styles.jsonNull}>undefined</Text>
83
- }
84
-
85
- if (typeof value === 'boolean') {
86
- return <Text style={styles.jsonBoolean}>{value.toString()}</Text>
87
- }
88
-
89
- if (typeof value === 'number') {
90
- return <Text style={styles.jsonNumber}>{value}</Text>
91
- }
92
-
93
- if (typeof value === 'string') {
94
- if (value.length > 150) {
95
- return (
96
- <CollapsibleSection title={`String (${value.length} chars)`} initiallyExpanded={false}>
97
- <LongTextContent text={value} />
98
- </CollapsibleSection>
99
- )
100
- }
101
-
102
- return (
103
- <Text style={styles.jsonString} selectable={true}>
104
- {value}
105
- </Text>
106
- )
107
- }
108
-
109
- // For objects and arrays, use JSONTree for improved large data handling
110
- if (typeof value === 'object') {
111
- return (
112
- <JSONTree
113
- data={value}
114
- theme={theme}
115
- invertTheme={true}
116
- hideRoot={true}
117
- shouldExpandNode={(keyPath, nodeData, currentLevel) => currentLevel < maxExpandLevel}
118
- />
119
- )
120
- }
121
-
122
- return <Text>{String(value)}</Text>
123
- }
124
-
125
- const ApiStatus = ({ status, success }) => {
126
- let statusColor = '#666'
127
- let statusText = ''
128
-
129
- if (typeof status === 'number') {
130
- statusText = status.toString()
131
-
132
- if (status >= 200 && status < 300) {
133
- statusColor = '#00C851'
134
- } else if (status >= 400) {
135
- statusColor = '#ff4444'
136
- }
137
- } else if (success === false) {
138
- statusColor = '#ff4444'
139
- statusText = 'Error'
140
- } else if (success === true) {
141
- statusColor = '#00C851'
142
- statusText = 'Success'
143
- }
144
-
145
- return (
146
- <Text style={[styles.statusPill, { backgroundColor: statusColor }]}>
147
- {statusText}
148
- </Text>
149
- )
150
- }
151
-
152
- const HttpLogDetails = ({ log }) => {
153
- const formatDataSize = (data) => {
154
- if (!data) {
155
- return '(empty)'
156
- }
157
-
158
- try {
159
- const stringData = typeof data === 'string' ? data : JSON.stringify(data)
160
- // Use string length as an approximation instead of TextEncoder
161
- const bytes = stringData.length
162
-
163
- if (bytes < 1024) {
164
- return `(${bytes} B)`
165
- } else if (bytes < 1024 * 1024) {
166
- return `(${(bytes / 1024).toFixed(1)} KB)`
167
- } else {
168
- return `(${(bytes / (1024 * 1024)).toFixed(1)} MB)`
169
- }
170
- } catch (e) {
171
- return '(size unknown)'
172
- }
173
- }
174
-
175
- const generateCurl = useCallback(() => {
176
- if (!log.request) {
177
- return 'curl command unavailable'
178
- }
179
-
180
- let curl = `curl -X ${log.request.method || 'GET'} '${log.request.url}'`
181
-
182
- // Add headers
183
- if (log.request.headers && Object.keys(log.request.headers).length > 0) {
184
- Object.entries(log.request.headers).forEach(([key, value]) => {
185
- if (typeof value === 'string') {
186
- curl += ` \\\n -H '${key}: ${value}'`
187
- }
188
- })
189
- }
190
-
191
- // Add body
192
- if (log.request.body) {
193
- try {
194
- const bodyStr =
195
- typeof log.request.body === 'string'
196
- ? log.request.body
197
- : JSON.stringify(log.request.body)
198
-
199
- curl += ` \\\n -d '${bodyStr.replace(/'/g, "'\\''")}'`
200
- } catch (e) {
201
- // Skip body if it can't be stringified
202
- }
203
- }
204
-
205
- return curl
206
- }, [log])
207
-
208
- if (!log) {
209
- return (
210
- <View style={styles.errorContainer}>
211
- <Text style={styles.errorText}>Log data is missing</Text>
212
- </View>
213
- )
214
- }
215
-
216
- const request = log.request || {}
217
- const response = log.response || {}
218
- const status = response.status
219
- const success = response.success
220
- const error = log.error
221
- const duration = log.duration
222
-
223
- const requestData = request.body
224
- const responseData = response.data
225
- const responseSize = formatDataSize(responseData)
226
-
227
- return (
228
- <ScrollView
229
- style={styles.container}
230
- contentContainerStyle={styles.contentContainer}
231
- showsVerticalScrollIndicator={true}
232
- scrollEventThrottle={16}
233
- keyboardShouldPersistTaps='handled'>
234
- <View style={styles.header}>
235
- <View style={styles.headerInfo}>
236
- <Text style={styles.url} numberOfLines={2} selectable={true}>
237
- {request.url || 'Unknown URL'}
238
- </Text>
239
- <View style={styles.methodRow}>
240
- <Text
241
- style={[
242
- styles.method,
243
- { color: getMethodColor(request.method) },
244
- ]}>
245
- {(request.method || 'GET').toUpperCase()}
246
- </Text>
247
- {status && <ApiStatus status={status} success={success} />}
248
- {duration && <Text style={styles.duration}>(duration:{duration}ms)</Text>}
249
- </View>
250
- </View>
251
- <CopyButton text={request.url || ''} />
252
- </View>
253
-
254
- <CollapsibleSection title='Request' initiallyExpanded={true}>
255
- <View style={styles.content}>
256
- {requestData && (
257
- <View style={styles.dataSection}>
258
- <View style={styles.dataSectionHeader}>
259
- <Text style={styles.dataSectionTitle}>
260
- Body {formatDataSize(requestData)}
261
- </Text>
262
- <CopyButton
263
- text={
264
- typeof requestData === 'string'
265
- ? requestData
266
- : JSON.stringify(requestData, null, 2)
267
- }
268
- />
269
- </View>
270
- <View style={styles.dataContentWrapper}>
271
- <ScrollView
272
- style={styles.dataContent}
273
- nestedScrollEnabled={true}
274
- bounces={false}
275
- showsVerticalScrollIndicator={true}>
276
- <JSONValue value={requestData} maxExpandLevel={1} />
277
- </ScrollView>
278
- </View>
279
- </View>
280
- )}
281
-
282
- <CollapsibleSection title='Headers'>
283
- <View style={styles.dataContentWrapper}>
284
- <ScrollView
285
- style={styles.dataContent}
286
- nestedScrollEnabled={true}
287
- bounces={false}
288
- showsVerticalScrollIndicator={true}>
289
- <JSONValue value={request.headers || {}} maxExpandLevel={0} />
290
- </ScrollView>
291
- </View>
292
- </CollapsibleSection>
293
- </View>
294
- </CollapsibleSection>
295
-
296
- <CollapsibleSection
297
- title={`Response ${responseSize}`}
298
- initiallyExpanded={true}>
299
- <View style={styles.content}>
300
- {/* <View style={styles.row}>
301
- <Text style={styles.label}>Status: {status || (success === false ? 'Error' : 'Unknown')}
302
- {status && response.statusText ? ` (${response.statusText})` : ''}
303
- {duration && ` Duration: (${duration}ms)`}
304
- </Text>
305
- </View> */}
306
-
307
- {error && (
308
- <View style={styles.errorSection}>
309
- <Text style={styles.errorLabel}>Error:</Text>
310
- <Text style={styles.errorValue} selectable={true}>
311
- {error}
312
- </Text>
313
- </View>
314
- )}
315
-
316
- {responseData && (
317
- <View style={styles.dataSection}>
318
- <View style={styles.dataSectionHeader}>
319
- <Text style={styles.dataSectionTitle}>Body</Text>
320
- <CopyButton
321
- text={
322
- typeof responseData === 'string'
323
- ? responseData
324
- : JSON.stringify(responseData, null, 2)
325
- }
326
- />
327
- </View>
328
- <View style={styles.dataContentWrapper}>
329
- <ScrollView
330
- style={styles.dataContent}
331
- nestedScrollEnabled={true}
332
- bounces={false}
333
- showsVerticalScrollIndicator={true}>
334
- <JSONValue value={responseData} maxExpandLevel={2} />
335
- </ScrollView>
336
- </View>
337
- </View>
338
- )}
339
-
340
- <CollapsibleSection title='Headers'>
341
- <View style={styles.dataContentWrapper}>
342
- <ScrollView
343
- style={styles.dataContent}
344
- nestedScrollEnabled={true}
345
- bounces={false}
346
- showsVerticalScrollIndicator={true}>
347
- <JSONValue value={response.headers || {}} maxExpandLevel={0} />
348
- </ScrollView>
349
- </View>
350
- </CollapsibleSection>
351
- </View>
352
- </CollapsibleSection>
353
-
354
- <CollapsibleSection title='cURL Command'>
355
- <View style={styles.content}>
356
- <View style={styles.codeBlockContainer}>
357
- <View style={styles.codeBlockHeader}>
358
- <Text style={styles.codeBlockLabel}>Debug with cURL</Text>
359
- <CopyButton text={generateCurl()} />
360
- </View>
361
- <View style={styles.dataContentWrapper}>
362
- <ScrollView
363
- style={styles.codeBlock}
364
- nestedScrollEnabled={true}
365
- bounces={false}
366
- showsVerticalScrollIndicator={true}>
367
- <Text style={styles.codeText} selectable={true}>
368
- {generateCurl()}
369
- </Text>
370
- </ScrollView>
371
- </View>
372
- </View>
373
- </View>
374
- </CollapsibleSection>
375
-
376
- <CollapsibleSection title='Timing'>
377
- <View style={styles.content}>
378
- <Text style={styles.label}>Time:</Text>
379
- <Text style={styles.value}>
380
- {log.timestamp
381
- ? new Date(log.timestamp).toLocaleString()
382
- : 'Unknown'}
383
- </Text>
384
-
385
- <Text style={styles.label}>Duration:</Text>
386
- <Text style={styles.value}>
387
- {log.duration ? `${log.duration}ms` : 'Unknown'}
388
- </Text>
389
- </View>
390
- </CollapsibleSection>
391
- </ScrollView>
392
- )
393
- }
394
-
395
- const getMethodColor = (method) => {
396
- switch (method?.toUpperCase()) {
397
- case 'GET':
398
- return '#0D96F2' // Standard API blue
399
- case 'POST':
400
- return '#49CC90' // Swagger green
401
- case 'PUT':
402
- return '#FCA130' // Standard PUT orange
403
- case 'DELETE':
404
- return '#F93E3E' // Standard DELETE red
405
- default:
406
- return '#666666'
407
- }
408
- }
409
-
410
- const styles = StyleSheet.create({
411
- container: {
412
- flex: 1,
413
- backgroundColor: '#fff',
414
- },
415
- contentContainer: {
416
- paddingBottom: 20,
417
- },
418
- header: {
419
- flexDirection: 'row',
420
- padding: 15,
421
- borderBottomWidth: 1,
422
- borderBottomColor: '#eee',
423
- alignItems: 'flex-start',
424
- },
425
- headerInfo: {
426
- flex: 1,
427
- marginRight: 10,
428
- },
429
- url: {
430
- fontSize: 14,
431
- color: '#333',
432
- marginBottom: 6,
433
- fontWeight: '500',
434
- },
435
- methodRow: {
436
- flexDirection: 'row',
437
- alignItems: 'center',
438
- },
439
- method: {
440
- fontSize: 14,
441
- fontWeight: 'bold',
442
- marginRight: 8,
443
- },
444
- statusPill: {
445
- paddingHorizontal: 8,
446
- paddingVertical: 2,
447
- borderRadius: 12,
448
- color: 'white',
449
- fontSize: 12,
450
- fontWeight: 'bold',
451
- },
452
- collapsibleSection: {
453
- marginBottom: 1,
454
- backgroundColor: '#fff',
455
- },
456
- sectionHeader: {
457
- flexDirection: 'row',
458
- justifyContent: 'space-between',
459
- alignItems: 'center',
460
- padding: 15,
461
- backgroundColor: '#f5f5f5',
462
- },
463
- sectionTitle: {
464
- fontSize: 15,
465
- fontWeight: 'bold',
466
- color: '#333',
467
- },
468
- expandIcon: {
469
- fontSize: 14,
470
- color: '#666',
471
- },
472
- content: {
473
- padding: 15,
474
- },
475
- row: {
476
- marginBottom: 10,
477
- },
478
- label: {
479
- fontSize: 14,
480
- fontWeight: 'bold',
481
- color: '#666',
482
- marginBottom: 5,
483
- },
484
- value: {
485
- fontSize: 14,
486
- color: '#333',
487
- marginBottom: 10,
488
- },
489
- errorContainer: {
490
- flex: 1,
491
- justifyContent: 'center',
492
- alignItems: 'center',
493
- padding: 20,
494
- },
495
- errorText: {
496
- color: '#ff4444',
497
- fontSize: 16,
498
- },
499
- errorSection: {
500
- backgroundColor: '#fff8f8',
501
- padding: 10,
502
- borderRadius: 4,
503
- borderWidth: 1,
504
- borderColor: '#ffdddd',
505
- marginBottom: 15,
506
- },
507
- errorLabel: {
508
- fontSize: 14,
509
- fontWeight: 'bold',
510
- color: '#ff4444',
511
- marginBottom: 5,
512
- },
513
- errorValue: {
514
- fontSize: 14,
515
- color: '#ff4444',
516
- },
517
- dataSection: {
518
- marginBottom: 15,
519
- },
520
- dataSectionHeader: {
521
- flexDirection: 'row',
522
- justifyContent: 'space-between',
523
- alignItems: 'center',
524
- marginBottom: 5,
525
- },
526
- dataSectionTitle: {
527
- fontSize: 14,
528
- fontWeight: 'bold',
529
- color: '#666',
530
- },
531
- dataContentWrapper: {
532
- flex: 1,
533
- },
534
- dataContent: {
535
- flex: 1,
536
- backgroundColor: '#f8f9fa',
537
- padding: 10,
538
- borderRadius: 4,
539
- borderWidth: 1,
540
- borderColor: '#e9ecef',
541
- },
542
- codeBlockContainer: {
543
- marginBottom: 15,
544
- },
545
- codeBlockHeader: {
546
- flexDirection: 'row',
547
- justifyContent: 'space-between',
548
- alignItems: 'center',
549
- marginBottom: 5,
550
- },
551
- codeBlockLabel: {
552
- fontSize: 12,
553
- color: '#666',
554
- fontWeight: 'bold',
555
- },
556
- codeBlock: {
557
- flex: 1,
558
- backgroundColor: '#f8f9fa',
559
- padding: 10,
560
- borderRadius: 4,
561
- borderWidth: 1,
562
- borderColor: '#e9ecef',
563
- },
564
- codeText: {
565
- fontSize: 13,
566
- color: '#333',
567
- fontFamily: 'Courier',
568
- },
569
- copyButton: {
570
- backgroundColor: '#e9ecef',
571
- paddingHorizontal: 10,
572
- paddingVertical: 5,
573
- borderRadius: 4,
574
- },
575
- copyButtonText: {
576
- fontSize: 12,
577
- color: '#666',
578
- },
579
- jsonContainer: {
580
- marginVertical: 2,
581
- },
582
- jsonToggle: {
583
- flexDirection: 'row',
584
- alignItems: 'center',
585
- },
586
- jsonBrackets: {
587
- color: '#666',
588
- fontWeight: 'bold',
589
- },
590
- jsonCollapsed: {
591
- color: '#888',
592
- fontSize: 12,
593
- fontStyle: 'italic',
594
- },
595
- jsonChildren: {
596
- paddingLeft: 16,
597
- borderLeftWidth: 1,
598
- borderLeftColor: '#e0e0e0',
599
- },
600
- jsonProperty: {
601
- flexDirection: 'row',
602
- flexWrap: 'wrap',
603
- marginVertical: 2,
604
- },
605
- jsonArrayItem: {
606
- flexDirection: 'row',
607
- flexWrap: 'wrap',
608
- marginVertical: 2,
609
- },
610
- jsonKey: {
611
- color: '#7B61AB',
612
- fontWeight: '500',
613
- },
614
- jsonValue: {
615
- flex: 1,
616
- },
617
- jsonString: {
618
- color: '#CB772F',
619
- },
620
- jsonNumber: {
621
- color: '#2878D0',
622
- },
623
- jsonBoolean: {
624
- color: '#2878D0',
625
- fontWeight: 'bold',
626
- },
627
- jsonNull: {
628
- color: '#A0A0A0',
629
- fontStyle: 'italic',
630
- },
631
- jsonObject: {
632
- color: '#666',
633
- },
634
- jsonArray: {
635
- color: '#666',
636
- },
637
- longTextContainer: {
638
- flex: 1,
639
- paddingHorizontal: 8,
640
- paddingVertical: 5,
641
- backgroundColor: '#f8f9fa',
642
- },
643
- longTextContent: {
644
- paddingBottom: 10,
645
- },
646
- })
647
-
648
- export default HttpLogDetails