@buoy-gg/events 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 (123) hide show
  1. package/README.md +11 -64
  2. package/lib/commonjs/components/EventsCopySettingsView.js +1 -581
  3. package/lib/commonjs/components/EventsModal.js +1 -378
  4. package/lib/commonjs/components/ReactQueryEventDetail.js +1 -433
  5. package/lib/commonjs/components/UnifiedEventDetail.js +1 -565
  6. package/lib/commonjs/components/UnifiedEventFilters.js +1 -160
  7. package/lib/commonjs/components/UnifiedEventItem.js +1 -416
  8. package/lib/commonjs/components/UnifiedEventList.js +1 -187
  9. package/lib/commonjs/components/UnifiedEventViewer.js +1 -130
  10. package/lib/commonjs/hooks/useUnifiedEvents.js +1 -419
  11. package/lib/commonjs/index.js +1 -282
  12. package/lib/commonjs/preset.js +1 -60
  13. package/lib/commonjs/sources/sourceIds.js +1 -30
  14. package/lib/commonjs/stores/unifiedEventStore.js +1 -712
  15. package/lib/commonjs/sync/eventsSyncAdapter.js +1 -358
  16. package/lib/commonjs/types/copySettings.js +1 -249
  17. package/lib/commonjs/types/index.js +1 -17
  18. package/lib/commonjs/utils/autoDiscoverEventSources.js +1 -1068
  19. package/lib/commonjs/utils/badgeSelectionStorage.js +1 -126
  20. package/lib/commonjs/utils/copySettingsStorage.js +1 -43
  21. package/lib/commonjs/utils/correlationUtils.js +1 -130
  22. package/lib/commonjs/utils/eventExportFormatter.js +1 -1912
  23. package/lib/commonjs/utils/eventTransformers.js +1 -496
  24. package/lib/commonjs/utils/eventVisibility.js +1 -76
  25. package/lib/commonjs/utils/testIDs.js +1 -91
  26. package/lib/module/components/EventsCopySettingsView.js +1 -577
  27. package/lib/module/components/EventsModal.js +1 -374
  28. package/lib/module/components/ReactQueryEventDetail.js +1 -429
  29. package/lib/module/components/UnifiedEventDetail.js +1 -561
  30. package/lib/module/components/UnifiedEventFilters.js +1 -156
  31. package/lib/module/components/UnifiedEventItem.js +1 -412
  32. package/lib/module/components/UnifiedEventList.js +1 -183
  33. package/lib/module/components/UnifiedEventViewer.js +1 -126
  34. package/lib/module/hooks/useUnifiedEvents.js +1 -416
  35. package/lib/module/index.js +1 -102
  36. package/lib/module/preset.js +1 -57
  37. package/lib/module/sources/sourceIds.js +1 -26
  38. package/lib/module/stores/unifiedEventStore.js +1 -678
  39. package/lib/module/sync/eventsSyncAdapter.js +1 -354
  40. package/lib/module/types/copySettings.js +1 -244
  41. package/lib/module/types/index.js +1 -37
  42. package/lib/module/utils/autoDiscoverEventSources.js +1 -1060
  43. package/lib/module/utils/badgeSelectionStorage.js +1 -116
  44. package/lib/module/utils/copySettingsStorage.js +1 -37
  45. package/lib/module/utils/correlationUtils.js +1 -120
  46. package/lib/module/utils/eventExportFormatter.js +1 -1901
  47. package/lib/module/utils/eventTransformers.js +1 -487
  48. package/lib/module/utils/eventVisibility.js +1 -70
  49. package/lib/module/utils/testIDs.js +1 -83
  50. package/lib/web/index.mjs +9 -10
  51. package/package.json +4 -7
  52. package/lib/commonjs/components/EventsCopySettingsView.js.map +0 -1
  53. package/lib/commonjs/components/EventsModal.js.map +0 -1
  54. package/lib/commonjs/components/ReactQueryEventDetail.js.map +0 -1
  55. package/lib/commonjs/components/UnifiedEventDetail.js.map +0 -1
  56. package/lib/commonjs/components/UnifiedEventFilters.js.map +0 -1
  57. package/lib/commonjs/components/UnifiedEventItem.js.map +0 -1
  58. package/lib/commonjs/components/UnifiedEventList.js.map +0 -1
  59. package/lib/commonjs/components/UnifiedEventViewer.js.map +0 -1
  60. package/lib/commonjs/hooks/useUnifiedEvents.js.map +0 -1
  61. package/lib/commonjs/index.js.map +0 -1
  62. package/lib/commonjs/preset.js.map +0 -1
  63. package/lib/commonjs/sources/sourceIds.js.map +0 -1
  64. package/lib/commonjs/stores/unifiedEventStore.js.map +0 -1
  65. package/lib/commonjs/sync/eventsSyncAdapter.js.map +0 -1
  66. package/lib/commonjs/types/copySettings.js.map +0 -1
  67. package/lib/commonjs/types/index.js.map +0 -1
  68. package/lib/commonjs/utils/autoDiscoverEventSources.js.map +0 -1
  69. package/lib/commonjs/utils/badgeSelectionStorage.js.map +0 -1
  70. package/lib/commonjs/utils/copySettingsStorage.js.map +0 -1
  71. package/lib/commonjs/utils/correlationUtils.js.map +0 -1
  72. package/lib/commonjs/utils/eventExportFormatter.js.map +0 -1
  73. package/lib/commonjs/utils/eventTransformers.js.map +0 -1
  74. package/lib/commonjs/utils/eventVisibility.js.map +0 -1
  75. package/lib/commonjs/utils/testIDs.js.map +0 -1
  76. package/lib/module/components/EventsCopySettingsView.js.map +0 -1
  77. package/lib/module/components/EventsModal.js.map +0 -1
  78. package/lib/module/components/ReactQueryEventDetail.js.map +0 -1
  79. package/lib/module/components/UnifiedEventDetail.js.map +0 -1
  80. package/lib/module/components/UnifiedEventFilters.js.map +0 -1
  81. package/lib/module/components/UnifiedEventItem.js.map +0 -1
  82. package/lib/module/components/UnifiedEventList.js.map +0 -1
  83. package/lib/module/components/UnifiedEventViewer.js.map +0 -1
  84. package/lib/module/hooks/useUnifiedEvents.js.map +0 -1
  85. package/lib/module/index.js.map +0 -1
  86. package/lib/module/preset.js.map +0 -1
  87. package/lib/module/sources/sourceIds.js.map +0 -1
  88. package/lib/module/stores/unifiedEventStore.js.map +0 -1
  89. package/lib/module/sync/eventsSyncAdapter.js.map +0 -1
  90. package/lib/module/types/copySettings.js.map +0 -1
  91. package/lib/module/types/index.js.map +0 -1
  92. package/lib/module/utils/autoDiscoverEventSources.js.map +0 -1
  93. package/lib/module/utils/badgeSelectionStorage.js.map +0 -1
  94. package/lib/module/utils/copySettingsStorage.js.map +0 -1
  95. package/lib/module/utils/correlationUtils.js.map +0 -1
  96. package/lib/module/utils/eventExportFormatter.js.map +0 -1
  97. package/lib/module/utils/eventTransformers.js.map +0 -1
  98. package/lib/module/utils/eventVisibility.js.map +0 -1
  99. package/lib/module/utils/testIDs.js.map +0 -1
  100. package/lib/typescript/components/EventsCopySettingsView.d.ts.map +0 -1
  101. package/lib/typescript/components/EventsModal.d.ts.map +0 -1
  102. package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +0 -1
  103. package/lib/typescript/components/UnifiedEventDetail.d.ts.map +0 -1
  104. package/lib/typescript/components/UnifiedEventFilters.d.ts.map +0 -1
  105. package/lib/typescript/components/UnifiedEventItem.d.ts.map +0 -1
  106. package/lib/typescript/components/UnifiedEventList.d.ts.map +0 -1
  107. package/lib/typescript/components/UnifiedEventViewer.d.ts.map +0 -1
  108. package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +0 -1
  109. package/lib/typescript/index.d.ts.map +0 -1
  110. package/lib/typescript/preset.d.ts.map +0 -1
  111. package/lib/typescript/sources/sourceIds.d.ts.map +0 -1
  112. package/lib/typescript/stores/unifiedEventStore.d.ts.map +0 -1
  113. package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +0 -1
  114. package/lib/typescript/types/copySettings.d.ts.map +0 -1
  115. package/lib/typescript/types/index.d.ts.map +0 -1
  116. package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +0 -1
  117. package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +0 -1
  118. package/lib/typescript/utils/copySettingsStorage.d.ts.map +0 -1
  119. package/lib/typescript/utils/correlationUtils.d.ts.map +0 -1
  120. package/lib/typescript/utils/eventExportFormatter.d.ts.map +0 -1
  121. package/lib/typescript/utils/eventTransformers.d.ts.map +0 -1
  122. package/lib/typescript/utils/eventVisibility.d.ts.map +0 -1
  123. package/lib/typescript/utils/testIDs.d.ts.map +0 -1
