rn-backstage 1.3.0 → 1.4.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.
Files changed (83) hide show
  1. package/README.md +27 -0
  2. package/lib/commonjs/Backstage.js +13 -2
  3. package/lib/commonjs/Backstage.js.map +1 -1
  4. package/lib/commonjs/bug-report.js +173 -0
  5. package/lib/commonjs/bug-report.js.map +1 -0
  6. package/lib/commonjs/components/BackstagePanel.js +82 -15
  7. package/lib/commonjs/components/BackstagePanel.js.map +1 -1
  8. package/lib/commonjs/components/BugReportComposer.js +510 -0
  9. package/lib/commonjs/components/BugReportComposer.js.map +1 -0
  10. package/lib/commonjs/components/FlagsTab.js +10 -2
  11. package/lib/commonjs/components/FlagsTab.js.map +1 -1
  12. package/lib/commonjs/components/LogsTab.js +1 -3
  13. package/lib/commonjs/components/LogsTab.js.map +1 -1
  14. package/lib/commonjs/components/NetworkTab.js +1 -2
  15. package/lib/commonjs/components/NetworkTab.js.map +1 -1
  16. package/lib/commonjs/components/StorageTab.js +207 -190
  17. package/lib/commonjs/components/StorageTab.js.map +1 -1
  18. package/lib/commonjs/constants.js +16 -0
  19. package/lib/commonjs/constants.js.map +1 -1
  20. package/lib/commonjs/index.js +7 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/types.js +1 -0
  23. package/lib/commonjs/types.js.map +1 -1
  24. package/lib/module/Backstage.js +13 -2
  25. package/lib/module/Backstage.js.map +1 -1
  26. package/lib/module/bug-report.js +164 -0
  27. package/lib/module/bug-report.js.map +1 -0
  28. package/lib/module/components/BackstagePanel.js +83 -16
  29. package/lib/module/components/BackstagePanel.js.map +1 -1
  30. package/lib/module/components/BugReportComposer.js +505 -0
  31. package/lib/module/components/BugReportComposer.js.map +1 -0
  32. package/lib/module/components/FlagsTab.js +12 -4
  33. package/lib/module/components/FlagsTab.js.map +1 -1
  34. package/lib/module/components/LogsTab.js +1 -3
  35. package/lib/module/components/LogsTab.js.map +1 -1
  36. package/lib/module/components/NetworkTab.js +1 -2
  37. package/lib/module/components/NetworkTab.js.map +1 -1
  38. package/lib/module/components/StorageTab.js +208 -191
  39. package/lib/module/components/StorageTab.js.map +1 -1
  40. package/lib/module/constants.js +16 -0
  41. package/lib/module/constants.js.map +1 -1
  42. package/lib/module/index.js +1 -0
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/module/types.js +2 -0
  45. package/lib/module/types.js.map +1 -1
  46. package/lib/typescript/Backstage.d.ts.map +1 -1
  47. package/lib/typescript/bug-report.d.ts +12 -0
  48. package/lib/typescript/bug-report.d.ts.map +1 -0
  49. package/lib/typescript/components/BackstagePanel.d.ts +3 -1
  50. package/lib/typescript/components/BackstagePanel.d.ts.map +1 -1
  51. package/lib/typescript/components/BugReportComposer.d.ts +17 -0
  52. package/lib/typescript/components/BugReportComposer.d.ts.map +1 -0
  53. package/lib/typescript/components/FlagsTab.d.ts.map +1 -1
  54. package/lib/typescript/components/LogsTab.d.ts.map +1 -1
  55. package/lib/typescript/components/NetworkTab.d.ts.map +1 -1
  56. package/lib/typescript/components/StorageTab.d.ts.map +1 -1
  57. package/lib/typescript/constants.d.ts +15 -0
  58. package/lib/typescript/constants.d.ts.map +1 -1
  59. package/lib/typescript/index.d.ts +2 -1
  60. package/lib/typescript/index.d.ts.map +1 -1
  61. package/lib/typescript/types.d.ts +39 -0
  62. package/lib/typescript/types.d.ts.map +1 -1
  63. package/package.json +2 -3
  64. package/src/Backstage.tsx +0 -215
  65. package/src/ThemeContext.tsx +0 -38
  66. package/src/components/BackstagePanel.tsx +0 -277
  67. package/src/components/FlagsTab.tsx +0 -200
  68. package/src/components/FloatingPill.tsx +0 -247
  69. package/src/components/InfoTab.tsx +0 -231
  70. package/src/components/JsonTreeView.tsx +0 -239
  71. package/src/components/LogItem.tsx +0 -153
  72. package/src/components/LogsTab.tsx +0 -217
  73. package/src/components/NetworkItem.tsx +0 -425
  74. package/src/components/NetworkTab.tsx +0 -240
  75. package/src/components/StorageTab.tsx +0 -607
  76. package/src/components/TabBar.tsx +0 -154
  77. package/src/constants.ts +0 -190
  78. package/src/index.ts +0 -33
  79. package/src/log-interceptor.ts +0 -148
  80. package/src/network-interceptor.ts +0 -468
  81. package/src/types.ts +0 -235
  82. package/src/utils/formatTimestamp.ts +0 -22
  83. package/src/utils/stringify.ts +0 -90
