@buoy-gg/network 7.0.41 → 7.0.43

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 (272) hide show
  1. package/README.md +11 -85
  2. package/lib/commonjs/index.js +1 -332
  3. package/lib/commonjs/index.web.js +1 -420
  4. package/lib/commonjs/network/components/DataViewer.web.js +1 -879
  5. package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
  6. package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
  7. package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
  8. package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
  9. package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
  10. package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
  11. package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
  12. package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
  13. package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
  14. package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
  15. package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
  16. package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
  17. package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
  18. package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
  19. package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
  20. package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
  21. package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
  22. package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
  23. package/lib/commonjs/network/components/NetworkModal.js +1 -786
  24. package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
  25. package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
  26. package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
  27. package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
  28. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
  29. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
  30. package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
  31. package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
  32. package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
  33. package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
  34. package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
  35. package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
  36. package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
  37. package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
  38. package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
  39. package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
  40. package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
  41. package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
  42. package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
  43. package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
  44. package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
  45. package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
  46. package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
  47. package/lib/commonjs/network/conditions/store.js +1 -75
  48. package/lib/commonjs/network/conditions/wait.js +1 -43
  49. package/lib/commonjs/network/conditions/xhr.js +1 -135
  50. package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
  51. package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
  52. package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
  53. package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
  54. package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
  55. package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
  56. package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
  57. package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
  58. package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
  59. package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
  60. package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
  61. package/lib/commonjs/network/overrides/engine.js +1 -93
  62. package/lib/commonjs/network/overrides/matchRule.js +1 -87
  63. package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
  64. package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
  65. package/lib/commonjs/network/overrides/presets.js +1 -70
  66. package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
  67. package/lib/commonjs/network/overrides/types.js +1 -90
  68. package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
  69. package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
  70. package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
  71. package/lib/commonjs/network/types/index.js +1 -5
  72. package/lib/commonjs/network/utils/extractOperationName.js +1 -80
  73. package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
  74. package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
  75. package/lib/commonjs/network/utils/formatting.js +1 -30
  76. package/lib/commonjs/network/utils/generateCurl.js +2 -71
  77. package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
  78. package/lib/commonjs/network/utils/httpCompletion.js +1 -37
  79. package/lib/commonjs/network/utils/networkEventStore.js +1 -411
  80. package/lib/commonjs/network/utils/networkListener.js +4 -1352
  81. package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
  82. package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
  83. package/lib/commonjs/network/utils/realNow.js +1 -0
  84. package/lib/commonjs/network/utils/requestId.js +1 -16
  85. package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
  86. package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
  87. package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
  88. package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
  89. package/lib/commonjs/preset.js +1 -93
  90. package/lib/module/index.js +1 -104
  91. package/lib/module/index.web.js +1 -82
  92. package/lib/module/network/components/DataViewer.web.js +1 -875
  93. package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
  94. package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
  95. package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
  96. package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
  97. package/lib/module/network/components/NetworkDetailStepper.js +1 -104
  98. package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
  99. package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
  100. package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
  101. package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
  102. package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
  103. package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
  104. package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
  105. package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
  106. package/lib/module/network/components/NetworkHeaderLive.js +1 -366
  107. package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
  108. package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
  109. package/lib/module/network/components/NetworkListScreen.js +1 -399
  110. package/lib/module/network/components/NetworkListScreen.web.js +1 -622
  111. package/lib/module/network/components/NetworkModal.js +1 -781
  112. package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
  113. package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
  114. package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
  115. package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
  116. package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
  117. package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
  118. package/lib/module/network/components/NetworkOverridesButton.js +1 -87
  119. package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
  120. package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
  121. package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
  122. package/lib/module/network/components/NetworkSavedScreen.js +1 -222
  123. package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
  124. package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
  125. package/lib/module/network/components/response-editor/Explorer.js +1 -972
  126. package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
  127. package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
  128. package/lib/module/network/components/response-editor/editorContext.js +1 -29
  129. package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
  130. package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
  131. package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
  132. package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
  133. package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
  134. package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
  135. package/lib/module/network/conditions/store.js +1 -65
  136. package/lib/module/network/conditions/wait.js +1 -38
  137. package/lib/module/network/conditions/xhr.js +1 -131
  138. package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
  139. package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
  140. package/lib/module/network/hooks/useNetworkEventList.js +1 -104
  141. package/lib/module/network/hooks/useNetworkEvents.js +1 -314
  142. package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
  143. package/lib/module/network/hooks/useNetworkSaved.js +1 -34
  144. package/lib/module/network/hooks/useNetworkSelection.js +1 -46
  145. package/lib/module/network/hooks/useOverrideRules.js +1 -32
  146. package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
  147. package/lib/module/network/overrides/applyToFetch.js +1 -72
  148. package/lib/module/network/overrides/applyToXhr.js +2 -502
  149. package/lib/module/network/overrides/engine.js +1 -85
  150. package/lib/module/network/overrides/matchRule.js +1 -81
  151. package/lib/module/network/overrides/overriddenRows.js +1 -33
  152. package/lib/module/network/overrides/overrideRulesStore.js +1 -547
  153. package/lib/module/network/overrides/presets.js +1 -65
  154. package/lib/module/network/overrides/resolveOverride.js +1 -152
  155. package/lib/module/network/overrides/types.js +1 -86
  156. package/lib/module/network/sync/networkBodyResolver.js +1 -34
  157. package/lib/module/network/sync/networkSyncAdapter.js +1 -880
  158. package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
  159. package/lib/module/network/types/index.js +1 -3
  160. package/lib/module/network/utils/extractOperationName.js +1 -76
  161. package/lib/module/network/utils/filterNetworkEvents.js +1 -92
  162. package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
  163. package/lib/module/network/utils/formatting.js +1 -9
  164. package/lib/module/network/utils/generateCurl.js +2 -67
  165. package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
  166. package/lib/module/network/utils/httpCompletion.js +1 -32
  167. package/lib/module/network/utils/networkEventStore.js +1 -409
  168. package/lib/module/network/utils/networkListener.js +4 -1341
  169. package/lib/module/network/utils/networkSavedStore.js +3 -572
  170. package/lib/module/network/utils/networkSelectionStore.js +1 -188
  171. package/lib/module/network/utils/realNow.js +1 -0
  172. package/lib/module/network/utils/requestId.js +1 -12
  173. package/lib/module/network/utils/resolveRequestUrl.js +1 -11
  174. package/lib/module/network/utils/selectSavedEvents.js +1 -35
  175. package/lib/module/network/utils/startNetworkCapture.js +1 -21
  176. package/lib/module/network/utils/withPinnedFirst.js +1 -28
  177. package/lib/module/preset.js +1 -91
  178. package/lib/typescript/network/overrides/engine.d.ts +1 -1
  179. package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
  180. package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
  181. package/lib/typescript/network/overrides/types.d.ts +9 -0
  182. package/lib/typescript/network/utils/networkListener.d.ts +11 -0
  183. package/lib/typescript/network/utils/realNow.d.ts +18 -0
  184. package/lib/web/index.mjs +73 -74
  185. package/package.json +3 -6
  186. package/lib/typescript/index.d.ts.map +0 -1
  187. package/lib/typescript/index.web.d.ts.map +0 -1
  188. package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
  189. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
  190. package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
  191. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
  192. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
  193. package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
  194. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
  195. package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
  196. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
  197. package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
  198. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
  199. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
  200. package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
  201. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
  202. package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
  203. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
  204. package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
  205. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
  206. package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
  207. package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
  208. package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
  209. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
  210. package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
  211. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
  212. package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
  213. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
  214. package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
  215. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
  216. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
  217. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
  218. package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
  219. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
  220. package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
  221. package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
  222. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
  223. package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
  224. package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
  225. package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
  226. package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
  227. package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
  228. package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
  229. package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
  230. package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
  231. package/lib/typescript/network/conditions/store.d.ts.map +0 -1
  232. package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
  233. package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
  234. package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
  235. package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
  236. package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
  237. package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
  238. package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
  239. package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
  240. package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
  241. package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
  242. package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
  243. package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
  244. package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
  245. package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
  246. package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
  247. package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
  248. package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
  249. package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
  250. package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
  251. package/lib/typescript/network/overrides/types.d.ts.map +0 -1
  252. package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
  253. package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
  254. package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
  255. package/lib/typescript/network/types/index.d.ts.map +0 -1
  256. package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
  257. package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
  258. package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
  259. package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
  260. package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
  261. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
  262. package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
  263. package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
  264. package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
  265. package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
  266. package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
  267. package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
  268. package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
  269. package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
  270. package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
  271. package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
  272. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,818 +1,2 @@
