react-native-inapp-inspector 1.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 +97 -0
- package/dist/commonjs/components/AnalyticsDetail.d.ts +6 -0
- package/dist/commonjs/components/AnalyticsDetail.js +558 -0
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/commonjs/components/AnalyticsEventCard.js +327 -0
- package/dist/commonjs/components/AnalyticsGraph.d.ts +8 -0
- package/dist/commonjs/components/AnalyticsGraph.js +416 -0
- package/dist/commonjs/components/CodeSnippet.d.ts +8 -0
- package/dist/commonjs/components/CodeSnippet.js +427 -0
- package/dist/commonjs/components/ConsoleLogCard.d.ts +10 -0
- package/dist/commonjs/components/ConsoleLogCard.js +401 -0
- package/dist/commonjs/components/CopyButton.d.ts +4 -0
- package/dist/commonjs/components/CopyButton.js +69 -0
- package/dist/commonjs/components/DiffViewer.d.ts +7 -0
- package/dist/commonjs/components/DiffViewer.js +86 -0
- package/dist/commonjs/components/DomainHeader.d.ts +18 -0
- package/dist/commonjs/components/DomainHeader.js +136 -0
- package/dist/commonjs/components/EmptyState.d.ts +5 -0
- package/dist/commonjs/components/EmptyState.js +40 -0
- package/dist/commonjs/components/HeadersSection.d.ts +4 -0
- package/dist/commonjs/components/HeadersSection.js +155 -0
- package/dist/commonjs/components/HighlightText.d.ts +3 -0
- package/dist/commonjs/components/HighlightText.js +57 -0
- package/dist/commonjs/components/JsonViewer.d.ts +7 -0
- package/dist/commonjs/components/JsonViewer.js +19 -0
- package/dist/commonjs/components/LogCard.d.ts +4 -0
- package/dist/commonjs/components/LogCard.js +179 -0
- package/dist/commonjs/components/MetaAccordion.d.ts +4 -0
- package/dist/commonjs/components/MetaAccordion.js +113 -0
- package/dist/commonjs/components/MiniBarChart.d.ts +7 -0
- package/dist/commonjs/components/MiniBarChart.js +56 -0
- package/dist/commonjs/components/MiniLineChart.d.ts +6 -0
- package/dist/commonjs/components/MiniLineChart.js +58 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +31 -0
- package/dist/commonjs/components/NetworkIcons.js +245 -0
- package/dist/commonjs/components/SectionHeader.d.ts +4 -0
- package/dist/commonjs/components/SectionHeader.js +87 -0
- package/dist/commonjs/components/SourcePageCard.d.ts +4 -0
- package/dist/commonjs/components/SourcePageCard.js +132 -0
- package/dist/commonjs/components/TouchableScale.d.ts +9 -0
- package/dist/commonjs/components/TouchableScale.js +44 -0
- package/dist/commonjs/components/TreeNode.d.ts +4 -0
- package/dist/commonjs/components/TreeNode.js +140 -0
- package/dist/commonjs/constants/index.d.ts +7 -0
- package/dist/commonjs/constants/index.js +35 -0
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +160 -0
- package/dist/commonjs/customHooks/consoleLogger.d.ts +5 -0
- package/dist/commonjs/customHooks/consoleLogger.js +141 -0
- package/dist/commonjs/customHooks/logFilters.d.ts +5 -0
- package/dist/commonjs/customHooks/logFilters.js +34 -0
- package/dist/commonjs/customHooks/networkLogger.d.ts +20 -0
- package/dist/commonjs/customHooks/networkLogger.js +272 -0
- package/dist/commonjs/customHooks/useAccordion.d.ts +17 -0
- package/dist/commonjs/customHooks/useAccordion.js +48 -0
- package/dist/commonjs/customHooks/webViewLogger.d.ts +22 -0
- package/dist/commonjs/customHooks/webViewLogger.js +412 -0
- package/dist/commonjs/helpers/index.d.ts +20 -0
- package/dist/commonjs/helpers/index.js +229 -0
- package/dist/commonjs/index.d.ts +7 -0
- package/dist/commonjs/index.js +2668 -0
- package/dist/commonjs/styles/AppColors.d.ts +27 -0
- package/dist/commonjs/styles/AppColors.js +30 -0
- package/dist/commonjs/styles/AppFonts.d.ts +7 -0
- package/dist/commonjs/styles/AppFonts.js +10 -0
- package/dist/commonjs/styles/index.d.ts +1488 -0
- package/dist/commonjs/styles/index.js +1357 -0
- package/dist/commonjs/types/index.d.ts +127 -0
- package/dist/commonjs/types/index.js +2 -0
- package/dist/esm/components/AnalyticsDetail.d.ts +6 -0
- package/dist/esm/components/AnalyticsDetail.js +520 -0
- package/dist/esm/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/esm/components/AnalyticsEventCard.js +288 -0
- package/dist/esm/components/AnalyticsGraph.d.ts +8 -0
- package/dist/esm/components/AnalyticsGraph.js +378 -0
- package/dist/esm/components/CodeSnippet.d.ts +8 -0
- package/dist/esm/components/CodeSnippet.js +392 -0
- package/dist/esm/components/ConsoleLogCard.d.ts +10 -0
- package/dist/esm/components/ConsoleLogCard.js +362 -0
- package/dist/esm/components/CopyButton.d.ts +4 -0
- package/dist/esm/components/CopyButton.js +31 -0
- package/dist/esm/components/DiffViewer.d.ts +7 -0
- package/dist/esm/components/DiffViewer.js +48 -0
- package/dist/esm/components/DomainHeader.d.ts +18 -0
- package/dist/esm/components/DomainHeader.js +98 -0
- package/dist/esm/components/EmptyState.d.ts +5 -0
- package/dist/esm/components/EmptyState.js +35 -0
- package/dist/esm/components/HeadersSection.d.ts +4 -0
- package/dist/esm/components/HeadersSection.js +117 -0
- package/dist/esm/components/HighlightText.d.ts +3 -0
- package/dist/esm/components/HighlightText.js +52 -0
- package/dist/esm/components/JsonViewer.d.ts +7 -0
- package/dist/esm/components/JsonViewer.js +14 -0
- package/dist/esm/components/LogCard.d.ts +4 -0
- package/dist/esm/components/LogCard.js +141 -0
- package/dist/esm/components/MetaAccordion.d.ts +4 -0
- package/dist/esm/components/MetaAccordion.js +108 -0
- package/dist/esm/components/MiniBarChart.d.ts +7 -0
- package/dist/esm/components/MiniBarChart.js +18 -0
- package/dist/esm/components/MiniLineChart.d.ts +6 -0
- package/dist/esm/components/MiniLineChart.js +20 -0
- package/dist/esm/components/NetworkIcons.d.ts +31 -0
- package/dist/esm/components/NetworkIcons.js +176 -0
- package/dist/esm/components/SectionHeader.d.ts +4 -0
- package/dist/esm/components/SectionHeader.js +49 -0
- package/dist/esm/components/SourcePageCard.d.ts +4 -0
- package/dist/esm/components/SourcePageCard.js +94 -0
- package/dist/esm/components/TouchableScale.d.ts +9 -0
- package/dist/esm/components/TouchableScale.js +9 -0
- package/dist/esm/components/TreeNode.d.ts +4 -0
- package/dist/esm/components/TreeNode.js +102 -0
- package/dist/esm/constants/index.d.ts +7 -0
- package/dist/esm/constants/index.js +32 -0
- package/dist/esm/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/esm/customHooks/analyticsLogger.js +152 -0
- package/dist/esm/customHooks/consoleLogger.d.ts +5 -0
- package/dist/esm/customHooks/consoleLogger.js +134 -0
- package/dist/esm/customHooks/logFilters.d.ts +5 -0
- package/dist/esm/customHooks/logFilters.js +31 -0
- package/dist/esm/customHooks/networkLogger.d.ts +20 -0
- package/dist/esm/customHooks/networkLogger.js +264 -0
- package/dist/esm/customHooks/useAccordion.d.ts +17 -0
- package/dist/esm/customHooks/useAccordion.js +46 -0
- package/dist/esm/customHooks/webViewLogger.d.ts +22 -0
- package/dist/esm/customHooks/webViewLogger.js +365 -0
- package/dist/esm/helpers/index.d.ts +20 -0
- package/dist/esm/helpers/index.js +207 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +2611 -0
- package/dist/esm/styles/AppColors.d.ts +27 -0
- package/dist/esm/styles/AppColors.js +27 -0
- package/dist/esm/styles/AppFonts.d.ts +7 -0
- package/dist/esm/styles/AppFonts.js +7 -0
- package/dist/esm/styles/index.d.ts +1488 -0
- package/dist/esm/styles/index.js +1355 -0
- package/dist/esm/types/index.d.ts +127 -0
- package/dist/esm/types/index.js +1 -0
- package/fonts/Inter/Inter.ttc +0 -0
- package/fonts/Inter/InterVariable-Italic.ttf +0 -0
- package/fonts/Inter/InterVariable.ttf +0 -0
- package/fonts/Inter/LICENSE.txt +92 -0
- package/fonts/Inter/extras/otf/Inter-Black.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Light.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Black.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Light.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/help.txt +165 -0
- package/fonts/Inter/web/Inter-Black.woff2 +0 -0
- package/fonts/Inter/web/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/web/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Light.woff2 +0 -0
- package/fonts/Inter/web/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/web/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/web/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable.woff2 +0 -0
- package/fonts/Inter/web/inter.css +148 -0
- package/package.json +52 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { StyleSheet, Text, View, Platform, FlatList } from 'react-native';
|
|
3
|
+
const escapeRegExp = (string) => {
|
|
4
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
5
|
+
};
|
|
6
|
+
// HTML pretty printer
|
|
7
|
+
const formatHTML = (html) => {
|
|
8
|
+
if (!html)
|
|
9
|
+
return '';
|
|
10
|
+
let indent = 0;
|
|
11
|
+
const cleaned = html
|
|
12
|
+
.replace(/<([a-zA-Z0-9:-]+)([^>]*)>\s*<\/([a-zA-Z0-9:-]+)>/g, '<$1$2></$3>')
|
|
13
|
+
.replace(/(<[^>]+>)/g, '\n$1\n')
|
|
14
|
+
.replace(/\n+/g, '\n');
|
|
15
|
+
const lines = cleaned.split('\n');
|
|
16
|
+
const formatted = [];
|
|
17
|
+
const selfClosingTags = /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i;
|
|
18
|
+
for (let i = 0; i < lines.length; i++) {
|
|
19
|
+
const line = lines[i].trim();
|
|
20
|
+
if (!line)
|
|
21
|
+
continue;
|
|
22
|
+
if (line.startsWith('</')) {
|
|
23
|
+
indent = Math.max(0, indent - 1);
|
|
24
|
+
}
|
|
25
|
+
formatted.push(' '.repeat(indent) + line);
|
|
26
|
+
if (line.startsWith('<') &&
|
|
27
|
+
!line.startsWith('</') &&
|
|
28
|
+
!line.startsWith('<!') &&
|
|
29
|
+
!line.endsWith('/>')) {
|
|
30
|
+
const tagNameMatch = line.match(/^<([a-zA-Z0-9:-]+)/);
|
|
31
|
+
if (tagNameMatch) {
|
|
32
|
+
const tagName = tagNameMatch[1];
|
|
33
|
+
if (!selfClosingTags.test(tagName)) {
|
|
34
|
+
const closeTagRegex = new RegExp(`</${escapeRegExp(tagName)}>`);
|
|
35
|
+
if (!closeTagRegex.test(line)) {
|
|
36
|
+
indent++;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return formatted.join('\n');
|
|
43
|
+
};
|
|
44
|
+
// CSS pretty printer
|
|
45
|
+
const formatCSS = (css) => {
|
|
46
|
+
if (!css)
|
|
47
|
+
return '';
|
|
48
|
+
const cleaned = css
|
|
49
|
+
.replace(/\s*\{\s*/g, ' {\n')
|
|
50
|
+
.replace(/\s*;\s*/g, ';\n')
|
|
51
|
+
.replace(/\s*\}\s*/g, '\n}\n')
|
|
52
|
+
.replace(/\n+/g, '\n');
|
|
53
|
+
const lines = cleaned.split('\n');
|
|
54
|
+
let indent = 0;
|
|
55
|
+
const formatted = [];
|
|
56
|
+
for (let i = 0; i < lines.length; i++) {
|
|
57
|
+
const line = lines[i].trim();
|
|
58
|
+
if (!line)
|
|
59
|
+
continue;
|
|
60
|
+
if (line.startsWith('}')) {
|
|
61
|
+
indent = Math.max(0, indent - 1);
|
|
62
|
+
}
|
|
63
|
+
formatted.push(' '.repeat(indent) + line);
|
|
64
|
+
if (line.endsWith('{')) {
|
|
65
|
+
indent++;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return formatted.join('\n');
|
|
69
|
+
};
|
|
70
|
+
// JS pretty printer
|
|
71
|
+
const formatJS = (js) => {
|
|
72
|
+
if (!js)
|
|
73
|
+
return '';
|
|
74
|
+
const lines = js.split(/\r?\n/);
|
|
75
|
+
let indent = 0;
|
|
76
|
+
const formatted = [];
|
|
77
|
+
for (let i = 0; i < lines.length; i++) {
|
|
78
|
+
const line = lines[i].trim();
|
|
79
|
+
if (!line)
|
|
80
|
+
continue;
|
|
81
|
+
let openCount = (line.match(/\{|\[/g) || []).length;
|
|
82
|
+
let closeCount = (line.match(/\}|\]/g) || []).length;
|
|
83
|
+
if (line.startsWith('}') || line.startsWith(']')) {
|
|
84
|
+
indent = Math.max(0, indent - 1);
|
|
85
|
+
}
|
|
86
|
+
else if (closeCount > openCount) {
|
|
87
|
+
indent = Math.max(0, indent - (closeCount - openCount));
|
|
88
|
+
}
|
|
89
|
+
formatted.push(' '.repeat(indent) + line);
|
|
90
|
+
if (openCount > closeCount &&
|
|
91
|
+
!line.startsWith('}') &&
|
|
92
|
+
!line.startsWith(']')) {
|
|
93
|
+
indent += openCount - closeCount;
|
|
94
|
+
}
|
|
95
|
+
else if (line.endsWith('{') || line.endsWith('[')) {
|
|
96
|
+
indent++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return formatted.join('\n');
|
|
100
|
+
};
|
|
101
|
+
const tokenizeJS = (text) => {
|
|
102
|
+
const tokens = [];
|
|
103
|
+
const regex = /(\/\/.*|\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)|(\b(?:const|let|var|function|return|if|else|for|while|import|export|class|try|catch|new|this|async|await|break|continue|switch|case|default|throw|typeof|yield|let)\b)|(\b(?:console|window|document|fetch|global|require|module|exports|Promise|Map|Set|Array|Object|String|Number|Boolean)\b)|(\b\d+(?:\.\d+)?\b)/g;
|
|
104
|
+
let lastIndex = 0;
|
|
105
|
+
let match;
|
|
106
|
+
while ((match = regex.exec(text)) !== null) {
|
|
107
|
+
if (regex.lastIndex === match.index) {
|
|
108
|
+
regex.lastIndex++;
|
|
109
|
+
}
|
|
110
|
+
if (match.index > lastIndex) {
|
|
111
|
+
tokens.push({
|
|
112
|
+
text: text.substring(lastIndex, match.index),
|
|
113
|
+
type: 'plain',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const matchedText = match[0];
|
|
117
|
+
if (match[1])
|
|
118
|
+
tokens.push({ text: matchedText, type: 'comment' });
|
|
119
|
+
else if (match[2])
|
|
120
|
+
tokens.push({ text: matchedText, type: 'string' });
|
|
121
|
+
else if (match[3])
|
|
122
|
+
tokens.push({ text: matchedText, type: 'keyword' });
|
|
123
|
+
else if (match[4])
|
|
124
|
+
tokens.push({ text: matchedText, type: 'builtin' });
|
|
125
|
+
else if (match[5])
|
|
126
|
+
tokens.push({ text: matchedText, type: 'number' });
|
|
127
|
+
lastIndex = regex.lastIndex;
|
|
128
|
+
}
|
|
129
|
+
if (lastIndex < text.length) {
|
|
130
|
+
tokens.push({ text: text.substring(lastIndex), type: 'plain' });
|
|
131
|
+
}
|
|
132
|
+
return tokens;
|
|
133
|
+
};
|
|
134
|
+
const tokenizeCSS = (text) => {
|
|
135
|
+
const tokens = [];
|
|
136
|
+
const regex = /(\/\*[\s\S]*?\*\/)|(\.[a-zA-Z0-9_-]+|#[a-zA-Z0-9_-]+|[a-zA-Z0-9_-]+(?=\s*\{))|([a-zA-Z0-9_-]+(?=\s*:))|(:[^;]+;)/g;
|
|
137
|
+
let lastIndex = 0;
|
|
138
|
+
let match;
|
|
139
|
+
while ((match = regex.exec(text)) !== null) {
|
|
140
|
+
if (regex.lastIndex === match.index) {
|
|
141
|
+
regex.lastIndex++;
|
|
142
|
+
}
|
|
143
|
+
if (match.index > lastIndex) {
|
|
144
|
+
tokens.push({
|
|
145
|
+
text: text.substring(lastIndex, match.index),
|
|
146
|
+
type: 'plain',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
const matchedText = match[0];
|
|
150
|
+
if (match[1])
|
|
151
|
+
tokens.push({ text: matchedText, type: 'comment' });
|
|
152
|
+
else if (match[2])
|
|
153
|
+
tokens.push({ text: matchedText, type: 'selector' });
|
|
154
|
+
else if (match[3])
|
|
155
|
+
tokens.push({ text: matchedText, type: 'property' });
|
|
156
|
+
else if (match[4]) {
|
|
157
|
+
tokens.push({ text: ':', type: 'plain' });
|
|
158
|
+
tokens.push({ text: matchedText.substring(1), type: 'value' });
|
|
159
|
+
}
|
|
160
|
+
lastIndex = regex.lastIndex;
|
|
161
|
+
}
|
|
162
|
+
if (lastIndex < text.length) {
|
|
163
|
+
tokens.push({ text: text.substring(lastIndex), type: 'plain' });
|
|
164
|
+
}
|
|
165
|
+
return tokens;
|
|
166
|
+
};
|
|
167
|
+
const tokenizeHTML = (text) => {
|
|
168
|
+
const tokens = [];
|
|
169
|
+
const regex = /(<!--[\s\S]*?-->)|(<\/?[a-zA-Z0-9:-]+>?)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|([a-zA-Z0-9:-]+(?=\s*=))/g;
|
|
170
|
+
let lastIndex = 0;
|
|
171
|
+
let match;
|
|
172
|
+
while ((match = regex.exec(text)) !== null) {
|
|
173
|
+
if (regex.lastIndex === match.index) {
|
|
174
|
+
regex.lastIndex++;
|
|
175
|
+
}
|
|
176
|
+
if (match.index > lastIndex) {
|
|
177
|
+
tokens.push({
|
|
178
|
+
text: text.substring(lastIndex, match.index),
|
|
179
|
+
type: 'plain',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const matchedText = match[0];
|
|
183
|
+
if (match[1])
|
|
184
|
+
tokens.push({ text: matchedText, type: 'comment' });
|
|
185
|
+
else if (match[2])
|
|
186
|
+
tokens.push({ text: matchedText, type: 'tag' });
|
|
187
|
+
else if (match[3])
|
|
188
|
+
tokens.push({ text: matchedText, type: 'string' });
|
|
189
|
+
else if (match[4])
|
|
190
|
+
tokens.push({ text: matchedText, type: 'attribute' });
|
|
191
|
+
lastIndex = regex.lastIndex;
|
|
192
|
+
}
|
|
193
|
+
if (lastIndex < text.length) {
|
|
194
|
+
tokens.push({ text: text.substring(lastIndex), type: 'plain' });
|
|
195
|
+
}
|
|
196
|
+
return tokens;
|
|
197
|
+
};
|
|
198
|
+
const getStyleForType = (type) => {
|
|
199
|
+
switch (type) {
|
|
200
|
+
case 'comment':
|
|
201
|
+
return styles.comment;
|
|
202
|
+
case 'string':
|
|
203
|
+
return styles.string;
|
|
204
|
+
case 'keyword':
|
|
205
|
+
return styles.keyword;
|
|
206
|
+
case 'builtin':
|
|
207
|
+
return styles.builtin;
|
|
208
|
+
case 'number':
|
|
209
|
+
return styles.number;
|
|
210
|
+
case 'tag':
|
|
211
|
+
return styles.tag;
|
|
212
|
+
case 'attribute':
|
|
213
|
+
return styles.attribute;
|
|
214
|
+
case 'selector':
|
|
215
|
+
return styles.selector;
|
|
216
|
+
case 'property':
|
|
217
|
+
return styles.property;
|
|
218
|
+
case 'value':
|
|
219
|
+
return styles.value;
|
|
220
|
+
default:
|
|
221
|
+
return styles.plain;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const CodeSnippetLine = React.memo(({ line, lineIndex, language, search, }) => {
|
|
225
|
+
const tokens = useMemo(() => {
|
|
226
|
+
if (language === 'html')
|
|
227
|
+
return tokenizeHTML(line);
|
|
228
|
+
if (language === 'css')
|
|
229
|
+
return tokenizeCSS(line);
|
|
230
|
+
return tokenizeJS(line);
|
|
231
|
+
}, [line, language]);
|
|
232
|
+
const renderTokenText = (text, type) => {
|
|
233
|
+
const baseStyle = getStyleForType(type);
|
|
234
|
+
if (!search) {
|
|
235
|
+
return <Text style={baseStyle}>{text}</Text>;
|
|
236
|
+
}
|
|
237
|
+
const parts = text.split(new RegExp(`(${escapeRegExp(search)})`, 'gi'));
|
|
238
|
+
return (<Text style={baseStyle}>
|
|
239
|
+
{parts.map((part, index) => {
|
|
240
|
+
const isMatch = part.toLowerCase() === search.toLowerCase();
|
|
241
|
+
return isMatch ? (<Text key={index} style={styles.highlight}>
|
|
242
|
+
{part}
|
|
243
|
+
</Text>) : (part);
|
|
244
|
+
})}
|
|
245
|
+
</Text>);
|
|
246
|
+
};
|
|
247
|
+
return (<View style={styles.lineRow}>
|
|
248
|
+
{/* Gutter Line Number */}
|
|
249
|
+
<View style={styles.gutter}>
|
|
250
|
+
<Text style={styles.lineNumber}>{lineIndex + 1}</Text>
|
|
251
|
+
</View>
|
|
252
|
+
|
|
253
|
+
{/* Highlighted Code Line */}
|
|
254
|
+
<View style={styles.codeLine}>
|
|
255
|
+
<Text style={styles.codeLineText}>
|
|
256
|
+
{tokens.length === 0 ? (<Text style={styles.plain}> </Text>) : (tokens.map((token, tokenIdx) => (<React.Fragment key={tokenIdx}>
|
|
257
|
+
{renderTokenText(token.text, token.type)}
|
|
258
|
+
</React.Fragment>)))}
|
|
259
|
+
</Text>
|
|
260
|
+
</View>
|
|
261
|
+
</View>);
|
|
262
|
+
});
|
|
263
|
+
const CodeSnippet = ({ code, language, search = '', }) => {
|
|
264
|
+
const formattedCode = useMemo(() => {
|
|
265
|
+
if (!code)
|
|
266
|
+
return '';
|
|
267
|
+
if (language === 'html')
|
|
268
|
+
return formatHTML(code);
|
|
269
|
+
if (language === 'css')
|
|
270
|
+
return formatCSS(code);
|
|
271
|
+
if (language === 'javascript')
|
|
272
|
+
return formatJS(code);
|
|
273
|
+
return code;
|
|
274
|
+
}, [code, language]);
|
|
275
|
+
const lines = useMemo(() => {
|
|
276
|
+
if (!formattedCode)
|
|
277
|
+
return [];
|
|
278
|
+
return formattedCode.split(/\r?\n/);
|
|
279
|
+
}, [formattedCode]);
|
|
280
|
+
const renderLine = ({ item, index }) => (<CodeSnippetLine line={item} lineIndex={index} language={language} search={search}/>);
|
|
281
|
+
return (<View style={styles.container}>
|
|
282
|
+
<FlatList data={lines} renderItem={renderLine} keyExtractor={(_, index) => String(index)} maxToRenderPerBatch={50} windowSize={10} initialNumToRender={30} removeClippedSubviews={Platform.OS === 'android'}/>
|
|
283
|
+
</View>);
|
|
284
|
+
};
|
|
285
|
+
const monoFont = Platform.OS === 'ios' ? 'Menlo' : 'monospace';
|
|
286
|
+
const styles = StyleSheet.create({
|
|
287
|
+
container: {
|
|
288
|
+
flex: 1,
|
|
289
|
+
backgroundColor: '#F8FAFC',
|
|
290
|
+
borderRadius: 8,
|
|
291
|
+
borderWidth: 1,
|
|
292
|
+
borderColor: '#E2E8F0',
|
|
293
|
+
overflow: 'hidden',
|
|
294
|
+
},
|
|
295
|
+
lineRow: {
|
|
296
|
+
flexDirection: 'row',
|
|
297
|
+
alignItems: 'stretch',
|
|
298
|
+
minHeight: 20,
|
|
299
|
+
paddingVertical: 1,
|
|
300
|
+
},
|
|
301
|
+
gutter: {
|
|
302
|
+
width: 40,
|
|
303
|
+
backgroundColor: '#F1F5F9',
|
|
304
|
+
borderRightWidth: 1,
|
|
305
|
+
borderRightColor: '#E2E8F0',
|
|
306
|
+
justifyContent: 'flex-start',
|
|
307
|
+
alignItems: 'flex-end',
|
|
308
|
+
paddingRight: 6,
|
|
309
|
+
paddingTop: 1,
|
|
310
|
+
},
|
|
311
|
+
lineNumber: {
|
|
312
|
+
fontFamily: monoFont,
|
|
313
|
+
fontSize: 9,
|
|
314
|
+
color: '#94A3B8',
|
|
315
|
+
},
|
|
316
|
+
codeLine: {
|
|
317
|
+
flex: 1,
|
|
318
|
+
paddingLeft: 10,
|
|
319
|
+
paddingRight: 12,
|
|
320
|
+
justifyContent: 'center',
|
|
321
|
+
},
|
|
322
|
+
codeLineText: {
|
|
323
|
+
fontFamily: monoFont,
|
|
324
|
+
fontSize: 10.5,
|
|
325
|
+
color: '#334155',
|
|
326
|
+
flexWrap: 'wrap',
|
|
327
|
+
},
|
|
328
|
+
plain: {
|
|
329
|
+
fontFamily: monoFont,
|
|
330
|
+
fontSize: 10.5,
|
|
331
|
+
color: '#334155',
|
|
332
|
+
},
|
|
333
|
+
comment: {
|
|
334
|
+
fontFamily: monoFont,
|
|
335
|
+
fontSize: 10.5,
|
|
336
|
+
color: '#64748B',
|
|
337
|
+
fontStyle: 'italic',
|
|
338
|
+
},
|
|
339
|
+
string: {
|
|
340
|
+
fontFamily: monoFont,
|
|
341
|
+
fontSize: 10.5,
|
|
342
|
+
color: '#D97706',
|
|
343
|
+
},
|
|
344
|
+
keyword: {
|
|
345
|
+
fontFamily: monoFont,
|
|
346
|
+
fontSize: 10.5,
|
|
347
|
+
color: '#7C3AED',
|
|
348
|
+
fontWeight: 'bold',
|
|
349
|
+
},
|
|
350
|
+
builtin: {
|
|
351
|
+
fontFamily: monoFont,
|
|
352
|
+
fontSize: 10.5,
|
|
353
|
+
color: '#0D9488',
|
|
354
|
+
},
|
|
355
|
+
number: {
|
|
356
|
+
fontFamily: monoFont,
|
|
357
|
+
fontSize: 10.5,
|
|
358
|
+
color: '#2563EB',
|
|
359
|
+
},
|
|
360
|
+
tag: {
|
|
361
|
+
fontFamily: monoFont,
|
|
362
|
+
fontSize: 10.5,
|
|
363
|
+
color: '#4F46E5',
|
|
364
|
+
fontWeight: 'bold',
|
|
365
|
+
},
|
|
366
|
+
attribute: {
|
|
367
|
+
fontFamily: monoFont,
|
|
368
|
+
fontSize: 10.5,
|
|
369
|
+
color: '#0D9488',
|
|
370
|
+
},
|
|
371
|
+
selector: {
|
|
372
|
+
fontFamily: monoFont,
|
|
373
|
+
fontSize: 10.5,
|
|
374
|
+
color: '#7C3AED',
|
|
375
|
+
fontWeight: 'bold',
|
|
376
|
+
},
|
|
377
|
+
property: {
|
|
378
|
+
fontFamily: monoFont,
|
|
379
|
+
fontSize: 10.5,
|
|
380
|
+
color: '#0D9488',
|
|
381
|
+
},
|
|
382
|
+
value: {
|
|
383
|
+
fontFamily: monoFont,
|
|
384
|
+
fontSize: 10.5,
|
|
385
|
+
color: '#EA580C',
|
|
386
|
+
},
|
|
387
|
+
highlight: {
|
|
388
|
+
backgroundColor: '#FDE047',
|
|
389
|
+
color: '#000000',
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
export default CodeSnippet;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConsoleLog } from '../types';
|
|
3
|
+
import { WebViewLog } from '../customHooks/webViewLogger';
|
|
4
|
+
interface ConsoleLogCardProps {
|
|
5
|
+
item: ConsoleLog | WebViewLog;
|
|
6
|
+
searchStr?: string;
|
|
7
|
+
isWebView?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ConsoleLogCard: React.NamedExoticComponent<ConsoleLogCardProps>;
|
|
10
|
+
export {};
|