react-native-debug-toolkit 2.0.0 → 2.2.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.
- package/README.md +82 -120
- package/README.zh-CN.md +171 -0
- package/lib/commonjs/core/DebugToolkit.js +117 -115
- package/lib/commonjs/core/DebugToolkit.js.map +1 -1
- package/lib/commonjs/core/DebugToolkitProvider.js +38 -30
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -1
- package/lib/commonjs/core/initialize.js +84 -0
- package/lib/commonjs/core/initialize.js.map +1 -0
- package/lib/commonjs/{components → features/clipboard}/ClipboardTab.js +16 -17
- package/lib/commonjs/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/commonjs/features/{ClipboardFeature.js → clipboard/index.js} +9 -5
- package/lib/commonjs/features/clipboard/index.js.map +1 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js +162 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/features/console/index.js +118 -0
- package/lib/commonjs/features/console/index.js.map +1 -0
- package/lib/commonjs/{components → features/environment}/EnvironmentTab.js +24 -25
- package/lib/commonjs/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- package/lib/commonjs/features/environment/index.js.map +1 -0
- package/lib/commonjs/{components → features/navigation}/NavigationLogTab.js +11 -10
- package/lib/commonjs/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/features/navigation/index.js +39 -0
- package/lib/commonjs/features/navigation/index.js.map +1 -0
- package/lib/commonjs/{hooks → features/navigation}/useNavigationLogger.js +3 -3
- package/lib/commonjs/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/features/network/NetworkLogTab.js +405 -0
- package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/features/network/index.js +96 -0
- package/lib/commonjs/features/network/index.js.map +1 -0
- package/lib/commonjs/features/network/networkInterceptor.js +261 -0
- package/lib/commonjs/features/network/networkInterceptor.js.map +1 -0
- package/lib/commonjs/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +10 -9
- package/lib/commonjs/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +8 -8
- package/lib/commonjs/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/commonjs/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/commonjs/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/commonjs/features/track/TrackLogTab.js +230 -0
- package/lib/commonjs/features/track/TrackLogTab.js.map +1 -0
- package/lib/commonjs/features/track/index.js +39 -0
- package/lib/commonjs/features/track/index.js.map +1 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js +311 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/features/zustand/index.js +59 -0
- package/lib/commonjs/features/zustand/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/environment.js +2 -0
- package/lib/commonjs/types/environment.js.map +1 -0
- package/lib/commonjs/types/feature.js +6 -0
- package/lib/commonjs/types/feature.js.map +1 -0
- package/lib/commonjs/types/index.js +0 -4
- package/lib/commonjs/types/logs.js +2 -0
- package/lib/commonjs/types/logs.js.map +1 -0
- package/lib/commonjs/types/navigation.js +2 -0
- package/lib/commonjs/types/navigation.js.map +1 -0
- package/lib/commonjs/types/thirdPartyLibs.js +2 -0
- package/lib/commonjs/types/thirdPartyLibs.js.map +1 -0
- package/lib/commonjs/ui/DebugView.js +66 -0
- package/lib/commonjs/ui/DebugView.js.map +1 -0
- package/lib/commonjs/ui/floating/FloatIcon.js +240 -0
- package/lib/commonjs/ui/floating/FloatIcon.js.map +1 -0
- package/lib/commonjs/ui/panel/DebugPanel.js +230 -0
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js +182 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js +238 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CollapsibleSection.js +4 -4
- package/lib/commonjs/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CopyButton.js +3 -3
- package/lib/commonjs/ui/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/ui/shared/JsonView.js.map +1 -0
- package/lib/commonjs/ui/shared/LogListScreen.js +174 -0
- package/lib/commonjs/ui/shared/LogListScreen.js.map +1 -0
- package/lib/commonjs/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/ui/theme/colors.js +43 -0
- package/lib/commonjs/ui/theme/colors.js.map +1 -0
- package/lib/commonjs/ui/theme/layout.js +8 -0
- package/lib/commonjs/ui/theme/layout.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +62 -0
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +5 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -1
- package/lib/commonjs/utils/createPersistedObservableStore.js +71 -0
- package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/commonjs/utils/debugPreferences.js +52 -0
- package/lib/commonjs/utils/debugPreferences.js.map +1 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +117 -114
- package/lib/module/core/DebugToolkit.js.map +1 -1
- package/lib/module/core/DebugToolkitProvider.js +39 -31
- package/lib/module/core/DebugToolkitProvider.js.map +1 -1
- package/lib/module/core/initialize.js +80 -0
- package/lib/module/core/initialize.js.map +1 -0
- package/lib/module/{components → features/clipboard}/ClipboardTab.js +9 -9
- package/lib/module/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/module/features/clipboard/index.js +16 -0
- package/lib/module/features/clipboard/index.js.map +1 -0
- package/lib/module/features/console/ConsoleLogTab.js +157 -0
- package/lib/module/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/module/features/console/index.js +112 -0
- package/lib/module/features/console/index.js.map +1 -0
- package/lib/module/{components → features/environment}/EnvironmentTab.js +5 -5
- package/lib/module/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/module/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- package/lib/module/features/environment/index.js.map +1 -0
- package/lib/module/{components → features/navigation}/NavigationLogTab.js +4 -3
- package/lib/module/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/module/features/navigation/index.js +32 -0
- package/lib/module/features/navigation/index.js.map +1 -0
- package/lib/module/{hooks → features/navigation}/useNavigationLogger.js +2 -2
- package/lib/module/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/module/features/network/NetworkLogTab.js +400 -0
- package/lib/module/features/network/NetworkLogTab.js.map +1 -0
- package/lib/module/features/network/index.js +90 -0
- package/lib/module/features/network/index.js.map +1 -0
- package/lib/module/features/network/networkInterceptor.js +256 -0
- package/lib/module/features/network/networkInterceptor.js.map +1 -0
- package/lib/module/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +3 -2
- package/lib/module/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +4 -4
- package/lib/module/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/module/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/module/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/module/features/track/TrackLogTab.js +225 -0
- package/lib/module/features/track/TrackLogTab.js.map +1 -0
- package/lib/module/features/track/index.js +32 -0
- package/lib/module/features/track/index.js.map +1 -0
- package/lib/module/features/zustand/ZustandLogTab.js +306 -0
- package/lib/module/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/module/features/zustand/index.js +53 -0
- package/lib/module/features/zustand/index.js.map +1 -0
- package/lib/module/index.js +11 -12
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/environment.js +2 -0
- package/lib/module/types/environment.js.map +1 -0
- package/lib/module/types/feature.js +4 -0
- package/lib/module/types/feature.js.map +1 -0
- package/lib/module/types/index.js +0 -2
- package/lib/module/types/logs.js +2 -0
- package/lib/module/types/logs.js.map +1 -0
- package/lib/module/types/navigation.js +2 -0
- package/lib/module/types/navigation.js.map +1 -0
- package/lib/module/types/thirdPartyLibs.js +2 -0
- package/lib/module/types/thirdPartyLibs.js.map +1 -0
- package/lib/module/ui/DebugView.js +61 -0
- package/lib/module/ui/DebugView.js.map +1 -0
- package/lib/module/ui/floating/FloatIcon.js +235 -0
- package/lib/module/ui/floating/FloatIcon.js.map +1 -0
- package/lib/module/ui/panel/DebugPanel.js +225 -0
- package/lib/module/ui/panel/DebugPanel.js.map +1 -0
- package/lib/module/ui/panel/FeatureTabBar.js +177 -0
- package/lib/module/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/module/ui/panel/FloatPanelView.js +233 -0
- package/lib/module/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/module/{components → ui}/shared/CollapsibleSection.js +1 -1
- package/lib/module/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/{components → ui}/shared/CopyButton.js +1 -1
- package/lib/module/ui/shared/CopyButton.js.map +1 -0
- package/lib/module/ui/shared/JsonView.js.map +1 -0
- package/lib/module/ui/shared/LogListScreen.js +169 -0
- package/lib/module/ui/shared/LogListScreen.js.map +1 -0
- package/lib/module/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/ui/theme/colors.js +38 -0
- package/lib/module/ui/theme/colors.js.map +1 -0
- package/lib/module/ui/theme/layout.js +4 -0
- package/lib/module/ui/theme/layout.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +58 -0
- package/lib/module/utils/createChannelFeature.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +5 -0
- package/lib/module/utils/createObservableStore.js.map +1 -1
- package/lib/module/utils/createPersistedObservableStore.js +67 -0
- package/lib/module/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/module/utils/debugPreferences.js +46 -0
- package/lib/module/utils/debugPreferences.js.map +1 -0
- package/lib/module/utils/urlRewriterRegistry.js +10 -0
- package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +17 -20
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -1
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +4 -7
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/initialize.d.ts +32 -0
- package/lib/typescript/src/core/initialize.d.ts.map +1 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/features/clipboard/index.d.ts +7 -0
- package/lib/typescript/src/features/clipboard/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/console}/ConsoleLogTab.d.ts +2 -2
- package/lib/typescript/src/features/console/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/console/index.d.ts +9 -0
- package/lib/typescript/src/features/console/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/environment}/EnvironmentTab.d.ts +1 -1
- package/lib/typescript/src/features/environment/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{EnvironmentFeature.d.ts → environment/index.d.ts} +2 -2
- package/lib/typescript/src/features/environment/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/navigation}/NavigationLogTab.d.ts +2 -2
- package/lib/typescript/src/features/navigation/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{NavigationLogFeature.d.ts → navigation/index.d.ts} +5 -3
- package/lib/typescript/src/features/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/{hooks → features/navigation}/useNavigationLogger.d.ts +1 -8
- package/lib/typescript/src/features/navigation/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/network}/NetworkLogTab.d.ts +2 -2
- package/lib/typescript/src/features/network/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/network/index.d.ts +15 -0
- package/lib/typescript/src/features/network/index.d.ts.map +1 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts +19 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.d.ts +2 -2
- package/lib/typescript/src/features/thirdPartyLibs/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts +3 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts.map +1 -0
- package/lib/typescript/src/{native/NativeDebugLibs.d.ts → features/thirdPartyLibs/nativeDebugLibs.d.ts} +1 -1
- package/lib/typescript/src/features/thirdPartyLibs/nativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/track}/TrackLogTab.d.ts +2 -2
- package/lib/typescript/src/features/track/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{TrackFeature.d.ts → track/index.d.ts} +5 -3
- package/lib/typescript/src/features/track/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/zustand}/ZustandLogTab.d.ts +2 -2
- package/lib/typescript/src/features/zustand/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{ZustandLogFeature.d.ts → zustand/index.d.ts} +5 -3
- package/lib/typescript/src/features/zustand/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +20 -20
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/environment.d.ts +11 -0
- package/lib/typescript/src/types/environment.d.ts.map +1 -0
- package/lib/typescript/src/types/feature.d.ts +23 -0
- package/lib/typescript/src/types/feature.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +5 -111
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/logs.d.ts +51 -0
- package/lib/typescript/src/types/logs.d.ts.map +1 -0
- package/lib/typescript/src/types/navigation.d.ts +8 -0
- package/lib/typescript/src/types/navigation.d.ts.map +1 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts +13 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts.map +1 -0
- package/lib/typescript/src/ui/DebugView.d.ts +19 -0
- package/lib/typescript/src/ui/DebugView.d.ts.map +1 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts +12 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts +9 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts +13 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts +12 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/LogListScreen.d.ts +21 -0
- package/lib/typescript/src/ui/shared/LogListScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/colors.d.ts +21 -0
- package/lib/typescript/src/ui/theme/colors.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/layout.d.ts +2 -0
- package/lib/typescript/src/ui/theme/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +27 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +15 -0
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts +10 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts.map +1 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/core/DebugToolkit.tsx +144 -142
- package/src/core/DebugToolkitProvider.tsx +44 -43
- package/src/core/initialize.ts +122 -0
- package/src/{components → features/clipboard}/ClipboardTab.tsx +10 -10
- package/src/features/clipboard/index.ts +15 -0
- package/src/features/console/ConsoleLogTab.tsx +95 -0
- package/src/features/console/index.ts +119 -0
- package/src/{components → features/environment}/EnvironmentTab.tsx +7 -7
- package/src/features/{EnvironmentFeature.ts → environment/index.ts} +27 -25
- package/src/{components → features/navigation}/NavigationLogTab.tsx +6 -5
- package/src/features/navigation/index.ts +44 -0
- package/src/{hooks → features/navigation}/useNavigationLogger.ts +3 -8
- package/src/features/network/NetworkLogTab.tsx +271 -0
- package/src/features/network/index.ts +113 -0
- package/src/features/network/networkInterceptor.ts +311 -0
- package/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.tsx +6 -5
- package/src/features/{ThirdPartyLibsFeature.ts → thirdPartyLibs/index.ts} +5 -5
- package/src/features/track/TrackLogTab.tsx +110 -0
- package/src/features/track/index.ts +41 -0
- package/src/features/zustand/ZustandLogTab.tsx +203 -0
- package/src/features/{ZustandLogFeature.ts → zustand/index.ts} +19 -45
- package/src/index.ts +20 -24
- package/src/types/environment.ts +11 -0
- package/src/types/feature.ts +32 -0
- package/src/types/index.ts +29 -138
- package/src/types/logs.ts +54 -0
- package/src/types/navigation.ts +5 -0
- package/src/types/thirdPartyLibs.ts +13 -0
- package/src/ui/DebugView.tsx +80 -0
- package/src/ui/floating/FloatIcon.tsx +202 -0
- package/src/ui/panel/DebugPanel.tsx +215 -0
- package/src/ui/panel/FeatureTabBar.tsx +204 -0
- package/src/ui/panel/FloatPanelView.tsx +227 -0
- package/src/{components → ui}/shared/CollapsibleSection.tsx +1 -1
- package/src/{components → ui}/shared/CopyButton.tsx +1 -1
- package/src/ui/shared/LogListScreen.tsx +164 -0
- package/src/ui/theme/colors.ts +33 -0
- package/src/ui/theme/layout.ts +1 -0
- package/src/utils/createChannelFeature.ts +80 -0
- package/src/utils/createObservableStore.ts +6 -0
- package/src/utils/createPersistedObservableStore.ts +76 -0
- package/src/utils/debugPreferences.ts +48 -0
- package/src/utils/urlRewriterRegistry.ts +10 -0
- package/lib/commonjs/components/ClipboardTab.js.map +0 -1
- package/lib/commonjs/components/ConsoleLogTab.js +0 -295
- package/lib/commonjs/components/ConsoleLogTab.js.map +0 -1
- package/lib/commonjs/components/EnvironmentTab.js.map +0 -1
- package/lib/commonjs/components/FloatPanelView.js +0 -797
- package/lib/commonjs/components/FloatPanelView.js.map +0 -1
- package/lib/commonjs/components/NavigationLogTab.js.map +0 -1
- package/lib/commonjs/components/NetworkLogTab.js +0 -575
- package/lib/commonjs/components/NetworkLogTab.js.map +0 -1
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/commonjs/components/TrackLogTab.js +0 -372
- package/lib/commonjs/components/TrackLogTab.js.map +0 -1
- package/lib/commonjs/components/ZustandLogTab.js +0 -451
- package/lib/commonjs/components/ZustandLogTab.js.map +0 -1
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/commonjs/components/shared/CopyButton.js.map +0 -1
- package/lib/commonjs/components/shared/JsonView.js.map +0 -1
- package/lib/commonjs/features/ClipboardFeature.js.map +0 -1
- package/lib/commonjs/features/ConsoleLogFeature.js +0 -98
- package/lib/commonjs/features/ConsoleLogFeature.js.map +0 -1
- package/lib/commonjs/features/EnvironmentFeature.js.map +0 -1
- package/lib/commonjs/features/NavigationLogFeature.js +0 -60
- package/lib/commonjs/features/NavigationLogFeature.js.map +0 -1
- package/lib/commonjs/features/NetworkFeature.js +0 -328
- package/lib/commonjs/features/NetworkFeature.js.map +0 -1
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/commonjs/features/TrackFeature.js +0 -55
- package/lib/commonjs/features/TrackFeature.js.map +0 -1
- package/lib/commonjs/features/ZustandLogFeature.js +0 -76
- package/lib/commonjs/features/ZustandLogFeature.js.map +0 -1
- package/lib/commonjs/hooks/useNavigationLogger.js.map +0 -1
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/commonjs/initialize.js +0 -161
- package/lib/commonjs/initialize.js.map +0 -1
- package/lib/commonjs/native/NativeDebugLibs.js.map +0 -1
- package/lib/commonjs/utils/constants.js +0 -135
- package/lib/commonjs/utils/constants.js.map +0 -1
- package/lib/module/components/ClipboardTab.js.map +0 -1
- package/lib/module/components/ConsoleLogTab.js +0 -290
- package/lib/module/components/ConsoleLogTab.js.map +0 -1
- package/lib/module/components/EnvironmentTab.js.map +0 -1
- package/lib/module/components/FloatPanelView.js +0 -791
- package/lib/module/components/FloatPanelView.js.map +0 -1
- package/lib/module/components/NavigationLogTab.js.map +0 -1
- package/lib/module/components/NetworkLogTab.js +0 -570
- package/lib/module/components/NetworkLogTab.js.map +0 -1
- package/lib/module/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/module/components/TrackLogTab.js +0 -367
- package/lib/module/components/TrackLogTab.js.map +0 -1
- package/lib/module/components/ZustandLogTab.js +0 -446
- package/lib/module/components/ZustandLogTab.js.map +0 -1
- package/lib/module/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/module/components/shared/CopyButton.js.map +0 -1
- package/lib/module/components/shared/JsonView.js.map +0 -1
- package/lib/module/features/ClipboardFeature.js +0 -12
- package/lib/module/features/ClipboardFeature.js.map +0 -1
- package/lib/module/features/ConsoleLogFeature.js +0 -93
- package/lib/module/features/ConsoleLogFeature.js.map +0 -1
- package/lib/module/features/EnvironmentFeature.js.map +0 -1
- package/lib/module/features/NavigationLogFeature.js +0 -54
- package/lib/module/features/NavigationLogFeature.js.map +0 -1
- package/lib/module/features/NetworkFeature.js +0 -322
- package/lib/module/features/NetworkFeature.js.map +0 -1
- package/lib/module/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/module/features/TrackFeature.js +0 -49
- package/lib/module/features/TrackFeature.js.map +0 -1
- package/lib/module/features/ZustandLogFeature.js +0 -69
- package/lib/module/features/ZustandLogFeature.js.map +0 -1
- package/lib/module/hooks/useNavigationLogger.js.map +0 -1
- package/lib/module/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/module/initialize.js +0 -156
- package/lib/module/initialize.js.map +0 -1
- package/lib/module/native/NativeDebugLibs.js.map +0 -1
- package/lib/module/utils/constants.js +0 -130
- package/lib/module/utils/constants.js.map +0 -1
- package/lib/typescript/src/components/ClipboardTab.d.ts +0 -4
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +0 -1
- package/lib/typescript/src/components/FloatPanelView.d.ts +0 -64
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +0 -1
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +0 -1
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +0 -1
- package/lib/typescript/src/features/ClipboardFeature.d.ts +0 -3
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +0 -7
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NetworkFeature.d.ts +0 -28
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +0 -3
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/TrackFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +0 -1
- package/lib/typescript/src/initialize.d.ts +0 -51
- package/lib/typescript/src/initialize.d.ts.map +0 -1
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +0 -1
- package/lib/typescript/src/utils/constants.d.ts +0 -96
- package/lib/typescript/src/utils/constants.d.ts.map +0 -1
- package/src/components/ConsoleLogTab.tsx +0 -209
- package/src/components/FloatPanelView.tsx +0 -714
- package/src/components/NetworkLogTab.tsx +0 -411
- package/src/components/TrackLogTab.tsx +0 -245
- package/src/components/ZustandLogTab.tsx +0 -305
- package/src/features/ClipboardFeature.ts +0 -11
- package/src/features/ConsoleLogFeature.ts +0 -118
- package/src/features/NavigationLogFeature.ts +0 -74
- package/src/features/NetworkFeature.ts +0 -488
- package/src/features/TrackFeature.ts +0 -69
- package/src/initialize.ts +0 -214
- package/src/utils/constants.ts +0 -91
- /package/lib/commonjs/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/commonjs/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/module/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/module/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CollapsibleSection.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CopyButton.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/JsonView.d.ts +0 -0
- /package/lib/typescript/src/{hooks → ui/shared}/useSlideDetailAnimation.d.ts +0 -0
- /package/src/{native/NativeDebugLibs.ts → features/thirdPartyLibs/nativeDebugLibs.ts} +0 -0
- /package/src/{components → ui}/shared/JsonView.tsx +0 -0
- /package/src/{hooks → ui/shared}/useSlideDetailAnimation.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-debug-toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A dev-only floating debug panel for React Native with network, console, Zustand, navigation, and event logs",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
19
19
|
"typescript": "npm run typecheck",
|
|
20
|
+
"test": "jest",
|
|
20
21
|
"build": "bob build",
|
|
21
22
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
22
23
|
"prepare": "bob build"
|
|
@@ -52,12 +53,15 @@
|
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@react-native/babel-preset": "^0.76.0",
|
|
54
55
|
"@react-native/eslint-config": "^0.76.0",
|
|
56
|
+
"@types/jest": "^30.0.0",
|
|
55
57
|
"@types/react": "^18.3.1",
|
|
56
58
|
"eslint": "^8.57.0",
|
|
59
|
+
"jest": "^30.3.0",
|
|
57
60
|
"prettier": "^3.3.0",
|
|
58
61
|
"react": "^18.3.1",
|
|
59
62
|
"react-native": "^0.76.6",
|
|
60
63
|
"react-native-builder-bob": "^0.30.0",
|
|
64
|
+
"ts-jest": "^29.4.9",
|
|
61
65
|
"typescript": "^5.5.0"
|
|
62
66
|
},
|
|
63
67
|
"react-native": "src/index.ts",
|
|
@@ -1,174 +1,176 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export class DebugToolkit {
|
|
4
|
-
private static instance: DebugToolkit | null = null;
|
|
5
|
-
private _features: DebugFeature[] = [];
|
|
6
|
-
private _enabled: boolean;
|
|
7
|
-
private _panelVisible: boolean = false;
|
|
8
|
-
private renderCallback: (() => void) | null = null;
|
|
9
|
-
|
|
10
|
-
private constructor(enabled = true) {
|
|
11
|
-
this._enabled = enabled;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static getInstance(enabled = true): DebugToolkit {
|
|
15
|
-
if (!DebugToolkit.instance) {
|
|
16
|
-
DebugToolkit.instance = new DebugToolkit(enabled);
|
|
17
|
-
} else {
|
|
18
|
-
DebugToolkit.instance._enabled = enabled;
|
|
19
|
-
}
|
|
20
|
-
return DebugToolkit.instance;
|
|
21
|
-
}
|
|
1
|
+
import type { AnyDebugFeature } from '../types';
|
|
22
2
|
|
|
23
|
-
|
|
24
|
-
return [...this._features];
|
|
25
|
-
}
|
|
3
|
+
type Listener = () => void;
|
|
26
4
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this.renderCallback) {
|
|
37
|
-
console.warn(
|
|
38
|
-
'[DebugToolkit] A render callback is already registered. Overwriting. ' +
|
|
39
|
-
'Make sure only one <DebugToolkitProvider> is mounted at a time.',
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
this.renderCallback = cb;
|
|
43
|
-
}
|
|
5
|
+
const listeners = new Set<Listener>();
|
|
6
|
+
let _features: AnyDebugFeature[] = [];
|
|
7
|
+
let _launcherVisible = false;
|
|
8
|
+
let _panelOpen = false;
|
|
9
|
+
let _enabled = true;
|
|
10
|
+
|
|
11
|
+
function notify(): void {
|
|
12
|
+
listeners.forEach((l) => l());
|
|
13
|
+
}
|
|
44
14
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
function setupFeature(feature: AnyDebugFeature): void {
|
|
16
|
+
feature.setup?.();
|
|
17
|
+
}
|
|
48
18
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
19
|
+
function cleanupFeature(feature: AnyDebugFeature): void {
|
|
20
|
+
feature.cleanup?.();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const DebugToolkit = {
|
|
24
|
+
subscribe(listener: Listener): () => void {
|
|
25
|
+
listeners.add(listener);
|
|
26
|
+
return () => {
|
|
27
|
+
listeners.delete(listener);
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
get features(): AnyDebugFeature[] {
|
|
32
|
+
return [..._features];
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
get enabled(): boolean {
|
|
36
|
+
return _enabled;
|
|
37
|
+
},
|
|
53
38
|
|
|
54
|
-
|
|
39
|
+
get launcherVisible(): boolean {
|
|
40
|
+
return _launcherVisible;
|
|
41
|
+
},
|
|
55
42
|
|
|
43
|
+
setEnabled(enabled: boolean): void {
|
|
44
|
+
if (_enabled === enabled) return;
|
|
45
|
+
_enabled = enabled;
|
|
56
46
|
if (!enabled) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
_launcherVisible = false;
|
|
48
|
+
_features.forEach(cleanupFeature);
|
|
49
|
+
_features = [];
|
|
60
50
|
}
|
|
61
|
-
|
|
51
|
+
notify();
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
replaceFeatures(features: AnyDebugFeature[]): void {
|
|
55
|
+
if (!_enabled) return;
|
|
56
|
+
const next = features.filter(
|
|
57
|
+
(f, i, arr) =>
|
|
58
|
+
f && typeof f.name === 'string' && arr.findIndex((item) => item.name === f.name) === i,
|
|
59
|
+
);
|
|
60
|
+
const prevMap = new Map(_features.map((f) => [f.name, f]));
|
|
61
|
+
const nextMap = new Map(next.map((f) => [f.name, f]));
|
|
62
|
+
|
|
63
|
+
_features.forEach((f) => {
|
|
64
|
+
if (!nextMap.get(f.name) || nextMap.get(f.name) !== f) cleanupFeature(f);
|
|
65
|
+
});
|
|
66
|
+
next.forEach((f) => {
|
|
67
|
+
if (!prevMap.get(f.name) || prevMap.get(f.name) !== f) setupFeature(f);
|
|
68
|
+
});
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
70
|
+
_features = next;
|
|
71
|
+
notify();
|
|
72
|
+
},
|
|
66
73
|
|
|
67
|
-
addFeature(feature:
|
|
68
|
-
if (!
|
|
74
|
+
addFeature(feature: AnyDebugFeature): void {
|
|
75
|
+
if (!_enabled || !feature || typeof feature.name !== 'string') {
|
|
69
76
|
return;
|
|
70
77
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
currentFeature.cleanup?.();
|
|
81
|
-
this._features = this._features.map((item, index) =>
|
|
82
|
-
index === existingIndex ? feature : item,
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
this._features = [...this._features, feature];
|
|
78
|
+
|
|
79
|
+
const existingIndex = _features.findIndex((f) => f.name === feature.name);
|
|
80
|
+
if (existingIndex >= 0) {
|
|
81
|
+
const existing = _features[existingIndex]!;
|
|
82
|
+
if (existing === feature) {
|
|
83
|
+
return;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
cleanupFeature(existing);
|
|
87
|
+
setupFeature(feature);
|
|
88
|
+
_features = [
|
|
89
|
+
..._features.slice(0, existingIndex),
|
|
90
|
+
feature,
|
|
91
|
+
..._features.slice(existingIndex + 1),
|
|
92
|
+
];
|
|
93
|
+
notify();
|
|
94
|
+
return;
|
|
90
95
|
}
|
|
91
|
-
|
|
96
|
+
|
|
97
|
+
setupFeature(feature);
|
|
98
|
+
_features = [..._features, feature];
|
|
99
|
+
notify();
|
|
100
|
+
},
|
|
92
101
|
|
|
93
102
|
removeFeature(name: string): void {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this._features[idx]!.cleanup?.();
|
|
97
|
-
this._features = this._features.filter((feature) => feature.name !== name);
|
|
98
|
-
this.updatePanel();
|
|
103
|
+
if (!_enabled) {
|
|
104
|
+
return;
|
|
99
105
|
}
|
|
100
|
-
}
|
|
101
106
|
|
|
102
|
-
|
|
103
|
-
if (!
|
|
107
|
+
const feature = _features.find((f) => f.name === name);
|
|
108
|
+
if (!feature) {
|
|
104
109
|
return;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const nextByName = new Map(nextFeatures.map((feature) => [feature.name, feature]));
|
|
115
|
-
|
|
116
|
-
this._features.forEach((feature) => {
|
|
117
|
-
const nextFeature = nextByName.get(feature.name);
|
|
118
|
-
if (!nextFeature || nextFeature !== feature) {
|
|
119
|
-
feature.cleanup?.();
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
nextFeatures.forEach((feature) => {
|
|
124
|
-
const currentFeature = previousByName.get(feature.name);
|
|
125
|
-
if (!currentFeature || currentFeature !== feature) {
|
|
126
|
-
feature.setup?.();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
this._features = nextFeatures;
|
|
131
|
-
this.updatePanel();
|
|
132
|
-
}
|
|
112
|
+
cleanupFeature(feature);
|
|
113
|
+
_features = _features.filter((f) => f.name !== name);
|
|
114
|
+
if (_features.length === 0) {
|
|
115
|
+
_launcherVisible = false;
|
|
116
|
+
}
|
|
117
|
+
notify();
|
|
118
|
+
},
|
|
133
119
|
|
|
134
120
|
reset(): void {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
_launcherVisible = false;
|
|
122
|
+
_panelOpen = false;
|
|
123
|
+
_features.forEach(cleanupFeature);
|
|
124
|
+
_features = [];
|
|
125
|
+
notify();
|
|
126
|
+
},
|
|
139
127
|
|
|
140
128
|
hasFeatures(): boolean {
|
|
141
|
-
return
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
129
|
+
return _features.length > 0;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
get panelOpen(): boolean {
|
|
133
|
+
return _panelOpen;
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
openPanel(): void {
|
|
137
|
+
if (!_enabled || _panelOpen) return;
|
|
138
|
+
_panelOpen = true;
|
|
139
|
+
notify();
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
closePanel(): void {
|
|
143
|
+
if (!_panelOpen) return;
|
|
144
|
+
_panelOpen = false;
|
|
145
|
+
notify();
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
togglePanel(): void {
|
|
149
|
+
if (_panelOpen) {
|
|
150
|
+
DebugToolkit.closePanel();
|
|
151
|
+
} else {
|
|
152
|
+
DebugToolkit.openPanel();
|
|
147
153
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
showLauncher(): void {
|
|
157
|
+
if (!_enabled) return;
|
|
158
|
+
_launcherVisible = true;
|
|
159
|
+
notify();
|
|
160
|
+
},
|
|
151
161
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
162
|
+
hideLauncher(): void {
|
|
163
|
+
_launcherVisible = false;
|
|
164
|
+
notify();
|
|
165
|
+
},
|
|
156
166
|
|
|
157
167
|
clearAll(): void {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} else {
|
|
162
|
-
f.cleanup?.();
|
|
163
|
-
f.setup?.();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
this.updatePanel();
|
|
167
|
-
}
|
|
168
|
+
_features.forEach((f) => f.clear?.());
|
|
169
|
+
notify();
|
|
170
|
+
},
|
|
168
171
|
|
|
169
172
|
destroy(): void {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
173
|
+
DebugToolkit.reset();
|
|
174
|
+
listeners.clear();
|
|
175
|
+
},
|
|
176
|
+
};
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import React, { createContext, useContext, useEffect, useState, type ReactNode } from 'react';
|
|
1
|
+
import React, { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';
|
|
2
2
|
import { DebugToolkit } from './DebugToolkit';
|
|
3
|
-
import { FloatPanelView } from '../
|
|
4
|
-
import type {
|
|
3
|
+
import { FloatPanelView } from '../ui/panel/FloatPanelView';
|
|
4
|
+
import type { AnyDebugFeature } from '../types';
|
|
5
5
|
|
|
6
6
|
interface ToolkitContextValue {
|
|
7
|
-
features:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
addFeature: (feature: DebugFeature) => void;
|
|
11
|
-
removeFeature: (name: string) => void;
|
|
7
|
+
features: AnyDebugFeature[];
|
|
8
|
+
showLauncher: () => void;
|
|
9
|
+
hideLauncher: () => void;
|
|
12
10
|
clearAll: () => void;
|
|
13
|
-
destroy: () => void;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
const ToolkitContext = createContext<ToolkitContextValue | null>(null);
|
|
17
14
|
|
|
18
15
|
interface ProviderState {
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
launcherVisible: boolean;
|
|
17
|
+
panelOpen: boolean;
|
|
18
|
+
features: AnyDebugFeature[];
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
interface DebugToolkitProviderProps {
|
|
@@ -25,52 +23,55 @@ interface DebugToolkitProviderProps {
|
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export function DebugToolkitProvider({ children }: DebugToolkitProviderProps) {
|
|
28
|
-
const [state, setState] = useState<ProviderState>(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
});
|
|
26
|
+
const [state, setState] = useState<ProviderState>(() => ({
|
|
27
|
+
launcherVisible: DebugToolkit.launcherVisible,
|
|
28
|
+
panelOpen: DebugToolkit.panelOpen,
|
|
29
|
+
features: DebugToolkit.features,
|
|
30
|
+
}));
|
|
35
31
|
|
|
36
32
|
useEffect(() => {
|
|
37
|
-
|
|
33
|
+
// Sync current state — initializeDebugToolkit() may have been called
|
|
34
|
+
// in a child useEffect that runs before this parent effect subscribes.
|
|
35
|
+
setState({
|
|
36
|
+
launcherVisible: DebugToolkit.launcherVisible,
|
|
37
|
+
panelOpen: DebugToolkit.panelOpen,
|
|
38
|
+
features: DebugToolkit.features,
|
|
39
|
+
});
|
|
38
40
|
|
|
39
|
-
const
|
|
41
|
+
const unsubscribe = DebugToolkit.subscribe(() => {
|
|
40
42
|
setState({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
launcherVisible: DebugToolkit.launcherVisible,
|
|
44
|
+
panelOpen: DebugToolkit.panelOpen,
|
|
45
|
+
features: DebugToolkit.features,
|
|
43
46
|
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
toolkit.registerRenderCallback(syncState);
|
|
47
|
-
syncState();
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
toolkit.unregisterRenderCallback();
|
|
51
|
-
};
|
|
47
|
+
});
|
|
48
|
+
return unsubscribe;
|
|
52
49
|
}, []);
|
|
53
50
|
|
|
54
|
-
const
|
|
51
|
+
const showLauncher = useCallback(() => { DebugToolkit.showLauncher(); }, []);
|
|
52
|
+
const hideLauncher = useCallback(() => { DebugToolkit.hideLauncher(); }, []);
|
|
53
|
+
const clearAll = useCallback(() => { DebugToolkit.clearAll(); }, []);
|
|
55
54
|
|
|
56
|
-
const contextValue
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
const contextValue = useMemo<ToolkitContextValue>(
|
|
56
|
+
() => ({
|
|
57
|
+
features: state.features,
|
|
58
|
+
showLauncher,
|
|
59
|
+
hideLauncher,
|
|
60
|
+
clearAll,
|
|
61
|
+
}),
|
|
62
|
+
[state.features, showLauncher, hideLauncher, clearAll],
|
|
63
|
+
);
|
|
65
64
|
|
|
66
65
|
return (
|
|
67
66
|
<ToolkitContext.Provider value={contextValue}>
|
|
68
67
|
{children}
|
|
69
|
-
{state.
|
|
68
|
+
{state.launcherVisible && (
|
|
70
69
|
<FloatPanelView
|
|
71
70
|
features={state.features}
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
panelOpen={state.panelOpen}
|
|
72
|
+
onOpenPanel={() => DebugToolkit.openPanel()}
|
|
73
|
+
onClosePanel={() => DebugToolkit.closePanel()}
|
|
74
|
+
onClearAll={() => DebugToolkit.clearAll()}
|
|
74
75
|
/>
|
|
75
76
|
)}
|
|
76
77
|
</ToolkitContext.Provider>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DebugToolkit } from './DebugToolkit';
|
|
2
|
+
import { createNetworkFeature } from '../features/network';
|
|
3
|
+
import type { NetworkFeatureConfig } from '../features/network';
|
|
4
|
+
import { createConsoleLogFeature } from '../features/console';
|
|
5
|
+
import type { ConsoleFeatureConfig } from '../features/console';
|
|
6
|
+
import { createZustandLogFeature } from '../features/zustand';
|
|
7
|
+
import type { ZustandFeatureConfig } from '../features/zustand';
|
|
8
|
+
import { createNavigationLogFeature } from '../features/navigation';
|
|
9
|
+
import type { NavigationFeatureConfig } from '../features/navigation';
|
|
10
|
+
import { createTrackFeature } from '../features/track';
|
|
11
|
+
import type { TrackFeatureConfig } from '../features/track';
|
|
12
|
+
import { createEnvironmentFeature } from '../features/environment';
|
|
13
|
+
import { createClipboardFeature } from '../features/clipboard';
|
|
14
|
+
import type { AnyDebugFeature, BuiltInFeatureName } from '../types';
|
|
15
|
+
|
|
16
|
+
const isDebugMode = __DEV__;
|
|
17
|
+
|
|
18
|
+
/** Feature-specific configuration map */
|
|
19
|
+
export interface FeatureConfigs {
|
|
20
|
+
network?: boolean | NetworkFeatureConfig;
|
|
21
|
+
console?: boolean | ConsoleFeatureConfig;
|
|
22
|
+
zustand?: boolean | ZustandFeatureConfig;
|
|
23
|
+
navigation?: boolean | NavigationFeatureConfig;
|
|
24
|
+
track?: boolean | TrackFeatureConfig;
|
|
25
|
+
environment?: Parameters<typeof createEnvironmentFeature>[0];
|
|
26
|
+
clipboard?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface InitializeOptions {
|
|
30
|
+
features?: FeatureConfigs;
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Registry mapping feature names to creator functions */
|
|
35
|
+
// Config param requires `any` — each factory accepts a different config type.
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
+
const featureRegistry: Record<BuiltInFeatureName, (config?: any) => AnyDebugFeature> = {
|
|
38
|
+
network: createNetworkFeature,
|
|
39
|
+
console: createConsoleLogFeature,
|
|
40
|
+
zustand: createZustandLogFeature,
|
|
41
|
+
navigation: createNavigationLogFeature,
|
|
42
|
+
track: createTrackFeature,
|
|
43
|
+
environment: createEnvironmentFeature,
|
|
44
|
+
clipboard: createClipboardFeature,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const DEFAULT_FEATURES: BuiltInFeatureName[] = [
|
|
48
|
+
'network',
|
|
49
|
+
'console',
|
|
50
|
+
'navigation',
|
|
51
|
+
'zustand',
|
|
52
|
+
'track',
|
|
53
|
+
'clipboard',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
function resolveFeatureConfigs(configs: FeatureConfigs): AnyDebugFeature[] {
|
|
57
|
+
const features: AnyDebugFeature[] = [];
|
|
58
|
+
const entries = Object.entries(configs) as [BuiltInFeatureName, unknown][];
|
|
59
|
+
|
|
60
|
+
for (const [name, config] of entries) {
|
|
61
|
+
if (config === false) continue;
|
|
62
|
+
|
|
63
|
+
const creator = featureRegistry[name];
|
|
64
|
+
if (!creator) {
|
|
65
|
+
console.warn(`[DebugToolkit] Unknown feature: "${name}"`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (config === true || config === undefined) {
|
|
70
|
+
features.push(creator());
|
|
71
|
+
} else if (typeof config === 'object') {
|
|
72
|
+
features.push(creator(config as Record<string, unknown>));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return features;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function resolveDefaultFeatures(): AnyDebugFeature[] {
|
|
80
|
+
return DEFAULT_FEATURES.map((name) => featureRegistry[name]!());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Initialize the debug toolkit.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* initializeDebugToolkit({
|
|
88
|
+
* features: { network: true, console: true },
|
|
89
|
+
* enabled: true,
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
export function initializeDebugToolkit(
|
|
93
|
+
options?: InitializeOptions,
|
|
94
|
+
): typeof DebugToolkit {
|
|
95
|
+
const enabled = options?.enabled ?? isDebugMode;
|
|
96
|
+
|
|
97
|
+
const resolvedFeatures = options?.features
|
|
98
|
+
? resolveFeatureConfigs(options.features)
|
|
99
|
+
: resolveDefaultFeatures();
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
DebugToolkit.setEnabled(enabled);
|
|
103
|
+
|
|
104
|
+
if (!enabled) {
|
|
105
|
+
DebugToolkit.reset();
|
|
106
|
+
return DebugToolkit;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
DebugToolkit.replaceFeatures(resolvedFeatures);
|
|
110
|
+
|
|
111
|
+
if (DebugToolkit.hasFeatures()) {
|
|
112
|
+
DebugToolkit.showLauncher();
|
|
113
|
+
} else {
|
|
114
|
+
DebugToolkit.hideLauncher();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return DebugToolkit;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('[DebugToolkit] Initialization failed:', error);
|
|
120
|
+
return DebugToolkit;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
import { Colors
|
|
4
|
-
import { copyToComputer } from '
|
|
5
|
-
import type { DebugFeatureRenderProps } from '
|
|
3
|
+
import { Colors } from '../../ui/theme/colors';
|
|
4
|
+
import { copyToComputer } from '../../utils/copyToComputer';
|
|
5
|
+
import type { DebugFeatureRenderProps } from '../../types';
|
|
6
6
|
|
|
7
|
-
export const ClipboardTab: React.FC<DebugFeatureRenderProps<
|
|
7
|
+
export const ClipboardTab: React.FC<DebugFeatureRenderProps<null>> = React.memo(() => {
|
|
8
8
|
const [text, setText] = useState('');
|
|
9
9
|
const [feedback, setFeedback] = useState<string | null>(null);
|
|
10
10
|
|
|
@@ -41,25 +41,25 @@ export const ClipboardTab: React.FC<DebugFeatureRenderProps<void>> = () => {
|
|
|
41
41
|
</View>
|
|
42
42
|
</View>
|
|
43
43
|
);
|
|
44
|
-
};
|
|
44
|
+
});
|
|
45
45
|
|
|
46
46
|
const s = StyleSheet.create({
|
|
47
47
|
container: {
|
|
48
48
|
flex: 1,
|
|
49
49
|
backgroundColor: Colors.background,
|
|
50
|
-
padding:
|
|
50
|
+
padding: 12,
|
|
51
51
|
},
|
|
52
52
|
input: {
|
|
53
53
|
flex: 1,
|
|
54
54
|
backgroundColor: Colors.surface,
|
|
55
|
-
borderRadius:
|
|
56
|
-
padding:
|
|
55
|
+
borderRadius: 12,
|
|
56
|
+
padding: 12,
|
|
57
57
|
fontSize: 14,
|
|
58
58
|
color: Colors.text,
|
|
59
59
|
lineHeight: 20,
|
|
60
60
|
},
|
|
61
61
|
footer: {
|
|
62
|
-
paddingTop:
|
|
62
|
+
paddingTop: 8,
|
|
63
63
|
minHeight: 36,
|
|
64
64
|
alignItems: 'flex-end',
|
|
65
65
|
},
|
|
@@ -71,7 +71,7 @@ const s = StyleSheet.create({
|
|
|
71
71
|
backgroundColor: Colors.background,
|
|
72
72
|
paddingHorizontal: 16,
|
|
73
73
|
paddingVertical: 6,
|
|
74
|
-
borderRadius:
|
|
74
|
+
borderRadius: 8,
|
|
75
75
|
},
|
|
76
76
|
copyBtnText: {
|
|
77
77
|
fontSize: 13,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClipboardTab } from './ClipboardTab';
|
|
2
|
+
import type { DebugFeature } from '../../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Clipboard feature — all logic lives in ClipboardTab.
|
|
6
|
+
* Data flow is user-driven (TextInput), not event-based.
|
|
7
|
+
*/
|
|
8
|
+
export const createClipboardFeature = (): DebugFeature<null> => ({
|
|
9
|
+
name: 'clipboard',
|
|
10
|
+
label: 'Clipboard',
|
|
11
|
+
renderContent: ClipboardTab,
|
|
12
|
+
setup() {},
|
|
13
|
+
getSnapshot: () => null,
|
|
14
|
+
cleanup() {},
|
|
15
|
+
});
|