1
- "use strict";
2
-
3
- /**
4
- * NetworkEventItemCompact.web — DOM twin of NetworkEventItemCompact.tsx.
5
- *
6
- * Same row layout, prop contract, memoization and display logic as the native
7
- * file: method badge + size indicators on the left, 2-line URL / GraphQL
8
- * operation display in the middle (via the SAME pure `formatGraphQLDisplay`
9
- * util), content-type badge + chevron on the right, absolute-positioned
10
- * status/client chips top-right and duration/relative-time bottom-right, and
11
- * the pinned/saved/overridden glyphs.
12
- *
13
- * Web consumers resolve `@buoy-gg/shared-ui` to a minimal shim (storage +
14
- * JsModal + ignored-pattern helpers only), so the RN-only chrome the native
15
- * row imports from shared-ui is replicated here as DOM with provenance:
16
- * - `DevToolsCard` / `MethodBadge` / `TypeBadge` — inlined DOM twins, values
17
- * copied from shared/src/ui/components/DevToolsCard.tsx and Badge.tsx
18
- * (buoyColors palette inlined below).
19
- * - `macOSColors` — inlined verbatim subset from
20
- * shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts.
21
- * - Icons — inline lucide SVGs (shared-ui's icons are lucide re-exports,
22
- * 24×24 viewBox, strokeWidth 2).
23
- * - `formatBytes` / `formatDuration` — copied verbatim from
24
- * shared/src/utils/formatting/dataFormatting.ts (not in the web shim).
25
- * - `formatRelativeTime` — copied verbatim from
26
- * shared/src/utils/time/formatRelativeTime.ts.
27
- *
28
- * Intentional deviations (all logged):
29
- * - `useTickEveryMinute` (shared-ui TickProvider context, 5s interval as
30
- * mounted by NetworkModal) is replaced by a module-level shared 5s interval
31
- * hook — the shim exposes no `useTick`, and one shared timer keeps the
32
- * native "one clock for all rows" behavior.
33
- * - `onLongPress` (pin toggle) fires after a 500ms pointer hold — the native
34
- * TouchableOpacity default `delayLongPress`. The click that follows a long
35
- * press is swallowed, matching native semantics.
36
- * - `activeOpacity={0.8}` press feedback is a pointer-driven opacity state.
37
- * - `numberOfLines={2}` → `-webkit-line-clamp: 2`.
38
- * - The duration/relative-time separator is two literal spaces natively;
39
- * `white-space: pre` preserves them (HTML would collapse to one).
40
- *
41
- * @platform React DOM Web
42
- */
43
-
44
- import { memo, useEffect, useState, useRef } from "react";
45
- import { formatGraphQLDisplay } from "../utils/formatGraphQLVariables";
46
-
47
- // =============================
48
- // Native palettes (provenance)
49
- // =============================
50
-
51
- /** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
52
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
53
- const macOSColors = {
54
- text: {
55
- primary: "#F5F5F7",
56
- secondary: "#A1A1A6",
57
- muted: "#8E8E93"
58
- },
59
- semantic: {
60
- success: "#34C759",
61
- error: "#FF453A",
62
- warning: "#FFEB3B",
63
- info: "#00B8E6",
64
- debug: "#BF5AF2"
65
- }
66
- };
67
-
68
- /** buoyColors subset — shared/src/ui/gameUI/constants/gameUIColors.ts (macOS theme), verbatim. */
69
- const buoy = {
70
- card: "#1A1A1A",
71
- border: "#333333",
72
- primary: "#20C997",
73
- // Buoy teal (success/primary are the same value)
74
- success: "#20C997",
75
- warning: "#FFA94D",
76
- error: "#EF4444",
77
- textSecondary: "#A0A0A0",
78
- textMuted: "#888888"
79
- };
80
-
81
- // =============================
82
- // Inline lucide icons (shared-ui icons are lucide re-exports)
83
- // =============================
84
-
85
- function Svg({
86
- size = 14,
87
- color = "currentColor",
88
- children
89
- }) {
90
- return /*#__PURE__*/_jsx("svg", {
91
- width: size,
92
- height: size,
93
- viewBox: "0 0 24 24",
94
- fill: "none",
95
- stroke: color,
96
- strokeWidth: 2,
97
- strokeLinecap: "round",
98
- strokeLinejoin: "round",
99
- style: {
100
- flexShrink: 0,
101
- display: "block"
102
- },
103
- children: children
104
- });
105
- }
106
- const ChevronRight = p => /*#__PURE__*/_jsx(Svg, {
107
- ...p,
108
- children: /*#__PURE__*/_jsx("path", {
109
- d: "m9 18 6-6-6-6"
110
- })
111
- });
112
- const Upload = p => /*#__PURE__*/_jsxs(Svg, {
113
- ...p,
114
- children: [/*#__PURE__*/_jsx("path", {
115
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
116
- }), /*#__PURE__*/_jsx("polyline", {
117
- points: "17 8 12 3 7 8"
118
- }), /*#__PURE__*/_jsx("line", {
119
- x1: "12",
120
- x2: "12",
121
- y1: "3",
122
- y2: "15"
123
- })]
124
- });
125
- const Download = p => /*#__PURE__*/_jsxs(Svg, {
126
- ...p,
127
- children: [/*#__PURE__*/_jsx("path", {
128
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
129
- }), /*#__PURE__*/_jsx("polyline", {
130
- points: "7 10 12 15 17 10"
131
- }), /*#__PURE__*/_jsx("line", {
132
- x1: "12",
133
- x2: "12",
134
- y1: "15",
135
- y2: "3"
136
- })]
137
- });
138
- const Clock = p => /*#__PURE__*/_jsxs(Svg, {
139
- ...p,
140
- children: [/*#__PURE__*/_jsx("circle", {
141
- cx: "12",
142
- cy: "12",
143
- r: "10"
144
- }), /*#__PURE__*/_jsx("polyline", {
145
- points: "12 6 12 12 16 14"
146
- })]
147
- });
148
- const AlertCircle = p => /*#__PURE__*/_jsxs(Svg, {
149
- ...p,
150
- children: [/*#__PURE__*/_jsx("circle", {
151
- cx: "12",
152
- cy: "12",
153
- r: "10"
154
- }), /*#__PURE__*/_jsx("line", {
155
- x1: "12",
156
- x2: "12",
157
- y1: "8",
158
- y2: "12"
159
- }), /*#__PURE__*/_jsx("line", {
160
- x1: "12",
161
- x2: "12.01",
162
- y1: "16",
163
- y2: "16"
164
- })]
165
- });
166
- const Bookmark = p => /*#__PURE__*/_jsx(Svg, {
167
- ...p,
168
- children: /*#__PURE__*/_jsx("path", {
169
- d: "m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"
170
- })
171
- });
172
- const FlaskConical = p => /*#__PURE__*/_jsxs(Svg, {
173
- ...p,
174
- children: [/*#__PURE__*/_jsx("path", {
175
- d: "M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"
176
- }), /*#__PURE__*/_jsx("path", {
177
- d: "M8.5 2h7"
178
- }), /*#__PURE__*/_jsx("path", {
179
- d: "M7 16h10"
180
- })]
181
- });
182
- const Pin = ({
183
- active,
184
- ...p
185
- }) => /*#__PURE__*/_jsx(Svg, {
186
- ...p,
187
- children: /*#__PURE__*/_jsxs("g", {
188
- transform: active ? "rotate(-45 12 12) translate(12 12) scale(0.92) translate(-12 -12)" : undefined,
189
- children: [/*#__PURE__*/_jsx("path", {
190
- d: "M2.97 21.03 8.18 15.82"
191
- }), /*#__PURE__*/_jsx("path", {
192
- d: "M4.4 10.81 13.19 19.6"
193
- }), /*#__PURE__*/_jsx("path", {
194
- d: "M5.17 10.54 11.43 8.83"
195
- }), /*#__PURE__*/_jsx("path", {
196
- d: "M13.46 18.83 15.17 12.57"
197
- }), /*#__PURE__*/_jsx("rect", {
198
- x: "12.15",
199
- y: "5.4",
200
- width: "9.38",
201
- height: "3.52",
202
- rx: "1.07",
203
- transform: "rotate(-45 16.84 7.16)"
204
- })]
205
- })
206
- });
207
-
208
- // =============================
209
- // Shared formatters (provenance copies — not in the web shim)
210
- // =============================
211
-
212
- /** shared/src/utils/formatting/dataFormatting.ts — verbatim. */
213
- function formatBytes(bytes) {
214
- if (bytes === undefined || bytes === null) return "N/A";
215
- if (bytes === 0) return "0 B";
216
- const k = 1024;
217
- const sizes = ["B", "KB", "MB", "GB", "TB"];
218
- const i = Math.floor(Math.log(bytes) / Math.log(k));
219
- return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`;
220
- }
221
-
222
- /** shared/src/utils/formatting/dataFormatting.ts — verbatim. */
223
- function formatDuration(ms) {
224
- if (ms === undefined || ms === null) return "N/A";
225
- if (ms < 1000) {
226
- return `${ms}ms`;
227
- }
228
- if (ms < 60000) {
229
- return `${(ms / 1000).toFixed(1)}s`;
230
- }
231
- if (ms < 3600000) {
232
- const minutes = Math.floor(ms / 60000);
233
- const seconds = Math.floor(ms % 60000 / 1000);
234
- return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
235
- }
236
- const hours = Math.floor(ms / 3600000);
237
- const minutes = Math.floor(ms % 3600000 / 60000);
238
- return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
239
- }
240
-
241
- /** shared/src/utils/time/formatRelativeTime.ts — verbatim. */
242
- function formatRelativeTime(timestamp, currentTime = Date.now()) {
243
- const timestampMs = timestamp instanceof Date ? timestamp.getTime() : timestamp;
244
- const seconds = Math.floor((currentTime - timestampMs) / 1000);
245
- if (seconds < 0) {
246
- return "just now";
247
- }
248
- if (seconds < 60) {
249
- return seconds === 0 ? "just now" : `${seconds}s ago`;
250
- }
251
- const minutes = Math.floor(seconds / 60);
252
- if (minutes < 60) {
253
- return `${minutes}m ago`;
254
- }
255
- const hours = Math.floor(minutes / 60);
256
- if (hours < 24) {
257
- return `${hours}h ago`;
258
- }
259
- const days = Math.floor(hours / 24);
260
- return `${days}d ago`;
261
- }
262
-
263
- // =============================
264
- // Shared tick (DEVIATION: replaces shared-ui TickProvider/useTick)
265
- // =============================
266
-
267
- /**
268
- * One module-level 5s clock shared by every mounted row — the same cadence the
269
- * native rows get from NetworkModal's `TickProvider` (default `intervalMs`
270
- * 5_000). The interval only runs while at least one row is mounted.
271
- */
272
- const tickListeners = new Set();
273
- let tickInterval = null;
274
- function subscribeTick(listener) {
275
- tickListeners.add(listener);
276
- if (tickInterval == null) {
277
- tickInterval = setInterval(() => {
278
- const now = Date.now();
279
- tickListeners.forEach(l => l(now));
280
- }, 5_000);
281
- }
282
- return () => {
283
- tickListeners.delete(listener);
284
- if (tickListeners.size === 0 && tickInterval != null) {
285
- clearInterval(tickInterval);
286
- tickInterval = null;
287
- }
288
- };
289
- }
290
- function useSharedTick() {
291
- const [tick, setTick] = useState(() => Date.now());
292
- useEffect(() => subscribeTick(setTick), []);
293
- return tick;
294
- }
295
-
296
- // =============================
297
- // Pure display helpers (copied verbatim from the native file)
298
- // =============================
299
-
300
- // Get color based on status
301
- function getStatusColor(status, error) {
302
- if (error) return macOSColors.semantic.error;
303
- if (!status) return macOSColors.semantic.warning;
304
- if (status >= 200 && status < 300) return macOSColors.semantic.success;
305
- if (status >= 300 && status < 400) return macOSColors.semantic.info;
306
- if (status >= 400) return macOSColors.semantic.error;
307
- return macOSColors.text.muted;
308
- }
309
-
310
- // Get content type badge with color
311
- function getContentTypeBadge(headers) {
312
- const contentType = headers?.["content-type"] || headers?.["Content-Type"] || "";
313
- if (contentType.includes("json")) return "JSON";
314
- if (contentType.includes("xml")) return "XML";
315
- if (contentType.includes("html")) return "HTML";
316
- if (contentType.includes("text")) return "TEXT";
317
- if (contentType.includes("image")) return "IMG";
318
- if (contentType.includes("video")) return "VIDEO";
319
- if (contentType.includes("audio")) return "AUDIO";
320
- if (contentType.includes("form")) return "FORM";
321
- return null;
322
- }
323
-
324
- /**
325
- * The transport chip (`fetch` / `GQL` / `gRPC` / `XHR`), one brand colour each.
326
- */
327
- function getClientChipColors(requestClient) {
328
- switch (requestClient) {
329
- case "fetch":
330
- return {
331
- backgroundColor: "rgba(74, 144, 226, 0.15)",
332
- color: "#4A90E2"
333
- };
334
- case "graphql":
335
- return {
336
- backgroundColor: "rgba(229, 53, 171, 0.15)",
337
- color: "#E535AB"
338
- };
339
- case "grpc-web":
340
- return {
341
- backgroundColor: "rgba(16, 185, 129, 0.15)",
342
- color: "#10B981"
343
- };
344
- case "xhr":
345
- return {
346
- backgroundColor: "rgba(245, 158, 11, 0.15)",
347
- color: "#F59E0B"
348
- };
349
- default:
350
- return {
351
- backgroundColor: "rgba(147, 51, 234, 0.15)",
352
- color: "#9333EA"
353
- };
354
- }
355
- }
356
-
357
- // =============================
358
- // shared-ui DOM twins (provenance: Badge.tsx / DevToolsCard.tsx)
359
- // =============================
360
-
361
- /**
362
- * MethodBadge twin — shared/src/ui/components/Badge.tsx `MethodBadge`
363
- * (`size="small"`: 6/2 padding, 11px, weight 700, minWidth 45, `${color}15`
364
- * fill, `${color}40` border, radius 4). METHOD_COLORS map, verbatim.
365
- */
366
- const METHOD_COLORS = {
367
- GET: buoy.success,
368
- POST: buoy.primary,
369
- PUT: buoy.warning,
370
- PATCH: buoy.textSecondary,
371
- DELETE: buoy.error,
372
- HEAD: buoy.textMuted,
373
- OPTIONS: buoy.primary
374
- };
375
- function MethodBadgeWeb({
376
- method
377
- }) {
378
- const color = METHOD_COLORS[method.toUpperCase()] || "#6B7280";
379
- return /*#__PURE__*/_jsx("span", {
380
- style: {
381
- display: "inline-flex",
382
- alignItems: "center",
383
- justifyContent: "center",
384
- minWidth: 45,
385
- boxSizing: "border-box",
386
- padding: "2px 6px",
387
- fontSize: 11,
388
- fontWeight: 700,
389
- color,
390
- backgroundColor: `${color}15`,
391
- border: `1px solid ${color}40`,
392
- borderRadius: 4
393
- },
394
- children: method.toUpperCase()
395
- });
396
- }
397
-
398
- /**
399
- * TypeBadge twin — shared/src/ui/components/Badge.tsx `TypeBadge`
400
- * (`size="small"`). Content types ("JSON" etc.) are not in `getTypeColor`'s
401
- * map, so they all resolve to `buoyColors.textMuted` — same as native.
402
- */
403
- function TypeBadgeWeb({
404
- type
405
- }) {
406
- const color = buoy.textMuted;
407
- return /*#__PURE__*/_jsx("span", {
408
- style: {
409
- display: "inline-flex",
410
- alignItems: "center",
411
- padding: "2px 6px",
412
- fontSize: 11,
413
- fontWeight: 600,
414
- color,
415
- backgroundColor: `${color}15`,
416
- border: `1px solid ${color}40`,
417
- borderRadius: 4
418
- },
419
- children: type
420
- });
421
- }
422
-
423
- /**
424
- * DevToolsCard twin — shared/src/ui/components/DevToolsCard.tsx. Wrapper
425
- * margin 4px vertical (the native row overrides horizontal to 8), card =
426
- * buoyColors.card fill, `${border}40` outline + bottom hairline, radius 8,
427
- * padding 12, minHeight 44, activeOpacity 0.8. Long-press = 500ms pointer
428
- * hold (TouchableOpacity default delayLongPress) — see file header.
429
- */
430
- function DevToolsCardWeb({
431
- onPress,
432
- onLongPress,
433
- children,
434
- contentStyle
435
- }) {
436
- const [pressed, setPressed] = useState(false);
437
- const longPressTimer = useRef(null);
438
- const longPressFired = useRef(false);
439
- const clearTimer = () => {
440
- if (longPressTimer.current != null) {
441
- clearTimeout(longPressTimer.current);
442
- longPressTimer.current = null;
443
- }
444
- };
445
- return /*#__PURE__*/_jsx("div", {
446
- style: {
447
- margin: "4px 8px"
448
- },
449
- children: /*#__PURE__*/_jsx("button", {
450
- type: "button",
451
- onPointerDown: () => {
452
- setPressed(true);
453
- if (onLongPress) {
454
- longPressFired.current = false;
455
- clearTimer();
456
- longPressTimer.current = setTimeout(() => {
457
- longPressFired.current = true;
458
- onLongPress();
459
- }, 500);
460
- }
461
- },
462
- onPointerUp: () => {
463
- setPressed(false);
464
- clearTimer();
465
- },
466
- onPointerLeave: () => {
467
- setPressed(false);
468
- clearTimer();
469
- },
470
- onPointerCancel: () => {
471
- setPressed(false);
472
- clearTimer();
473
- },
474
- onClick: () => {
475
- // A long press toggles the pin; it must not ALSO open the detail.
476
- if (longPressFired.current) {
477
- longPressFired.current = false;
478
- return;
479
- }
480
- onPress();
481
- },
482
- style: {
483
- position: "relative",
484
- display: "flex",
485
- width: "100%",
486
- boxSizing: "border-box",
487
- backgroundColor: buoy.card,
488
- borderRadius: 8,
489
- border: `1px solid ${buoy.border}40`,
490
- borderBottom: `1px solid ${buoy.border}40`,
491
- padding: 12,
492
- minHeight: 44,
493
- margin: 0,
494
- textAlign: "left",
495
- cursor: "pointer",
496
- fontFamily: "inherit",
497
- color: "inherit",
498
- userSelect: "none",
499
- WebkitUserSelect: "none",
500
- opacity: pressed ? 0.8 : 1,
501
- ...contentStyle
502
- },
503
- children: children
504
- })
505
- });
506
- }
507
-
508
- // =============================
509
- // Row (structure mirrors the native file 1:1)
510
- // =============================
511
-
512
- // Status indicator component - single responsibility
513
- function StatusIndicator({
514
- event,
515
- isPending,
516
- statusColor
517
- }) {
518
- if (isPending) {
519
- return /*#__PURE__*/_jsxs("span", {
520
- style: styles.pendingBadge,
521
- children: [/*#__PURE__*/_jsx(Clock, {
522
- size: 10,
523
- color: macOSColors.semantic.warning
524
- }), /*#__PURE__*/_jsx("span", {
525
- style: styles.pendingText,
526
- children: "..."
527
- })]
528
- });
529
- }
530
- if (event.error) {
531
- return /*#__PURE__*/_jsxs("span", {
532
- style: styles.errorBadge,
533
- children: [/*#__PURE__*/_jsx(AlertCircle, {
534
- size: 10,
535
- color: macOSColors.semantic.error
536
- }), /*#__PURE__*/_jsx("span", {
537
- style: styles.errorText,
538
- children: "ERR"
539
- })]
540
- });
541
- }
542
- return /*#__PURE__*/_jsx("span", {
543
- style: styles.statusBadge,
544
- children: /*#__PURE__*/_jsx("span", {
545
- style: {
546
- ...styles.statusText,
547
- color: statusColor
548
- },
549
- children: String(event.status)
550
- })
551
- });
552
- }
553
-
554
- // Size indicators component - single responsibility
555
- function SizeIndicators({
556
- requestSize,
557
- responseSize
558
- }) {
559
- if (!requestSize && !responseSize) return null;
560
- return /*#__PURE__*/_jsxs("span", {
561
- style: styles.sizeRow,
562
- children: [requestSize ? /*#__PURE__*/_jsxs("span", {
563
- style: styles.sizeItem,
564
- children: [/*#__PURE__*/_jsx(Upload, {
565
- size: 8,
566
- color: macOSColors.semantic.info
567
- }), /*#__PURE__*/_jsx("span", {
568
- style: styles.sizeText,
569
- children: formatBytes(requestSize)
570
- })]
571
- }) : null, responseSize ? /*#__PURE__*/_jsxs("span", {
572
- style: styles.sizeItem,
573
- children: [/*#__PURE__*/_jsx(Download, {
574
- size: 8,
575
- color: macOSColors.semantic.success
576
- }), /*#__PURE__*/_jsx("span", {
577
- style: styles.sizeText,
578
- children: formatBytes(responseSize)
579
- })]
580
- }) : null]
581
- });
582
- }
583
-
584
- /**
585
- * Sole tick consumer in the row (rule2: composition over memo) — the periodic
586
- * relative-timestamp tick re-renders ONLY this leaf, not the whole card.
587
- */
588
- function BottomRightTime({
589
- timestamp,
590
- duration
591
- }) {
592
- const tick = useSharedTick();
593
- const relativeTime = formatRelativeTime(timestamp, tick);
594
- return duration ? /*#__PURE__*/_jsxs("span", {
595
- style: styles.bottomRightText,
596
- children: [formatDuration(duration), " ", relativeTime]
597
- }) : /*#__PURE__*/_jsx("span", {
598
- style: styles.bottomRightText,
599
- children: relativeTime
600
- });
601
- }
602
- export const NetworkEventItemCompact = /*#__PURE__*/memo(function NetworkEventItemCompact({
603
- event,
604
- onPress,
605
- pinned = false,
606
- saved = false,
607
- overridden = false,
608
- onLongPress
609
- }) {
610
- const statusColor = getStatusColor(event.status, event.error);
611
- const isPending = !event.status && !event.error;
612
- const contentType = getContentTypeBadge(event.responseHeaders);
613
-
614
- // Format URL for display (max 2 lines)
615
- let displayUrl = event.path || event.url.replace(/^https?:\/\/[^/]+/, "");
616
-
617
- // If this is a GraphQL request, show operation name with variables using
618
- // arrow notation (same pure util as native).
619
- if (event.requestClient === "graphql") {
620
- if (event.operationName) {
621
- displayUrl = formatGraphQLDisplay(event.operationName, event.graphqlVariables);
622
- } else {
623
- displayUrl = displayUrl.replace(/\/graphql[^?]*/, "/graphql");
624
- }
625
- } else if (event.operationName) {
626
- // For non-GraphQL requests with operation names (e.g., gRPC)
627
- displayUrl = `${displayUrl}\n(${event.operationName})`;
628
- }
629
- return /*#__PURE__*/_jsxs(DevToolsCardWeb, {
630
- onPress: () => onPress(event),
631
- onLongPress: onLongPress ? () => onLongPress(event) : undefined,
632
- contentStyle: {
633
- flexDirection: "row",
634
- alignItems: "center",
635
- borderLeft: `3px solid ${statusColor}`
636
- },
637
- children: [/*#__PURE__*/_jsxs("span", {
638
- style: styles.topRightContainer,
639
- children: [pinned ? /*#__PURE__*/_jsx(Pin, {
640
- size: 10,
641
- active: true,
642
- color: macOSColors.semantic.info
643
- }) : null, saved ? /*#__PURE__*/_jsx(Bookmark, {
644
- size: 10,
645
- color: macOSColors.semantic.debug
646
- }) : null, overridden || event.override ? /*#__PURE__*/_jsx(FlaskConical, {
647
- size: 10,
648
- color: macOSColors.semantic.warning
649
- }) : null, /*#__PURE__*/_jsx(StatusIndicator, {
650
- event: event,
651
- isPending: isPending,
652
- statusColor: statusColor
653
- }), event.requestClient ? /*#__PURE__*/_jsx("span", {
654
- style: {
655
- ...styles.topRightBadge,
656
- backgroundColor: getClientChipColors(event.requestClient).backgroundColor
657
- },
658
- children: /*#__PURE__*/_jsx("span", {
659
- style: {
660
- ...styles.clientText,
661
- color: getClientChipColors(event.requestClient).color
662
- },
663
- children: event.requestClient === "graphql" ? "GQL" : event.requestClient === "grpc-web" ? "gRPC" : event.requestClient === "xhr" ? "XHR" : event.requestClient
664
- })
665
- }) : null]
666
- }), /*#__PURE__*/_jsxs("span", {
667
- style: styles.leftSection,
668
- children: [/*#__PURE__*/_jsx(MethodBadgeWeb, {
669
- method: event.method
670
- }), /*#__PURE__*/_jsx(SizeIndicators, {
671
- requestSize: event.requestSize,
672
- responseSize: event.responseSize
673
- })]
674
- }), /*#__PURE__*/_jsx("span", {
675
- style: styles.middleSection,
676
- children: /*#__PURE__*/_jsx("span", {
677
- style: styles.urlText,
678
- children: displayUrl
679
- })
680
- }), /*#__PURE__*/_jsxs("span", {
681
- style: styles.rightSection,
682
- children: [contentType ? /*#__PURE__*/_jsx(TypeBadgeWeb, {
683
- type: contentType
684
- }) : null, /*#__PURE__*/_jsx(ChevronRight, {
685
- size: 14,
686
- color: macOSColors.text.muted
687
- })]
688
- }), /*#__PURE__*/_jsx("span", {
689
- style: styles.bottomRightContainer,
690
- children: /*#__PURE__*/_jsx(BottomRightTime, {
691
- timestamp: event.timestamp,
692
- duration: event.duration
693
- })
694
- })]
695
- });
696
- });
697
- NetworkEventItemCompact.displayName = "NetworkEventItemCompact";
698
-
699
- // Values mirror the native StyleSheet block 1:1.
700
- const styles = {
701
- leftSection: {
702
- display: "flex",
703
- flexDirection: "column",
704
- marginRight: 8,
705
- alignItems: "flex-start"
706
- },
707
- topRightContainer: {
708
- position: "absolute",
709
- top: 1,
710
- right: 1,
711
- display: "flex",
712
- flexDirection: "row",
713
- alignItems: "center",
714
- gap: 4
715
- },
716
- topRightBadge: {
717
- display: "inline-flex",
718
- padding: "2px 4px",
719
- borderRadius: 4
720
- },
721
- middleSection: {
722
- flex: 1,
723
- minWidth: 0,
724
- display: "flex",
725
- flexDirection: "column",
726
- justifyContent: "center",
727
- paddingRight: 8
728
- },
729
- urlText: {
730
- fontSize: 12,
731
- color: macOSColors.text.primary,
732
- lineHeight: "16px",
733
- fontFamily: "ui-monospace, Menlo, monospace",
734
- display: "-webkit-box",
735
- WebkitLineClamp: 2,
736
- WebkitBoxOrient: "vertical",
737
- overflow: "hidden",
738
- whiteSpace: "pre-wrap",
739
- wordBreak: "break-all"
740
- },
741
- rightSection: {
742
- display: "flex",
743
- flexDirection: "row",
744
- alignItems: "center",
745
- gap: 6
746
- },
747
- bottomRightContainer: {
748
- position: "absolute",
749
- bottom: 4,
750
- right: 8
751
- },
752
- bottomRightText: {
753
- fontSize: 9,
754
- color: macOSColors.text.muted,
755
- fontFamily: "ui-monospace, Menlo, monospace",
756
- whiteSpace: "pre"
757
- },
758
- statusBadge: {
759
- display: "inline-flex",
760
- padding: "1px 4px",
761
- borderRadius: 3
762
- },
763
- statusText: {
764
- fontSize: 10,
765
- fontWeight: 600
766
- },
767
- pendingBadge: {
768
- display: "inline-flex",
769
- flexDirection: "row",
770
- alignItems: "center",
771
- gap: 2,
772
- padding: "1px 4px",
773
- backgroundColor: macOSColors.semantic.warning + "26",
774
- borderRadius: 3
775
- },
776
- pendingText: {
777
- fontSize: 10,
778
- color: macOSColors.semantic.warning,
779
- fontWeight: 600
780
- },
781
- errorBadge: {
782
- display: "inline-flex",
783
- flexDirection: "row",
784
- alignItems: "center",
785
- gap: 2,
786
- padding: "1px 4px",
787
- backgroundColor: macOSColors.semantic.error + "26",
788
- borderRadius: 3
789
- },
790
- errorText: {
791
- fontSize: 10,
792
- color: macOSColors.semantic.error,
793
- fontWeight: 600
794
- },
795
- sizeRow: {
796
- display: "flex",
797
- flexDirection: "row",
798
- gap: 4,
799
- marginTop: 4
800
- },
801
- sizeItem: {
802
- display: "inline-flex",
803
- flexDirection: "row",
804
- alignItems: "center",
805
- gap: 2
806
- },
807
- sizeText: {
808
- fontSize: 8,
809
- color: macOSColors.text.secondary,
810
- fontFamily: "ui-monospace, Menlo, monospace"
811
- },
812
- clientText: {
813
- fontSize: 8,
814
- fontWeight: 700,
815
- letterSpacing: 0.3,
816
- textTransform: "uppercase"
817
- }
818
- };
1
+ "use strict";import{memo as k,useEffect as S,useState as b,useRef as C}from"react";import{formatGraphQLDisplay as M}from"../utils/formatGraphQLVariables";import{jsx as r,jsxs as s}from"react/jsx-runtime";const n={text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93"},semantic:{success:"#34C759",error:"#FF453A",warning:"#FFEB3B",info:"#00B8E6",debug:"#BF5AF2"}};const a={card:"#1A1A1A",border:"#333333",primary:"#20C997",success:"#20C997",warning:"#FFA94D",error:"#EF4444",textSecondary:"#A0A0A0",textMuted:"#888888"};function p({size:t=14,color:e="currentColor",children:i}){return r("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:i})}const B=t=>r(p,{...t,children:r("path",{d:"m9 18 6-6-6-6"})});const z=t=>s(p,{...t,children:[r("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),r("polyline",{points:"17 8 12 3 7 8"}),r("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]});const R=t=>s(p,{...t,children:[r("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),r("polyline",{points:"7 10 12 15 17 10"}),r("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]});const D=t=>s(p,{...t,children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("polyline",{points:"12 6 12 12 16 14"})]});const I=t=>s(p,{...t,children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),r("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});const A=t=>r(p,{...t,children:r("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})});const E=t=>s(p,{...t,children:[r("path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"}),r("path",{d:"M8.5 2h7"}),r("path",{d:"M7 16h10"})]});const $=({active:t,...e})=>r(p,{...e,children:s("g",{transform:t?"rotate(-45 12 12) translate(12 12) scale(0.92) translate(-12 -12)":void 0,children:[r("path",{d:"M2.97 21.03 8.18 15.82"}),r("path",{d:"M4.4 10.81 13.19 19.6"}),r("path",{d:"M5.17 10.54 11.43 8.83"}),r("path",{d:"M13.46 18.83 15.17 12.57"}),r("rect",{x:"12.15",y:"5.4",width:"9.38",height:"3.52",rx:"1.07",transform:"rotate(-45 16.84 7.16)"})]})});function T(t){if(t===void 0||t===null)return"N/A";if(t===0)return"0 B";const e=1024;const i=["B","KB","MB","GB","TB"];const l=Math.floor(Math.log(t)/Math.log(e));return`${(t/Math.pow(e,l)).toFixed(1)} ${i[l]}`}function F(t){if(t===void 0||t===null)return"N/A";if(t<1e3){return`${t}ms`}if(t<6e4){return`${(t/1e3).toFixed(1)}s`}if(t<36e5){const l=Math.floor(t/6e4);const c=Math.floor(t%6e4/1e3);return c>0?`${l}m ${c}s`:`${l}m`}const e=Math.floor(t/36e5);const i=Math.floor(t%36e5/6e4);return i>0?`${e}h ${i}m`:`${e}h`}function P(t,e=Date.now()){const i=t instanceof Date?t.getTime():t;const l=Math.floor((e-i)/1e3);if(l<0){return"just now"}if(l<60){return l===0?"just now":`${l}s ago`}const c=Math.floor(l/60);if(c<60){return`${c}m ago`}const d=Math.floor(c/60);if(d<24){return`${d}h ago`}const u=Math.floor(d/24);return`${u}d ago`}const x=new Set;let m=null;function W(t){x.add(t);if(m==null){m=setInterval(()=>{const e=Date.now();x.forEach(i=>i(e))},5e3)}return()=>{x.delete(t);if(x.size===0&&m!=null){clearInterval(m);m=null}}}function q(){const[t,e]=b(()=>Date.now());S(()=>W(e),[]);return t}function L(t,e){if(e)return n.semantic.error;if(!t)return n.semantic.warning;if(t>=200&&t<300)return n.semantic.success;if(t>=300&&t<400)return n.semantic.info;if(t>=400)return n.semantic.error;return n.text.muted}function N(t){const e=t?.["content-type"]||t?.["Content-Type"]||"";if(e.includes("json"))return"JSON";if(e.includes("xml"))return"XML";if(e.includes("html"))return"HTML";if(e.includes("text"))return"TEXT";if(e.includes("image"))return"IMG";if(e.includes("video"))return"VIDEO";if(e.includes("audio"))return"AUDIO";if(e.includes("form"))return"FORM";return null}function w(t){switch(t){case"fetch":return{backgroundColor:"rgba(74, 144, 226, 0.15)",color:"#4A90E2"};case"graphql":return{backgroundColor:"rgba(229, 53, 171, 0.15)",color:"#E535AB"};case"grpc-web":return{backgroundColor:"rgba(16, 185, 129, 0.15)",color:"#10B981"};case"xhr":return{backgroundColor:"rgba(245, 158, 11, 0.15)",color:"#F59E0B"};default:return{backgroundColor:"rgba(147, 51, 234, 0.15)",color:"#9333EA"}}}const O={GET:a.success,POST:a.primary,PUT:a.warning,PATCH:a.textSecondary,DELETE:a.error,HEAD:a.textMuted,OPTIONS:a.primary};function j({method:t}){const e=O[t.toUpperCase()]||"#6B7280";return r("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:45,boxSizing:"border-box",padding:"2px 6px",fontSize:11,fontWeight:700,color:e,backgroundColor:`${e}15`,border:`1px solid ${e}40`,borderRadius:4},children:t.toUpperCase()})}function H({type:t}){const e=a.textMuted;return r("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 6px",fontSize:11,fontWeight:600,color:e,backgroundColor:`${e}15`,border:`1px solid ${e}40`,borderRadius:4},children:t})}function U({onPress:t,onLongPress:e,children:i,contentStyle:l}){const[c,d]=b(false);const u=C(null);const f=C(false);const h=()=>{if(u.current!=null){clearTimeout(u.current);u.current=null}};return r("div",{style:{margin:"4px 8px"},children:r("button",{type:"button",onPointerDown:()=>{d(true);if(e){f.current=false;h();u.current=setTimeout(()=>{f.current=true;e()},500)}},onPointerUp:()=>{d(false);h()},onPointerLeave:()=>{d(false);h()},onPointerCancel:()=>{d(false);h()},onClick:()=>{if(f.current){f.current=false;return}t()},style:{position:"relative",display:"flex",width:"100%",boxSizing:"border-box",backgroundColor:a.card,borderRadius:8,border:`1px solid ${a.border}40`,borderBottom:`1px solid ${a.border}40`,padding:12,minHeight:44,margin:0,textAlign:"left",cursor:"pointer",fontFamily:"inherit",color:"inherit",userSelect:"none",WebkitUserSelect:"none",opacity:c?.8:1,...l},children:i})})}function G({event:t,isPending:e,statusColor:i}){if(e){return s("span",{style:o.pendingBadge,children:[r(D,{size:10,color:n.semantic.warning}),r("span",{style:o.pendingText,children:"..."})]})}if(t.error){return s("span",{style:o.errorBadge,children:[r(I,{size:10,color:n.semantic.error}),r("span",{style:o.errorText,children:"ERR"})]})}return r("span",{style:o.statusBadge,children:r("span",{style:{...o.statusText,color:i},children:String(t.status)})})}function V({requestSize:t,responseSize:e}){if(!t&&!e)return null;return s("span",{style:o.sizeRow,children:[t?s("span",{style:o.sizeItem,children:[r(z,{size:8,color:n.semantic.info}),r("span",{style:o.sizeText,children:T(t)})]}):null,e?s("span",{style:o.sizeItem,children:[r(R,{size:8,color:n.semantic.success}),r("span",{style:o.sizeText,children:T(e)})]}):null]})}function _({timestamp:t,duration:e}){const i=q();const l=P(t,i);return e?s("span",{style:o.bottomRightText,children:[F(e)," ",l]}):r("span",{style:o.bottomRightText,children:l})}export const NetworkEventItemCompact=k(function t({event:e,onPress:i,pinned:l=false,saved:c=false,overridden:d=false,onLongPress:u}){const f=L(e.status,e.error);const h=!e.status&&!e.error;const y=N(e.responseHeaders);let g=e.path||e.url.replace(/^https?:\/\/[^/]+/,"");if(e.requestClient==="graphql"){if(e.operationName){g=M(e.operationName,e.graphqlVariables)}else{g=g.replace(/\/graphql[^?]*/,"/graphql")}}else if(e.operationName){g=`${g}
2
+ (${e.operationName})`}return s(U,{onPress:()=>i(e),onLongPress:u?()=>u(e):void 0,contentStyle:{flexDirection:"row",alignItems:"center",borderLeft:`3px solid ${f}`},children:[s("span",{style:o.topRightContainer,children:[l?r($,{size:10,active:true,color:n.semantic.info}):null,c?r(A,{size:10,color:n.semantic.debug}):null,d||e.override?r(E,{size:10,color:n.semantic.warning}):null,r(G,{event:e,isPending:h,statusColor:f}),e.requestClient?r("span",{style:{...o.topRightBadge,backgroundColor:w(e.requestClient).backgroundColor},children:r("span",{style:{...o.clientText,color:w(e.requestClient).color},children:e.requestClient==="graphql"?"GQL":e.requestClient==="grpc-web"?"gRPC":e.requestClient==="xhr"?"XHR":e.requestClient})}):null]}),s("span",{style:o.leftSection,children:[r(j,{method:e.method}),r(V,{requestSize:e.requestSize,responseSize:e.responseSize})]}),r("span",{style:o.middleSection,children:r("span",{style:o.urlText,children:g})}),s("span",{style:o.rightSection,children:[y?r(H,{type:y}):null,r(B,{size:14,color:n.text.muted})]}),r("span",{style:o.bottomRightContainer,children:r(_,{timestamp:e.timestamp,duration:e.duration})})]})});NetworkEventItemCompact.displayName="NetworkEventItemCompact";const o={leftSection:{display:"flex",flexDirection:"column",marginRight:8,alignItems:"flex-start"},topRightContainer:{position:"absolute",top:1,right:1,display:"flex",flexDirection:"row",alignItems:"center",gap:4},topRightBadge:{display:"inline-flex",padding:"2px 4px",borderRadius:4},middleSection:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",paddingRight:8},urlText:{fontSize:12,color:n.text.primary,lineHeight:"16px",fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap",wordBreak:"break-all"},rightSection:{display:"flex",flexDirection:"row",alignItems:"center",gap:6},bottomRightContainer:{position:"absolute",bottom:4,right:8},bottomRightText:{fontSize:9,color:n.text.muted,fontFamily:"ui-monospace, Menlo, monospace",whiteSpace:"pre"},statusBadge:{display:"inline-flex",padding:"1px 4px",borderRadius:3},statusText:{fontSize:10,fontWeight:600},pendingBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.semantic.warning+"26",borderRadius:3},pendingText:{fontSize:10,color:n.semantic.warning,fontWeight:600},errorBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:n.semantic.error+"26",borderRadius:3},errorText:{fontSize:10,color:n.semantic.error,fontWeight:600},sizeRow:{display:"flex",flexDirection:"row",gap:4,marginTop:4},sizeItem:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2},sizeText:{fontSize:8,color:n.text.secondary,fontFamily:"ui-monospace, Menlo, monospace"},clientText:{fontSize:8,fontWeight:700,letterSpacing:.3,textTransform:"uppercase"}};