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,164 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
FlatList,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Animated,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { Colors } from '../theme/colors';
|
|
11
|
+
import { useSlideDetailAnimation } from './useSlideDetailAnimation';
|
|
12
|
+
|
|
13
|
+
interface LogListItem {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface LogListScreenProps<T extends LogListItem> {
|
|
18
|
+
data: T[];
|
|
19
|
+
renderRow: (item: T) => React.ReactElement;
|
|
20
|
+
renderListHeader?: () => React.ReactElement;
|
|
21
|
+
renderDetailHeader?: (item: T) => React.ReactNode;
|
|
22
|
+
renderDetailBody: (item: T) => React.ReactElement;
|
|
23
|
+
emptyText: string;
|
|
24
|
+
reversed?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Shared list→detail screen with slide animation.
|
|
29
|
+
* Handles: selected state, FlatList, empty state, back button, push navigation.
|
|
30
|
+
* Each tab provides renderRow, renderDetailBody, and optional renderDetailHeader.
|
|
31
|
+
*/
|
|
32
|
+
export function LogListScreen<T extends LogListItem>({
|
|
33
|
+
data,
|
|
34
|
+
renderRow,
|
|
35
|
+
renderListHeader,
|
|
36
|
+
renderDetailHeader,
|
|
37
|
+
renderDetailBody,
|
|
38
|
+
emptyText,
|
|
39
|
+
reversed = true,
|
|
40
|
+
}: LogListScreenProps<T>) {
|
|
41
|
+
const [selected, setSelected] = useState<T | null>(null);
|
|
42
|
+
const { detailTranslateX, listTranslateX, listOpacity } = useSlideDetailAnimation(selected);
|
|
43
|
+
|
|
44
|
+
const displayData = useMemo(
|
|
45
|
+
() => (reversed ? [...data].reverse() : data),
|
|
46
|
+
[data, reversed],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View style={styles.container}>
|
|
51
|
+
{/* List */}
|
|
52
|
+
<Animated.View
|
|
53
|
+
style={[
|
|
54
|
+
styles.listWrap,
|
|
55
|
+
selected
|
|
56
|
+
? { opacity: listOpacity, transform: [{ translateX: listTranslateX }] }
|
|
57
|
+
: null,
|
|
58
|
+
]}
|
|
59
|
+
>
|
|
60
|
+
{renderListHeader?.()}
|
|
61
|
+
{displayData.length === 0 ? (
|
|
62
|
+
<View style={styles.emptyContainer}>
|
|
63
|
+
<Text style={styles.emptyIcon}>~</Text>
|
|
64
|
+
<Text style={styles.empty}>{emptyText}</Text>
|
|
65
|
+
</View>
|
|
66
|
+
) : (
|
|
67
|
+
<FlatList
|
|
68
|
+
data={displayData}
|
|
69
|
+
renderItem={({ item }) => (
|
|
70
|
+
<TouchableOpacity
|
|
71
|
+
style={styles.card}
|
|
72
|
+
onPress={() => setSelected(item)}
|
|
73
|
+
activeOpacity={0.6}
|
|
74
|
+
>
|
|
75
|
+
{renderRow(item)}
|
|
76
|
+
</TouchableOpacity>
|
|
77
|
+
)}
|
|
78
|
+
keyExtractor={(item) => item.id}
|
|
79
|
+
contentContainerStyle={styles.listContent}
|
|
80
|
+
initialNumToRender={20}
|
|
81
|
+
maxToRenderPerBatch={10}
|
|
82
|
+
windowSize={5}
|
|
83
|
+
removeClippedSubviews={true}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
</Animated.View>
|
|
87
|
+
|
|
88
|
+
{/* Detail */}
|
|
89
|
+
{selected && (
|
|
90
|
+
<Animated.View
|
|
91
|
+
style={[styles.detailOverlay, { transform: [{ translateX: detailTranslateX }] }]}
|
|
92
|
+
>
|
|
93
|
+
<View style={styles.detailWrap}>
|
|
94
|
+
<View style={styles.detailHeader}>
|
|
95
|
+
<TouchableOpacity
|
|
96
|
+
onPress={() => setSelected(null)}
|
|
97
|
+
style={styles.backBtn}
|
|
98
|
+
activeOpacity={0.6}
|
|
99
|
+
>
|
|
100
|
+
<Text style={styles.backIcon}>‹</Text>
|
|
101
|
+
<Text style={styles.backText}>Back</Text>
|
|
102
|
+
</TouchableOpacity>
|
|
103
|
+
{renderDetailHeader?.(selected)}
|
|
104
|
+
</View>
|
|
105
|
+
{renderDetailBody(selected)}
|
|
106
|
+
</View>
|
|
107
|
+
</Animated.View>
|
|
108
|
+
)}
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const styles = StyleSheet.create({
|
|
114
|
+
container: { flex: 1, backgroundColor: Colors.background },
|
|
115
|
+
listWrap: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
|
|
116
|
+
listContent: { padding: 12 },
|
|
117
|
+
emptyContainer: { flex: 1, alignItems: 'center', justifyContent: 'center' },
|
|
118
|
+
emptyIcon: { fontSize: 40, color: Colors.textLight, marginBottom: 4 },
|
|
119
|
+
empty: { textAlign: 'center', color: Colors.textLight, fontSize: 14 },
|
|
120
|
+
card: {
|
|
121
|
+
backgroundColor: Colors.surface,
|
|
122
|
+
borderRadius: 12,
|
|
123
|
+
marginBottom: 8,
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
},
|
|
126
|
+
detailOverlay: {
|
|
127
|
+
position: 'absolute',
|
|
128
|
+
top: 0,
|
|
129
|
+
left: 0,
|
|
130
|
+
right: 0,
|
|
131
|
+
bottom: 0,
|
|
132
|
+
backgroundColor: Colors.background,
|
|
133
|
+
},
|
|
134
|
+
detailWrap: { flex: 1, backgroundColor: Colors.background },
|
|
135
|
+
detailHeader: {
|
|
136
|
+
flexDirection: 'row',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
paddingHorizontal: 8,
|
|
139
|
+
paddingVertical: 10,
|
|
140
|
+
backgroundColor: Colors.surface,
|
|
141
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
142
|
+
borderBottomColor: Colors.border,
|
|
143
|
+
gap: 8,
|
|
144
|
+
},
|
|
145
|
+
backBtn: {
|
|
146
|
+
flexDirection: 'row',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
paddingHorizontal: 6,
|
|
149
|
+
paddingVertical: 4,
|
|
150
|
+
borderRadius: 8,
|
|
151
|
+
},
|
|
152
|
+
backIcon: {
|
|
153
|
+
fontSize: 24,
|
|
154
|
+
fontWeight: '300',
|
|
155
|
+
color: Colors.primary,
|
|
156
|
+
marginTop: -2,
|
|
157
|
+
marginRight: 2,
|
|
158
|
+
},
|
|
159
|
+
backText: {
|
|
160
|
+
fontSize: 16,
|
|
161
|
+
color: Colors.primary,
|
|
162
|
+
fontWeight: '500',
|
|
163
|
+
},
|
|
164
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const Colors = {
|
|
2
|
+
primary: '#007AFF',
|
|
3
|
+
text: '#1C1C1E',
|
|
4
|
+
textSecondary: '#8E8E93',
|
|
5
|
+
textLight: '#C7C7CC',
|
|
6
|
+
border: '#E5E5EA',
|
|
7
|
+
background: '#F2F2F7',
|
|
8
|
+
surface: '#FFFFFF',
|
|
9
|
+
|
|
10
|
+
success: '#34C759',
|
|
11
|
+
error: '#FF3B30',
|
|
12
|
+
warning: '#FF9500',
|
|
13
|
+
info: '#5AC8FA',
|
|
14
|
+
|
|
15
|
+
purple: '#AF52DE',
|
|
16
|
+
|
|
17
|
+
get: '#007AFF',
|
|
18
|
+
post: '#34C759',
|
|
19
|
+
put: '#FF9500',
|
|
20
|
+
delete: '#FF3B30',
|
|
21
|
+
patch: '#5AC8FA',
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export function getMethodColor(method: string): string {
|
|
25
|
+
switch (method.toUpperCase()) {
|
|
26
|
+
case 'GET': return Colors.get;
|
|
27
|
+
case 'POST': return Colors.post;
|
|
28
|
+
case 'PUT': return Colors.put;
|
|
29
|
+
case 'DELETE': return Colors.delete;
|
|
30
|
+
case 'PATCH': return Colors.patch;
|
|
31
|
+
default: return Colors.textSecondary;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ICON_SIZE = 52;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { DebugFeature, DebugFeatureListener, DebugFeatureRenderProps } from '../types';
|
|
3
|
+
import type { EventChannel } from './createEventChannel';
|
|
4
|
+
import { createObservableStore, type ObservableStore } from './createObservableStore';
|
|
5
|
+
import { createPersistedObservableStore } from './createPersistedObservableStore';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_MAX_LOGS = 200;
|
|
8
|
+
|
|
9
|
+
export interface ChannelFeaturePersistConfig<TEntry> {
|
|
10
|
+
storageKey: string;
|
|
11
|
+
maxPersist: number;
|
|
12
|
+
debounceMs?: number;
|
|
13
|
+
serialize?: (entry: TEntry) => unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Generic factory for features that subscribe to an event channel.
|
|
18
|
+
* Eliminates boilerplate across channel-based features (Track, Navigation, Zustand).
|
|
19
|
+
*
|
|
20
|
+
* @param getChannel - Function returning the current channel (supports test resets)
|
|
21
|
+
* @param toEntry - Maps a payload + auto-generated id to a typed log entry
|
|
22
|
+
* @param options - Feature name, label, render component, and optional maxLogs
|
|
23
|
+
*/
|
|
24
|
+
export function createChannelFeature<TPayload, TEntry extends { id?: string }>(
|
|
25
|
+
getChannel: () => EventChannel<TPayload>,
|
|
26
|
+
toEntry: (payload: TPayload, id: string) => TEntry,
|
|
27
|
+
options: {
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
renderContent?: ComponentType<DebugFeatureRenderProps<TEntry[]>>;
|
|
31
|
+
maxLogs?: number;
|
|
32
|
+
persist?: ChannelFeaturePersistConfig<TEntry>;
|
|
33
|
+
},
|
|
34
|
+
): DebugFeature<TEntry[]> {
|
|
35
|
+
const maxLogs = options.maxLogs ?? DEFAULT_MAX_LOGS;
|
|
36
|
+
let nextId = 0;
|
|
37
|
+
let logStore: ObservableStore<TEntry>;
|
|
38
|
+
let getId: () => string;
|
|
39
|
+
|
|
40
|
+
if (options.persist) {
|
|
41
|
+
const persisted = createPersistedObservableStore<TEntry>({
|
|
42
|
+
storageKey: options.persist.storageKey,
|
|
43
|
+
maxPersist: options.persist.maxPersist,
|
|
44
|
+
debounceMs: options.persist.debounceMs,
|
|
45
|
+
serialize: options.persist.serialize,
|
|
46
|
+
});
|
|
47
|
+
logStore = persisted;
|
|
48
|
+
getId = () => persisted.nextId();
|
|
49
|
+
} else {
|
|
50
|
+
logStore = createObservableStore<TEntry>();
|
|
51
|
+
getId = () => String(nextId++);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let initialized = false;
|
|
55
|
+
let unsubscribe: (() => void) | null = null;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
name: options.name,
|
|
59
|
+
label: options.label,
|
|
60
|
+
renderContent: options.renderContent,
|
|
61
|
+
setup: () => {
|
|
62
|
+
if (initialized) return;
|
|
63
|
+
unsubscribe = getChannel().subscribe((payload) => {
|
|
64
|
+
logStore.push(toEntry(payload, getId()), maxLogs);
|
|
65
|
+
});
|
|
66
|
+
initialized = true;
|
|
67
|
+
},
|
|
68
|
+
getSnapshot: () => logStore.getData(),
|
|
69
|
+
clear: () => {
|
|
70
|
+
logStore.clear();
|
|
71
|
+
},
|
|
72
|
+
cleanup: () => {
|
|
73
|
+
unsubscribe?.();
|
|
74
|
+
unsubscribe = null;
|
|
75
|
+
logStore.clear();
|
|
76
|
+
initialized = false;
|
|
77
|
+
},
|
|
78
|
+
subscribe: (listener: DebugFeatureListener) => logStore.subscribe(listener),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -3,6 +3,7 @@ export type StoreListener = () => void;
|
|
|
3
3
|
export interface ObservableStore<T> {
|
|
4
4
|
getData: () => T[];
|
|
5
5
|
push: (item: T, maxEntries?: number) => void;
|
|
6
|
+
pushBatch: (items: T[]) => void;
|
|
6
7
|
clear: () => void;
|
|
7
8
|
subscribe: (listener: StoreListener) => () => void;
|
|
8
9
|
}
|
|
@@ -25,6 +26,11 @@ export function createObservableStore<T>(): ObservableStore<T> {
|
|
|
25
26
|
}
|
|
26
27
|
notify();
|
|
27
28
|
},
|
|
29
|
+
pushBatch: (items) => {
|
|
30
|
+
if (items.length === 0) return;
|
|
31
|
+
data = [...data, ...items];
|
|
32
|
+
notify();
|
|
33
|
+
},
|
|
28
34
|
clear: () => {
|
|
29
35
|
if (data.length === 0) {
|
|
30
36
|
return;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createObservableStore, type ObservableStore } from './createObservableStore';
|
|
2
|
+
import { getPreference, setPreference } from './debugPreferences';
|
|
3
|
+
|
|
4
|
+
export interface PersistedStoreOptions<T> {
|
|
5
|
+
storageKey: string;
|
|
6
|
+
maxPersist: number;
|
|
7
|
+
debounceMs?: number;
|
|
8
|
+
serialize?: (entry: T) => unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PersistedObservableStore<T> extends ObservableStore<T> {
|
|
12
|
+
/** Returns the next auto-incrementing ID and advances the counter. */
|
|
13
|
+
nextId: () => string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createPersistedObservableStore<T extends { id?: string }>(
|
|
17
|
+
options: PersistedStoreOptions<T>,
|
|
18
|
+
): PersistedObservableStore<T> {
|
|
19
|
+
const { storageKey, maxPersist, debounceMs = 2000, serialize } = options;
|
|
20
|
+
const store = createObservableStore<T>();
|
|
21
|
+
let writeTimer: ReturnType<typeof setTimeout> | null = null;
|
|
22
|
+
let idCounter = 0;
|
|
23
|
+
|
|
24
|
+
// Restore from storage (single notify via pushBatch)
|
|
25
|
+
getPreference(storageKey).then((raw) => {
|
|
26
|
+
if (!raw) return;
|
|
27
|
+
try {
|
|
28
|
+
const entries = JSON.parse(raw) as T[];
|
|
29
|
+
if (!Array.isArray(entries)) return;
|
|
30
|
+
const restored = entries.slice(-maxPersist);
|
|
31
|
+
store.pushBatch(restored);
|
|
32
|
+
// Fix ID counter to avoid collision with restored entries
|
|
33
|
+
let max = 0;
|
|
34
|
+
for (const e of restored) {
|
|
35
|
+
const n = parseInt(e.id ?? '', 10);
|
|
36
|
+
if (!isNaN(n) && n >= max) max = n + 1;
|
|
37
|
+
}
|
|
38
|
+
idCounter = max;
|
|
39
|
+
} catch {
|
|
40
|
+
// ignore corrupt data
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function scheduleWrite(): void {
|
|
45
|
+
if (writeTimer !== null) clearTimeout(writeTimer);
|
|
46
|
+
writeTimer = setTimeout(() => {
|
|
47
|
+
writeTimer = null;
|
|
48
|
+
const data = store.getData().slice(-maxPersist);
|
|
49
|
+
const toStore = serialize ? data.map(serialize) : data;
|
|
50
|
+
try {
|
|
51
|
+
setPreference(storageKey, JSON.stringify(toStore));
|
|
52
|
+
} catch {
|
|
53
|
+
// stringify failed (circular refs, etc) — skip write
|
|
54
|
+
}
|
|
55
|
+
}, debounceMs);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
getData: store.getData,
|
|
60
|
+
push: (item, maxEntries) => {
|
|
61
|
+
store.push(item, maxEntries);
|
|
62
|
+
scheduleWrite();
|
|
63
|
+
},
|
|
64
|
+
pushBatch: store.pushBatch,
|
|
65
|
+
clear: () => {
|
|
66
|
+
store.clear();
|
|
67
|
+
if (writeTimer !== null) {
|
|
68
|
+
clearTimeout(writeTimer);
|
|
69
|
+
writeTimer = null;
|
|
70
|
+
}
|
|
71
|
+
setPreference(storageKey, '[]');
|
|
72
|
+
},
|
|
73
|
+
subscribe: store.subscribe,
|
|
74
|
+
nextId: () => String(idCounter++),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
+
type AsyncStorageLike = { getItem: (k: string) => Promise<string | null>; setItem: (k: string, v: string) => Promise<void> };
|
|
3
|
+
|
|
4
|
+
const memoryStore = new Map<string, string>();
|
|
5
|
+
|
|
6
|
+
function loadAsyncStorage(): AsyncStorageLike | null {
|
|
7
|
+
try {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9
|
+
const mod = require('@react-native-async-storage/async-storage');
|
|
10
|
+
if (mod && typeof mod.getItem === 'function') return mod;
|
|
11
|
+
return null;
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function setPreference(key: string, value: string): Promise<void> {
|
|
18
|
+
memoryStore.set(key, value);
|
|
19
|
+
const AsyncStorage = loadAsyncStorage();
|
|
20
|
+
if (AsyncStorage) {
|
|
21
|
+
try {
|
|
22
|
+
await AsyncStorage.setItem(key, value);
|
|
23
|
+
} catch {
|
|
24
|
+
// degrade to memory only
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function getPreference(key: string): Promise<string | null> {
|
|
30
|
+
const AsyncStorage = loadAsyncStorage();
|
|
31
|
+
if (AsyncStorage) {
|
|
32
|
+
try {
|
|
33
|
+
const val = await AsyncStorage.getItem(key);
|
|
34
|
+
if (val !== null) return val;
|
|
35
|
+
} catch {
|
|
36
|
+
// fall through to memory
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return memoryStore.get(key) ?? null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const KEYS = {
|
|
43
|
+
fabPosition: '@react_native_debug_toolkit/fab_position',
|
|
44
|
+
lastTab: '@react_native_debug_toolkit/last_tab',
|
|
45
|
+
consoleLogs: '@react_native_debug_toolkit/console_logs',
|
|
46
|
+
networkLogs: '@react_native_debug_toolkit/network_logs',
|
|
47
|
+
trackLogs: '@react_native_debug_toolkit/track_logs',
|
|
48
|
+
} as const;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_constants","_copyToComputer","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ClipboardTab","text","setText","useState","feedback","setFeedback","handleCopy","useCallback","result","copyToComputer","label","method","setTimeout","jsxs","View","style","s","container","children","jsx","TextInput","input","value","onChangeText","placeholder","placeholderTextColor","Colors","textLight","multiline","textAlignVertical","footer","TouchableOpacity","copyBtn","onPress","activeOpacity","Text","copyBtnText","hint","exports","StyleSheet","create","flex","backgroundColor","background","padding","Spacing","md","surface","borderRadius","Radius","fontSize","color","lineHeight","paddingTop","sm","minHeight","alignItems","paddingHorizontal","paddingVertical","primary","fontWeight"],"sourceRoot":"../../../src","sources":["components/ClipboardTab.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAAyD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,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