@buoy-gg/events 7.0.41 → 7.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -64
- package/lib/commonjs/components/EventsCopySettingsView.js +1 -581
- package/lib/commonjs/components/EventsModal.js +1 -378
- package/lib/commonjs/components/ReactQueryEventDetail.js +1 -433
- package/lib/commonjs/components/UnifiedEventDetail.js +1 -565
- package/lib/commonjs/components/UnifiedEventFilters.js +1 -160
- package/lib/commonjs/components/UnifiedEventItem.js +1 -416
- package/lib/commonjs/components/UnifiedEventList.js +1 -187
- package/lib/commonjs/components/UnifiedEventViewer.js +1 -130
- package/lib/commonjs/hooks/useUnifiedEvents.js +1 -419
- package/lib/commonjs/index.js +1 -282
- package/lib/commonjs/preset.js +1 -60
- package/lib/commonjs/sources/sourceIds.js +1 -30
- package/lib/commonjs/stores/unifiedEventStore.js +1 -712
- package/lib/commonjs/sync/eventsSyncAdapter.js +1 -358
- package/lib/commonjs/types/copySettings.js +1 -249
- package/lib/commonjs/types/index.js +1 -17
- package/lib/commonjs/utils/autoDiscoverEventSources.js +1 -1068
- package/lib/commonjs/utils/badgeSelectionStorage.js +1 -126
- package/lib/commonjs/utils/copySettingsStorage.js +1 -43
- package/lib/commonjs/utils/correlationUtils.js +1 -130
- package/lib/commonjs/utils/eventExportFormatter.js +1 -1912
- package/lib/commonjs/utils/eventTransformers.js +1 -496
- package/lib/commonjs/utils/eventVisibility.js +1 -76
- package/lib/commonjs/utils/testIDs.js +1 -91
- package/lib/module/components/EventsCopySettingsView.js +1 -577
- package/lib/module/components/EventsModal.js +1 -374
- package/lib/module/components/ReactQueryEventDetail.js +1 -429
- package/lib/module/components/UnifiedEventDetail.js +1 -561
- package/lib/module/components/UnifiedEventFilters.js +1 -156
- package/lib/module/components/UnifiedEventItem.js +1 -412
- package/lib/module/components/UnifiedEventList.js +1 -183
- package/lib/module/components/UnifiedEventViewer.js +1 -126
- package/lib/module/hooks/useUnifiedEvents.js +1 -416
- package/lib/module/index.js +1 -102
- package/lib/module/preset.js +1 -57
- package/lib/module/sources/sourceIds.js +1 -26
- package/lib/module/stores/unifiedEventStore.js +1 -678
- package/lib/module/sync/eventsSyncAdapter.js +1 -354
- package/lib/module/types/copySettings.js +1 -244
- package/lib/module/types/index.js +1 -37
- package/lib/module/utils/autoDiscoverEventSources.js +1 -1060
- package/lib/module/utils/badgeSelectionStorage.js +1 -116
- package/lib/module/utils/copySettingsStorage.js +1 -37
- package/lib/module/utils/correlationUtils.js +1 -120
- package/lib/module/utils/eventExportFormatter.js +1 -1901
- package/lib/module/utils/eventTransformers.js +1 -487
- package/lib/module/utils/eventVisibility.js +1 -70
- package/lib/module/utils/testIDs.js +1 -83
- package/lib/web/index.mjs +9 -10
- package/package.json +3 -3
- package/lib/commonjs/components/EventsCopySettingsView.js.map +0 -1
- package/lib/commonjs/components/EventsModal.js.map +0 -1
- package/lib/commonjs/components/ReactQueryEventDetail.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventDetail.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventFilters.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventItem.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventList.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventViewer.js.map +0 -1
- package/lib/commonjs/hooks/useUnifiedEvents.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/sources/sourceIds.js.map +0 -1
- package/lib/commonjs/stores/unifiedEventStore.js.map +0 -1
- package/lib/commonjs/sync/eventsSyncAdapter.js.map +0 -1
- package/lib/commonjs/types/copySettings.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/utils/autoDiscoverEventSources.js.map +0 -1
- package/lib/commonjs/utils/badgeSelectionStorage.js.map +0 -1
- package/lib/commonjs/utils/copySettingsStorage.js.map +0 -1
- package/lib/commonjs/utils/correlationUtils.js.map +0 -1
- package/lib/commonjs/utils/eventExportFormatter.js.map +0 -1
- package/lib/commonjs/utils/eventTransformers.js.map +0 -1
- package/lib/commonjs/utils/eventVisibility.js.map +0 -1
- package/lib/commonjs/utils/testIDs.js.map +0 -1
- package/lib/module/components/EventsCopySettingsView.js.map +0 -1
- package/lib/module/components/EventsModal.js.map +0 -1
- package/lib/module/components/ReactQueryEventDetail.js.map +0 -1
- package/lib/module/components/UnifiedEventDetail.js.map +0 -1
- package/lib/module/components/UnifiedEventFilters.js.map +0 -1
- package/lib/module/components/UnifiedEventItem.js.map +0 -1
- package/lib/module/components/UnifiedEventList.js.map +0 -1
- package/lib/module/components/UnifiedEventViewer.js.map +0 -1
- package/lib/module/hooks/useUnifiedEvents.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/sources/sourceIds.js.map +0 -1
- package/lib/module/stores/unifiedEventStore.js.map +0 -1
- package/lib/module/sync/eventsSyncAdapter.js.map +0 -1
- package/lib/module/types/copySettings.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/utils/autoDiscoverEventSources.js.map +0 -1
- package/lib/module/utils/badgeSelectionStorage.js.map +0 -1
- package/lib/module/utils/copySettingsStorage.js.map +0 -1
- package/lib/module/utils/correlationUtils.js.map +0 -1
- package/lib/module/utils/eventExportFormatter.js.map +0 -1
- package/lib/module/utils/eventTransformers.js.map +0 -1
- package/lib/module/utils/eventVisibility.js.map +0 -1
- package/lib/module/utils/testIDs.js.map +0 -1
- package/lib/typescript/components/EventsCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/components/EventsModal.d.ts.map +0 -1
- package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventDetail.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventFilters.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventItem.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventList.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventViewer.d.ts.map +0 -1
- package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/sources/sourceIds.d.ts.map +0 -1
- package/lib/typescript/stores/unifiedEventStore.d.ts.map +0 -1
- package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/types/copySettings.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +0 -1
- package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +0 -1
- package/lib/typescript/utils/copySettingsStorage.d.ts.map +0 -1
- package/lib/typescript/utils/correlationUtils.d.ts.map +0 -1
- package/lib/typescript/utils/eventExportFormatter.d.ts.map +0 -1
- package/lib/typescript/utils/eventTransformers.d.ts.map +0 -1
- package/lib/typescript/utils/eventVisibility.d.ts.map +0 -1
- package/lib/typescript/utils/testIDs.d.ts.map +0 -1
|
@@ -1,416 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* useUnifiedEvents Hook
|
|
5
|
-
*
|
|
6
|
-
* Main hook for consuming unified events from all sources.
|
|
7
|
-
* Automatically discovers and subscribes to available event sources.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { useState, useEffect, useCallback, useMemo, useRef } from "react";
|
|
11
|
-
import { useFeatureGate, subscribeToSubscriberCountChanges, useIgnoredPatterns, useLimit } from "@buoy-gg/shared-ui";
|
|
12
|
-
import { subscribe, setLocalEnabledSources, clearEvents as clearStoreEvents, getAvailableEventSources, getEvents, getSubscriberCounts } from "../stores/unifiedEventStore";
|
|
13
|
-
import { saveEnabledSources, loadEnabledSources, saveCapturingState, loadCapturingState, savePausedAt, loadPausedAt } from "../utils/badgeSelectionStorage";
|
|
14
|
-
import { getSourceDisplayConfig } from "../utils/autoDiscoverEventSources";
|
|
15
|
-
import { isBuoyInternalEvent, isNetworkEventIgnored } from "../utils/eventVisibility";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Match an event against the header search query. Searches the two fields the
|
|
19
|
-
* row actually renders (title/subtitle) plus a network event's full URL — the
|
|
20
|
-
* title only carries the path, so a query for the host or a query-string value
|
|
21
|
-
* would otherwise miss. `query` must already be lowercased and trimmed.
|
|
22
|
-
*/
|
|
23
|
-
function matchesSearch(event, query) {
|
|
24
|
-
if (event.title.toLowerCase().includes(query)) return true;
|
|
25
|
-
if (event.subtitle.toLowerCase().includes(query)) return true;
|
|
26
|
-
const url = event.originalEvent?.url;
|
|
27
|
-
return typeof url === "string" && url.toLowerCase().includes(query);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* All possible sources for display
|
|
32
|
-
*/
|
|
33
|
-
const ALL_DISPLAY_SOURCES = ["storage-async", "redux", "network", "react-query-query", "react-query-mutation", "route", "zustand", "jotai", "render"];
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Sources enabled by default on first load.
|
|
37
|
-
* "render" is excluded because high-frequency render tracking can cause
|
|
38
|
-
* performance issues or crashes in unoptimized apps.
|
|
39
|
-
*/
|
|
40
|
-
const DEFAULT_ENABLED_SOURCES = ALL_DISPLAY_SOURCES.filter(s => s !== "render");
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Map display sources to actual event sources they should match
|
|
44
|
-
*/
|
|
45
|
-
const SOURCE_TO_EVENT_SOURCES = {
|
|
46
|
-
"storage-async": ["storage-async", "storage-mmkv"],
|
|
47
|
-
"storage-mmkv": ["storage-mmkv"],
|
|
48
|
-
redux: ["redux"],
|
|
49
|
-
network: ["network"],
|
|
50
|
-
"react-query": ["react-query", "react-query-query"],
|
|
51
|
-
"react-query-query": ["react-query", "react-query-query"],
|
|
52
|
-
"react-query-mutation": ["react-query-mutation"],
|
|
53
|
-
route: ["route"],
|
|
54
|
-
zustand: ["zustand"],
|
|
55
|
-
jotai: ["jotai"],
|
|
56
|
-
render: ["render"]
|
|
57
|
-
};
|
|
58
|
-
export function useUnifiedEvents(options) {
|
|
59
|
-
const {
|
|
60
|
-
isPro
|
|
61
|
-
} = useFeatureGate();
|
|
62
|
-
const eventLimit = useLimit("events.entries");
|
|
63
|
-
// Shared ignored-domain/URL patterns (same store as the Network tool). Network
|
|
64
|
-
// events matching these are hidden from the events list too, keeping both
|
|
65
|
-
// tools' filtering perfectly in sync.
|
|
66
|
-
const {
|
|
67
|
-
patterns: ignoredPatterns
|
|
68
|
-
} = useIgnoredPatterns();
|
|
69
|
-
const [events, setEvents] = useState([]);
|
|
70
|
-
const [enabledSources, setEnabledSources] = useState(() => new Set(DEFAULT_ENABLED_SOURCES));
|
|
71
|
-
const [isCapturing, setIsCapturing] = useState(true);
|
|
72
|
-
const [searchText, setSearchText] = useState("");
|
|
73
|
-
const isStateRestoredRef = useRef(false);
|
|
74
|
-
|
|
75
|
-
// Wall-clock windows during which capture was OFF. Releasing this hook's
|
|
76
|
-
// subscriptions is not enough to keep the list still: source subscriptions
|
|
77
|
-
// are ref-counted and a watching dashboard legitimately keeps capturing into
|
|
78
|
-
// the SHARED store while the device is paused. So events stamped inside a
|
|
79
|
-
// paused window stay hidden — and stay hidden AFTER resume too: the user was
|
|
80
|
-
// told the tool wasn't listening, and a resume that surfaces a backlog of
|
|
81
|
-
// "unheard" events reads as capture-while-off (pause → clear → tap around →
|
|
82
|
-
// resume must come back BLANK). The open window's start is persisted beside
|
|
83
|
-
// the capturing flag, so a remount or relaunch while paused keeps hiding
|
|
84
|
-
// from the ORIGINAL pause press, not from the reopen.
|
|
85
|
-
const effectiveCapturing = options?.capturingOverride ?? isCapturing;
|
|
86
|
-
const pausedAtRef = useRef(null);
|
|
87
|
-
const pausedWindowsRef = useRef([]);
|
|
88
|
-
// Bumped whenever a window opens or closes so the visibility memo re-runs.
|
|
89
|
-
const [pauseVersion, setPauseVersion] = useState(0);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (effectiveCapturing) {
|
|
92
|
-
if (pausedAtRef.current !== null) {
|
|
93
|
-
pausedWindowsRef.current = [...pausedWindowsRef.current, [pausedAtRef.current, Date.now()]];
|
|
94
|
-
pausedAtRef.current = null;
|
|
95
|
-
setPauseVersion(v => v + 1);
|
|
96
|
-
savePausedAt(null);
|
|
97
|
-
}
|
|
98
|
-
} else if (pausedAtRef.current === null) {
|
|
99
|
-
pausedAtRef.current = Date.now();
|
|
100
|
-
setPauseVersion(v => v + 1);
|
|
101
|
-
savePausedAt(pausedAtRef.current);
|
|
102
|
-
}
|
|
103
|
-
}, [effectiveCapturing]);
|
|
104
|
-
const isInPausedGap = useCallback(timestamp => {
|
|
105
|
-
const pausedAt = pausedAtRef.current;
|
|
106
|
-
if (pausedAt !== null && timestamp > pausedAt) return true;
|
|
107
|
-
for (const [start, end] of pausedWindowsRef.current) {
|
|
108
|
-
if (timestamp > start && timestamp <= end) return true;
|
|
109
|
-
}
|
|
110
|
-
return false;
|
|
111
|
-
}, []);
|
|
112
|
-
|
|
113
|
-
// Get discovered sources (which packages are installed).
|
|
114
|
-
// Held in state, not a mount-only memo, because in remote mirror mode
|
|
115
|
-
// (desktop dashboard) the device's available sources arrive asynchronously
|
|
116
|
-
// via setRemoteAvailableSources() — after first paint. We refresh this from
|
|
117
|
-
// the store's notify path below so the filter badge bar appears once the
|
|
118
|
-
// first device snapshot lands. The reference is kept stable while the set is
|
|
119
|
-
// unchanged so dependent memos/effects don't re-run on every event.
|
|
120
|
-
const [discoveredSources, setDiscoveredSources] = useState(() => getAvailableEventSources());
|
|
121
|
-
|
|
122
|
-
// Subscribe to subscriber count changes for instant UI updates (TanStack Query pattern)
|
|
123
|
-
const [subscriberCountVersion, setSubscriberCountVersion] = useState(0);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
return subscribeToSubscriberCountChanges(() => {
|
|
126
|
-
setSubscriberCountVersion(v => v + 1);
|
|
127
|
-
});
|
|
128
|
-
}, []);
|
|
129
|
-
|
|
130
|
-
// Get available display sources (only show sources for installed packages)
|
|
131
|
-
const availableDisplaySources = useMemo(() => {
|
|
132
|
-
return ALL_DISPLAY_SOURCES.filter(displaySource => {
|
|
133
|
-
const eventSources = SOURCE_TO_EVENT_SOURCES[displaySource] || [displaySource];
|
|
134
|
-
// Check if any of the event sources for this display source are available
|
|
135
|
-
return eventSources.some(es => discoveredSources.has(es));
|
|
136
|
-
});
|
|
137
|
-
}, [discoveredSources]);
|
|
138
|
-
|
|
139
|
-
// Subscribe to store changes (always subscribe to get events when they come).
|
|
140
|
-
// Also refresh discoveredSources here: in remote mirror mode the device's
|
|
141
|
-
// availability is set right before replaceEvents() fires this listener, so
|
|
142
|
-
// this is where the badge bar first learns which sources exist. Keep the
|
|
143
|
-
// Set reference stable when membership is unchanged to avoid re-running the
|
|
144
|
-
// availableDisplaySources memo / restore-state effect on every event.
|
|
145
|
-
useEffect(() => {
|
|
146
|
-
// Frame-coalesced: the aggregator hears EVERY tool's emissions, so
|
|
147
|
-
// bursts previously produced one whole-modal commit per event (see
|
|
148
|
-
// network tool-bench 2026-07-06 for the measured pattern).
|
|
149
|
-
let rafId = null;
|
|
150
|
-
const unsubscribe = subscribe(() => {
|
|
151
|
-
if (rafId != null) return;
|
|
152
|
-
rafId = requestAnimationFrame(() => {
|
|
153
|
-
rafId = null;
|
|
154
|
-
applyLatest();
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
const applyLatest = () => {
|
|
158
|
-
const newEvents = getEvents();
|
|
159
|
-
setEvents(newEvents);
|
|
160
|
-
setDiscoveredSources(prev => {
|
|
161
|
-
const next = getAvailableEventSources();
|
|
162
|
-
if (prev.size === next.size && [...next].every(s => prev.has(s))) {
|
|
163
|
-
return prev;
|
|
164
|
-
}
|
|
165
|
-
return new Set(next);
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
return () => {
|
|
169
|
-
unsubscribe();
|
|
170
|
-
if (rafId != null) cancelAnimationFrame(rafId);
|
|
171
|
-
};
|
|
172
|
-
}, []);
|
|
173
|
-
|
|
174
|
-
// Restore saved state on mount (badge selection + capturing state)
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
const restoreState = async () => {
|
|
177
|
-
// Load badge selection
|
|
178
|
-
const savedSources = await loadEnabledSources();
|
|
179
|
-
let sourcesToEnable;
|
|
180
|
-
|
|
181
|
-
// Default enabled = available sources minus those excluded by default (e.g. render)
|
|
182
|
-
const defaultEnabledAvailable = availableDisplaySources.filter(s => DEFAULT_ENABLED_SOURCES.includes(s));
|
|
183
|
-
if (savedSources && savedSources.length > 0) {
|
|
184
|
-
// Filter to only include valid sources that still exist and are available
|
|
185
|
-
const validSources = savedSources.filter(s => availableDisplaySources.includes(s));
|
|
186
|
-
if (validSources.length > 0) {
|
|
187
|
-
sourcesToEnable = new Set(validSources);
|
|
188
|
-
} else {
|
|
189
|
-
// If no saved sources are valid, use defaults
|
|
190
|
-
sourcesToEnable = new Set(defaultEnabledAvailable);
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
// No saved state - use defaults (render disabled)
|
|
194
|
-
sourcesToEnable = new Set(defaultEnabledAvailable);
|
|
195
|
-
}
|
|
196
|
-
setEnabledSources(sourcesToEnable);
|
|
197
|
-
|
|
198
|
-
// Load capturing state (default to true if not saved)
|
|
199
|
-
const savedCapturing = await loadCapturingState();
|
|
200
|
-
const shouldCapture = savedCapturing !== null ? savedCapturing : true;
|
|
201
|
-
if (!shouldCapture && pausedAtRef.current === null) {
|
|
202
|
-
// Seed the open paused window from the ORIGINAL pause press before the
|
|
203
|
-
// pause effect can stamp mount time over it — events captured (for a
|
|
204
|
-
// watching dashboard) between that press and this mount stay hidden.
|
|
205
|
-
const savedPausedAt = await loadPausedAt();
|
|
206
|
-
pausedAtRef.current = savedPausedAt ?? Date.now();
|
|
207
|
-
setPauseVersion(v => v + 1);
|
|
208
|
-
}
|
|
209
|
-
setIsCapturing(shouldCapture);
|
|
210
|
-
isStateRestoredRef.current = true;
|
|
211
|
-
// Drive the first sync DIRECTLY rather than trusting the effect below to
|
|
212
|
-
// fire. The setStates above sit behind TWO awaits, so React can commit
|
|
213
|
-
// the sources update while the restored-guard is still down (effect
|
|
214
|
-
// skips), and a same-value setIsCapturing then bails out without another
|
|
215
|
-
// commit — leaving the effect nothing to fire on and the tool deaf until
|
|
216
|
-
// something else changes state. The store's ledger diff makes this call
|
|
217
|
-
// idempotent with the effect's.
|
|
218
|
-
void setLocalEnabledSources(shouldCapture ? Array.from(sourcesToEnable) : []);
|
|
219
|
-
};
|
|
220
|
-
restoreState();
|
|
221
|
-
}, [availableDisplaySources]);
|
|
222
|
-
|
|
223
|
-
// Keep the store's local-consumer subscriptions in sync with what this hook
|
|
224
|
-
// wants: the enabled sources while capturing, nothing while paused. The store
|
|
225
|
-
// diffs each declaration against what it already holds for the on-device
|
|
226
|
-
// consumer, so remounts and re-runs are idempotent — imperative
|
|
227
|
-
// subscribe/unsubscribe pairs here used to drift (a reopened tool stacked a
|
|
228
|
-
// second ref per source, leaving capture running after the power toggle
|
|
229
|
-
// released only one).
|
|
230
|
-
useEffect(() => {
|
|
231
|
-
if (!isStateRestoredRef.current) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
void setLocalEnabledSources(isCapturing ? Array.from(enabledSources) : []);
|
|
235
|
-
}, [enabledSources, isCapturing]);
|
|
236
|
-
|
|
237
|
-
// Persist enabled sources whenever they change (after initial restoration)
|
|
238
|
-
useEffect(() => {
|
|
239
|
-
if (!isStateRestoredRef.current) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
saveEnabledSources(Array.from(enabledSources));
|
|
243
|
-
}, [enabledSources]);
|
|
244
|
-
|
|
245
|
-
// Persist capturing state whenever it changes (after initial restoration)
|
|
246
|
-
useEffect(() => {
|
|
247
|
-
if (!isStateRestoredRef.current) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
saveCapturingState(isCapturing);
|
|
251
|
-
}, [isCapturing]);
|
|
252
|
-
|
|
253
|
-
// Build set of all event sources that should be shown
|
|
254
|
-
const allowedEventSources = useMemo(() => {
|
|
255
|
-
const allowed = new Set();
|
|
256
|
-
enabledSources.forEach(displaySource => {
|
|
257
|
-
const eventSources = SOURCE_TO_EVENT_SOURCES[displaySource];
|
|
258
|
-
if (eventSources) {
|
|
259
|
-
eventSources.forEach(s => allowed.add(s));
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
return allowed;
|
|
263
|
-
}, [enabledSources]);
|
|
264
|
-
const normalizedSearch = searchText.trim().toLowerCase();
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Everything this tool is willing to SHOW, before the user's own choices.
|
|
268
|
-
*
|
|
269
|
-
* Buoy's housekeeping writes and the shared ignored-URL patterns are removed
|
|
270
|
-
* here rather than alongside the source filter and the search, because the
|
|
271
|
-
* two kinds of hiding are not the same thing. A source badge and a search box
|
|
272
|
-
* are the user narrowing a list, and "Showing X of Y" is there to say so.
|
|
273
|
-
* This filter is the tool declining to report on itself, and there is no
|
|
274
|
-
* affordance anywhere that explains it — so counting these would make the
|
|
275
|
-
* header read "74 captured" over a list of 68, and leave the storage badge
|
|
276
|
-
* advertising writes that cannot be reached by any combination of controls.
|
|
277
|
-
*/
|
|
278
|
-
const visibleEvents = useMemo(() => events.filter(event => !isInPausedGap(event.timestamp) && !isBuoyInternalEvent(event) && !isNetworkEventIgnored(event, ignoredPatterns)),
|
|
279
|
-
// pauseVersion invalidates this when a paused window opens or closes —
|
|
280
|
-
// the predicate itself reads refs.
|
|
281
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
282
|
-
[events, ignoredPatterns, isInPausedGap, pauseVersion]);
|
|
283
|
-
|
|
284
|
-
// What the user's own filters leave: the enabled sources and the header
|
|
285
|
-
// search, applied to the events above.
|
|
286
|
-
const allFilteredEvents = useMemo(() => {
|
|
287
|
-
if (allowedEventSources.size === 0) {
|
|
288
|
-
return [];
|
|
289
|
-
}
|
|
290
|
-
return visibleEvents.filter(event => allowedEventSources.has(event.source) && (normalizedSearch === "" || matchesSearch(event, normalizedSearch)));
|
|
291
|
-
}, [visibleEvents, allowedEventSources, normalizedSearch]);
|
|
292
|
-
|
|
293
|
-
// Pro is Infinity here, so slice() returns everything and the hidden count
|
|
294
|
-
// floors at 0 — no tier branching needed at the call site.
|
|
295
|
-
const filteredEvents = useMemo(() => allFilteredEvents.slice(0, eventLimit), [allFilteredEvents, eventLimit]);
|
|
296
|
-
const hiddenEventsCount = useMemo(() => Math.max(0, allFilteredEvents.length - eventLimit), [allFilteredEvents, eventLimit]);
|
|
297
|
-
|
|
298
|
-
// Get all available sources with counts, sorted: enabled first, disabled last
|
|
299
|
-
const availableSources = useMemo(() => {
|
|
300
|
-
// Counted from the visible set for the same reason `totalCount` is: a badge
|
|
301
|
-
// reading 72 over a list that can only ever show 69 of them is not a filter,
|
|
302
|
-
// it is a mystery. (`getSourceCounts()` is the raw store tally — still what
|
|
303
|
-
// the sync adapter reports to a dashboard, which wants the unfiltered
|
|
304
|
-
// truth.)
|
|
305
|
-
const counts = visibleEvents.reduce((acc, event) => {
|
|
306
|
-
acc[event.source] = (acc[event.source] ?? 0) + 1;
|
|
307
|
-
return acc;
|
|
308
|
-
}, {});
|
|
309
|
-
const subscriberCounts = getSubscriberCounts();
|
|
310
|
-
|
|
311
|
-
// Build a map from source ID to subscriber count
|
|
312
|
-
const subscriberCountBySourceId = {};
|
|
313
|
-
for (const source of subscriberCounts.sources) {
|
|
314
|
-
subscriberCountBySourceId[source.sourceId] = source.counts.total;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// Map display source to store source ID
|
|
318
|
-
const displaySourceToStoreId = {
|
|
319
|
-
"storage-async": "storage",
|
|
320
|
-
"storage-mmkv": "storage",
|
|
321
|
-
redux: "redux",
|
|
322
|
-
network: "network",
|
|
323
|
-
"react-query": "react-query",
|
|
324
|
-
"react-query-query": "react-query",
|
|
325
|
-
"react-query-mutation": "react-query",
|
|
326
|
-
route: "route-events",
|
|
327
|
-
zustand: "zustand",
|
|
328
|
-
jotai: "jotai",
|
|
329
|
-
render: "render"
|
|
330
|
-
};
|
|
331
|
-
const sources = availableDisplaySources.map(source => {
|
|
332
|
-
const eventSources = SOURCE_TO_EVENT_SOURCES[source] || [source];
|
|
333
|
-
const totalCount = eventSources.reduce((sum, s) => sum + (counts[s] || 0), 0);
|
|
334
|
-
const displayConfig = getSourceDisplayConfig(source);
|
|
335
|
-
const storeId = displaySourceToStoreId[source];
|
|
336
|
-
// Only set subscriberCount if the source has subscriber tracking
|
|
337
|
-
// (undefined means no tracking, vs 0 which means tracked but no subscribers)
|
|
338
|
-
const subscriberCount = storeId && storeId in subscriberCountBySourceId ? subscriberCountBySourceId[storeId] : undefined;
|
|
339
|
-
return {
|
|
340
|
-
source,
|
|
341
|
-
...displayConfig,
|
|
342
|
-
count: totalCount,
|
|
343
|
-
enabled: enabledSources.has(source),
|
|
344
|
-
subscriberCount
|
|
345
|
-
};
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
// Sort: enabled first, then disabled
|
|
349
|
-
return sources.sort((a, b) => {
|
|
350
|
-
if (a.enabled && !b.enabled) return -1;
|
|
351
|
-
if (!a.enabled && b.enabled) return 1;
|
|
352
|
-
return 0;
|
|
353
|
-
});
|
|
354
|
-
}, [visibleEvents, enabledSources, availableDisplaySources, subscriberCountVersion]);
|
|
355
|
-
|
|
356
|
-
// Pure state change — the sync effect above translates the new selection
|
|
357
|
-
// into store subscriptions, correctly keeping a shared discovery source
|
|
358
|
-
// (react-query serves both the query and mutation badges) alive while
|
|
359
|
-
// either badge still wants it.
|
|
360
|
-
const toggleSource = useCallback(source => {
|
|
361
|
-
setEnabledSources(prev => {
|
|
362
|
-
const next = new Set(prev);
|
|
363
|
-
if (next.has(source)) {
|
|
364
|
-
next.delete(source);
|
|
365
|
-
} else {
|
|
366
|
-
next.add(source);
|
|
367
|
-
}
|
|
368
|
-
return next;
|
|
369
|
-
});
|
|
370
|
-
}, []);
|
|
371
|
-
const enableAllSources = useCallback(() => {
|
|
372
|
-
setEnabledSources(new Set(availableDisplaySources));
|
|
373
|
-
}, [availableDisplaySources]);
|
|
374
|
-
const clearEvents = useCallback(() => {
|
|
375
|
-
clearStoreEvents();
|
|
376
|
-
}, []);
|
|
377
|
-
|
|
378
|
-
// Pure state changes — the sync effect declares the resulting desired set to
|
|
379
|
-
// the store, which releases every subscription this consumer holds when
|
|
380
|
-
// capture turns off (a dashboard's own subscriptions stay ref-counted and
|
|
381
|
-
// untouched).
|
|
382
|
-
const startCapturing = useCallback(() => {
|
|
383
|
-
setIsCapturing(true);
|
|
384
|
-
}, []);
|
|
385
|
-
const stopCapturing = useCallback(() => {
|
|
386
|
-
setIsCapturing(false);
|
|
387
|
-
}, []);
|
|
388
|
-
const toggleCapturing = useCallback(() => {
|
|
389
|
-
setIsCapturing(prev => !prev);
|
|
390
|
-
}, []);
|
|
391
|
-
|
|
392
|
-
// Get subscriber counts (recalculates on every render, but it's a cheap operation)
|
|
393
|
-
const totalSubscriberCount = getSubscriberCounts().totalSubscribers;
|
|
394
|
-
return {
|
|
395
|
-
events,
|
|
396
|
-
filteredEvents,
|
|
397
|
-
availableSources,
|
|
398
|
-
enabledSources,
|
|
399
|
-
searchText,
|
|
400
|
-
setSearchText,
|
|
401
|
-
toggleSource,
|
|
402
|
-
enableAllSources,
|
|
403
|
-
clearEvents,
|
|
404
|
-
totalCount: visibleEvents.length,
|
|
405
|
-
filteredCount: filteredEvents.length,
|
|
406
|
-
isCapturing,
|
|
407
|
-
startCapturing,
|
|
408
|
-
stopCapturing,
|
|
409
|
-
toggleCapturing,
|
|
410
|
-
discoveredSources,
|
|
411
|
-
hiddenEventsCount,
|
|
412
|
-
isPro,
|
|
413
|
-
totalSubscriberCount
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
//# sourceMappingURL=useUnifiedEvents.js.map
|
|
1
|
+
"use strict";import{useState as f,useEffect as S,useCallback as b,useMemo as g,useRef as D}from"react";import{useFeatureGate as ie,subscribeToSubscriberCountChanges as le,useIgnoredPatterns as de,useLimit as fe}from"@buoy-gg/shared-ui";import{subscribe as Se,setLocalEnabledSources as j,clearEvents as be,getAvailableEventSources as F,getEvents as ge,getSubscriberCounts as V}from"../stores/unifiedEventStore";import{saveEnabledSources as me,loadEnabledSources as ve,saveCapturingState as ye,loadCapturingState as Ce,savePausedAt as B,loadPausedAt as Ee}from"../utils/badgeSelectionStorage";import{getSourceDisplayConfig as pe}from"../utils/autoDiscoverEventSources";import{isBuoyInternalEvent as we,isNetworkEventIgnored as he}from"../utils/eventVisibility";function qe(i,v){if(i.title.toLowerCase().includes(v))return true;if(i.subtitle.toLowerCase().includes(v))return true;const l=i.originalEvent?.url;return typeof l==="string"&&l.toLowerCase().includes(v)}const N=["storage-async","redux","network","react-query-query","react-query-mutation","route","zustand","jotai","render"];const G=N.filter(i=>i!=="render");const P={"storage-async":["storage-async","storage-mmkv"],"storage-mmkv":["storage-mmkv"],redux:["redux"],network:["network"],"react-query":["react-query","react-query-query"],"react-query-query":["react-query","react-query-query"],"react-query-mutation":["react-query-mutation"],route:["route"],zustand:["zustand"],jotai:["jotai"],render:["render"]};export function useUnifiedEvents(i){const{isPro:v}=ie();const l=fe("events.entries");const{patterns:R}=de();const[h,M]=f([]);const[u,q]=f(()=>new Set(G));const[m,E]=f(true);const[T,W]=f("");const p=D(false);const _=i?.capturingOverride??m;const a=D(null);const A=D([]);const[Y,L]=f(0);S(()=>{if(_){if(a.current!==null){A.current=[...A.current,[a.current,Date.now()]];a.current=null;L(e=>e+1);B(null)}}else if(a.current===null){a.current=Date.now();L(e=>e+1);B(a.current)}},[_]);const O=b(e=>{const n=a.current;if(n!==null&&e>n)return true;for(const[r,o]of A.current){if(e>r&&e<=o)return true}return false},[]);const[k,H]=f(()=>F());const[J,K]=f(0);S(()=>{return le(()=>{K(e=>e+1)})},[]);const d=g(()=>{return N.filter(e=>{const n=P[e]||[e];return n.some(r=>k.has(r))})},[k]);S(()=>{let e=null;const n=Se(()=>{if(e!=null)return;e=requestAnimationFrame(()=>{e=null;r()})});const r=()=>{const o=ge();M(o);H(c=>{const t=F();if(c.size===t.size&&[...t].every(s=>c.has(s))){return c}return new Set(t)})};return()=>{n();if(e!=null)cancelAnimationFrame(e)}},[]);S(()=>{const e=async()=>{const n=await ve();let r;const o=d.filter(s=>G.includes(s));if(n&&n.length>0){const s=n.filter(C=>d.includes(C));if(s.length>0){r=new Set(s)}else{r=new Set(o)}}else{r=new Set(o)}q(r);const c=await Ce();const t=c!==null?c:true;if(!t&&a.current===null){const s=await Ee();a.current=s??Date.now();L(C=>C+1)}E(t);p.current=true;void j(t?Array.from(r):[])};e()},[d]);S(()=>{if(!p.current){return}void j(m?Array.from(u):[])},[u,m]);S(()=>{if(!p.current){return}me(Array.from(u))},[u]);S(()=>{if(!p.current){return}ye(m)},[m]);const x=g(()=>{const e=new Set;u.forEach(n=>{const r=P[n];if(r){r.forEach(o=>e.add(o))}});return e},[u]);const I=T.trim().toLowerCase();const y=g(()=>h.filter(e=>!O(e.timestamp)&&!we(e)&&!he(e,R)),[h,R,O,Y]);const w=g(()=>{if(x.size===0){return[]}return y.filter(e=>x.has(e.source)&&(I===""||qe(e,I)))},[y,x,I]);const U=g(()=>w.slice(0,l),[w,l]);const Q=g(()=>Math.max(0,w.length-l),[w,l]);const X=g(()=>{const e=y.reduce((t,s)=>{t[s.source]=(t[s.source]??0)+1;return t},{});const n=V();const r={};for(const t of n.sources){r[t.sourceId]=t.counts.total}const o={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};const c=d.map(t=>{const s=P[t]||[t];const C=s.reduce((ae,ce)=>ae+(e[ce]||0),0);const oe=pe(t);const z=o[t];const ue=z&&z in r?r[z]:void 0;return{source:t,...oe,count:C,enabled:u.has(t),subscriberCount:ue}});return c.sort((t,s)=>{if(t.enabled&&!s.enabled)return-1;if(!t.enabled&&s.enabled)return 1;return 0})},[y,u,d,J]);const Z=b(e=>{q(n=>{const r=new Set(n);if(r.has(e)){r.delete(e)}else{r.add(e)}return r})},[]);const $=b(()=>{q(new Set(d))},[d]);const ee=b(()=>{be()},[]);const te=b(()=>{E(true)},[]);const re=b(()=>{E(false)},[]);const ne=b(()=>{E(e=>!e)},[]);const se=V().totalSubscribers;return{events:h,filteredEvents:U,availableSources:X,enabledSources:u,searchText:T,setSearchText:W,toggleSource:Z,enableAllSources:$,clearEvents:ee,totalCount:y.length,filteredCount:U.length,isCapturing:m,startCapturing:te,stopCapturing:re,toggleCapturing:ne,discoveredSources:k,hiddenEventsCount:Q,isPro:v,totalSubscriberCount:se}}
|
package/lib/module/index.js
CHANGED
|
@@ -1,102 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @buoy-gg/events
|
|
5
|
-
*
|
|
6
|
-
* Unified event timeline for all DevTools sources.
|
|
7
|
-
* Shows events from Storage, Redux, Network, React Query, etc.
|
|
8
|
-
* in a single chronological view.
|
|
9
|
-
*
|
|
10
|
-
* PUBLIC API - Only these exports are supported for external use.
|
|
11
|
-
* Internal stores and subscription mechanisms are not exported to prevent
|
|
12
|
-
* bypassing the tool's intended usage patterns.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// =============================================================================
|
|
16
|
-
// PRESET (Primary entry point for users)
|
|
17
|
-
// =============================================================================
|
|
18
|
-
export { eventsToolPreset, createEventsTool } from "./preset";
|
|
19
|
-
|
|
20
|
-
// =============================================================================
|
|
21
|
-
// MAIN COMPONENT
|
|
22
|
-
// =============================================================================
|
|
23
|
-
export { UnifiedEventViewer } from "./components/UnifiedEventViewer";
|
|
24
|
-
// `EventsToolView` is the same tool rendered inline (header bar + body)
|
|
25
|
-
// instead of inside a JsModal — for hosts that show tools in a panel.
|
|
26
|
-
export { EventsModal, EventsToolView } from "./components/EventsModal";
|
|
27
|
-
// The per-tool detail pages a bundled host must inject — see UnifiedEventDetail.
|
|
28
|
-
|
|
29
|
-
// =============================================================================
|
|
30
|
-
// EXTERNAL SYNC (Adapter for @buoy-gg/external-sync's useExternalSync)
|
|
31
|
-
// =============================================================================
|
|
32
|
-
export { eventsSyncAdapter } from "./sync/eventsSyncAdapter";
|
|
33
|
-
|
|
34
|
-
// =============================================================================
|
|
35
|
-
// HOOKS (For consuming event data)
|
|
36
|
-
// =============================================================================
|
|
37
|
-
export { useUnifiedEvents } from "./hooks/useUnifiedEvents";
|
|
38
|
-
// =============================================================================
|
|
39
|
-
// VISIBILITY PREDICATES (What the tool refuses to show, without rendering it)
|
|
40
|
-
// =============================================================================
|
|
41
|
-
// The Workbench sidebar counts events off the synced snapshot; it must apply
|
|
42
|
-
// the same hiding the tool does or the badge advertises unreachable rows.
|
|
43
|
-
export { isBuoyInternalEvent, isNetworkEventIgnored, isEventHiddenFromTool } from "./utils/eventVisibility";
|
|
44
|
-
|
|
45
|
-
// =============================================================================
|
|
46
|
-
// TYPES
|
|
47
|
-
// =============================================================================
|
|
48
|
-
|
|
49
|
-
// =============================================================================
|
|
50
|
-
// COPY SETTINGS (Configuration types and presets)
|
|
51
|
-
// =============================================================================
|
|
52
|
-
export { DEFAULT_COPY_SETTINGS, COPY_PRESETS, PRESET_METADATA, detectActivePreset } from "./types/copySettings";
|
|
53
|
-
|
|
54
|
-
// =============================================================================
|
|
55
|
-
// UI COMPONENTS (For custom implementations)
|
|
56
|
-
// =============================================================================
|
|
57
|
-
export { UnifiedEventItem } from "./components/UnifiedEventItem";
|
|
58
|
-
export { UnifiedEventList } from "./components/UnifiedEventList";
|
|
59
|
-
export { UnifiedEventFilters } from "./components/UnifiedEventFilters";
|
|
60
|
-
export { UnifiedEventDetail } from "./components/UnifiedEventDetail";
|
|
61
|
-
export { ReactQueryEventDetail } from "./components/ReactQueryEventDetail";
|
|
62
|
-
export { EventsCopySettingsView } from "./components/EventsCopySettingsView";
|
|
63
|
-
|
|
64
|
-
// =============================================================================
|
|
65
|
-
// TEST HANDLES (shared with the e2e suites and the website's live tour)
|
|
66
|
-
// =============================================================================
|
|
67
|
-
export { EVENTS_TEST_ID, eventRowTestID, eventFilterTestID, eventIdentity } from "./utils/testIDs";
|
|
68
|
-
|
|
69
|
-
// =============================================================================
|
|
70
|
-
// CORRELATION UTILITIES (For linking related events)
|
|
71
|
-
// =============================================================================
|
|
72
|
-
export { findRelatedEvents, hasRelatedEvents, getRelatedEventsCount, buildCorrelationCountMap, getCorrelationGroup, getCorrelationLabel, getCorrelationColor } from "./utils/correlationUtils";
|
|
73
|
-
|
|
74
|
-
// =============================================================================
|
|
75
|
-
// EXPORT UTILITIES (For generating formatted exports)
|
|
76
|
-
// =============================================================================
|
|
77
|
-
export { generateExport, generateMarkdownExport, generateJsonExport, generatePlaintextExport, generateMermaidExport, estimateExportSize, getExportSummary, filterEvents } from "./utils/eventExportFormatter";
|
|
78
|
-
// =============================================================================
|
|
79
|
-
// COPY SETTINGS STORAGE (For persisting export preferences)
|
|
80
|
-
// =============================================================================
|
|
81
|
-
export { loadCopySettings, saveCopySettings, clearCopySettings } from "./utils/copySettingsStorage";
|
|
82
|
-
|
|
83
|
-
// =============================================================================
|
|
84
|
-
// INTERNAL EXPORTS (For @buoy-gg/* packages only - not part of public API)
|
|
85
|
-
// These are NOT exported to prevent users from bypassing the unified event
|
|
86
|
-
// system. Event subscription should go through the proper tool integration.
|
|
87
|
-
// =============================================================================
|
|
88
|
-
/** @internal - Remote mirror mode only (desktop dashboard): replaceEvents /
|
|
89
|
-
* onClear / setRemoteAvailableSources. Do not use for event subscription. */
|
|
90
|
-
export { unifiedEventStore } from "./stores/unifiedEventStore";
|
|
91
|
-
// NOTE: The following are intentionally NOT exported:
|
|
92
|
-
// - subscribeToStorage, unsubscribeFromStorage (internal subscription)
|
|
93
|
-
// - subscribeToRedux, unsubscribeFromRedux (internal subscription)
|
|
94
|
-
// - subscribeToNetwork, unsubscribeFromNetwork (internal subscription)
|
|
95
|
-
// - subscribeToReactQuery, unsubscribeFromReactQuery (internal subscription)
|
|
96
|
-
// - subscribeToRoutes, unsubscribeFromRoutes (internal subscription)
|
|
97
|
-
// - getEvents, getActiveSources, getSourceCounts (internal store operations)
|
|
98
|
-
// - clearEvents, subscribe, getEventCount (internal store operations)
|
|
99
|
-
|
|
100
|
-
// Note: For subscriber count notifications, use @buoy-gg/shared-ui:
|
|
101
|
-
// import { notifySubscriberCountChange, subscribeToSubscriberCountChanges } from "@buoy-gg/shared-ui";
|
|
102
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{eventsToolPreset,createEventsTool}from"./preset";export{UnifiedEventViewer}from"./components/UnifiedEventViewer";export{EventsModal,EventsToolView}from"./components/EventsModal";export{eventsSyncAdapter}from"./sync/eventsSyncAdapter";export{useUnifiedEvents}from"./hooks/useUnifiedEvents";export{isBuoyInternalEvent,isNetworkEventIgnored,isEventHiddenFromTool}from"./utils/eventVisibility";export{DEFAULT_COPY_SETTINGS,COPY_PRESETS,PRESET_METADATA,detectActivePreset}from"./types/copySettings";export{UnifiedEventItem}from"./components/UnifiedEventItem";export{UnifiedEventList}from"./components/UnifiedEventList";export{UnifiedEventFilters}from"./components/UnifiedEventFilters";export{UnifiedEventDetail}from"./components/UnifiedEventDetail";export{ReactQueryEventDetail}from"./components/ReactQueryEventDetail";export{EventsCopySettingsView}from"./components/EventsCopySettingsView";export{EVENTS_TEST_ID,eventRowTestID,eventFilterTestID,eventIdentity}from"./utils/testIDs";export{findRelatedEvents,hasRelatedEvents,getRelatedEventsCount,buildCorrelationCountMap,getCorrelationGroup,getCorrelationLabel,getCorrelationColor}from"./utils/correlationUtils";export{generateExport,generateMarkdownExport,generateJsonExport,generatePlaintextExport,generateMermaidExport,estimateExportSize,getExportSummary,filterEvents}from"./utils/eventExportFormatter";export{loadCopySettings,saveCopySettings,clearCopySettings}from"./utils/copySettingsStorage";export{unifiedEventStore}from"./stores/unifiedEventStore";
|
package/lib/module/preset.js
CHANGED
|
@@ -1,57 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-configured Events tool for FloatingDevTools
|
|
5
|
-
*
|
|
6
|
-
* This preset provides a unified event timeline showing events
|
|
7
|
-
* from all DevTools sources (Storage, Redux, Network, etc.)
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { eventsToolPreset } from '@buoy-gg/events';
|
|
12
|
-
*
|
|
13
|
-
* const installedApps = [
|
|
14
|
-
* eventsToolPreset, // That's it!
|
|
15
|
-
* // ...other tools
|
|
16
|
-
* ];
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { EventsIcon, EVENTS_ICON_COLOR } from "@buoy-gg/floating-tools-core";
|
|
21
|
-
import { EventsModal } from "./components/EventsModal";
|
|
22
|
-
import { createToolFactory, defineToolPreset } from "@buoy-gg/shared-ui";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Pre-configured Events tool for FloatingDevTools.
|
|
26
|
-
* Shows a unified timeline of events from all sources:
|
|
27
|
-
* - AsyncStorage operations
|
|
28
|
-
* - MMKV operations (coming soon)
|
|
29
|
-
* - Redux actions (coming soon)
|
|
30
|
-
* - Network requests (coming soon)
|
|
31
|
-
* - React Query events (coming soon)
|
|
32
|
-
*/
|
|
33
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
-
export const eventsToolPreset = defineToolPreset({
|
|
35
|
-
id: "events",
|
|
36
|
-
name: "EVENTS",
|
|
37
|
-
description: "Unified event timeline",
|
|
38
|
-
slot: "both",
|
|
39
|
-
icon: ({
|
|
40
|
-
size,
|
|
41
|
-
color
|
|
42
|
-
}) => /*#__PURE__*/_jsx(EventsIcon, {
|
|
43
|
-
size: size,
|
|
44
|
-
color: color || EVENTS_ICON_COLOR
|
|
45
|
-
}),
|
|
46
|
-
component: EventsModal,
|
|
47
|
-
props: {
|
|
48
|
-
enableSharedModalDimensions: false
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Create a custom Events tool configuration.
|
|
54
|
-
* Use this if you want to override default settings.
|
|
55
|
-
*/
|
|
56
|
-
export const createEventsTool = createToolFactory(eventsToolPreset);
|
|
57
|
-
//# sourceMappingURL=preset.js.map
|
|
1
|
+
"use strict";import{EventsIcon as t,EVENTS_ICON_COLOR as s}from"@buoy-gg/floating-tools-core";import{EventsModal as n}from"./components/EventsModal";import{createToolFactory as r,defineToolPreset as i}from"@buoy-gg/shared-ui";import{jsx as m}from"react/jsx-runtime";export const eventsToolPreset=i({id:"events",name:"EVENTS",description:"Unified event timeline",slot:"both",icon:({size:e,color:o})=>m(t,{size:e,color:o||s}),component:n,props:{enableSharedModalDimensions:false}});export const createEventsTool=r(eventsToolPreset);
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Map an event source (the granular UI badge identity) to its parent discovery
|
|
5
|
-
* ID (the key used by unifiedEventStore's source subscriptions). Several event
|
|
6
|
-
* sources can share one discovery source — e.g. storage-async + storage-mmkv
|
|
7
|
-
* both come from the "storage" discovery source, and the react-query family all
|
|
8
|
-
* map to "react-query".
|
|
9
|
-
*
|
|
10
|
-
* Shared by useUnifiedEvents (the on-device consumer) and unifiedEventStore's
|
|
11
|
-
* remote-consumer channel so the mapping lives in exactly one place.
|
|
12
|
-
*/
|
|
13
|
-
export const EVENT_SOURCE_TO_DISCOVERY_ID = {
|
|
14
|
-
"storage-async": "storage",
|
|
15
|
-
"storage-mmkv": "storage",
|
|
16
|
-
redux: "redux",
|
|
17
|
-
network: "network",
|
|
18
|
-
"react-query": "react-query",
|
|
19
|
-
"react-query-query": "react-query",
|
|
20
|
-
"react-query-mutation": "react-query",
|
|
21
|
-
route: "route-events",
|
|
22
|
-
zustand: "zustand",
|
|
23
|
-
jotai: "jotai",
|
|
24
|
-
render: "render"
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=sourceIds.js.map
|
|
1
|
+
"use strict";export const EVENT_SOURCE_TO_DISCOVERY_ID={"storage-async":"storage","storage-mmkv":"storage",redux:"redux",network:"network","react-query":"react-query","react-query-query":"react-query","react-query-mutation":"react-query",route:"route-events",zustand:"zustand",jotai:"jotai",render:"render"};
|