react-native-debug-toolkit 0.6.3 → 2.0.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/LICENSE +21 -0
- package/README.md +150 -212
- package/lib/commonjs/components/ClipboardTab.js +92 -0
- package/lib/commonjs/components/ClipboardTab.js.map +1 -0
- package/lib/commonjs/components/ConsoleLogTab.js +295 -0
- package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/components/EnvironmentTab.js +288 -0
- package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/components/FloatPanelView.js +797 -0
- package/lib/commonjs/components/FloatPanelView.js.map +1 -0
- package/lib/commonjs/components/NavigationLogTab.js +131 -0
- package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/components/NetworkLogTab.js +575 -0
- package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/components/TrackLogTab.js +372 -0
- package/lib/commonjs/components/TrackLogTab.js.map +1 -0
- package/lib/commonjs/components/ZustandLogTab.js +451 -0
- package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/components/shared/CopyButton.js +64 -0
- package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/components/shared/JsonView.js +157 -0
- package/lib/commonjs/components/shared/JsonView.js.map +1 -0
- package/lib/commonjs/core/DebugToolkit.js +142 -0
- package/lib/commonjs/core/DebugToolkit.js.map +1 -0
- package/lib/commonjs/core/DebugToolkitProvider.js +64 -0
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
- package/lib/commonjs/features/ClipboardFeature.js +17 -0
- package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
- package/lib/commonjs/features/ConsoleLogFeature.js +98 -0
- package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
- package/lib/commonjs/features/EnvironmentFeature.js +168 -0
- package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
- package/lib/commonjs/features/NavigationLogFeature.js +60 -0
- package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
- package/lib/commonjs/features/NetworkFeature.js +328 -0
- package/lib/commonjs/features/NetworkFeature.js.map +1 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/commonjs/features/TrackFeature.js +55 -0
- package/lib/commonjs/features/TrackFeature.js.map +1 -0
- package/lib/commonjs/features/ZustandLogFeature.js +76 -0
- package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
- package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
- package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/index.js +165 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +161 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/native/NativeDebugLibs.js +58 -0
- package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/constants.js +135 -0
- package/lib/commonjs/utils/constants.js.map +1 -0
- package/lib/commonjs/utils/copyToComputer.js +97 -0
- package/lib/commonjs/utils/copyToComputer.js.map +1 -0
- package/lib/commonjs/utils/createEventChannel.js +21 -0
- package/lib/commonjs/utils/createEventChannel.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +38 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -0
- package/lib/commonjs/utils/safeStringify.js +27 -0
- package/lib/commonjs/utils/safeStringify.js.map +1 -0
- package/lib/module/components/ClipboardTab.js +86 -0
- package/lib/module/components/ClipboardTab.js.map +1 -0
- package/lib/module/components/ConsoleLogTab.js +290 -0
- package/lib/module/components/ConsoleLogTab.js.map +1 -0
- package/lib/module/components/EnvironmentTab.js +282 -0
- package/lib/module/components/EnvironmentTab.js.map +1 -0
- package/lib/module/components/FloatPanelView.js +791 -0
- package/lib/module/components/FloatPanelView.js.map +1 -0
- package/lib/module/components/NavigationLogTab.js +126 -0
- package/lib/module/components/NavigationLogTab.js.map +1 -0
- package/lib/module/components/NetworkLogTab.js +570 -0
- package/lib/module/components/NetworkLogTab.js.map +1 -0
- package/lib/module/components/ThirdPartyLibsTab.js +91 -0
- package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/components/TrackLogTab.js +367 -0
- package/lib/module/components/TrackLogTab.js.map +1 -0
- package/lib/module/components/ZustandLogTab.js +446 -0
- package/lib/module/components/ZustandLogTab.js.map +1 -0
- package/lib/module/components/shared/CollapsibleSection.js +78 -0
- package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/components/shared/CopyButton.js +58 -0
- package/lib/module/components/shared/CopyButton.js.map +1 -0
- package/lib/module/components/shared/JsonView.js +152 -0
- package/lib/module/components/shared/JsonView.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +137 -0
- package/lib/module/core/DebugToolkit.js.map +1 -0
- package/lib/module/core/DebugToolkitProvider.js +58 -0
- package/lib/module/core/DebugToolkitProvider.js.map +1 -0
- package/lib/module/features/ClipboardFeature.js +12 -0
- package/lib/module/features/ClipboardFeature.js.map +1 -0
- package/lib/module/features/ConsoleLogFeature.js +93 -0
- package/lib/module/features/ConsoleLogFeature.js.map +1 -0
- package/lib/module/features/EnvironmentFeature.js +164 -0
- package/lib/module/features/EnvironmentFeature.js.map +1 -0
- package/lib/module/features/NavigationLogFeature.js +54 -0
- package/lib/module/features/NavigationLogFeature.js.map +1 -0
- package/lib/module/features/NetworkFeature.js +322 -0
- package/lib/module/features/NetworkFeature.js.map +1 -0
- package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
- package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/module/features/TrackFeature.js +49 -0
- package/lib/module/features/TrackFeature.js.map +1 -0
- package/lib/module/features/ZustandLogFeature.js +69 -0
- package/lib/module/features/ZustandLogFeature.js.map +1 -0
- package/lib/module/hooks/useNavigationLogger.js +74 -0
- package/lib/module/hooks/useNavigationLogger.js.map +1 -0
- package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
- package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +156 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/native/NativeDebugLibs.js +54 -0
- package/lib/module/native/NativeDebugLibs.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/constants.js +130 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/copyToComputer.js +91 -0
- package/lib/module/utils/copyToComputer.js.map +1 -0
- package/lib/module/utils/createEventChannel.js +17 -0
- package/lib/module/utils/createEventChannel.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +34 -0
- package/lib/module/utils/createObservableStore.js.map +1 -0
- package/lib/module/utils/safeStringify.js +23 -0
- package/lib/module/utils/safeStringify.js.map +1 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts +64 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +27 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +18 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts +3 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +7 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts +8 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts +28 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/TrackFeature.d.ts +12 -0
- package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts +29 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts +20 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +26 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/initialize.d.ts +51 -0
- package/lib/typescript/src/initialize.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +112 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/constants.d.ts +96 -0
- package/lib/typescript/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
- package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
- package/package.json +63 -24
- package/src/components/ClipboardTab.tsx +81 -0
- package/src/components/ConsoleLogTab.tsx +209 -0
- package/src/components/EnvironmentTab.tsx +276 -0
- package/src/components/FloatPanelView.tsx +714 -0
- package/src/components/NavigationLogTab.tsx +66 -0
- package/src/components/NetworkLogTab.tsx +411 -0
- package/src/components/ThirdPartyLibsTab.tsx +63 -0
- package/src/components/TrackLogTab.tsx +245 -0
- package/src/components/ZustandLogTab.tsx +305 -0
- package/src/components/shared/CollapsibleSection.tsx +78 -0
- package/src/components/shared/CopyButton.tsx +68 -0
- package/src/components/shared/JsonView.tsx +125 -0
- package/src/core/DebugToolkit.tsx +174 -0
- package/src/core/DebugToolkitProvider.tsx +89 -0
- package/src/features/ClipboardFeature.ts +11 -0
- package/src/features/ConsoleLogFeature.ts +118 -0
- package/src/features/EnvironmentFeature.ts +194 -0
- package/src/features/NavigationLogFeature.ts +74 -0
- package/src/features/NetworkFeature.ts +488 -0
- package/src/features/ThirdPartyLibsFeature.ts +42 -0
- package/src/features/TrackFeature.ts +69 -0
- package/src/features/ZustandLogFeature.ts +127 -0
- package/src/hooks/useNavigationLogger.ts +107 -0
- package/src/hooks/useSlideDetailAnimation.ts +45 -0
- package/src/index.ts +52 -0
- package/src/initialize.ts +214 -0
- package/src/native/NativeDebugLibs.ts +74 -0
- package/src/types/index.ts +138 -0
- package/src/utils/constants.ts +91 -0
- package/src/utils/copyToComputer.ts +104 -0
- package/src/utils/createEventChannel.ts +22 -0
- package/src/utils/createObservableStore.ts +42 -0
- package/src/utils/safeStringify.ts +25 -0
- package/.cursor/rules/react-native.mdc +0 -41
- package/README.zh-CN.md +0 -230
- package/android/build.gradle +0 -34
- package/android/src/main/AndroidManifest.xml +0 -8
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypeModule.java +0 -44
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypePackage.java +0 -25
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsModule.java +0 -75
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsPackage.java +0 -28
- package/index.js +0 -41
- package/ios/BuildTypeModule.h +0 -9
- package/ios/BuildTypeModule.m +0 -42
- package/ios/RNDebugLibs.h +0 -10
- package/ios/RNDebugLibs.m +0 -79
- package/lib/DebugToolKit.js +0 -126
- package/lib/EnvironmentManager.ts +0 -80
- package/lib/NativeDebugLibs.js +0 -67
- package/lib/features/ConsoleLogFeature.js +0 -70
- package/lib/features/NavigationLogFeature.js +0 -45
- package/lib/features/NetworkFeature.js +0 -389
- package/lib/features/PerformanceFeature.js +0 -390
- package/lib/features/ThirdPartyLibsFeature.js +0 -63
- package/lib/features/TrackFeature.js +0 -94
- package/lib/features/ZustandLogFeature.js +0 -44
- package/lib/hooks/useNavigationLogger.js +0 -92
- package/lib/index.js +0 -114
- package/lib/navigation/NavigationLogger.js +0 -1
- package/lib/types/TrackTypes.ts +0 -92
- package/lib/utils/DebugConst.js +0 -67
- package/lib/utils/StorageUtils.js +0 -80
- package/lib/views/ConsoleLogDetails.js +0 -314
- package/lib/views/FloatPanelView.js +0 -697
- package/lib/views/HttpLogDetails.js +0 -648
- package/lib/views/NavigationLogDetails.js +0 -302
- package/lib/views/RestartModal.js +0 -75
- package/lib/views/SubViewConsoleLogs.js +0 -209
- package/lib/views/SubViewEnvironment.js +0 -73
- package/lib/views/SubViewHTTPLogs.js +0 -235
- package/lib/views/SubViewNavigationLogs.js +0 -199
- package/lib/views/SubViewPerformance.js +0 -515
- package/lib/views/SubViewThirdPartyLibs.js +0 -239
- package/lib/views/SubViewTrackLogs.js +0 -318
- package/lib/views/SubViewZustandLogs.js +0 -279
- package/lib/views/TabView.js +0 -66
- package/lib/views/TrackLogDetails.js +0 -481
- package/lib/views/ZustandLogDetails.js +0 -355
- package/react-native-debug-toolkit.podspec +0 -25
- package/react-native.config.js +0 -18
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
export type DebugFeatureListener = () => void;
|
|
3
|
+
export type BuiltInFeatureName = 'network' | 'console' | 'zustand' | 'navigation' | 'track' | 'thirdPartyLibs' | 'environment' | 'clipboard';
|
|
4
|
+
export interface DebugFeatureRenderProps<TData = unknown> {
|
|
5
|
+
data: TData[];
|
|
6
|
+
feature: DebugFeature<TData>;
|
|
7
|
+
}
|
|
8
|
+
export type DebugFeatureRenderer<TData = unknown> = ComponentType<DebugFeatureRenderProps<TData>>;
|
|
9
|
+
export type DebugFeatureFactory = () => DebugFeature<any>;
|
|
10
|
+
export type DebugFeatureInput = BuiltInFeatureName | DebugFeature<any> | DebugFeatureFactory;
|
|
11
|
+
/** Base interface all debug features must implement */
|
|
12
|
+
export interface DebugFeature<TData = unknown> {
|
|
13
|
+
name: string;
|
|
14
|
+
label: string;
|
|
15
|
+
setup: () => void;
|
|
16
|
+
getData: () => TData[];
|
|
17
|
+
clear?: () => void;
|
|
18
|
+
cleanup: () => void;
|
|
19
|
+
subscribe?: (listener: DebugFeatureListener) => () => void;
|
|
20
|
+
renderContent?: DebugFeatureRenderer<TData>;
|
|
21
|
+
badge?: () => {
|
|
22
|
+
label: string;
|
|
23
|
+
color: string;
|
|
24
|
+
} | null;
|
|
25
|
+
}
|
|
26
|
+
export interface NetworkLogEntry {
|
|
27
|
+
id: string;
|
|
28
|
+
timestamp: number;
|
|
29
|
+
duration?: number;
|
|
30
|
+
request: {
|
|
31
|
+
url: string;
|
|
32
|
+
method: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
body?: unknown;
|
|
35
|
+
};
|
|
36
|
+
response?: {
|
|
37
|
+
status: number;
|
|
38
|
+
statusText?: string;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
data?: unknown;
|
|
41
|
+
success?: boolean;
|
|
42
|
+
};
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ConsoleLogEntry {
|
|
46
|
+
id: string;
|
|
47
|
+
timestamp: number;
|
|
48
|
+
level: 'log' | 'info' | 'warn' | 'error';
|
|
49
|
+
data: unknown[];
|
|
50
|
+
}
|
|
51
|
+
export interface ZustandLogEntry {
|
|
52
|
+
id: string;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
action: string;
|
|
55
|
+
prevState: unknown;
|
|
56
|
+
nextState: unknown;
|
|
57
|
+
actionCompleteTime?: number;
|
|
58
|
+
storeName?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface NavigationLogEntry {
|
|
61
|
+
id: string;
|
|
62
|
+
timestamp: number;
|
|
63
|
+
action: string;
|
|
64
|
+
from: string;
|
|
65
|
+
to: string;
|
|
66
|
+
startTime?: number;
|
|
67
|
+
duration?: number;
|
|
68
|
+
debugLog?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface TrackLogEntry {
|
|
71
|
+
id: string;
|
|
72
|
+
timestamp: number;
|
|
73
|
+
eventName: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
export interface ThirdPartyLib {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
description: string;
|
|
80
|
+
platform: 'ios' | 'android' | 'both';
|
|
81
|
+
actions: Array<{
|
|
82
|
+
id: string;
|
|
83
|
+
label: string;
|
|
84
|
+
onPress: () => void;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export interface EnvironmentConfig {
|
|
88
|
+
id: string;
|
|
89
|
+
label: string;
|
|
90
|
+
host: string;
|
|
91
|
+
color?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface EnvironmentState {
|
|
94
|
+
environments: EnvironmentConfig[];
|
|
95
|
+
currentEnvironmentId: string | null;
|
|
96
|
+
}
|
|
97
|
+
export interface DebugToolkitConfig {
|
|
98
|
+
features?: DebugFeatureInput[];
|
|
99
|
+
enabled?: boolean;
|
|
100
|
+
/** Maximum number of log entries per feature (default: 200) */
|
|
101
|
+
maxLogsPerFeature?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface DebugToolkitAPI {
|
|
104
|
+
readonly features: ReadonlyArray<DebugFeature<any>>;
|
|
105
|
+
addFeature: (feature: DebugFeature<any>) => void;
|
|
106
|
+
removeFeature: (name: string) => void;
|
|
107
|
+
showPanel: () => void;
|
|
108
|
+
hidePanel: () => void;
|
|
109
|
+
clearAll: () => void;
|
|
110
|
+
destroy: () => void;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export declare const Layout: {
|
|
2
|
+
readonly screenWidth: number;
|
|
3
|
+
readonly screenHeight: number;
|
|
4
|
+
readonly iconSize: 52;
|
|
5
|
+
};
|
|
6
|
+
export declare const Colors: {
|
|
7
|
+
readonly primary: "#007AFF";
|
|
8
|
+
readonly text: "#1C1C1E";
|
|
9
|
+
readonly textSecondary: "#8E8E93";
|
|
10
|
+
readonly textLight: "#C7C7CC";
|
|
11
|
+
readonly border: "#E5E5EA";
|
|
12
|
+
readonly opaqueSeparator: "#C6C6C8";
|
|
13
|
+
readonly background: "#F2F2F7";
|
|
14
|
+
readonly surface: "#FFFFFF";
|
|
15
|
+
readonly success: "#34C759";
|
|
16
|
+
readonly error: "#FF3B30";
|
|
17
|
+
readonly warning: "#FF9500";
|
|
18
|
+
readonly info: "#5AC8FA";
|
|
19
|
+
readonly blue: "#007AFF";
|
|
20
|
+
readonly green: "#34C759";
|
|
21
|
+
readonly indigo: "#5856D6";
|
|
22
|
+
readonly orange: "#FF9500";
|
|
23
|
+
readonly pink: "#FF2D55";
|
|
24
|
+
readonly purple: "#AF52DE";
|
|
25
|
+
readonly red: "#FF3B30";
|
|
26
|
+
readonly teal: "#5AC8FA";
|
|
27
|
+
readonly yellow: "#FFCC00";
|
|
28
|
+
readonly get: "#007AFF";
|
|
29
|
+
readonly post: "#34C759";
|
|
30
|
+
readonly put: "#FF9500";
|
|
31
|
+
readonly delete: "#FF3B30";
|
|
32
|
+
readonly patch: "#5AC8FA";
|
|
33
|
+
};
|
|
34
|
+
export declare const getMethodColor: (method: string) => string;
|
|
35
|
+
export declare const Spacing: {
|
|
36
|
+
readonly xs: 4;
|
|
37
|
+
readonly sm: 8;
|
|
38
|
+
readonly md: 12;
|
|
39
|
+
readonly lg: 16;
|
|
40
|
+
readonly xl: 20;
|
|
41
|
+
readonly xxl: 24;
|
|
42
|
+
};
|
|
43
|
+
export declare const Radius: {
|
|
44
|
+
readonly sm: 8;
|
|
45
|
+
readonly md: 12;
|
|
46
|
+
readonly lg: 16;
|
|
47
|
+
readonly xl: 20;
|
|
48
|
+
readonly full: 999;
|
|
49
|
+
};
|
|
50
|
+
export declare const Typography: {
|
|
51
|
+
readonly largeTitle: {
|
|
52
|
+
readonly fontSize: 34;
|
|
53
|
+
readonly fontWeight: "700";
|
|
54
|
+
};
|
|
55
|
+
readonly title1: {
|
|
56
|
+
readonly fontSize: 28;
|
|
57
|
+
readonly fontWeight: "700";
|
|
58
|
+
};
|
|
59
|
+
readonly title2: {
|
|
60
|
+
readonly fontSize: 22;
|
|
61
|
+
readonly fontWeight: "700";
|
|
62
|
+
};
|
|
63
|
+
readonly title3: {
|
|
64
|
+
readonly fontSize: 20;
|
|
65
|
+
readonly fontWeight: "600";
|
|
66
|
+
};
|
|
67
|
+
readonly headline: {
|
|
68
|
+
readonly fontSize: 17;
|
|
69
|
+
readonly fontWeight: "600";
|
|
70
|
+
};
|
|
71
|
+
readonly body: {
|
|
72
|
+
readonly fontSize: 17;
|
|
73
|
+
readonly fontWeight: "400";
|
|
74
|
+
};
|
|
75
|
+
readonly callout: {
|
|
76
|
+
readonly fontSize: 16;
|
|
77
|
+
readonly fontWeight: "400";
|
|
78
|
+
};
|
|
79
|
+
readonly subheadline: {
|
|
80
|
+
readonly fontSize: 15;
|
|
81
|
+
readonly fontWeight: "400";
|
|
82
|
+
};
|
|
83
|
+
readonly footnote: {
|
|
84
|
+
readonly fontSize: 13;
|
|
85
|
+
readonly fontWeight: "400";
|
|
86
|
+
};
|
|
87
|
+
readonly caption1: {
|
|
88
|
+
readonly fontSize: 12;
|
|
89
|
+
readonly fontWeight: "400";
|
|
90
|
+
};
|
|
91
|
+
readonly caption2: {
|
|
92
|
+
readonly fontSize: 11;
|
|
93
|
+
readonly fontWeight: "400";
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCT,CAAC;AAEX,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAS/C,CAAC;AAGF,eAAO,MAAM,OAAO;;;;;;;CAOV,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CopyMethod = 'clipboard' | 'console' | 'none';
|
|
2
|
+
export interface CopyResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
method: CopyMethod;
|
|
5
|
+
}
|
|
6
|
+
export interface CopyOptions {
|
|
7
|
+
/** Descriptive label for console.log identification */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** If true, only copy to clipboard without console.log */
|
|
10
|
+
silent?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Format data for copying (pretty JSON or raw string).
|
|
14
|
+
*/
|
|
15
|
+
export declare function fmt(data: unknown): string;
|
|
16
|
+
/**
|
|
17
|
+
* Log content to console (Metro terminal / DevTools) with a structured prefix.
|
|
18
|
+
* ConsoleLogFeature intercepts console.log but still calls the original first,
|
|
19
|
+
* so output reliably appears in Metro terminal.
|
|
20
|
+
*/
|
|
21
|
+
export declare function logToComputer(content: string, label?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Copy content to computer via the best available method.
|
|
24
|
+
*
|
|
25
|
+
* 1. Attempts device clipboard (if @react-native-clipboard/clipboard is installed)
|
|
26
|
+
* 2. Always console.logs with structured prefix (appears in Metro terminal)
|
|
27
|
+
* 3. Returns result indicating what succeeded
|
|
28
|
+
*/
|
|
29
|
+
export declare function copyToComputer(content: string, options?: CopyOptions): CopyResult;
|
|
30
|
+
//# sourceMappingURL=copyToComputer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyToComputer.d.ts","sourceRoot":"","sources":["../../../../src/utils/copyToComputer.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAID;;GAEG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOzC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAgBnE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAuBjF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type EventListener<TEvent> = (event: TEvent) => void;
|
|
2
|
+
export interface EventChannel<TEvent> {
|
|
3
|
+
emit: (event: TEvent) => void;
|
|
4
|
+
subscribe: (listener: EventListener<TEvent>) => () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function createEventChannel<TEvent>(): EventChannel<TEvent>;
|
|
7
|
+
//# sourceMappingURL=createEventChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEventChannel.d.ts","sourceRoot":"","sources":["../../../../src/utils/createEventChannel.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5D,MAAM,WAAW,YAAY,CAAC,MAAM;IAClC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,IAAI,CAAC;CAC5D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,CAAC,CAcjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type StoreListener = () => void;
|
|
2
|
+
export interface ObservableStore<T> {
|
|
3
|
+
getData: () => T[];
|
|
4
|
+
push: (item: T, maxEntries?: number) => void;
|
|
5
|
+
clear: () => void;
|
|
6
|
+
subscribe: (listener: StoreListener) => () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createObservableStore<T>(): ObservableStore<T>;
|
|
9
|
+
//# sourceMappingURL=createObservableStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createObservableStore.d.ts","sourceRoot":"","sources":["../../../../src/utils/createObservableStore.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AAEvC,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,MAAM,IAAI,CAAC;CACpD;AAED,wBAAgB,qBAAqB,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAgC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeStringify.d.ts","sourceRoot":"","sources":["../../../../src/utils/safeStringify.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAoBpE"}
|
package/package.json
CHANGED
|
@@ -1,43 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-debug-toolkit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A dev-only floating debug panel for React Native with network, console, Zustand, navigation, and event logs",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"src",
|
|
10
|
+
"lib",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"!**/__tests__",
|
|
14
|
+
"!**/__fixtures__",
|
|
15
|
+
"!**/__mocks__"
|
|
16
|
+
],
|
|
8
17
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"url": "git+https://gitlab.outer.staruniongame.com/seaart-app-front/react-native-debug-toolkit.git"
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"typescript": "npm run typecheck",
|
|
20
|
+
"build": "bob build",
|
|
21
|
+
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
22
|
+
"prepare": "bob build"
|
|
15
23
|
},
|
|
16
24
|
"keywords": [
|
|
17
25
|
"react-native",
|
|
18
26
|
"debug",
|
|
19
27
|
"toolkit",
|
|
20
|
-
"
|
|
28
|
+
"http-inspector",
|
|
21
29
|
"development-tools",
|
|
22
|
-
"floating-
|
|
30
|
+
"floating-panel"
|
|
23
31
|
],
|
|
24
32
|
"author": "zcj",
|
|
25
33
|
"license": "MIT",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"react-native-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/zcj0808/react-native-debug-toolkit"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/zcj0808/react-native-debug-toolkit#readme",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/zcj0808/react-native-debug-toolkit/issues"
|
|
31
41
|
},
|
|
32
42
|
"peerDependencies": {
|
|
33
|
-
"react": "
|
|
34
|
-
"react
|
|
43
|
+
"@react-native-clipboard/clipboard": ">=1.0.0",
|
|
44
|
+
"react": ">=18.0.0",
|
|
45
|
+
"react-native": ">=0.72.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@react-native-clipboard/clipboard": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
35
51
|
},
|
|
36
52
|
"devDependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
53
|
+
"@react-native/babel-preset": "^0.76.0",
|
|
54
|
+
"@react-native/eslint-config": "^0.76.0",
|
|
55
|
+
"@types/react": "^18.3.1",
|
|
56
|
+
"eslint": "^8.57.0",
|
|
57
|
+
"prettier": "^3.3.0",
|
|
58
|
+
"react": "^18.3.1",
|
|
59
|
+
"react-native": "^0.76.6",
|
|
60
|
+
"react-native-builder-bob": "^0.30.0",
|
|
61
|
+
"typescript": "^5.5.0"
|
|
39
62
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
63
|
+
"react-native": "src/index.ts",
|
|
64
|
+
"source": "src/index.ts",
|
|
65
|
+
"react-native-builder-bob": {
|
|
66
|
+
"source": "src",
|
|
67
|
+
"output": "lib",
|
|
68
|
+
"targets": [
|
|
69
|
+
"commonjs",
|
|
70
|
+
"module",
|
|
71
|
+
[
|
|
72
|
+
"typescript",
|
|
73
|
+
{
|
|
74
|
+
"project": "tsconfig.json"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@babel/runtime": "^7.29.2"
|
|
42
81
|
}
|
|
43
82
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
import { Colors, Spacing, Radius } from '../utils/constants';
|
|
4
|
+
import { copyToComputer } from '../utils/copyToComputer';
|
|
5
|
+
import type { DebugFeatureRenderProps } from '../types';
|
|
6
|
+
|
|
7
|
+
export const ClipboardTab: React.FC<DebugFeatureRenderProps<void>> = () => {
|
|
8
|
+
const [text, setText] = useState('');
|
|
9
|
+
const [feedback, setFeedback] = useState<string | null>(null);
|
|
10
|
+
|
|
11
|
+
const handleCopy = useCallback(() => {
|
|
12
|
+
if (!text) return;
|
|
13
|
+
try {
|
|
14
|
+
const result = copyToComputer(text, { label: 'Clipboard' });
|
|
15
|
+
setFeedback(result.method === 'clipboard' ? 'Copied' : 'Logged');
|
|
16
|
+
} catch {
|
|
17
|
+
setFeedback('Logged');
|
|
18
|
+
}
|
|
19
|
+
setTimeout(() => setFeedback(null), 2000);
|
|
20
|
+
}, [text]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View style={s.container}>
|
|
24
|
+
<TextInput
|
|
25
|
+
style={s.input}
|
|
26
|
+
value={text}
|
|
27
|
+
onChangeText={setText}
|
|
28
|
+
placeholder="Paste or type text here..."
|
|
29
|
+
placeholderTextColor={Colors.textLight}
|
|
30
|
+
multiline
|
|
31
|
+
textAlignVertical="top"
|
|
32
|
+
/>
|
|
33
|
+
<View style={s.footer}>
|
|
34
|
+
{text ? (
|
|
35
|
+
<TouchableOpacity style={s.copyBtn} onPress={handleCopy} activeOpacity={0.7}>
|
|
36
|
+
<Text style={s.copyBtnText}>{feedback ?? 'Copy'}</Text>
|
|
37
|
+
</TouchableOpacity>
|
|
38
|
+
) : (
|
|
39
|
+
<Text style={s.hint}>Paste or type content above, then copy to computer</Text>
|
|
40
|
+
)}
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const s = StyleSheet.create({
|
|
47
|
+
container: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
backgroundColor: Colors.background,
|
|
50
|
+
padding: Spacing.md,
|
|
51
|
+
},
|
|
52
|
+
input: {
|
|
53
|
+
flex: 1,
|
|
54
|
+
backgroundColor: Colors.surface,
|
|
55
|
+
borderRadius: Radius.md,
|
|
56
|
+
padding: Spacing.md,
|
|
57
|
+
fontSize: 14,
|
|
58
|
+
color: Colors.text,
|
|
59
|
+
lineHeight: 20,
|
|
60
|
+
},
|
|
61
|
+
footer: {
|
|
62
|
+
paddingTop: Spacing.sm,
|
|
63
|
+
minHeight: 36,
|
|
64
|
+
alignItems: 'flex-end',
|
|
65
|
+
},
|
|
66
|
+
hint: {
|
|
67
|
+
fontSize: 12,
|
|
68
|
+
color: Colors.textLight,
|
|
69
|
+
},
|
|
70
|
+
copyBtn: {
|
|
71
|
+
backgroundColor: Colors.background,
|
|
72
|
+
paddingHorizontal: 16,
|
|
73
|
+
paddingVertical: 6,
|
|
74
|
+
borderRadius: Radius.sm,
|
|
75
|
+
},
|
|
76
|
+
copyBtnText: {
|
|
77
|
+
fontSize: 13,
|
|
78
|
+
color: Colors.primary,
|
|
79
|
+
fontWeight: '600',
|
|
80
|
+
},
|
|
81
|
+
});
|