@@ -1,429 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * ReactQueryEventDetail
5
- *
6
- * Detail view for React Query events in the Events DevTools.
7
- * Styled similarly to the React Query DevTools detail view.
8
- *
9
- * Uses local type definitions to avoid hard dependency on @buoy-gg/react-query.
10
- */
11
-
12
- import { memo, useMemo } from "react";
13
- import { View, Text, StyleSheet, ScrollView } from "react-native";
14
- import { buoyColors, night, displayValue, monoFont } from "@buoy-gg/shared-ui";
15
- import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
16
-
17
- /**
18
- * Extended React Query event with additional data fields
19
- */
20
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
- /**
22
- * Event type display configuration
23
- */
24
- const EVENT_TYPE_CONFIG = {
25
- "query-fetch-start": {
26
- label: "Query Fetching",
27
- color: night.color.accent,
28
- icon: "hourglass"
29
- },
30
- "query-fetch-success": {
31
- label: "Query Success",
32
- color: buoyColors.success,
33
- icon: "checkmark"
34
- },
35
- "query-fetch-error": {
36
- label: "Query Error",
37
- color: buoyColors.error,
38
- icon: "close"
39
- },
40
- "query-invalidated": {
41
- label: "Query Invalidated",
42
- color: buoyColors.warning,
43
- icon: "refresh"
44
- },
45
- "mutation-start": {
46
- label: "Mutation Started",
47
- color: night.color.accent,
48
- icon: "hourglass"
49
- },
50
- "mutation-success": {
51
- label: "Mutation Success",
52
- color: buoyColors.success,
53
- icon: "checkmark"
54
- },
55
- "mutation-error": {
56
- label: "Mutation Error",
57
- color: buoyColors.error,
58
- icon: "close"
59
- }
60
- };
61
- export const ReactQueryEventDetail = /*#__PURE__*/memo(function ReactQueryEventDetail({
62
- event
63
- }) {
64
- const reactQueryEvent = event.originalEvent;
65
- const eventConfig = EVENT_TYPE_CONFIG[reactQueryEvent.type] || {
66
- label: reactQueryEvent.type,
67
- color: night.color.textTertiary,
68
- icon: "help"
69
- };
70
- const isQuery = reactQueryEvent.type.startsWith("query-");
71
- const isMutation = reactQueryEvent.type.startsWith("mutation-");
72
-
73
- // Format query/mutation key for display
74
- const keyDisplay = useMemo(() => {
75
- const key = isQuery ? reactQueryEvent.queryKey : reactQueryEvent.mutationKey;
76
- if (!key) {
77
- // For mutations without a key, show the mutation ID
78
- if (isMutation && reactQueryEvent.mutationId !== undefined) {
79
- return `Mutation #${reactQueryEvent.mutationId}`;
80
- }
81
- return "No key";
82
- }
83
- return displayValue(key, true);
84
- }, [reactQueryEvent, isQuery, isMutation]);
85
-
86
- // Format timestamp
87
- const timestamp = new Date(reactQueryEvent.timestamp);
88
- const timeString = timestamp.toLocaleTimeString("en-US", {
89
- hour: "2-digit",
90
- minute: "2-digit",
91
- second: "2-digit",
92
- hour12: true
93
- });
94
-
95
- // Determine what data to show
96
- const hasData = isQuery ? !!reactQueryEvent.queryData : !!reactQueryEvent.mutationData;
97
- const hasError = isQuery ? !!reactQueryEvent.queryError : !!reactQueryEvent.mutationError;
98
- const hasVariables = isMutation && !!reactQueryEvent.mutationVariables;
99
- return /*#__PURE__*/_jsxs(ScrollView, {
100
- style: styles.container,
101
- contentContainerStyle: styles.contentContainer,
102
- children: [/*#__PURE__*/_jsx(View, {
103
- style: styles.section,
104
- children: /*#__PURE__*/_jsxs(View, {
105
- style: [styles.eventTypeContainer, {
106
- borderColor: eventConfig.color + "4D"
107
- }],
108
- children: [/*#__PURE__*/_jsx(Text, {
109
- style: [styles.eventTypeHeader, {
110
- backgroundColor: eventConfig.color + "15",
111
- color: eventConfig.color
112
- }],
113
- children: eventConfig.label
114
- }), /*#__PURE__*/_jsxs(View, {
115
- style: styles.eventTypeContent,
116
- children: [/*#__PURE__*/_jsxs(View, {
117
- style: styles.keyRow,
118
- children: [/*#__PURE__*/_jsx(ScrollView, {
119
- horizontal: true,
120
- style: styles.keyScrollView,
121
- children: /*#__PURE__*/_jsx(Text, {
122
- style: styles.keyText,
123
- children: keyDisplay
124
- })
125
- }), /*#__PURE__*/_jsx(EventStatusChip, {
126
- type: reactQueryEvent.type,
127
- color: eventConfig.color
128
- })]
129
- }), reactQueryEvent.duration !== undefined && /*#__PURE__*/_jsxs(View, {
130
- style: styles.row,
131
- children: [/*#__PURE__*/_jsx(Text, {
132
- style: styles.labelText,
133
- children: "Duration:"
134
- }), /*#__PURE__*/_jsxs(Text, {
135
- style: styles.valueText,
136
- children: [reactQueryEvent.duration.toFixed(0), "ms"]
137
- })]
138
- }), /*#__PURE__*/_jsxs(View, {
139
- style: styles.row,
140
- children: [/*#__PURE__*/_jsx(Text, {
141
- style: styles.labelText,
142
- children: "Timestamp:"
143
- }), /*#__PURE__*/_jsx(Text, {
144
- style: styles.valueText,
145
- children: timeString
146
- })]
147
- }), isQuery && reactQueryEvent.queryHash && /*#__PURE__*/_jsxs(View, {
148
- style: styles.row,
149
- children: [/*#__PURE__*/_jsx(Text, {
150
- style: styles.labelText,
151
- children: "Query Hash:"
152
- }), /*#__PURE__*/_jsx(Text, {
153
- style: [styles.valueText, styles.hashText],
154
- numberOfLines: 1,
155
- children: reactQueryEvent.queryHash
156
- })]
157
- }), isMutation && reactQueryEvent.mutationId !== undefined && /*#__PURE__*/_jsxs(View, {
158
- style: styles.row,
159
- children: [/*#__PURE__*/_jsx(Text, {
160
- style: styles.labelText,
161
- children: "Mutation ID:"
162
- }), /*#__PURE__*/_jsxs(Text, {
163
- style: styles.valueText,
164
- children: ["#", reactQueryEvent.mutationId]
165
- })]
166
- })]
167
- })]
168
- })
169
- }), hasVariables && /*#__PURE__*/_jsx(View, {
170
- style: styles.section,
171
- children: /*#__PURE__*/_jsxs(View, {
172
- style: styles.dataContainer,
173
- children: [/*#__PURE__*/_jsx(Text, {
174
- style: [styles.dataHeader, {
175
- color: buoyColors.warning
176
- }],
177
- children: "Variables"
178
- }), /*#__PURE__*/_jsx(View, {
179
- style: styles.dataContent,
180
- children: /*#__PURE__*/_jsx(DataViewer, {
181
- title: "",
182
- data: reactQueryEvent.mutationVariables,
183
- showTypeFilter: true,
184
- rawMode: true,
185
- initialExpanded: true
186
- })
187
- })]
188
- })
189
- }), hasData && /*#__PURE__*/_jsx(View, {
190
- style: styles.section,
191
- children: /*#__PURE__*/_jsxs(View, {
192
- style: styles.dataContainer,
193
- children: [/*#__PURE__*/_jsx(Text, {
194
- style: [styles.dataHeader, {
195
- color: buoyColors.success
196
- }],
197
- children: isQuery ? "Query Data" : "Mutation Result"
198
- }), /*#__PURE__*/_jsx(View, {
199
- style: styles.dataContent,
200
- children: /*#__PURE__*/_jsx(DataViewer, {
201
- title: "",
202
- data: isQuery ? reactQueryEvent.queryData : reactQueryEvent.mutationData,
203
- showTypeFilter: true,
204
- rawMode: true,
205
- initialExpanded: true
206
- })
207
- })]
208
- })
209
- }), hasError && /*#__PURE__*/_jsx(View, {
210
- style: styles.section,
211
- children: /*#__PURE__*/_jsxs(View, {
212
- style: [styles.dataContainer, styles.errorContainer],
213
- children: [/*#__PURE__*/_jsx(Text, {
214
- style: [styles.dataHeader, styles.errorHeader],
215
- children: "Error"
216
- }), /*#__PURE__*/_jsx(View, {
217
- style: styles.dataContent,
218
- children: /*#__PURE__*/_jsx(DataViewer, {
219
- title: "",
220
- data: isQuery ? reactQueryEvent.queryError : reactQueryEvent.mutationError,
221
- showTypeFilter: true,
222
- rawMode: true,
223
- initialExpanded: true
224
- })
225
- })]
226
- })
227
- }), /*#__PURE__*/_jsx(View, {
228
- style: styles.section,
229
- children: /*#__PURE__*/_jsxs(View, {
230
- style: styles.dataContainer,
231
- children: [/*#__PURE__*/_jsx(Text, {
232
- style: styles.dataHeader,
233
- children: "Event Details"
234
- }), /*#__PURE__*/_jsx(View, {
235
- style: styles.dataContent,
236
- children: /*#__PURE__*/_jsx(DataViewer, {
237
- title: "",
238
- data: reactQueryEvent,
239
- showTypeFilter: true,
240
- rawMode: true,
241
- initialExpanded: false
242
- })
243
- })]
244
- })
245
- })]
246
- });
247
- });
248
-
249
- /**
250
- * Status chip component for event type
251
- */
252
- function EventStatusChip({
253
- type,
254
- color
255
- }) {
256
- const getStatusLabel = () => {
257
- if (type.includes("start")) return "PENDING";
258
- if (type.includes("success")) return "SUCCESS";
259
- if (type.includes("error")) return "ERROR";
260
- if (type.includes("invalidated")) return "INVALIDATED";
261
- return type.toUpperCase();
262
- };
263
- return /*#__PURE__*/_jsx(View, {
264
- style: [styles.statusChip, {
265
- backgroundColor: color + "15",
266
- borderColor: color + "33"
267
- }],
268
- children: /*#__PURE__*/_jsx(Text, {
269
- style: [styles.statusChipText, {
270
- color
271
- }],
272
- children: getStatusLabel()
273
- })
274
- });
275
- }
276
- const styles = StyleSheet.create({
277
- container: {
278
- flex: 1,
279
- // Transparent so the night sheet's star field shows through.
280
- backgroundColor: "transparent"
281
- },
282
- contentContainer: {
283
- padding: 8,
284
- paddingBottom: 24
285
- },
286
- section: {
287
- marginBottom: 12
288
- },
289
- // Event type container (like QueryDetails)
290
- eventTypeContainer: {
291
- minWidth: 200,
292
- backgroundColor: night.color.surface,
293
- borderRadius: 6,
294
- borderWidth: 1,
295
- overflow: "hidden",
296
- shadowColor: night.color.accent,
297
- shadowOffset: {
298
- width: 0,
299
- height: 0
300
- },
301
- shadowOpacity: 0.1,
302
- shadowRadius: 6
303
- },
304
- eventTypeHeader: {
305
- paddingHorizontal: 12,
306
- paddingVertical: 10,
307
- fontWeight: "600",
308
- fontSize: 12,
309
- borderBottomWidth: 1,
310
- borderBottomColor: night.color.accentBorder,
311
- letterSpacing: 0.5,
312
- textTransform: "uppercase",
313
- fontFamily: monoFont
314
- },
315
- eventTypeContent: {
316
- padding: 0
317
- },
318
- keyRow: {
319
- flexDirection: "row",
320
- justifyContent: "space-between",
321
- alignItems: "center",
322
- paddingHorizontal: 12,
323
- paddingVertical: 10,
324
- borderBottomWidth: 1,
325
- borderBottomColor: night.color.separator
326
- },
327
- keyScrollView: {
328
- flex: 1,
329
- marginRight: 8
330
- },
331
- keyText: {
332
- fontSize: 12,
333
- color: night.color.text,
334
- fontFamily: monoFont,
335
- lineHeight: 18,
336
- backgroundColor: night.color.accentSoft,
337
- paddingHorizontal: 8,
338
- paddingVertical: 4,
339
- borderRadius: 4,
340
- borderWidth: 1,
341
- borderColor: night.color.accentBorderStrong
342
- },
343
- row: {
344
- flexDirection: "row",
345
- justifyContent: "space-between",
346
- alignItems: "center",
347
- paddingHorizontal: 12,
348
- paddingVertical: 10,
349
- borderBottomWidth: 1,
350
- borderBottomColor: night.color.separator
351
- },
352
- labelText: {
353
- fontSize: 10,
354
- color: night.color.textSecondary,
355
- fontWeight: "600",
356
- letterSpacing: 0.5,
357
- textTransform: "uppercase",
358
- fontFamily: monoFont
359
- },
360
- valueText: {
361
- fontSize: 12,
362
- color: night.color.text,
363
- fontWeight: "500",
364
- fontVariant: ["tabular-nums"],
365
- fontFamily: monoFont
366
- },
367
- hashText: {
368
- flex: 1,
369
- textAlign: "right",
370
- marginLeft: 8
371
- },
372
- // Status chip
373
- statusChip: {
374
- paddingHorizontal: 8,
375
- paddingVertical: 4,
376
- borderWidth: 1,
377
- borderRadius: 6,
378
- alignSelf: "flex-start"
379
- },
380
- statusChipText: {
381
- fontSize: 11,
382
- fontWeight: "600",
383
- textTransform: "uppercase",
384
- letterSpacing: 0.5,
385
- fontFamily: monoFont
386
- },
387
- // Data containers
388
- dataContainer: {
389
- minWidth: 200,
390
- backgroundColor: night.color.surface,
391
- borderRadius: 6,
392
- borderWidth: 1,
393
- borderColor: night.color.accentBorderStrong,
394
- overflow: "hidden",
395
- shadowColor: night.color.accent,
396
- shadowOffset: {
397
- width: 0,
398
- height: 0
399
- },
400
- shadowOpacity: 0.1,
401
- shadowRadius: 6
402
- },
403
- dataHeader: {
404
- backgroundColor: night.color.accentSoft,
405
- paddingHorizontal: 12,
406
- paddingVertical: 10,
407
- fontWeight: "600",
408
- fontSize: 12,
409
- color: night.color.accent,
410
- borderBottomWidth: 1,
411
- borderBottomColor: night.color.accentBorder,
412
- letterSpacing: 0.5,
413
- textTransform: "uppercase",
414
- fontFamily: monoFont
415
- },
416
- dataContent: {
417
- padding: 8
418
- },
419
- // Error container
420
- errorContainer: {
421
- borderColor: buoyColors.error + "4D"
422
- },
423
- errorHeader: {
424
- backgroundColor: buoyColors.error + "1A",
425
- color: buoyColors.error,
426
- borderBottomColor: buoyColors.error + "33"
427
- }
428
- });
429
- //# sourceMappingURL=ReactQueryEventDetail.js.map
1
+ "use strict";import{memo as S,useMemo as E}from"react";import{View as o,Text as a,StyleSheet as v,ScrollView as f}from"react-native";import{buoyColors as l,night as n,displayValue as k,monoFont as s}from"@buoy-gg/shared-ui";import{DataViewer as m}from"@buoy-gg/shared-ui/dataViewer";import{jsx as r,jsxs as i}from"react/jsx-runtime";const D={"query-fetch-start":{label:"Query Fetching",color:n.color.accent,icon:"hourglass"},"query-fetch-success":{label:"Query Success",color:l.success,icon:"checkmark"},"query-fetch-error":{label:"Query Error",color:l.error,icon:"close"},"query-invalidated":{label:"Query Invalidated",color:l.warning,icon:"refresh"},"mutation-start":{label:"Mutation Started",color:n.color.accent,icon:"hourglass"},"mutation-success":{label:"Mutation Success",color:l.success,icon:"checkmark"},"mutation-error":{label:"Mutation Error",color:l.error,icon:"close"}};export const ReactQueryEventDetail=S(function d({event:u}){const t=u.originalEvent;const h=D[t.type]||{label:t.type,color:n.color.textTertiary,icon:"help"};const c=t.type.startsWith("query-");const y=t.type.startsWith("mutation-");const g=E(()=>{const p=c?t.queryKey:t.mutationKey;if(!p){if(y&&t.mutationId!==void 0){return`Mutation #${t.mutationId}`}return"No key"}return k(p,true)},[t,c,y]);const b=new Date(t.timestamp);const C=b.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:true});const x=c?!!t.queryData:!!t.mutationData;const w=c?!!t.queryError:!!t.mutationError;const T=y&&!!t.mutationVariables;return i(f,{style:e.container,contentContainerStyle:e.contentContainer,children:[r(o,{style:e.section,children:i(o,{style:[e.eventTypeContainer,{borderColor:h.color+"4D"}],children:[r(a,{style:[e.eventTypeHeader,{backgroundColor:h.color+"15",color:h.color}],children:h.label}),i(o,{style:e.eventTypeContent,children:[i(o,{style:e.keyRow,children:[r(f,{horizontal:true,style:e.keyScrollView,children:r(a,{style:e.keyText,children:g})}),r(H,{type:t.type,color:h.color})]}),t.duration!==void 0&&i(o,{style:e.row,children:[r(a,{style:e.labelText,children:"Duration:"}),i(a,{style:e.valueText,children:[t.duration.toFixed(0),"ms"]})]}),i(o,{style:e.row,children:[r(a,{style:e.labelText,children:"Timestamp:"}),r(a,{style:e.valueText,children:C})]}),c&&t.queryHash&&i(o,{style:e.row,children:[r(a,{style:e.labelText,children:"Query Hash:"}),r(a,{style:[e.valueText,e.hashText],numberOfLines:1,children:t.queryHash})]}),y&&t.mutationId!==void 0&&i(o,{style:e.row,children:[r(a,{style:e.labelText,children:"Mutation ID:"}),i(a,{style:e.valueText,children:["#",t.mutationId]})]})]})]})}),T&&r(o,{style:e.section,children:i(o,{style:e.dataContainer,children:[r(a,{style:[e.dataHeader,{color:l.warning}],children:"Variables"}),r(o,{style:e.dataContent,children:r(m,{title:"",data:t.mutationVariables,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),x&&r(o,{style:e.section,children:i(o,{style:e.dataContainer,children:[r(a,{style:[e.dataHeader,{color:l.success}],children:c?"Query Data":"Mutation Result"}),r(o,{style:e.dataContent,children:r(m,{title:"",data:c?t.queryData:t.mutationData,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),w&&r(o,{style:e.section,children:i(o,{style:[e.dataContainer,e.errorContainer],children:[r(a,{style:[e.dataHeader,e.errorHeader],children:"Error"}),r(o,{style:e.dataContent,children:r(m,{title:"",data:c?t.queryError:t.mutationError,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})}),r(o,{style:e.section,children:i(o,{style:e.dataContainer,children:[r(a,{style:e.dataHeader,children:"Event Details"}),r(o,{style:e.dataContent,children:r(m,{title:"",data:t,showTypeFilter:true,rawMode:true,initialExpanded:false})})]})})]})});function H({type:d,color:u}){const t=()=>{if(d.includes("start"))return"PENDING";if(d.includes("success"))return"SUCCESS";if(d.includes("error"))return"ERROR";if(d.includes("invalidated"))return"INVALIDATED";return d.toUpperCase()};return r(o,{style:[e.statusChip,{backgroundColor:u+"15",borderColor:u+"33"}],children:r(a,{style:[e.statusChipText,{color:u}],children:t()})})}const e=v.create({container:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},section:{marginBottom:12},eventTypeContainer:{minWidth:200,backgroundColor:n.color.surface,borderRadius:6,borderWidth:1,overflow:"hidden",shadowColor:n.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},eventTypeHeader:{paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,borderBottomWidth:1,borderBottomColor:n.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:s},eventTypeContent:{padding:0},keyRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:n.color.separator},keyScrollView:{flex:1,marginRight:8},keyText:{fontSize:12,color:n.color.text,fontFamily:s,lineHeight:18,backgroundColor:n.color.accentSoft,paddingHorizontal:8,paddingVertical:4,borderRadius:4,borderWidth:1,borderColor:n.color.accentBorderStrong},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:n.color.separator},labelText:{fontSize:10,color:n.color.textSecondary,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:s},valueText:{fontSize:12,color:n.color.text,fontWeight:"500",fontVariant:["tabular-nums"],fontFamily:s},hashText:{flex:1,textAlign:"right",marginLeft:8},statusChip:{paddingHorizontal:8,paddingVertical:4,borderWidth:1,borderRadius:6,alignSelf:"flex-start"},statusChipText:{fontSize:11,fontWeight:"600",textTransform:"uppercase",letterSpacing:.5,fontFamily:s},dataContainer:{minWidth:200,backgroundColor:n.color.surface,borderRadius:6,borderWidth:1,borderColor:n.color.accentBorderStrong,overflow:"hidden",shadowColor:n.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:n.color.accentSoft,paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:n.color.accent,borderBottomWidth:1,borderBottomColor:n.color.accentBorder,letterSpacing:.5,textTransform:"uppercase",fontFamily:s},dataContent:{padding:8},errorContainer:{borderColor:l.error+"4D"},errorHeader:{backgroundColor:l.error+"1A",color:l.error,borderBottomColor:l.error+"33"}});