@@ -1,22 +0,0 @@
1
- /**
2
- * Formats a timestamp (Date.now()) into a human-readable local time string.
3
- * Format: "h:mm:ss.SSS AM/PM"
4
- * No external dependencies — uses native Date API.
5
- */
6
- export function formatTimestamp(timestamp: number): string {
7
- const date = new Date(timestamp)
8
- let hours = date.getHours()
9
- const minutes = date.getMinutes()
10
- const seconds = date.getSeconds()
11
- const milliseconds = date.getMilliseconds()
12
- const ampm = hours >= 12 ? 'PM' : 'AM'
13
-
14
- hours = hours % 12
15
- hours = hours || 12
16
-
17
- const mm = minutes.toString().padStart(2, '0')
18
- const ss = seconds.toString().padStart(2, '0')
19
- const ms = milliseconds.toString().padStart(3, '0')
20
-
21
- return `${hours}:${mm}:${ss}.${ms} ${ampm}`
22
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * Safely stringifies a value, handling circular references and Error objects.
3
- */
4
- export function safeStringify(value: unknown, indent = 2): string {
5
- if (value === undefined) return 'undefined'
6
- if (value === null) return 'null'
7
-
8
- if (value instanceof Error) {
9
- return JSON.stringify(
10
- {
11
- name: value.name,
12
- message: value.message,
13
- stack: value.stack,
14
- },
15
- null,
16
- indent,
17
- )
18
- }
19
-
20
- const seen = new WeakSet()
21
-
22
- try {
23
- return JSON.stringify(
24
- value,
25
- (_key, val) => {
26
- if (typeof val === 'object' && val !== null) {
27
- if (seen.has(val)) {
28
- return '[Circular]'
29
- }
30
- seen.add(val)
31
- }
32
- if (typeof val === 'bigint') {
33
- return val.toString()
34
- }
35
- if (typeof val === 'function') {
36
- return `[Function: ${val.name || 'anonymous'}]`
37
- }
38
- if (typeof val === 'symbol') {
39
- return val.toString()
40
- }
41
- return val
42
- },
43
- indent,
44
- )
45
- } catch {
46
- return String(value)
47
- }
48
- }
49
-
50
- /**
51
- * Formats a console message and its optional params into a single string.
52
- */
53
- export function formatLogMessage(message: unknown, optionalParams?: unknown[]): string {
54
- const parts: string[] = []
55
-
56
- if (message instanceof Error) {
57
- parts.push(`${message.name}: ${message.message}`)
58
- } else if (typeof message === 'object' && message !== null) {
59
- parts.push(safeStringify(message, 0))
60
- } else if (typeof message === 'string') {
61
- // Strip console color formatting (%c)
62
- parts.push(message.replace(/%c/g, '').trim())
63
- } else {
64
- parts.push(String(message))
65
- }
66
-
67
- if (optionalParams && optionalParams.length > 0) {
68
- for (const param of optionalParams) {
69
- if (typeof param === 'string' && isColorString(param)) {
70
- continue // skip css color strings from console.log('%c ...', 'color: ...')
71
- }
72
- if (typeof param === 'object' && param !== null) {
73
- parts.push(safeStringify(param, 0))
74
- } else {
75
- parts.push(String(param))
76
- }
77
- }
78
- }
79
-
80
- return parts.join(' ')
81
- }
82
-
83
- function isColorString(str: string): boolean {
84
- return (
85
- str.includes('color:') ||
86
- str.includes('background:') ||
87
- str.includes('font-') ||
88
- /^#[0-9A-Fa-f]{3,8}$/.test(str.trim())
89
- )
90
- }