react-native-inapp-inspector 1.0.15 → 1.0.17
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/dist/commonjs/components/AnimatedEntrance.d.ts +12 -0
- package/dist/commonjs/components/AnimatedEntrance.js +72 -0
- package/dist/commonjs/components/ConsoleLogCard.js +114 -29
- package/dist/commonjs/components/EmptyState.js +56 -5
- package/dist/commonjs/components/ReduxTreeView.js +96 -27
- package/dist/commonjs/components/TouchableScale.js +18 -2
- package/dist/commonjs/index.js +100 -34
- package/dist/esm/components/AnimatedEntrance.d.ts +12 -0
- package/dist/esm/components/AnimatedEntrance.js +37 -0
- package/dist/esm/components/ConsoleLogCard.js +116 -31
- package/dist/esm/components/EmptyState.js +24 -6
- package/dist/esm/components/ReduxTreeView.js +95 -29
- package/dist/esm/components/TouchableScale.js +18 -2
- package/dist/esm/index.js +101 -35
- package/package.json +3 -2
|
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.ReduxActionTimeline = exports.ReduxTreeView = void 0;
|
|
37
40
|
const react_1 = __importStar(require("react"));
|
|
@@ -40,6 +43,7 @@ const AppColors_1 = require("../styles/AppColors");
|
|
|
40
43
|
const AppFonts_1 = require("../styles/AppFonts");
|
|
41
44
|
const NetworkIcons_1 = require("./NetworkIcons");
|
|
42
45
|
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
46
|
+
const AnimatedEntrance_1 = __importDefault(require("./AnimatedEntrance"));
|
|
43
47
|
// Custom icons
|
|
44
48
|
const DatabaseIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
45
49
|
<react_native_svg_1.Path d="M12 2C6.5 2 2 4.2 2 7v10c0 2.8 4.5 5 10 5s10-2.2 10-5V7c0-2.8-4.5-5-10-5z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
@@ -52,6 +56,26 @@ const BoltIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) =>
|
|
|
52
56
|
const FolderIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
53
57
|
<react_native_svg_1.Path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
54
58
|
</react_native_svg_1.default>);
|
|
59
|
+
const animateTreeLayout = () => {
|
|
60
|
+
react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
|
|
61
|
+
};
|
|
62
|
+
const AnimatedChevron = ({ color, expanded, size, style, }) => {
|
|
63
|
+
const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(expanded ? 1 : 0)).current;
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
react_native_1.Animated.timing(progress, {
|
|
66
|
+
toValue: expanded ? 1 : 0,
|
|
67
|
+
duration: 180,
|
|
68
|
+
useNativeDriver: true,
|
|
69
|
+
}).start();
|
|
70
|
+
}, [expanded, progress]);
|
|
71
|
+
const rotate = progress.interpolate({
|
|
72
|
+
inputRange: [0, 1],
|
|
73
|
+
outputRange: ['0deg', '90deg'],
|
|
74
|
+
});
|
|
75
|
+
return (<react_native_1.Animated.View style={[style, { transform: [{ rotate }] }]}>
|
|
76
|
+
<NetworkIcons_1.ChevronIcon color={color} size={size}/>
|
|
77
|
+
</react_native_1.Animated.View>);
|
|
78
|
+
};
|
|
55
79
|
const ReduxValueNode = ({ name, value, level, search }) => {
|
|
56
80
|
const [expanded, setExpanded] = (0, react_1.useState)(level < 1);
|
|
57
81
|
const isObject = typeof value === 'object' && value !== null;
|
|
@@ -75,7 +99,11 @@ const ReduxValueNode = ({ name, value, level, search }) => {
|
|
|
75
99
|
return null;
|
|
76
100
|
}
|
|
77
101
|
if (!isObject) {
|
|
78
|
-
const valStr = value === null
|
|
102
|
+
const valStr = value === null
|
|
103
|
+
? 'null'
|
|
104
|
+
: value === undefined
|
|
105
|
+
? 'undefined'
|
|
106
|
+
: String(value);
|
|
79
107
|
// Pick different colors for primitives
|
|
80
108
|
let valColor = '#0D9488'; // String
|
|
81
109
|
if (value === null || value === undefined) {
|
|
@@ -99,13 +127,16 @@ const ReduxValueNode = ({ name, value, level, search }) => {
|
|
|
99
127
|
</react_native_1.View>);
|
|
100
128
|
}
|
|
101
129
|
const keys = Object.keys(value);
|
|
102
|
-
const summaryText = isArray
|
|
130
|
+
const summaryText = isArray
|
|
131
|
+
? `Array [${keys.length}]`
|
|
132
|
+
: `Object {${keys.length}}`;
|
|
103
133
|
return (<react_native_1.View style={reduxValueStyles.treeNodeBlock}>
|
|
104
|
-
<react_native_1.Pressable onPress={() =>
|
|
134
|
+
<react_native_1.Pressable onPress={() => {
|
|
135
|
+
animateTreeLayout();
|
|
136
|
+
setExpanded(!expanded);
|
|
137
|
+
}} style={reduxValueStyles.treeRow}>
|
|
105
138
|
<react_native_1.View style={reduxValueStyles.treeLeafConnector}/>
|
|
106
|
-
<
|
|
107
|
-
<NetworkIcons_1.ChevronIcon color={AppColors_1.AppColors.grayTextWeak} size={10}/>
|
|
108
|
-
</react_native_1.View>
|
|
139
|
+
<AnimatedChevron color={AppColors_1.AppColors.grayTextWeak} expanded={expanded} size={10} style={reduxValueStyles.chevronWrap}/>
|
|
109
140
|
<react_native_1.Text style={reduxValueStyles.keyText} selectable={true}>
|
|
110
141
|
{nameStr}
|
|
111
142
|
<react_native_1.Text style={reduxValueStyles.colonText}>: </react_native_1.Text>
|
|
@@ -120,13 +151,24 @@ const ReduxValueNode = ({ name, value, level, search }) => {
|
|
|
120
151
|
const ReduxTreeView = ({ state, lastActionMap, search, }) => {
|
|
121
152
|
const [storeExpanded, setStoreExpanded] = (0, react_1.useState)(true);
|
|
122
153
|
const [reducerExpanded, setReducerExpanded] = (0, react_1.useState)({});
|
|
154
|
+
(0, react_1.useEffect)(() => {
|
|
155
|
+
if (react_native_1.Platform.OS === 'android') {
|
|
156
|
+
react_native_1.UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
157
|
+
}
|
|
158
|
+
}, []);
|
|
123
159
|
if (!state || typeof state !== 'object') {
|
|
124
|
-
return (<react_native_1.Text style={{
|
|
160
|
+
return (<react_native_1.Text style={{
|
|
161
|
+
fontFamily: AppFonts_1.AppFonts.interRegular,
|
|
162
|
+
fontSize: 12,
|
|
163
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
164
|
+
padding: 12,
|
|
165
|
+
}}>
|
|
125
166
|
No state object to display.
|
|
126
167
|
</react_native_1.Text>);
|
|
127
168
|
}
|
|
128
169
|
const reducers = Object.keys(state);
|
|
129
170
|
const toggleReducer = (key) => {
|
|
171
|
+
animateTreeLayout();
|
|
130
172
|
setReducerExpanded(prev => ({
|
|
131
173
|
...prev,
|
|
132
174
|
[key]: !prev[key],
|
|
@@ -134,10 +176,11 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
|
|
|
134
176
|
};
|
|
135
177
|
return (<react_native_1.View style={styles.container}>
|
|
136
178
|
{/* Root Node: Store */}
|
|
137
|
-
<react_native_1.Pressable onPress={() =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
179
|
+
<react_native_1.Pressable onPress={() => {
|
|
180
|
+
animateTreeLayout();
|
|
181
|
+
setStoreExpanded(!storeExpanded);
|
|
182
|
+
}} style={styles.storeHeader}>
|
|
183
|
+
<AnimatedChevron color="#FFFFFF" expanded={storeExpanded} size={12} style={styles.chevronWrap}/>
|
|
141
184
|
<react_native_1.Text style={styles.storeTitle}>🏪 Redux Store</react_native_1.Text>
|
|
142
185
|
<react_native_1.View style={styles.badge}>
|
|
143
186
|
<react_native_1.Text style={styles.badgeText}>{reducers.length} Reducers</react_native_1.Text>
|
|
@@ -152,14 +195,15 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
|
|
|
152
195
|
const lastAction = lastActionMap[reducerKey];
|
|
153
196
|
return (<react_native_1.View key={reducerKey} style={styles.reducerContainer}>
|
|
154
197
|
{/* Visual Branch Line for Reducer */}
|
|
155
|
-
<react_native_1.View style={[
|
|
198
|
+
<react_native_1.View style={[
|
|
199
|
+
styles.reducerVerticalLine,
|
|
200
|
+
isLastReducer && { bottom: '50%' },
|
|
201
|
+
]}/>
|
|
156
202
|
|
|
157
203
|
{/* Reducer Header */}
|
|
158
204
|
<react_native_1.Pressable onPress={() => toggleReducer(reducerKey)} style={styles.reducerHeader}>
|
|
159
205
|
<react_native_1.View style={styles.reducerHorizontalLine}/>
|
|
160
|
-
<
|
|
161
|
-
<NetworkIcons_1.ChevronIcon color={AppColors_1.AppColors.purple} size={10}/>
|
|
162
|
-
</react_native_1.View>
|
|
206
|
+
<AnimatedChevron color={AppColors_1.AppColors.purple} expanded={isExpanded} size={10} style={styles.chevronWrap}/>
|
|
163
207
|
<react_native_1.View style={styles.iconWrap}>
|
|
164
208
|
<FolderIcon color={AppColors_1.AppColors.purple} size={11}/>
|
|
165
209
|
</react_native_1.View>
|
|
@@ -177,13 +221,24 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
|
|
|
177
221
|
<BoltIcon color="#DB2777" size={11}/>
|
|
178
222
|
</react_native_1.View>
|
|
179
223
|
<react_native_1.View style={{ flex: 1 }}>
|
|
180
|
-
<react_native_1.View style={{
|
|
224
|
+
<react_native_1.View style={{
|
|
225
|
+
flexDirection: 'row',
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
flexWrap: 'wrap',
|
|
228
|
+
gap: 6,
|
|
229
|
+
}}>
|
|
181
230
|
<react_native_1.Text style={styles.childLabel}>Last Action:</react_native_1.Text>
|
|
182
231
|
{lastAction ? (<react_native_1.View style={styles.actionTypeBadge}>
|
|
183
|
-
<react_native_1.Text style={styles.actionTypeText}>
|
|
184
|
-
|
|
232
|
+
<react_native_1.Text style={styles.actionTypeText}>
|
|
233
|
+
{lastAction.type}
|
|
234
|
+
</react_native_1.Text>
|
|
235
|
+
</react_native_1.View>) : (<react_native_1.Text style={styles.noActionText}>
|
|
236
|
+
None dispatched
|
|
237
|
+
</react_native_1.Text>)}
|
|
185
238
|
</react_native_1.View>
|
|
186
|
-
{lastAction && (<react_native_1.Text style={styles.timestampText}>
|
|
239
|
+
{lastAction && (<react_native_1.Text style={styles.timestampText}>
|
|
240
|
+
Dispatched: {lastAction.timestamp}
|
|
241
|
+
</react_native_1.Text>)}
|
|
187
242
|
{lastAction && lastAction.payload !== null && (<react_native_1.View style={{ marginTop: 6 }}>
|
|
188
243
|
<ReduxValueNode name="payload" value={lastAction.payload} level={0} search={search}/>
|
|
189
244
|
</react_native_1.View>)}
|
|
@@ -213,6 +268,7 @@ exports.ReduxTreeView = ReduxTreeView;
|
|
|
213
268
|
const ReduxActionTimeline = ({ history, onClear, search, }) => {
|
|
214
269
|
const [expandedActionId, setExpandedActionId] = (0, react_1.useState)(null);
|
|
215
270
|
const toggleExpand = (id) => {
|
|
271
|
+
animateTreeLayout();
|
|
216
272
|
setExpandedActionId(prev => (prev === id ? null : id));
|
|
217
273
|
};
|
|
218
274
|
const filteredHistory = history.filter(action => {
|
|
@@ -230,7 +286,9 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
|
|
|
230
286
|
});
|
|
231
287
|
return (<react_native_1.View style={timelineStyles.container}>
|
|
232
288
|
<react_native_1.View style={timelineStyles.headerRow}>
|
|
233
|
-
<react_native_1.Text style={timelineStyles.headerTitle}
|
|
289
|
+
<react_native_1.Text style={timelineStyles.headerTitle}>
|
|
290
|
+
⚡ Dispatched Actions ({filteredHistory.length})
|
|
291
|
+
</react_native_1.Text>
|
|
234
292
|
{history.length > 0 && (<react_native_1.Pressable onPress={onClear} style={timelineStyles.clearBtn}>
|
|
235
293
|
<react_native_1.Text style={timelineStyles.clearBtnText}>Clear Log</react_native_1.Text>
|
|
236
294
|
</react_native_1.Pressable>)}
|
|
@@ -246,9 +304,12 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
|
|
|
246
304
|
{filteredHistory.map((item, index) => {
|
|
247
305
|
const isLast = index === filteredHistory.length - 1;
|
|
248
306
|
const isExpanded = expandedActionId === item.id;
|
|
249
|
-
return (<
|
|
307
|
+
return (<AnimatedEntrance_1.default key={item.id} index={index} distance={8} style={timelineStyles.timelineItem}>
|
|
250
308
|
{/* Visual Line */}
|
|
251
|
-
<react_native_1.View style={[
|
|
309
|
+
<react_native_1.View style={[
|
|
310
|
+
timelineStyles.verticalLine,
|
|
311
|
+
isLast && { bottom: '50%' },
|
|
312
|
+
]}/>
|
|
252
313
|
<react_native_1.View style={timelineStyles.circleIndicator}>
|
|
253
314
|
<react_native_1.View style={timelineStyles.circleInner}/>
|
|
254
315
|
</react_native_1.View>
|
|
@@ -256,13 +317,18 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
|
|
|
256
317
|
{/* Card */}
|
|
257
318
|
<react_native_1.Pressable onPress={() => toggleExpand(item.id)} style={[
|
|
258
319
|
timelineStyles.card,
|
|
259
|
-
isExpanded && {
|
|
320
|
+
isExpanded && {
|
|
321
|
+
borderColor: AppColors_1.AppColors.purple,
|
|
322
|
+
backgroundColor: AppColors_1.AppColors.purpleShade50,
|
|
323
|
+
},
|
|
260
324
|
]}>
|
|
261
325
|
<react_native_1.View style={timelineStyles.cardHeader}>
|
|
262
326
|
<react_native_1.View style={timelineStyles.typeBadge}>
|
|
263
327
|
<react_native_1.Text style={timelineStyles.typeText}>{item.type}</react_native_1.Text>
|
|
264
328
|
</react_native_1.View>
|
|
265
|
-
<react_native_1.Text style={timelineStyles.timestamp}>
|
|
329
|
+
<react_native_1.Text style={timelineStyles.timestamp}>
|
|
330
|
+
{item.timestamp}
|
|
331
|
+
</react_native_1.Text>
|
|
266
332
|
</react_native_1.View>
|
|
267
333
|
|
|
268
334
|
{item.affectedSlices.length > 0 && (<react_native_1.View style={timelineStyles.slicesRow}>
|
|
@@ -274,12 +340,15 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
|
|
|
274
340
|
|
|
275
341
|
{isExpanded && (<react_native_1.View style={timelineStyles.payloadContainer}>
|
|
276
342
|
<react_native_1.Text style={timelineStyles.payloadTitle}>Payload</react_native_1.Text>
|
|
277
|
-
{item.payload !== null &&
|
|
278
|
-
|
|
343
|
+
{item.payload !== null &&
|
|
344
|
+
typeof item.payload === 'object' ? (<ReduxValueNode name="action.payload" value={item.payload} level={0} search={search}/>) : (<react_native_1.Text style={timelineStyles.primitivePayload}>
|
|
345
|
+
{item.payload === null
|
|
346
|
+
? 'null'
|
|
347
|
+
: String(item.payload)}
|
|
279
348
|
</react_native_1.Text>)}
|
|
280
349
|
</react_native_1.View>)}
|
|
281
350
|
</react_native_1.Pressable>
|
|
282
|
-
</
|
|
351
|
+
</AnimatedEntrance_1.default>);
|
|
283
352
|
})}
|
|
284
353
|
</react_native_1.View>)}
|
|
285
354
|
</react_native_1.View>);
|
|
@@ -37,6 +37,22 @@ const react_1 = __importStar(require("react"));
|
|
|
37
37
|
const react_native_1 = require("react-native");
|
|
38
38
|
const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
|
|
39
39
|
const scale = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
|
|
40
|
+
const opacity = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
|
|
41
|
+
const animatePress = (pressed) => {
|
|
42
|
+
react_native_1.Animated.parallel([
|
|
43
|
+
react_native_1.Animated.spring(scale, {
|
|
44
|
+
toValue: pressed ? 0.94 : 1,
|
|
45
|
+
friction: 6,
|
|
46
|
+
tension: 120,
|
|
47
|
+
useNativeDriver: true,
|
|
48
|
+
}),
|
|
49
|
+
react_native_1.Animated.timing(opacity, {
|
|
50
|
+
toValue: pressed ? 0.86 : 1,
|
|
51
|
+
duration: pressed ? 90 : 140,
|
|
52
|
+
useNativeDriver: true,
|
|
53
|
+
}),
|
|
54
|
+
]).start();
|
|
55
|
+
};
|
|
40
56
|
const flattenedStyle = react_native_1.StyleSheet.flatten(style) || {};
|
|
41
57
|
const layoutStyle = {
|
|
42
58
|
flex: flattenedStyle.flex,
|
|
@@ -49,8 +65,8 @@ const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
|
|
|
49
65
|
flexShrink: flattenedStyle.flexShrink,
|
|
50
66
|
gap: flattenedStyle.gap,
|
|
51
67
|
};
|
|
52
|
-
return (<react_native_1.Pressable disabled={disabled} style={style} onPressIn={() =>
|
|
53
|
-
<react_native_1.Animated.View style={[{ transform: [{ scale }] }, layoutStyle]}>
|
|
68
|
+
return (<react_native_1.Pressable disabled={disabled} style={style} onPressIn={() => animatePress(true)} onPressOut={() => animatePress(false)} onPress={onPress} hitSlop={hitSlop}>
|
|
69
|
+
<react_native_1.Animated.View style={[{ opacity, transform: [{ scale }] }, layoutStyle]}>
|
|
54
70
|
{children}
|
|
55
71
|
</react_native_1.Animated.View>
|
|
56
72
|
</react_native_1.Pressable>);
|