rn-backstage 1.2.1 → 1.3.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 -2
- package/lib/commonjs/Backstage.js +6 -0
- package/lib/commonjs/Backstage.js.map +1 -1
- package/lib/commonjs/components/BackstagePanel.js +18 -2
- package/lib/commonjs/components/BackstagePanel.js.map +1 -1
- package/lib/commonjs/components/FlagsTab.js +11 -9
- package/lib/commonjs/components/FlagsTab.js.map +1 -1
- package/lib/commonjs/components/FloatingPill.js +82 -22
- package/lib/commonjs/components/FloatingPill.js.map +1 -1
- package/lib/commonjs/components/InfoTab.js +5 -1
- package/lib/commonjs/components/InfoTab.js.map +1 -1
- package/lib/commonjs/components/LogItem.js +6 -0
- package/lib/commonjs/components/LogItem.js.map +1 -1
- package/lib/commonjs/components/LogsTab.js +2 -0
- package/lib/commonjs/components/LogsTab.js.map +1 -1
- package/lib/commonjs/components/NetworkTab.js +2 -0
- package/lib/commonjs/components/NetworkTab.js.map +1 -1
- package/lib/commonjs/components/StorageTab.js +655 -0
- package/lib/commonjs/components/StorageTab.js.map +1 -0
- package/lib/commonjs/constants.js +72 -6
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/index.js +77 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/Backstage.js +6 -0
- package/lib/module/Backstage.js.map +1 -1
- package/lib/module/components/BackstagePanel.js +18 -2
- package/lib/module/components/BackstagePanel.js.map +1 -1
- package/lib/module/components/FlagsTab.js +11 -9
- package/lib/module/components/FlagsTab.js.map +1 -1
- package/lib/module/components/FloatingPill.js +86 -26
- package/lib/module/components/FloatingPill.js.map +1 -1
- package/lib/module/components/InfoTab.js +6 -2
- package/lib/module/components/InfoTab.js.map +1 -1
- package/lib/module/components/LogItem.js +7 -1
- package/lib/module/components/LogItem.js.map +1 -1
- package/lib/module/components/LogsTab.js +2 -0
- package/lib/module/components/LogsTab.js.map +1 -1
- package/lib/module/components/NetworkTab.js +2 -0
- package/lib/module/components/NetworkTab.js.map +1 -1
- package/lib/module/components/StorageTab.js +650 -0
- package/lib/module/components/StorageTab.js.map +1 -0
- package/lib/module/constants.js +72 -6
- package/lib/module/constants.js.map +1 -1
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/Backstage.d.ts.map +1 -1
- package/lib/typescript/components/BackstagePanel.d.ts +2 -1
- package/lib/typescript/components/BackstagePanel.d.ts.map +1 -1
- package/lib/typescript/components/FloatingPill.d.ts +2 -0
- package/lib/typescript/components/FloatingPill.d.ts.map +1 -1
- package/lib/typescript/components/InfoTab.d.ts.map +1 -1
- package/lib/typescript/components/LogItem.d.ts.map +1 -1
- package/lib/typescript/components/StorageTab.d.ts +9 -0
- package/lib/typescript/components/StorageTab.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +59 -4
- package/lib/typescript/constants.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +12 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +16 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/Backstage.tsx +6 -0
- package/src/components/BackstagePanel.tsx +23 -4
- package/src/components/FlagsTab.tsx +6 -4
- package/src/components/FloatingPill.tsx +122 -28
- package/src/components/InfoTab.tsx +6 -5
- package/src/components/LogItem.tsx +13 -4
- package/src/components/LogsTab.tsx +2 -2
- package/src/components/NetworkTab.tsx +2 -2
- package/src/components/StorageTab.tsx +607 -0
- package/src/constants.ts +80 -4
- package/src/index.ts +15 -0
- package/src/types.ts +22 -0
package/src/constants.ts
CHANGED
|
@@ -81,34 +81,110 @@ export const MonospaceFont = Platform.select({
|
|
|
81
81
|
// ─── Test IDs ────────────────────────────────────────────────────────────────
|
|
82
82
|
|
|
83
83
|
export const TestIDs = {
|
|
84
|
+
// ── Floating Pill ──────────────────────────────
|
|
84
85
|
floatingPill: 'backstage.floating-pill',
|
|
86
|
+
floatingPillText: 'backstage.floating-pill.text',
|
|
87
|
+
|
|
88
|
+
// ── Panel ──────────────────────────────────────
|
|
85
89
|
panel: 'backstage.panel',
|
|
90
|
+
panelModal: 'backstage.panel.modal',
|
|
91
|
+
|
|
92
|
+
// ── Header ─────────────────────────────────────
|
|
86
93
|
header: {
|
|
87
94
|
container: 'backstage.header',
|
|
88
95
|
title: 'backstage.header.title',
|
|
89
96
|
closeButton: 'backstage.header.close',
|
|
90
97
|
},
|
|
98
|
+
|
|
99
|
+
// ── Tab Bar ────────────────────────────────────
|
|
91
100
|
tabBar: 'backstage.tab-bar',
|
|
92
101
|
tabs: {
|
|
93
102
|
info: 'backstage.tab.info',
|
|
103
|
+
network: 'backstage.tab.network',
|
|
104
|
+
flags: 'backstage.tab.flags',
|
|
105
|
+
storage: 'backstage.tab.storage',
|
|
94
106
|
logs: 'backstage.tab.logs',
|
|
95
107
|
},
|
|
108
|
+
|
|
109
|
+
// ── Info Tab ───────────────────────────────────
|
|
96
110
|
infoTab: {
|
|
97
|
-
|
|
111
|
+
container: 'backstage.info',
|
|
98
112
|
deviceInfo: 'backstage.info.device',
|
|
99
113
|
stateTree: 'backstage.info.state-tree',
|
|
100
114
|
quickActions: 'backstage.info.quick-actions',
|
|
115
|
+
/** Dynamic: backstage.info.action.{index} */
|
|
116
|
+
actionButton: (index: number) => `backstage.info.action.${index}`,
|
|
101
117
|
},
|
|
118
|
+
|
|
119
|
+
// ── Logs Tab ───────────────────────────────────
|
|
102
120
|
logsTab: {
|
|
103
|
-
|
|
121
|
+
container: 'backstage.logs',
|
|
104
122
|
searchInput: 'backstage.logs.search',
|
|
105
123
|
copyButton: 'backstage.logs.copy',
|
|
106
124
|
list: 'backstage.logs.list',
|
|
125
|
+
statsBar: 'backstage.logs.stats',
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// ── Log Item ───────────────────────────────────
|
|
129
|
+
logItem: {
|
|
130
|
+
/** Dynamic: backstage.log-item.{id} */
|
|
131
|
+
container: (id: string) => `backstage.log-item.${id}`,
|
|
132
|
+
badge: (id: string) => `backstage.log-item.${id}.badge`,
|
|
133
|
+
message: (id: string) => `backstage.log-item.${id}.message`,
|
|
134
|
+
timestamp: (id: string) => `backstage.log-item.${id}.timestamp`,
|
|
135
|
+
dataContainer: (id: string) => `backstage.log-item.${id}.data`,
|
|
136
|
+
copyButton: (id: string) => `backstage.log-item.${id}.copy`,
|
|
107
137
|
},
|
|
138
|
+
|
|
139
|
+
// ── Network Tab ────────────────────────────────
|
|
108
140
|
networkTab: {
|
|
109
|
-
|
|
141
|
+
container: 'backstage.network',
|
|
110
142
|
searchInput: 'backstage.network.search',
|
|
111
|
-
list: 'backstage.network.list',
|
|
112
143
|
clearButton: 'backstage.network.clear',
|
|
144
|
+
list: 'backstage.network.list',
|
|
145
|
+
statsBar: 'backstage.network.stats',
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
// ── Network Item ───────────────────────────────
|
|
149
|
+
networkItem: {
|
|
150
|
+
/** Dynamic: backstage.network-item.{id} */
|
|
151
|
+
container: (id: string) => `backstage.network-item.${id}`,
|
|
152
|
+
methodBadge: (id: string) => `backstage.network-item.${id}.method`,
|
|
153
|
+
statusBadge: (id: string) => `backstage.network-item.${id}.status`,
|
|
154
|
+
url: (id: string) => `backstage.network-item.${id}.url`,
|
|
155
|
+
sectionTab: (id: string, section: string) => `backstage.network-item.${id}.section.${section}`,
|
|
156
|
+
curlButton: (id: string) => `backstage.network-item.${id}.curl`,
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// ── Flags Tab ──────────────────────────────────
|
|
160
|
+
flagsTab: {
|
|
161
|
+
container: 'backstage.flags',
|
|
162
|
+
searchInput: 'backstage.flags.search',
|
|
163
|
+
statsBar: 'backstage.flags.stats',
|
|
164
|
+
list: 'backstage.flags.list',
|
|
165
|
+
/** Dynamic: backstage.flag.{key} — applied to the Switch */
|
|
166
|
+
flagSwitch: (key: string) => `backstage.flag.${key}`,
|
|
167
|
+
flagLabel: (key: string) => `backstage.flag.${key}.label`,
|
|
168
|
+
flagRow: (key: string) => `backstage.flag.${key}.row`,
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
// ── Storage Tab ────────────────────────────────
|
|
172
|
+
storageTab: {
|
|
173
|
+
container: 'backstage.storage',
|
|
174
|
+
searchInput: 'backstage.storage.search',
|
|
175
|
+
addButton: 'backstage.storage.add-button',
|
|
176
|
+
addForm: 'backstage.storage.add-form',
|
|
177
|
+
addKeyInput: 'backstage.storage.add-form.key',
|
|
178
|
+
addValueInput: 'backstage.storage.add-form.value',
|
|
179
|
+
addSubmitButton: 'backstage.storage.add-form.submit',
|
|
180
|
+
statsBar: 'backstage.storage.stats',
|
|
181
|
+
list: 'backstage.storage.list',
|
|
182
|
+
/** Dynamic: backstage.storage.entry.{key} */
|
|
183
|
+
entryRow: (key: string) => `backstage.storage.entry.${key}`,
|
|
184
|
+
entryEditButton: (key: string) => `backstage.storage.entry.${key}.edit`,
|
|
185
|
+
entryDeleteButton: (key: string) => `backstage.storage.entry.${key}.delete`,
|
|
186
|
+
entryEditInput: (key: string) => `backstage.storage.entry.${key}.edit-input`,
|
|
187
|
+
entrySaveButton: (key: string) => `backstage.storage.entry.${key}.save`,
|
|
188
|
+
entryCancelButton: (key: string) => `backstage.storage.entry.${key}.cancel`,
|
|
113
189
|
},
|
|
114
190
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type {
|
|
|
8
8
|
BackstageTheme,
|
|
9
9
|
QuickAction,
|
|
10
10
|
FeatureFlag,
|
|
11
|
+
StorageAdapter,
|
|
11
12
|
AppInfoItem,
|
|
12
13
|
LogEntry,
|
|
13
14
|
NetworkEntry,
|
|
@@ -16,3 +17,17 @@ export type {
|
|
|
16
17
|
export { LogLevel, NetworkState } from './types'
|
|
17
18
|
export { TestIDs, DarkTheme, LightTheme } from './constants'
|
|
18
19
|
export type { ThemePreference } from './ThemeContext'
|
|
20
|
+
|
|
21
|
+
// ─── Individual Components ───────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export { BackstagePanel } from './components/BackstagePanel'
|
|
24
|
+
export { FloatingPill } from './components/FloatingPill'
|
|
25
|
+
export { TabBar } from './components/TabBar'
|
|
26
|
+
export { InfoTab } from './components/InfoTab'
|
|
27
|
+
export { LogsTab } from './components/LogsTab'
|
|
28
|
+
export { LogItem } from './components/LogItem'
|
|
29
|
+
export { NetworkTab } from './components/NetworkTab'
|
|
30
|
+
export { NetworkItem } from './components/NetworkItem'
|
|
31
|
+
export { FlagsTab } from './components/FlagsTab'
|
|
32
|
+
export { StorageTab } from './components/StorageTab'
|
|
33
|
+
export { JsonTreeView } from './components/JsonTreeView'
|
package/src/types.ts
CHANGED
|
@@ -76,6 +76,19 @@ export interface FeatureFlag {
|
|
|
76
76
|
description?: string
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
// ─── Storage Adapter ─────────────────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
export interface StorageAdapter {
|
|
82
|
+
/** Return all stored keys */
|
|
83
|
+
getAllKeys: () => Promise<string[]>
|
|
84
|
+
/** Get value for a key. Return null if not found */
|
|
85
|
+
getItem: (key: string) => Promise<string | null>
|
|
86
|
+
/** Set a value for a key */
|
|
87
|
+
setItem: (key: string, value: string) => Promise<void>
|
|
88
|
+
/** Remove an entry by key */
|
|
89
|
+
removeItem: (key: string) => Promise<void>
|
|
90
|
+
}
|
|
91
|
+
|
|
79
92
|
// ─── Extensible Tabs ─────────────────────────────────────────────────────────
|
|
80
93
|
|
|
81
94
|
export interface BackstageTab {
|
|
@@ -141,6 +154,9 @@ export interface BackstageProps {
|
|
|
141
154
|
/** Callback when a feature flag is toggled */
|
|
142
155
|
onToggleFeatureFlag?: (key: string, value: boolean) => void
|
|
143
156
|
|
|
157
|
+
/** Storage adapter for the Storage Viewer tab (AsyncStorage, MMKV, etc.) */
|
|
158
|
+
storageAdapter?: StorageAdapter
|
|
159
|
+
|
|
144
160
|
/** Maximum number of logs to retain in memory. Default: 500 */
|
|
145
161
|
maxLogs?: number
|
|
146
162
|
|
|
@@ -168,6 +184,12 @@ export interface BackstageProps {
|
|
|
168
184
|
/** Text displayed on the floating pill. Defaults to appVersion or "DEV" */
|
|
169
185
|
pillText?: string
|
|
170
186
|
|
|
187
|
+
/** Width of the floating pill. Default: 60 */
|
|
188
|
+
pillWidth?: number
|
|
189
|
+
|
|
190
|
+
/** Height of the floating pill. Default: 32 */
|
|
191
|
+
pillHeight?: number
|
|
192
|
+
|
|
171
193
|
/** Whether to enable network request interception. Default: true */
|
|
172
194
|
enableNetworkInspector?: boolean
|
|
173
195
|
|