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/src/types/index.ts
CHANGED
|
@@ -1,138 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** Base interface all debug features must implement */
|
|
32
|
-
export interface DebugFeature<TData = unknown> {
|
|
33
|
-
name: string;
|
|
34
|
-
label: string;
|
|
35
|
-
setup: () => void;
|
|
36
|
-
getData: () => TData[];
|
|
37
|
-
clear?: () => void;
|
|
38
|
-
cleanup: () => void;
|
|
39
|
-
subscribe?: (listener: DebugFeatureListener) => () => void;
|
|
40
|
-
renderContent?: DebugFeatureRenderer<TData>;
|
|
41
|
-
badge?: () => { label: string; color: string } | null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface NetworkLogEntry {
|
|
45
|
-
id: string;
|
|
46
|
-
timestamp: number;
|
|
47
|
-
duration?: number;
|
|
48
|
-
request: {
|
|
49
|
-
url: string;
|
|
50
|
-
method: string;
|
|
51
|
-
headers?: Record<string, string>;
|
|
52
|
-
body?: unknown;
|
|
53
|
-
};
|
|
54
|
-
response?: {
|
|
55
|
-
status: number;
|
|
56
|
-
statusText?: string;
|
|
57
|
-
headers?: Record<string, string>;
|
|
58
|
-
data?: unknown;
|
|
59
|
-
success?: boolean;
|
|
60
|
-
};
|
|
61
|
-
error?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ConsoleLogEntry {
|
|
65
|
-
id: string;
|
|
66
|
-
timestamp: number;
|
|
67
|
-
level: 'log' | 'info' | 'warn' | 'error';
|
|
68
|
-
data: unknown[];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface ZustandLogEntry {
|
|
72
|
-
id: string;
|
|
73
|
-
timestamp: number;
|
|
74
|
-
action: string;
|
|
75
|
-
prevState: unknown;
|
|
76
|
-
nextState: unknown;
|
|
77
|
-
actionCompleteTime?: number;
|
|
78
|
-
storeName?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface NavigationLogEntry {
|
|
82
|
-
id: string;
|
|
83
|
-
timestamp: number;
|
|
84
|
-
action: string;
|
|
85
|
-
from: string;
|
|
86
|
-
to: string;
|
|
87
|
-
startTime?: number;
|
|
88
|
-
duration?: number;
|
|
89
|
-
debugLog?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface TrackLogEntry {
|
|
93
|
-
id: string;
|
|
94
|
-
timestamp: number;
|
|
95
|
-
eventName: string;
|
|
96
|
-
[key: string]: unknown;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface ThirdPartyLib {
|
|
100
|
-
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
description: string;
|
|
103
|
-
platform: 'ios' | 'android' | 'both';
|
|
104
|
-
actions: Array<{
|
|
105
|
-
id: string;
|
|
106
|
-
label: string;
|
|
107
|
-
onPress: () => void;
|
|
108
|
-
}>;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface EnvironmentConfig {
|
|
112
|
-
id: string;
|
|
113
|
-
label: string;
|
|
114
|
-
host: string;
|
|
115
|
-
color?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export interface EnvironmentState {
|
|
119
|
-
environments: EnvironmentConfig[];
|
|
120
|
-
currentEnvironmentId: string | null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface DebugToolkitConfig {
|
|
124
|
-
features?: DebugFeatureInput[];
|
|
125
|
-
enabled?: boolean;
|
|
126
|
-
/** Maximum number of log entries per feature (default: 200) */
|
|
127
|
-
maxLogsPerFeature?: number;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface DebugToolkitAPI {
|
|
131
|
-
readonly features: ReadonlyArray<DebugFeature<any>>;
|
|
132
|
-
addFeature: (feature: DebugFeature<any>) => void;
|
|
133
|
-
removeFeature: (name: string) => void;
|
|
134
|
-
showPanel: () => void;
|
|
135
|
-
hidePanel: () => void;
|
|
136
|
-
clearAll: () => void;
|
|
137
|
-
destroy: () => void;
|
|
138
|
-
}
|
|
1
|
+
export type {
|
|
2
|
+
AnyDebugFeature,
|
|
3
|
+
BuiltInFeatureName,
|
|
4
|
+
DebugFeature,
|
|
5
|
+
DebugFeatureListener,
|
|
6
|
+
DebugFeatureRenderProps,
|
|
7
|
+
} from './feature';
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
ConsoleLogEntry,
|
|
11
|
+
NavigationLogEntry,
|
|
12
|
+
NetworkLogEntry,
|
|
13
|
+
TrackLogEntry,
|
|
14
|
+
ZustandLogEntry,
|
|
15
|
+
} from './logs';
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
EnvironmentConfig,
|
|
19
|
+
EnvironmentState,
|
|
20
|
+
} from './environment';
|
|
21
|
+
|
|
22
|
+
export type {
|
|
23
|
+
NavigationContainerRef,
|
|
24
|
+
} from './navigation';
|
|
25
|
+
|
|
26
|
+
export type {
|
|
27
|
+
ThirdPartyLib,
|
|
28
|
+
ThirdPartyLibAction,
|
|
29
|
+
} from './thirdPartyLibs';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface NetworkLogEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
duration?: number;
|
|
5
|
+
request: {
|
|
6
|
+
url: string;
|
|
7
|
+
method: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
};
|
|
11
|
+
response?: {
|
|
12
|
+
status: number;
|
|
13
|
+
statusText?: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
data?: unknown;
|
|
16
|
+
success?: boolean;
|
|
17
|
+
};
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ConsoleLogEntry {
|
|
22
|
+
id: string;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
level: 'log' | 'info' | 'warn' | 'error';
|
|
25
|
+
data: unknown[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ZustandLogEntry {
|
|
29
|
+
id: string;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
action: string;
|
|
32
|
+
prevState: unknown;
|
|
33
|
+
nextState: unknown;
|
|
34
|
+
actionCompleteTime?: number;
|
|
35
|
+
storeName?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface NavigationLogEntry {
|
|
39
|
+
id: string;
|
|
40
|
+
timestamp: number;
|
|
41
|
+
action: string;
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
startTime?: number;
|
|
45
|
+
duration?: number;
|
|
46
|
+
debugLog?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface TrackLogEntry {
|
|
50
|
+
id: string;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
eventName: string;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ThirdPartyLibAction {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
onPress: () => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ThirdPartyLib {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
platform: 'ios' | 'android' | 'both';
|
|
12
|
+
actions: ThirdPartyLibAction[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { DebugToolkitProvider } from '../core/DebugToolkitProvider';
|
|
3
|
+
import { initializeDebugToolkit } from '../core/initialize';
|
|
4
|
+
import type { FeatureConfigs } from '../core/initialize';
|
|
5
|
+
import { useNavigationLogger } from '../features/navigation/useNavigationLogger';
|
|
6
|
+
import type { EnvironmentConfig, NavigationContainerRef } from '../types';
|
|
7
|
+
|
|
8
|
+
// --- Types ---
|
|
9
|
+
|
|
10
|
+
export interface DebugViewProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Enable/disable specific features. Omitted features default to enabled.
|
|
14
|
+
* Set to `false` to disable a feature.
|
|
15
|
+
*/
|
|
16
|
+
features?: Partial<FeatureConfigs>;
|
|
17
|
+
/** Navigation container ref for route tracking. */
|
|
18
|
+
navigationRef?: React.RefObject<NavigationContainerRef | null>;
|
|
19
|
+
/** Environment configs for runtime host switching. */
|
|
20
|
+
environments?: EnvironmentConfig[];
|
|
21
|
+
/** Force enable/disable (default: `__DEV__`). */
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// --- Inner component for navigation hook (satisfies rules of hooks) ---
|
|
26
|
+
|
|
27
|
+
function NavigationLoggerInner({
|
|
28
|
+
navigationRef,
|
|
29
|
+
}: {
|
|
30
|
+
navigationRef: React.RefObject<NavigationContainerRef | null>;
|
|
31
|
+
}) {
|
|
32
|
+
useNavigationLogger(navigationRef);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// --- Main component ---
|
|
37
|
+
|
|
38
|
+
export function DebugView({
|
|
39
|
+
children,
|
|
40
|
+
features,
|
|
41
|
+
navigationRef,
|
|
42
|
+
environments,
|
|
43
|
+
enabled,
|
|
44
|
+
}: DebugViewProps) {
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
// Build feature config: all enabled by default, user overrides take precedence
|
|
47
|
+
const resolvedFeatures: FeatureConfigs = {
|
|
48
|
+
network: true,
|
|
49
|
+
console: true,
|
|
50
|
+
zustand: true,
|
|
51
|
+
navigation: true,
|
|
52
|
+
track: true,
|
|
53
|
+
clipboard: true,
|
|
54
|
+
...features,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Apply environments prop
|
|
58
|
+
if (environments) {
|
|
59
|
+
resolvedFeatures.environment = environments;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Initialize toolkit
|
|
63
|
+
const toolkit = initializeDebugToolkit({
|
|
64
|
+
features: resolvedFeatures,
|
|
65
|
+
enabled,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
toolkit.destroy();
|
|
70
|
+
};
|
|
71
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
+
}, []);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<DebugToolkitProvider>
|
|
76
|
+
{navigationRef && <NavigationLoggerInner navigationRef={navigationRef} />}
|
|
77
|
+
{children}
|
|
78
|
+
</DebugToolkitProvider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Animated,
|
|
7
|
+
PanResponder,
|
|
8
|
+
Pressable,
|
|
9
|
+
useWindowDimensions,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { Colors } from '../theme/colors';
|
|
12
|
+
import { ICON_SIZE } from '../theme/layout';
|
|
13
|
+
import { getPreference, setPreference, KEYS } from '../../utils/debugPreferences';
|
|
14
|
+
|
|
15
|
+
const EDGE_MARGIN = 16;
|
|
16
|
+
|
|
17
|
+
interface FloatIconProps {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
onPress: () => void;
|
|
20
|
+
badge: { label: string; color: string } | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function FloatIcon({ visible, onPress, badge }: FloatIconProps) {
|
|
24
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
25
|
+
const defaultX = screenWidth - ICON_SIZE - EDGE_MARGIN;
|
|
26
|
+
const defaultY = screenHeight / 2 - ICON_SIZE / 2;
|
|
27
|
+
|
|
28
|
+
const pan = useRef(new Animated.ValueXY({ x: defaultX, y: defaultY })).current;
|
|
29
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
30
|
+
const lastPosition = useRef({ x: defaultX, y: defaultY });
|
|
31
|
+
const positionLoaded = useRef(false);
|
|
32
|
+
|
|
33
|
+
// Restore saved position
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
let mounted = true;
|
|
36
|
+
getPreference(KEYS.fabPosition).then((saved) => {
|
|
37
|
+
if (!mounted || !saved) return;
|
|
38
|
+
try {
|
|
39
|
+
const pos = JSON.parse(saved) as { x: number; y: number };
|
|
40
|
+
const x = Math.max(0, Math.min(pos.x, screenWidth - ICON_SIZE));
|
|
41
|
+
const y = Math.max(0, Math.min(pos.y, screenHeight - ICON_SIZE));
|
|
42
|
+
lastPosition.current = { x, y };
|
|
43
|
+
pan.setValue({ x, y });
|
|
44
|
+
positionLoaded.current = true;
|
|
45
|
+
} catch {
|
|
46
|
+
// ignore bad data
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return () => { mounted = false; };
|
|
50
|
+
}, [screenWidth, screenHeight, pan]);
|
|
51
|
+
|
|
52
|
+
const panResponder = useRef(
|
|
53
|
+
PanResponder.create({
|
|
54
|
+
onStartShouldSetPanResponder: () => true,
|
|
55
|
+
onMoveShouldSetPanResponder: () => true,
|
|
56
|
+
onPanResponderGrant: () => {
|
|
57
|
+
Animated.spring(scale, {
|
|
58
|
+
toValue: 0.9,
|
|
59
|
+
friction: 5,
|
|
60
|
+
useNativeDriver: true,
|
|
61
|
+
}).start();
|
|
62
|
+
},
|
|
63
|
+
onPanResponderMove: (_: unknown, gs: { dx: number; dy: number }) => {
|
|
64
|
+
const x = Math.max(
|
|
65
|
+
0,
|
|
66
|
+
Math.min(lastPosition.current.x + gs.dx, screenWidth - ICON_SIZE),
|
|
67
|
+
);
|
|
68
|
+
const y = Math.max(
|
|
69
|
+
0,
|
|
70
|
+
Math.min(lastPosition.current.y + gs.dy, screenHeight - ICON_SIZE),
|
|
71
|
+
);
|
|
72
|
+
pan.setValue({ x, y });
|
|
73
|
+
},
|
|
74
|
+
onPanResponderRelease: (_: unknown, gs: { dx: number; dy: number }) => {
|
|
75
|
+
if (Math.abs(gs.dx) < 5 && Math.abs(gs.dy) < 5) {
|
|
76
|
+
Animated.spring(scale, { toValue: 1, friction: 5, useNativeDriver: true }).start();
|
|
77
|
+
onPress();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
Animated.spring(scale, { toValue: 1, friction: 5, useNativeDriver: true }).start();
|
|
81
|
+
|
|
82
|
+
// Snap to nearest edge
|
|
83
|
+
const rawX = lastPosition.current.x + gs.dx;
|
|
84
|
+
const midX = screenWidth / 2 - ICON_SIZE / 2;
|
|
85
|
+
const snappedX = rawX < midX ? EDGE_MARGIN : screenWidth - ICON_SIZE - EDGE_MARGIN;
|
|
86
|
+
|
|
87
|
+
const finalY = Math.max(
|
|
88
|
+
0,
|
|
89
|
+
Math.min(lastPosition.current.y + gs.dy, screenHeight - ICON_SIZE),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
lastPosition.current = { x: snappedX, y: finalY };
|
|
93
|
+
Animated.spring(pan, {
|
|
94
|
+
toValue: { x: snappedX, y: finalY },
|
|
95
|
+
friction: 7,
|
|
96
|
+
tension: 40,
|
|
97
|
+
useNativeDriver: true,
|
|
98
|
+
}).start();
|
|
99
|
+
|
|
100
|
+
// Persist
|
|
101
|
+
setPreference(KEYS.fabPosition, JSON.stringify({ x: snappedX, y: finalY }));
|
|
102
|
+
},
|
|
103
|
+
onPanResponderTerminate: (_: unknown, gs: { dx: number; dy: number }) => {
|
|
104
|
+
const snappedX =
|
|
105
|
+
lastPosition.current.x + gs.dx < screenWidth / 2 - ICON_SIZE / 2
|
|
106
|
+
? EDGE_MARGIN
|
|
107
|
+
: screenWidth - ICON_SIZE - EDGE_MARGIN;
|
|
108
|
+
const finalY = Math.max(
|
|
109
|
+
0,
|
|
110
|
+
Math.min(lastPosition.current.y + gs.dy, screenHeight - ICON_SIZE),
|
|
111
|
+
);
|
|
112
|
+
lastPosition.current = { x: snappedX, y: finalY };
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
).current;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<Animated.View
|
|
119
|
+
pointerEvents={visible ? 'auto' : 'none'}
|
|
120
|
+
style={[
|
|
121
|
+
styles.root,
|
|
122
|
+
{
|
|
123
|
+
transform: [{ translateX: pan.x }, { translateY: pan.y }, { scale }],
|
|
124
|
+
opacity: visible ? 1 : 0,
|
|
125
|
+
},
|
|
126
|
+
]}
|
|
127
|
+
{...panResponder.panHandlers}
|
|
128
|
+
>
|
|
129
|
+
<Pressable onPress={onPress} style={styles.inner}>
|
|
130
|
+
<View style={styles.iconGrid}>
|
|
131
|
+
<View style={styles.iconRow}>
|
|
132
|
+
<View style={[styles.iconCell, { backgroundColor: Colors.primary }]} />
|
|
133
|
+
<View style={[styles.iconCell, { backgroundColor: Colors.success }]} />
|
|
134
|
+
</View>
|
|
135
|
+
<View style={styles.iconRow}>
|
|
136
|
+
<View style={[styles.iconCell, { backgroundColor: Colors.warning }]} />
|
|
137
|
+
<View style={[styles.iconCell, { backgroundColor: Colors.purple }]} />
|
|
138
|
+
</View>
|
|
139
|
+
</View>
|
|
140
|
+
{badge && (
|
|
141
|
+
<View style={[styles.badge, { backgroundColor: badge.color }]}>
|
|
142
|
+
<Text style={styles.badgeText}>{badge.label}</Text>
|
|
143
|
+
</View>
|
|
144
|
+
)}
|
|
145
|
+
</Pressable>
|
|
146
|
+
</Animated.View>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const styles = StyleSheet.create({
|
|
151
|
+
root: {
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
width: ICON_SIZE,
|
|
154
|
+
height: ICON_SIZE,
|
|
155
|
+
borderRadius: ICON_SIZE / 2,
|
|
156
|
+
backgroundColor: '#FFFFFF',
|
|
157
|
+
elevation: 6,
|
|
158
|
+
shadowColor: '#000',
|
|
159
|
+
shadowOffset: { width: 0, height: 2 },
|
|
160
|
+
shadowOpacity: 0.12,
|
|
161
|
+
shadowRadius: 8,
|
|
162
|
+
},
|
|
163
|
+
inner: {
|
|
164
|
+
width: '100%',
|
|
165
|
+
height: '100%',
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
justifyContent: 'center',
|
|
168
|
+
},
|
|
169
|
+
iconGrid: {
|
|
170
|
+
width: 22,
|
|
171
|
+
height: 22,
|
|
172
|
+
justifyContent: 'space-between',
|
|
173
|
+
},
|
|
174
|
+
iconRow: {
|
|
175
|
+
flexDirection: 'row',
|
|
176
|
+
justifyContent: 'space-between',
|
|
177
|
+
},
|
|
178
|
+
iconCell: {
|
|
179
|
+
width: 8,
|
|
180
|
+
height: 8,
|
|
181
|
+
borderRadius: 2.5,
|
|
182
|
+
},
|
|
183
|
+
badge: {
|
|
184
|
+
position: 'absolute',
|
|
185
|
+
top: -4,
|
|
186
|
+
right: -4,
|
|
187
|
+
minWidth: 20,
|
|
188
|
+
height: 18,
|
|
189
|
+
borderRadius: 9,
|
|
190
|
+
paddingHorizontal: 5,
|
|
191
|
+
alignItems: 'center',
|
|
192
|
+
justifyContent: 'center',
|
|
193
|
+
borderWidth: 2,
|
|
194
|
+
borderColor: '#FFF',
|
|
195
|
+
elevation: 4,
|
|
196
|
+
},
|
|
197
|
+
badgeText: {
|
|
198
|
+
color: '#FFF',
|
|
199
|
+
fontSize: 9,
|
|
200
|
+
fontWeight: '700',
|
|
201
|
+
},
|
|
202
|
+
});
|