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
package/package.json CHANGED
@@ -1,43 +1,86 @@
1
1
  {
2
2
  "name": "react-native-debug-toolkit",
3
- "version": "0.6.4",
4
- "description": "A simple yet powerful debugging toolkit for React Native with a convenient floating UI for development",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "podspec": "react-native-debug-toolkit.podspec",
3
+ "version": "2.1.0",
4
+ "description": "A dev-only floating debug panel for React Native with network, console, Zustand, navigation, and event logs",
5
+ "main": "lib/commonjs/index.js",
6
+ "module": "lib/module/index.js",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "files": [
9
+ "src",
10
+ "lib",
11
+ "README.md",
12
+ "LICENSE",
13
+ "!**/__tests__",
14
+ "!**/__fixtures__",
15
+ "!**/__mocks__"
16
+ ],
8
17
  "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1",
10
- "bundle": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output dist/main.jsbundle --assets-dest dist"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://gitlab.outer.staruniongame.com/seaart-app-front/react-native-debug-toolkit.git"
18
+ "typecheck": "tsc --noEmit",
19
+ "typescript": "npm run typecheck",
20
+ "test": "jest",
21
+ "build": "bob build",
22
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
23
+ "prepare": "bob build"
15
24
  },
16
25
  "keywords": [
17
26
  "react-native",
18
27
  "debug",
19
28
  "toolkit",
20
- "logging",
29
+ "http-inspector",
21
30
  "development-tools",
22
- "floating-ui"
31
+ "floating-panel"
23
32
  ],
24
33
  "author": "zcj",
25
34
  "license": "MIT",
26
- "dependencies": {
27
- "react-native-mmkv": "2.12.2",
28
- "react-native-json-tree": "^1.5.0",
29
- "react-native-performance": "5.1.2",
30
- "react-native-root-siblings": "^4.0.0"
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/zcj0808/react-native-debug-toolkit"
38
+ },
39
+ "homepage": "https://github.com/zcj0808/react-native-debug-toolkit#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/zcj0808/react-native-debug-toolkit/issues"
31
42
  },
32
43
  "peerDependencies": {
33
- "react": "*",
34
- "react-native": "*"
44
+ "@react-native-clipboard/clipboard": ">=1.0.0",
45
+ "react": ">=18.0.0",
46
+ "react-native": ">=0.72.0"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "@react-native-clipboard/clipboard": {
50
+ "optional": true
51
+ }
35
52
  },
36
53
  "devDependencies": {
37
- "@types/react": "^18.0.0",
38
- "@types/react-native": "^0.70.0"
54
+ "@react-native/babel-preset": "^0.76.0",
55
+ "@react-native/eslint-config": "^0.76.0",
56
+ "@types/jest": "^30.0.0",
57
+ "@types/react": "^18.3.1",
58
+ "eslint": "^8.57.0",
59
+ "jest": "^30.3.0",
60
+ "prettier": "^3.3.0",
61
+ "react": "^18.3.1",
62
+ "react-native": "^0.76.6",
63
+ "react-native-builder-bob": "^0.30.0",
64
+ "ts-jest": "^29.4.9",
65
+ "typescript": "^5.5.0"
39
66
  },
40
- "jest": {
41
- "preset": "react-native"
67
+ "react-native": "src/index.ts",
68
+ "source": "src/index.ts",
69
+ "react-native-builder-bob": {
70
+ "source": "src",
71
+ "output": "lib",
72
+ "targets": [
73
+ "commonjs",
74
+ "module",
75
+ [
76
+ "typescript",
77
+ {
78
+ "project": "tsconfig.json"
79
+ }
80
+ ]
81
+ ]
82
+ },
83
+ "dependencies": {
84
+ "@babel/runtime": "^7.29.2"
42
85
  }
43
86
  }
