@buoy-gg/network 7.0.14 → 7.0.16

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