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
|
@@ -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 '../theme/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: 28,
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
justifyContent: 'center',
|
|
162
|
+
backgroundColor: Colors.surface,
|
|
163
|
+
},
|
|
164
|
+
dragIndicator: {
|
|
165
|
+
width: 40,
|
|
166
|
+
height: 4,
|
|
167
|
+
borderRadius: 2,
|
|
168
|
+
backgroundColor: Colors.textLight,
|
|
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: `${Colors.error}0F`,
|
|
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,204 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Animated,
|
|
7
|
+
ScrollView,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { Colors } from '../theme/colors';
|
|
11
|
+
|
|
12
|
+
export interface TabItem {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface FeatureTabBarProps {
|
|
18
|
+
tabs: TabItem[];
|
|
19
|
+
activeIndex: number;
|
|
20
|
+
onSelectTab: (index: number) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function FeatureTabBar({ tabs, activeIndex, onSelectTab }: FeatureTabBarProps) {
|
|
24
|
+
const [underlineWidth, setUnderlineWidth] = useState(0);
|
|
25
|
+
const underlineTranslateX = useRef(new Animated.Value(0)).current;
|
|
26
|
+
const tabScrollViewRef = useRef<ScrollView>(null);
|
|
27
|
+
const tabLayouts = useRef<Array<{ x: number; width: number }>>([]);
|
|
28
|
+
const tabScrollOffset = useRef(0);
|
|
29
|
+
const tabViewportWidth = useRef(0);
|
|
30
|
+
const tabContentWidth = useRef(0);
|
|
31
|
+
const underlineInit = useRef(false);
|
|
32
|
+
const isSwitching = useRef(false);
|
|
33
|
+
|
|
34
|
+
const maxTabScroll = useCallback(
|
|
35
|
+
() => Math.max(0, tabContentWidth.current - tabViewportWidth.current),
|
|
36
|
+
[],
|
|
37
|
+
);
|
|
38
|
+
const clampScroll = useCallback(
|
|
39
|
+
(offset: number) => Math.min(Math.max(0, offset), maxTabScroll()),
|
|
40
|
+
[maxTabScroll],
|
|
41
|
+
);
|
|
42
|
+
const getTabScrollTarget = useCallback(
|
|
43
|
+
(index: number) => {
|
|
44
|
+
const layout = tabLayouts.current[index];
|
|
45
|
+
return layout ? clampScroll(layout.x - 60) : clampScroll(tabScrollOffset.current);
|
|
46
|
+
},
|
|
47
|
+
[clampScroll],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const animateUnderline = useCallback(
|
|
51
|
+
(index: number, scrollOffset?: number) => {
|
|
52
|
+
const layout = tabLayouts.current[index];
|
|
53
|
+
if (!layout) return;
|
|
54
|
+
const offsetX = clampScroll(scrollOffset ?? tabScrollOffset.current);
|
|
55
|
+
setUnderlineWidth(layout.width);
|
|
56
|
+
Animated.spring(underlineTranslateX, {
|
|
57
|
+
toValue: layout.x - offsetX,
|
|
58
|
+
friction: 7,
|
|
59
|
+
tension: 50,
|
|
60
|
+
useNativeDriver: true,
|
|
61
|
+
}).start();
|
|
62
|
+
},
|
|
63
|
+
[clampScroll, underlineTranslateX],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const syncUnderlineToActiveTab = useCallback(() => {
|
|
67
|
+
const layout = tabLayouts.current[activeIndex];
|
|
68
|
+
if (!layout) return;
|
|
69
|
+
const clamped = clampScroll(tabScrollOffset.current);
|
|
70
|
+
if (clamped !== tabScrollOffset.current) tabScrollOffset.current = clamped;
|
|
71
|
+
underlineTranslateX.setValue(layout.x - clamped);
|
|
72
|
+
setUnderlineWidth(layout.width);
|
|
73
|
+
}, [activeIndex, clampScroll, underlineTranslateX]);
|
|
74
|
+
|
|
75
|
+
const tryInit = useCallback(() => {
|
|
76
|
+
if (underlineInit.current || tabViewportWidth.current <= 0 || tabContentWidth.current <= 0)
|
|
77
|
+
return;
|
|
78
|
+
const layout = tabLayouts.current[activeIndex];
|
|
79
|
+
if (!layout) return;
|
|
80
|
+
const target = getTabScrollTarget(activeIndex);
|
|
81
|
+
tabScrollOffset.current = target;
|
|
82
|
+
tabScrollViewRef.current?.scrollTo({ x: target, animated: false });
|
|
83
|
+
underlineTranslateX.setValue(layout.x - target);
|
|
84
|
+
setUnderlineWidth(layout.width);
|
|
85
|
+
underlineInit.current = true;
|
|
86
|
+
}, [activeIndex, getTabScrollTarget, underlineTranslateX]);
|
|
87
|
+
|
|
88
|
+
const handleSelectTab = useCallback(
|
|
89
|
+
(index: number) => {
|
|
90
|
+
if (isSwitching.current || index === activeIndex) return;
|
|
91
|
+
isSwitching.current = true;
|
|
92
|
+
|
|
93
|
+
const layout = tabLayouts.current[index];
|
|
94
|
+
if (layout) {
|
|
95
|
+
const target = getTabScrollTarget(index);
|
|
96
|
+
tabScrollOffset.current = target;
|
|
97
|
+
tabScrollViewRef.current?.scrollTo({ x: target, animated: true });
|
|
98
|
+
animateUnderline(index, target);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onSelectTab(index);
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
isSwitching.current = false;
|
|
104
|
+
}, 350);
|
|
105
|
+
},
|
|
106
|
+
[activeIndex, animateUnderline, getTabScrollTarget, onSelectTab],
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// React to external activeIndex changes (e.g. swipe-to-switch)
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (!underlineInit.current) return;
|
|
112
|
+
const layout = tabLayouts.current[activeIndex];
|
|
113
|
+
if (!layout) return;
|
|
114
|
+
const target = getTabScrollTarget(activeIndex);
|
|
115
|
+
tabScrollOffset.current = target;
|
|
116
|
+
tabScrollViewRef.current?.scrollTo({ x: target, animated: true });
|
|
117
|
+
animateUnderline(activeIndex, target);
|
|
118
|
+
}, [activeIndex, animateUnderline, getTabScrollTarget]);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<View style={styles.container}>
|
|
122
|
+
<ScrollView
|
|
123
|
+
ref={tabScrollViewRef}
|
|
124
|
+
horizontal
|
|
125
|
+
showsHorizontalScrollIndicator={false}
|
|
126
|
+
contentContainerStyle={styles.scrollContent}
|
|
127
|
+
onLayout={(e) => {
|
|
128
|
+
tabViewportWidth.current = e.nativeEvent.layout.width;
|
|
129
|
+
tryInit();
|
|
130
|
+
}}
|
|
131
|
+
onContentSizeChange={(width) => {
|
|
132
|
+
tabContentWidth.current = width;
|
|
133
|
+
tryInit();
|
|
134
|
+
}}
|
|
135
|
+
onScroll={(e) => {
|
|
136
|
+
tabScrollOffset.current = clampScroll(e.nativeEvent.contentOffset.x);
|
|
137
|
+
if (!isSwitching.current) syncUnderlineToActiveTab();
|
|
138
|
+
}}
|
|
139
|
+
scrollEventThrottle={16}
|
|
140
|
+
>
|
|
141
|
+
{tabs.map((tab, index) => (
|
|
142
|
+
<TouchableOpacity
|
|
143
|
+
key={tab.id}
|
|
144
|
+
style={styles.tab}
|
|
145
|
+
onPress={() => handleSelectTab(index)}
|
|
146
|
+
activeOpacity={0.7}
|
|
147
|
+
onLayout={(e) => {
|
|
148
|
+
const { x, width } = e.nativeEvent.layout;
|
|
149
|
+
tabLayouts.current[index] = { x, width };
|
|
150
|
+
if (index === activeIndex) tryInit();
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
<Text
|
|
154
|
+
style={[styles.tabText, activeIndex === index && styles.activeTabText]}
|
|
155
|
+
numberOfLines={1}
|
|
156
|
+
>
|
|
157
|
+
{tab.label}
|
|
158
|
+
</Text>
|
|
159
|
+
</TouchableOpacity>
|
|
160
|
+
))}
|
|
161
|
+
</ScrollView>
|
|
162
|
+
<Animated.View
|
|
163
|
+
style={[
|
|
164
|
+
styles.underline,
|
|
165
|
+
{ width: underlineWidth, transform: [{ translateX: underlineTranslateX }] },
|
|
166
|
+
]}
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const styles = StyleSheet.create({
|
|
173
|
+
container: {
|
|
174
|
+
backgroundColor: Colors.surface,
|
|
175
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
176
|
+
borderBottomColor: Colors.border,
|
|
177
|
+
},
|
|
178
|
+
scrollContent: {
|
|
179
|
+
paddingHorizontal: 20,
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
},
|
|
182
|
+
tab: {
|
|
183
|
+
paddingVertical: 10,
|
|
184
|
+
paddingHorizontal: 14,
|
|
185
|
+
marginRight: 8,
|
|
186
|
+
},
|
|
187
|
+
tabText: {
|
|
188
|
+
fontSize: 14,
|
|
189
|
+
fontWeight: '500',
|
|
190
|
+
color: Colors.textLight,
|
|
191
|
+
},
|
|
192
|
+
activeTabText: {
|
|
193
|
+
color: Colors.primary,
|
|
194
|
+
fontWeight: '600',
|
|
195
|
+
},
|
|
196
|
+
underline: {
|
|
197
|
+
position: 'absolute',
|
|
198
|
+
bottom: 0,
|
|
199
|
+
left: 0,
|
|
200
|
+
height: 2.5,
|
|
201
|
+
borderRadius: 1.25,
|
|
202
|
+
backgroundColor: Colors.primary,
|
|
203
|
+
},
|
|
204
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import React, { Component, useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Animated,
|
|
7
|
+
PanResponder,
|
|
8
|
+
Easing,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import type { AnyDebugFeature } from '../../types';
|
|
11
|
+
import { getPreference, setPreference, KEYS } from '../../utils/debugPreferences';
|
|
12
|
+
import { FloatIcon } from '../floating/FloatIcon';
|
|
13
|
+
import { DebugPanel } from './DebugPanel';
|
|
14
|
+
import { FeatureTabBar } from './FeatureTabBar';
|
|
15
|
+
import type { TabItem } from './FeatureTabBar';
|
|
16
|
+
|
|
17
|
+
// ─── Error Boundary ────────────────────────────────────
|
|
18
|
+
interface ErrorBoundaryState {
|
|
19
|
+
hasError: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class DebugErrorBoundary extends Component<
|
|
23
|
+
{ children: React.ReactNode; onError: () => void },
|
|
24
|
+
ErrorBoundaryState
|
|
25
|
+
> {
|
|
26
|
+
state: ErrorBoundaryState = { hasError: false };
|
|
27
|
+
|
|
28
|
+
static getDerivedStateFromError(): ErrorBoundaryState {
|
|
29
|
+
return { hasError: true };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
componentDidCatch(error: Error, info: React.ErrorInfo) {
|
|
33
|
+
console.error('[DebugToolkit] Panel crashed:', error, info.componentStack);
|
|
34
|
+
this.props.onError();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
if (this.state.hasError) return null;
|
|
39
|
+
return this.props.children;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface FloatPanelViewProps {
|
|
44
|
+
features: AnyDebugFeature[];
|
|
45
|
+
panelOpen: boolean;
|
|
46
|
+
onOpenPanel: () => void;
|
|
47
|
+
onClosePanel: () => void;
|
|
48
|
+
onClearAll: () => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function FloatPanelView({ features, panelOpen, onOpenPanel, onClosePanel, onClearAll }: FloatPanelViewProps) {
|
|
52
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
53
|
+
const tabLoaded = useRef(false);
|
|
54
|
+
|
|
55
|
+
// Restore last tab on mount
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
let mounted = true;
|
|
58
|
+
getPreference(KEYS.lastTab).then((val) => {
|
|
59
|
+
if (!mounted || !val) return;
|
|
60
|
+
const idx = parseInt(val, 10);
|
|
61
|
+
if (!isNaN(idx) && idx >= 0) {
|
|
62
|
+
setActiveTab(idx);
|
|
63
|
+
tabLoaded.current = true;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return () => { mounted = false; };
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
// Content slide animation
|
|
70
|
+
const contentOpacity = useRef(new Animated.Value(1)).current;
|
|
71
|
+
const contentTranslateX = useRef(new Animated.Value(0)).current;
|
|
72
|
+
const isSwitchingTab = useRef(false);
|
|
73
|
+
|
|
74
|
+
// Refs to avoid stale closures in PanResponder
|
|
75
|
+
const activeTabRef = useRef(0);
|
|
76
|
+
activeTabRef.current = activeTab;
|
|
77
|
+
const featuresLengthRef = useRef(features.length);
|
|
78
|
+
featuresLengthRef.current = features.length;
|
|
79
|
+
const switchTabRef = useRef<(index: number) => void>(() => {});
|
|
80
|
+
|
|
81
|
+
// Swipe-to-switch responder
|
|
82
|
+
const swipeResponder = useRef(
|
|
83
|
+
PanResponder.create({
|
|
84
|
+
onStartShouldSetPanResponder: () => false,
|
|
85
|
+
onMoveShouldSetPanResponder: (_, gs) => {
|
|
86
|
+
if (isSwitchingTab.current) return false;
|
|
87
|
+
return Math.abs(gs.dx) > 25 && Math.abs(gs.dx) > Math.abs(gs.dy) * 2.5;
|
|
88
|
+
},
|
|
89
|
+
onPanResponderRelease: (_, gs) => {
|
|
90
|
+
const tab = activeTabRef.current;
|
|
91
|
+
if (gs.dx < -40 && tab < featuresLengthRef.current - 1) switchTabRef.current(tab + 1);
|
|
92
|
+
else if (gs.dx > 40 && tab > 0) switchTabRef.current(tab - 1);
|
|
93
|
+
},
|
|
94
|
+
onPanResponderTerminationRequest: () => true,
|
|
95
|
+
}),
|
|
96
|
+
).current;
|
|
97
|
+
|
|
98
|
+
// Feature subscription → re-render on data changes
|
|
99
|
+
const [, setTick] = useState(0);
|
|
100
|
+
const refreshQueued = useRef(false);
|
|
101
|
+
const scheduleRefresh = useCallback(() => {
|
|
102
|
+
if (refreshQueued.current) return;
|
|
103
|
+
refreshQueued.current = true;
|
|
104
|
+
requestAnimationFrame(() => {
|
|
105
|
+
refreshQueued.current = false;
|
|
106
|
+
setTick((t) => t + 1);
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
const unsubs = features
|
|
112
|
+
.map((f) => f.subscribe?.(() => scheduleRefresh()))
|
|
113
|
+
.filter((u): u is () => void => typeof u === 'function');
|
|
114
|
+
return () => unsubs.forEach((u) => u());
|
|
115
|
+
}, [features, scheduleRefresh]);
|
|
116
|
+
|
|
117
|
+
// Clamp activeTab if features shrink
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (features.length > 0 && activeTab >= features.length) {
|
|
120
|
+
setActiveTab(0);
|
|
121
|
+
setPreference(KEYS.lastTab, '0');
|
|
122
|
+
}
|
|
123
|
+
}, [features.length, activeTab]);
|
|
124
|
+
|
|
125
|
+
// Tab switching with content animation
|
|
126
|
+
const switchTab = useCallback(
|
|
127
|
+
(index: number) => {
|
|
128
|
+
if (isSwitchingTab.current || index === activeTabRef.current) return;
|
|
129
|
+
isSwitchingTab.current = true;
|
|
130
|
+
const direction = index > activeTabRef.current ? 1 : -1;
|
|
131
|
+
|
|
132
|
+
Animated.parallel([
|
|
133
|
+
Animated.timing(contentOpacity, { toValue: 0, duration: 80, useNativeDriver: true }),
|
|
134
|
+
Animated.timing(contentTranslateX, {
|
|
135
|
+
toValue: -direction * 40,
|
|
136
|
+
duration: 80,
|
|
137
|
+
useNativeDriver: true,
|
|
138
|
+
}),
|
|
139
|
+
]).start(() => {
|
|
140
|
+
setActiveTab(index);
|
|
141
|
+
setPreference(KEYS.lastTab, String(index));
|
|
142
|
+
contentTranslateX.setValue(direction * 40);
|
|
143
|
+
Animated.parallel([
|
|
144
|
+
Animated.timing(contentOpacity, { toValue: 1, duration: 150, useNativeDriver: true }),
|
|
145
|
+
Animated.timing(contentTranslateX, {
|
|
146
|
+
toValue: 0,
|
|
147
|
+
duration: 200,
|
|
148
|
+
easing: Easing.out(Easing.cubic),
|
|
149
|
+
useNativeDriver: true,
|
|
150
|
+
}),
|
|
151
|
+
]).start(() => {
|
|
152
|
+
isSwitchingTab.current = false;
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
[contentOpacity, contentTranslateX],
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
// Keep ref in sync
|
|
160
|
+
switchTabRef.current = switchTab;
|
|
161
|
+
|
|
162
|
+
// Badge (first feature that returns one)
|
|
163
|
+
const envBadge = features.map((f) => f.badge?.()).find((b) => b != null) ?? null;
|
|
164
|
+
const tabs: TabItem[] = features.map((f) => ({ label: f.label, id: f.name }));
|
|
165
|
+
|
|
166
|
+
// Render active feature content
|
|
167
|
+
const renderFeatureContent = () => {
|
|
168
|
+
if (features.length === 0) {
|
|
169
|
+
return <Text style={styles.emptyText}>No debug features enabled</Text>;
|
|
170
|
+
}
|
|
171
|
+
const feature = features[activeTab];
|
|
172
|
+
if (!feature) return <Text style={styles.emptyText}>Feature not found</Text>;
|
|
173
|
+
const snapshot = feature.getSnapshot();
|
|
174
|
+
const TabComponent = feature.renderContent;
|
|
175
|
+
if (TabComponent) return <TabComponent snapshot={snapshot} feature={feature} />;
|
|
176
|
+
return (
|
|
177
|
+
<View style={styles.genericContent}>
|
|
178
|
+
<Text style={styles.jsonContent}>{JSON.stringify(snapshot, null, 2)}</Text>
|
|
179
|
+
</View>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<DebugErrorBoundary onError={onClosePanel}>
|
|
185
|
+
<View style={styles.container} pointerEvents="box-none">
|
|
186
|
+
<FloatIcon visible={!panelOpen} onPress={onOpenPanel} badge={envBadge} />
|
|
187
|
+
{panelOpen && (
|
|
188
|
+
<DebugPanel
|
|
189
|
+
onClose={onClosePanel}
|
|
190
|
+
onClearAll={onClearAll}
|
|
191
|
+
>
|
|
192
|
+
<FeatureTabBar tabs={tabs} activeIndex={activeTab} onSelectTab={switchTab} />
|
|
193
|
+
<Animated.View
|
|
194
|
+
style={[
|
|
195
|
+
styles.contentContainer,
|
|
196
|
+
{ opacity: contentOpacity, transform: [{ translateX: contentTranslateX }] },
|
|
197
|
+
]}
|
|
198
|
+
{...swipeResponder.panHandlers}
|
|
199
|
+
>
|
|
200
|
+
{renderFeatureContent()}
|
|
201
|
+
</Animated.View>
|
|
202
|
+
</DebugPanel>
|
|
203
|
+
)}
|
|
204
|
+
</View>
|
|
205
|
+
</DebugErrorBoundary>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const styles = StyleSheet.create({
|
|
210
|
+
container: {
|
|
211
|
+
position: 'absolute',
|
|
212
|
+
top: 0,
|
|
213
|
+
left: 0,
|
|
214
|
+
right: 0,
|
|
215
|
+
bottom: 0,
|
|
216
|
+
zIndex: 999,
|
|
217
|
+
},
|
|
218
|
+
contentContainer: { flex: 1 },
|
|
219
|
+
emptyText: {
|
|
220
|
+
padding: 20,
|
|
221
|
+
textAlign: 'center',
|
|
222
|
+
color: '#C7C7CC',
|
|
223
|
+
fontSize: 13,
|
|
224
|
+
},
|
|
225
|
+
genericContent: { padding: 16, flex: 1 },
|
|
226
|
+
jsonContent: { fontFamily: 'monospace', fontSize: 12, color: '#1C1C1E' },
|
|
227
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, Text, StyleSheet } from 'react-native';
|
|
3
|
-
import { Colors } from '
|
|
3
|
+
import { Colors } from '../theme/colors';
|
|
4
4
|
import { copyToComputer } from '../../utils/copyToComputer';
|
|
5
5
|
|
|
6
6
|
interface CopyButtonProps {
|