@@ -0,0 +1,81 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
3
+ import { Colors } from '../utils/colors';
4
+ import { copyToComputer } from '../utils/copyToComputer';
5
+ import type { DebugFeatureRenderProps } from '../types';
6
+
7
+ export const ClipboardTab: React.FC<DebugFeatureRenderProps<void>> = React.memo(() => {
8
+ const [text, setText] = useState('');
9
+ const [feedback, setFeedback] = useState<string | null>(null);
10
+
11
+ const handleCopy = useCallback(() => {
12
+ if (!text) return;
13
+ try {
14
+ const result = copyToComputer(text, { label: 'Clipboard' });
15
+ setFeedback(result.method === 'clipboard' ? 'Copied' : 'Logged');
16
+ } catch {
17
+ setFeedback('Logged');
18
+ }
19
+ setTimeout(() => setFeedback(null), 2000);
20
+ }, [text]);
21
+
22
+ return (
23
+ <View style={s.container}>
24
+ <TextInput
25
+ style={s.input}
26
+ value={text}
27
+ onChangeText={setText}
28
+ placeholder="Paste or type text here..."
29
+ placeholderTextColor={Colors.textLight}
30
+ multiline
31
+ textAlignVertical="top"
32
+ />
33
+ <View style={s.footer}>
34
+ {text ? (
35
+ <TouchableOpacity style={s.copyBtn} onPress={handleCopy} activeOpacity={0.7}>
36
+ <Text style={s.copyBtnText}>{feedback ?? 'Copy'}</Text>
37
+ </TouchableOpacity>
38
+ ) : (
39
+ <Text style={s.hint}>Paste or type content above, then copy to computer</Text>
40
+ )}
41
+ </View>
42
+ </View>
43
+ );
44
+ });
45
+
46
+ const s = StyleSheet.create({
47
+ container: {
48
+ flex: 1,
49
+ backgroundColor: Colors.background,
50
+ padding: 12,
51
+ },
52
+ input: {
53
+ flex: 1,
54
+ backgroundColor: Colors.surface,
55
+ borderRadius: 12,
56
+ padding: 12,
57
+ fontSize: 14,
58
+ color: Colors.text,
59
+ lineHeight: 20,
60
+ },
61
+ footer: {
62
+ paddingTop: 8,
63
+ minHeight: 36,
64
+ alignItems: 'flex-end',
65
+ },
66
+ hint: {
67
+ fontSize: 12,
68
+ color: Colors.textLight,
69
+ },
70
+ copyBtn: {
71
+ backgroundColor: Colors.background,
72
+ paddingHorizontal: 16,
73
+ paddingVertical: 6,
74
+ borderRadius: 8,
75
+ },
76
+ copyBtnText: {
77
+ fontSize: 13,
78
+ color: Colors.primary,
79
+ fontWeight: '600',
80
+ },
81
+ });
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, ScrollView } from 'react-native';
3
+ import { Colors } from '../utils/colors';
4
+ import { safeStringify } from '../utils/safeStringify';
5
+ import { CollapsibleSection } from './shared/CollapsibleSection';
6
+ import { JsonView } from './shared/JsonView';
7
+ import { CopyButton } from './shared/CopyButton';
8
+ import { LogListScreen } from './shared/LogListScreen';
9
+ import { fmt } from '../utils/copyToComputer';
10
+ import type { ConsoleLogEntry, DebugFeatureRenderProps } from '../types';
11
+
12
+ const LEVEL_COLORS: Record<string, string> = {
13
+ log: '#8E8E93',
14
+ info: '#007AFF',
15
+ warn: '#FF9500',
16
+ error: '#FF3B30',
17
+ };
18
+
19
+ const LEVEL_ICONS: Record<string, string> = {
20
+ log: '●',
21
+ info: 'ℹ',
22
+ warn: '⚠',
23
+ error: '✕',
24
+ };
25
+
26
+ export const ConsoleLogTab: React.FC<DebugFeatureRenderProps<ConsoleLogEntry>> = React.memo(({ data }) => (
27
+ <LogListScreen
28
+ data={data}
29
+ emptyText="No console logs"
30
+ renderRow={(item) => (
31
+ <View style={s.cardRow}>
32
+ <View style={[s.levelDot, { backgroundColor: LEVEL_COLORS[item.level] ?? '#8E8E93' }]}>
33
+ <Text style={s.levelIcon}>{LEVEL_ICONS[item.level] ?? '●'}</Text>
34
+ </View>
35
+ <View style={s.cardContent}>
36
+ <Text style={s.logMessage} numberOfLines={2}>
37
+ {item.data.map((d) => (typeof d === 'string' ? d : safeStringify(d))).join(' ')}
38
+ </Text>
39
+ <Text style={s.time}>{new Date(item.timestamp).toLocaleTimeString()}</Text>
40
+ </View>
41
+ </View>
42
+ )}
43
+ renderDetailHeader={(item) => (
44
+ <>
45
+ <View style={[s.levelBadge, { backgroundColor: LEVEL_COLORS[item.level] ?? '#8E8E93' }]}>
46
+ <Text style={s.levelBadgeText}>{item.level.toUpperCase()}</Text>
47
+ </View>
48
+ <Text style={s.detailTime}>{new Date(item.timestamp).toLocaleString()}</Text>
49
+ </>
50
+ )}
51
+ renderDetailBody={(item) => (
52
+ <ScrollView style={s.detailBody} contentContainerStyle={s.detailBodyContent}>
53
+ {item.data.map((d, index) => {
54
+ const formatted = typeof d === 'object' && d !== null ? fmt(d) : String(d);
55
+ return (
56
+ <CollapsibleSection
57
+ key={index}
58
+ title={typeof d === 'object' && d !== null ? `Arg ${index + 1} (object)` : `Arg ${index + 1}`}
59
+ initiallyExpanded={index === 0}
60
+ >
61
+ <View style={s.sectionWithCopy}>
62
+ <CopyButton text={formatted} label={`Console Arg ${index + 1}`} />
63
+ {typeof d === 'object' && d !== null ? (
64
+ <JsonView data={d} maxHeight={250} />
65
+ ) : (
66
+ <Text style={s.plainText} selectable>{String(d)}</Text>
67
+ )}
68
+ </View>
69
+ </CollapsibleSection>
70
+ );
71
+ })}
72
+ </ScrollView>
73
+ )}
74
+ />
75
+ ));
76
+
77
+ const s = StyleSheet.create({
78
+ cardRow: { flexDirection: 'row', padding: 14, alignItems: 'flex-start' },
79
+ levelDot: {
80
+ width: 24, height: 24, borderRadius: 12,
81
+ alignItems: 'center', justifyContent: 'center',
82
+ marginRight: 12, marginTop: 1,
83
+ },
84
+ levelIcon: { color: '#FFF', fontSize: 11, fontWeight: '700' },
85
+ cardContent: { flex: 1 },
86
+ logMessage: { fontSize: 14, color: Colors.text, lineHeight: 20 },
87
+ time: { fontSize: 12, color: Colors.textSecondary, marginTop: 4 },
88
+ levelBadge: { paddingHorizontal: 10, paddingVertical: 4, borderRadius: 6 },
89
+ levelBadgeText: { color: '#FFF', fontSize: 12, fontWeight: '700' },
90
+ detailTime: { flex: 1, fontSize: 13, color: Colors.textSecondary, textAlign: 'right' },
91
+ detailBody: { flex: 1 },
92
+ detailBodyContent: { padding: 12 },
93
+ sectionWithCopy: { gap: 8 },
94
+ plainText: { fontFamily: 'Courier', fontSize: 13, color: Colors.text, lineHeight: 20 },
95
+ });
@@ -0,0 +1,215 @@
1
+ import React, { useCallback, useEffect, useRef } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ Animated,
7
+ PanResponder,
8
+ Pressable,
9
+ TouchableOpacity,
10
+ useWindowDimensions,
11
+ } from 'react-native';
12
+ import { Colors } from '../utils/colors';
13
+
14
+ interface DebugPanelProps {
15
+ onClose: () => void;
16
+ onClearAll: () => void;
17
+ children: React.ReactNode;
18
+ }
19
+
20
+ export function DebugPanel({ onClose, onClearAll, children }: DebugPanelProps) {
21
+ const { height: screenHeight } = useWindowDimensions();
22
+ const panelTranslateY = useRef(new Animated.Value(screenHeight)).current;
23
+ const backdropOpacity = useRef(new Animated.Value(0)).current;
24
+
25
+ useEffect(() => {
26
+ requestAnimationFrame(() => {
27
+ Animated.parallel([
28
+ Animated.spring(panelTranslateY, {
29
+ toValue: 0,
30
+ friction: 8,
31
+ tension: 65,
32
+ useNativeDriver: true,
33
+ }),
34
+ Animated.timing(backdropOpacity, {
35
+ toValue: 1,
36
+ duration: 250,
37
+ useNativeDriver: true,
38
+ }),
39
+ ]).start();
40
+ });
41
+ }, [panelTranslateY, backdropOpacity]);
42
+
43
+ const closePanel = useCallback(() => {
44
+ Animated.parallel([
45
+ Animated.spring(panelTranslateY, {
46
+ toValue: screenHeight,
47
+ friction: 8,
48
+ tension: 65,
49
+ useNativeDriver: true,
50
+ }),
51
+ Animated.timing(backdropOpacity, {
52
+ toValue: 0,
53
+ duration: 200,
54
+ useNativeDriver: true,
55
+ }),
56
+ ]).start(() => onClose());
57
+ }, [panelTranslateY, backdropOpacity, onClose, screenHeight]);
58
+
59
+ const panelResponder = useRef(
60
+ PanResponder.create({
61
+ onStartShouldSetPanResponder: () => true,
62
+ onMoveShouldSetPanResponder: (_, gs) => gs.dy > 5,
63
+ onPanResponderMove: (_, gs) => {
64
+ if (gs.dy > 0) {
65
+ panelTranslateY.setValue(gs.dy);
66
+ backdropOpacity.setValue(Math.max(0, 1 - gs.dy / 200));
67
+ }
68
+ },
69
+ onPanResponderRelease: (_, gs) => {
70
+ if (gs.dy > 100) {
71
+ closePanel();
72
+ } else {
73
+ Animated.spring(panelTranslateY, {
74
+ toValue: 0,
75
+ friction: 8,
76
+ tension: 50,
77
+ useNativeDriver: true,
78
+ }).start();
79
+ Animated.timing(backdropOpacity, {
80
+ toValue: 1,
81
+ duration: 200,
82
+ useNativeDriver: true,
83
+ }).start();
84
+ }
85
+ },
86
+ }),
87
+ ).current;
88
+
89
+ return (
90
+ <View style={styles.container}>
91
+ <Animated.View style={[styles.backdrop, { opacity: backdropOpacity }]}>
92
+ <Pressable style={styles.backdropPressable} onPress={closePanel} />
93
+ </Animated.View>
94
+ <Animated.View
95
+ style={[styles.panel, { transform: [{ translateY: panelTranslateY }] }]}
96
+ >
97
+ <View {...panelResponder.panHandlers}>
98
+ <View style={styles.dragHandle}>
99
+ <View style={styles.dragIndicator} />
100
+ </View>
101
+ <View style={styles.header}>
102
+ <Text style={styles.headerTitle}>Debug Toolkit</Text>
103
+ <View style={styles.headerButtons}>
104
+ <TouchableOpacity
105
+ onPress={() => {
106
+ onClearAll();
107
+ closePanel();
108
+ }}
109
+ style={styles.clearButton}
110
+ activeOpacity={0.6}
111
+ >
112
+ <Text style={styles.clearButtonText}>Clear</Text>
113
+ </TouchableOpacity>
114
+ <Pressable onPress={closePanel} style={styles.closeButton}>
115
+ <Text style={styles.closeButtonText}>✕</Text>
116
+ </Pressable>
117
+ </View>
118
+ </View>
119
+ </View>
120
+ <View style={styles.panelContent}>{children}</View>
121
+ </Animated.View>
122
+ </View>
123
+ );
124
+ }
125
+
126
+ const styles = StyleSheet.create({
127
+ container: {
128
+ position: 'absolute',
129
+ top: 0,
130
+ left: 0,
131
+ right: 0,
132
+ bottom: 0,
133
+ justifyContent: 'flex-end',
134
+ },
135
+ backdrop: {
136
+ position: 'absolute',
137
+ top: 0,
138
+ left: 0,
139
+ right: 0,
140
+ bottom: 0,
141
+ backgroundColor: 'rgba(0,0,0,0.35)',
142
+ },
143
+ backdropPressable: { flex: 1 },
144
+ panel: {
145
+ width: '100%',
146
+ height: '90%',
147
+ backgroundColor: Colors.background,
148
+ borderTopLeftRadius: 28,
149
+ borderTopRightRadius: 28,
150
+ overflow: 'hidden',
151
+ elevation: 24,
152
+ shadowColor: '#000',
153
+ shadowOffset: { width: 0, height: -4 },
154
+ shadowOpacity: 0.08,
155
+ shadowRadius: 12,
156
+ },
157
+ dragHandle: {
158
+ width: '100%',
159
+ height: 20,
160
+ alignItems: 'center',
161
+ justifyContent: 'center',
162
+ backgroundColor: Colors.surface,
163
+ },
164
+ dragIndicator: {
165
+ width: 40,
166
+ height: 4,
167
+ borderRadius: 2,
168
+ backgroundColor: '#D1D1D6',
169
+ },
170
+ panelContent: { flex: 1 },
171
+ header: {
172
+ flexDirection: 'row',
173
+ justifyContent: 'space-between',
174
+ alignItems: 'center',
175
+ paddingHorizontal: 20,
176
+ paddingTop: 6,
177
+ paddingBottom: 10,
178
+ backgroundColor: Colors.surface,
179
+ },
180
+ headerTitle: {
181
+ fontSize: 17,
182
+ fontWeight: '600',
183
+ color: Colors.text,
184
+ },
185
+ headerButtons: {
186
+ flexDirection: 'row',
187
+ alignItems: 'center',
188
+ gap: 12,
189
+ },
190
+ clearButton: {
191
+ paddingHorizontal: 12,
192
+ paddingVertical: 6,
193
+ borderRadius: 8,
194
+ backgroundColor: 'rgba(255,59,48,0.06)',
195
+ },
196
+ clearButtonText: {
197
+ color: Colors.error,
198
+ fontSize: 14,
199
+ fontWeight: '500',
200
+ },
201
+ closeButton: {
202
+ width: 30,
203
+ height: 30,
204
+ borderRadius: 15,
205
+ backgroundColor: Colors.background,
206
+ alignItems: 'center',
207
+ justifyContent: 'center',
208
+ },
209
+ closeButtonText: {
210
+ fontSize: 16,
211
+ fontWeight: '400',
212
+ color: Colors.textSecondary,
213
+ lineHeight: 16,
214
+ },
215
+ });
@@ -0,0 +1,80 @@
1
+ import React, { useEffect } from 'react';
2
+ import { DebugToolkitProvider } from '../core/DebugToolkitProvider';
3
+ import { initializeDebugToolkit } from '../initialize';
4
+ import type { FeatureConfigs } from '../initialize';
5
+ import { useNavigationLogger } from '../hooks/useNavigationLogger';
6
+ import type { EnvironmentConfig, NavigationContainerRef } from '../types';
7
+
8
+ // --- Types ---
9
+
10
+ export interface DebugViewProps {
11
+ children: React.ReactNode;
12
+ /**
13
+ * Enable/disable specific features. Omitted features default to enabled.
14
+ * Set to `false` to disable a feature.
15
+ */
16
+ features?: Partial<FeatureConfigs>;
17
+ /** Navigation container ref for route tracking. */
18
+ navigationRef?: React.RefObject<NavigationContainerRef | null>;
19
+ /** Environment configs for runtime host switching. */
20
+ environments?: EnvironmentConfig[];
21
+ /** Force enable/disable (default: `__DEV__`). */
22
+ enabled?: boolean;
23
+ }
24
+
25
+ // --- Inner component for navigation hook (satisfies rules of hooks) ---
26
+
27
+ function NavigationLoggerInner({
28
+ navigationRef,
29
+ }: {
30
+ navigationRef: React.RefObject<NavigationContainerRef | null>;
31
+ }) {
32
+ useNavigationLogger(navigationRef);
33
+ return null;
34
+ }
35
+
36
+ // --- Main component ---
37
+
38
+ export function DebugView({
39
+ children,
40
+ features,
41
+ navigationRef,
42
+ environments,
43
+ enabled,
44
+ }: DebugViewProps) {
45
+ useEffect(() => {
46
+ // Build feature config: all enabled by default, user overrides take precedence
47
+ const resolvedFeatures: FeatureConfigs = {
48
+ network: true,
49
+ console: true,
50
+ zustand: true,
51
+ navigation: true,
52
+ track: true,
53
+ clipboard: true,
54
+ ...features,
55
+ };
56
+
57
+ // Apply environments prop
58
+ if (environments) {
59
+ resolvedFeatures.environment = environments;
60
+ }
61
+
62
+ // Initialize toolkit
63
+ const toolkit = initializeDebugToolkit({
64
+ features: resolvedFeatures,
65
+ enabled,
66
+ });
67
+
68
+ return () => {
69
+ toolkit.destroy();
70
+ };
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
+ }, []);
73
+
74
+ return (
75
+ <DebugToolkitProvider>
76
+ {navigationRef && <NavigationLoggerInner navigationRef={navigationRef} />}
77
+ {children}
78
+ </DebugToolkitProvider>
79
+ );
80
+ }