@buoy-gg/network 7.0.41 → 7.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -85
- package/lib/commonjs/index.js +1 -332
- package/lib/commonjs/index.web.js +1 -420
- package/lib/commonjs/network/components/DataViewer.web.js +1 -879
- package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
- package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
- package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
- package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
- package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
- package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
- package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
- package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
- package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
- package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
- package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
- package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
- package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
- package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
- package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
- package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
- package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
- package/lib/commonjs/network/components/NetworkModal.js +1 -786
- package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
- package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
- package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
- package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
- package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
- package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
- package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
- package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
- package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
- package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
- package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
- package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
- package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
- package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
- package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
- package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
- package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
- package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
- package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
- package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
- package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
- package/lib/commonjs/network/conditions/store.js +1 -75
- package/lib/commonjs/network/conditions/wait.js +1 -43
- package/lib/commonjs/network/conditions/xhr.js +1 -135
- package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
- package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
- package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
- package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
- package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
- package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
- package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
- package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
- package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
- package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
- package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
- package/lib/commonjs/network/overrides/engine.js +1 -93
- package/lib/commonjs/network/overrides/matchRule.js +1 -87
- package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
- package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
- package/lib/commonjs/network/overrides/presets.js +1 -70
- package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
- package/lib/commonjs/network/overrides/types.js +1 -90
- package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
- package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
- package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
- package/lib/commonjs/network/types/index.js +1 -5
- package/lib/commonjs/network/utils/extractOperationName.js +1 -80
- package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
- package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
- package/lib/commonjs/network/utils/formatting.js +1 -30
- package/lib/commonjs/network/utils/generateCurl.js +2 -71
- package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
- package/lib/commonjs/network/utils/httpCompletion.js +1 -37
- package/lib/commonjs/network/utils/networkEventStore.js +1 -411
- package/lib/commonjs/network/utils/networkListener.js +4 -1352
- package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
- package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
- package/lib/commonjs/network/utils/realNow.js +1 -0
- package/lib/commonjs/network/utils/requestId.js +1 -16
- package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
- package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
- package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
- package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
- package/lib/commonjs/preset.js +1 -93
- package/lib/module/index.js +1 -104
- package/lib/module/index.web.js +1 -82
- package/lib/module/network/components/DataViewer.web.js +1 -875
- package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
- package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
- package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
- package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
- package/lib/module/network/components/NetworkDetailStepper.js +1 -104
- package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
- package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
- package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
- package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
- package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
- package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
- package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
- package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
- package/lib/module/network/components/NetworkHeaderLive.js +1 -366
- package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
- package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
- package/lib/module/network/components/NetworkListScreen.js +1 -399
- package/lib/module/network/components/NetworkListScreen.web.js +1 -622
- package/lib/module/network/components/NetworkModal.js +1 -781
- package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
- package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
- package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
- package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
- package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
- package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
- package/lib/module/network/components/NetworkOverridesButton.js +1 -87
- package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
- package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
- package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
- package/lib/module/network/components/NetworkSavedScreen.js +1 -222
- package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
- package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
- package/lib/module/network/components/response-editor/Explorer.js +1 -972
- package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
- package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
- package/lib/module/network/components/response-editor/editorContext.js +1 -29
- package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
- package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
- package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
- package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
- package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
- package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
- package/lib/module/network/conditions/store.js +1 -65
- package/lib/module/network/conditions/wait.js +1 -38
- package/lib/module/network/conditions/xhr.js +1 -131
- package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
- package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
- package/lib/module/network/hooks/useNetworkEventList.js +1 -104
- package/lib/module/network/hooks/useNetworkEvents.js +1 -314
- package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
- package/lib/module/network/hooks/useNetworkSaved.js +1 -34
- package/lib/module/network/hooks/useNetworkSelection.js +1 -46
- package/lib/module/network/hooks/useOverrideRules.js +1 -32
- package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
- package/lib/module/network/overrides/applyToFetch.js +1 -72
- package/lib/module/network/overrides/applyToXhr.js +2 -502
- package/lib/module/network/overrides/engine.js +1 -85
- package/lib/module/network/overrides/matchRule.js +1 -81
- package/lib/module/network/overrides/overriddenRows.js +1 -33
- package/lib/module/network/overrides/overrideRulesStore.js +1 -547
- package/lib/module/network/overrides/presets.js +1 -65
- package/lib/module/network/overrides/resolveOverride.js +1 -152
- package/lib/module/network/overrides/types.js +1 -86
- package/lib/module/network/sync/networkBodyResolver.js +1 -34
- package/lib/module/network/sync/networkSyncAdapter.js +1 -880
- package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
- package/lib/module/network/types/index.js +1 -3
- package/lib/module/network/utils/extractOperationName.js +1 -76
- package/lib/module/network/utils/filterNetworkEvents.js +1 -92
- package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
- package/lib/module/network/utils/formatting.js +1 -9
- package/lib/module/network/utils/generateCurl.js +2 -67
- package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
- package/lib/module/network/utils/httpCompletion.js +1 -32
- package/lib/module/network/utils/networkEventStore.js +1 -409
- package/lib/module/network/utils/networkListener.js +4 -1341
- package/lib/module/network/utils/networkSavedStore.js +3 -572
- package/lib/module/network/utils/networkSelectionStore.js +1 -188
- package/lib/module/network/utils/realNow.js +1 -0
- package/lib/module/network/utils/requestId.js +1 -12
- package/lib/module/network/utils/resolveRequestUrl.js +1 -11
- package/lib/module/network/utils/selectSavedEvents.js +1 -35
- package/lib/module/network/utils/startNetworkCapture.js +1 -21
- package/lib/module/network/utils/withPinnedFirst.js +1 -28
- package/lib/module/preset.js +1 -91
- package/lib/typescript/network/overrides/engine.d.ts +1 -1
- package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
- package/lib/typescript/network/overrides/types.d.ts +9 -0
- package/lib/typescript/network/utils/networkListener.d.ts +11 -0
- package/lib/typescript/network/utils/realNow.d.ts +18 -0
- package/lib/web/index.mjs +73 -74
- package/package.json +3 -6
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.web.d.ts.map +0 -1
- package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/store.d.ts.map +0 -1
- package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
- package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
- package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
- package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
- package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
- package/lib/typescript/network/overrides/types.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
- package/lib/typescript/network/types/index.d.ts.map +0 -1
- package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
- package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
- package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
- package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
- package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
- package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,617 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* NetworkHeaderLive.web — DOM twin of NetworkHeaderLive.tsx.
|
|
5
|
-
*
|
|
6
|
-
* The header pieces that consume LIVE event data, each its own narrow store
|
|
7
|
-
* subscriber (same decomposition + hooks as native — `useNetworkBadgeCounts`,
|
|
8
|
-
* `useNetworkHasEvents`, `useNetworkSaved` are platform-free and reused, not
|
|
9
|
-
* forked):
|
|
10
|
-
*
|
|
11
|
-
* - `NetworkHeaderBadges` — success/error/pending count chips (tap toggles
|
|
12
|
-
* the status filter)
|
|
13
|
-
* - `NetworkClearButton` — trash button, enabled while the store has events
|
|
14
|
-
* - `NetworkSavedButton` — Saved-screen entry point with its live count
|
|
15
|
-
* - `NetworkDetailPinActions` — pin + save toggles for the request-DETAIL
|
|
16
|
-
* header (ported with the F3 detail-view feature; same flagsForEventId /
|
|
17
|
-
* cap logic and press-time event resolution as native)
|
|
18
|
-
* - `NetworkHeaderCopyButton` — copy-all button / labelled ⋯-menu row
|
|
19
|
-
* (ported with the F5 saved+copy feature; the copy text is the SAME
|
|
20
|
-
* platform-free `generateNetworkCopyText`, resolved lazily at press time
|
|
21
|
-
* from a live store read, exactly like native)
|
|
22
|
-
*
|
|
23
|
-
* shared-ui RN chrome is replicated as DOM with provenance (web consumers
|
|
24
|
-
* resolve `@buoy-gg/shared-ui` to a minimal shim):
|
|
25
|
-
* - `macOSColors` — inlined verbatim subset from
|
|
26
|
-
* shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts.
|
|
27
|
-
* - Icons — inline lucide SVGs (shared-ui's icons are lucide re-exports).
|
|
28
|
-
* - The active chip's native shadow (shadowOffset 0/1, opacity 0.08,
|
|
29
|
-
* radius 2) → an equivalent CSS box-shadow.
|
|
30
|
-
* - shared-ui `CopyButton` (the Pro branch of the copy button) — inlined
|
|
31
|
-
* labelled DOM twin below: same idle/success/error icon set, 1500ms
|
|
32
|
-
* feedback, lazy function value, and label-follows-labelStyle behavior.
|
|
33
|
-
*
|
|
34
|
-
* Intentional deviations (all logged):
|
|
35
|
-
* - shared-ui CopyButton's ClipboardHintBanner and internal
|
|
36
|
-
* @buoy-gg/license Pro modal are not ported — license gating isn't part
|
|
37
|
-
* of the web port; the explicit `isPro` prop branch (native's own outer
|
|
38
|
-
* gate) still routes free users to `onUpgradePress`.
|
|
39
|
-
* - `CopySettings` is imported from the platform-free
|
|
40
|
-
* `generateNetworkCopyText` module (the native file imports it from
|
|
41
|
-
* NetworkCopySettingsView.tsx, which would drag react-native in).
|
|
42
|
-
*
|
|
43
|
-
* @platform React DOM Web
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
import { useEffect, useRef, useState } from "react";
|
|
47
|
-
import { useLimit } from "@buoy-gg/shared-ui";
|
|
48
|
-
import { networkEventStore } from "../utils/networkEventStore";
|
|
49
|
-
import { flagsForEventId, networkSavedStore, MAX_PINNED, MAX_SAVED } from "../utils/networkSavedStore";
|
|
50
|
-
import { useNetworkSaved } from "../hooks/useNetworkSaved";
|
|
51
|
-
import { useSelectedNetworkEventId } from "../hooks/useNetworkSelection";
|
|
52
|
-
import { useNetworkBadgeCounts } from "../hooks/useNetworkBadgeCounts";
|
|
53
|
-
import { useNetworkHasEvents, useNetworkHasMatches } from "../hooks/useNetworkHasMatches";
|
|
54
|
-
import { generateNetworkCopyText } from "../utils/generateNetworkCopyText";
|
|
55
|
-
import { applyIgnoredPatterns, filterNetworkEvents } from "../utils/filterNetworkEvents";
|
|
56
|
-
|
|
57
|
-
// =============================
|
|
58
|
-
// Native palette (provenance)
|
|
59
|
-
// =============================
|
|
60
|
-
|
|
61
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
62
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
63
|
-
const macOSColors = {
|
|
64
|
-
background: {
|
|
65
|
-
hover: "#1D1D1F"
|
|
66
|
-
},
|
|
67
|
-
border: {
|
|
68
|
-
default: "#2D2D2F"
|
|
69
|
-
},
|
|
70
|
-
text: {
|
|
71
|
-
primary: "#F5F5F7",
|
|
72
|
-
secondary: "#A1A1A6",
|
|
73
|
-
muted: "#8E8E93",
|
|
74
|
-
disabled: "#9E9EA0"
|
|
75
|
-
},
|
|
76
|
-
semantic: {
|
|
77
|
-
success: "#34C759",
|
|
78
|
-
error: "#FF453A",
|
|
79
|
-
warning: "#FFEB3B",
|
|
80
|
-
info: "#00B8E6",
|
|
81
|
-
infoBackground: "rgba(0, 184, 230, 0.1)",
|
|
82
|
-
debug: "#BF5AF2"
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// =============================
|
|
87
|
-
// Inline lucide icons (shared-ui icons are lucide re-exports)
|
|
88
|
-
// =============================
|
|
89
|
-
|
|
90
|
-
function Svg({
|
|
91
|
-
size = 14,
|
|
92
|
-
color = "currentColor",
|
|
93
|
-
children
|
|
94
|
-
}) {
|
|
95
|
-
return /*#__PURE__*/_jsx("svg", {
|
|
96
|
-
width: size,
|
|
97
|
-
height: size,
|
|
98
|
-
viewBox: "0 0 24 24",
|
|
99
|
-
fill: "none",
|
|
100
|
-
stroke: color,
|
|
101
|
-
strokeWidth: 2,
|
|
102
|
-
strokeLinecap: "round",
|
|
103
|
-
strokeLinejoin: "round",
|
|
104
|
-
style: {
|
|
105
|
-
flexShrink: 0,
|
|
106
|
-
display: "block"
|
|
107
|
-
},
|
|
108
|
-
children: children
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const CheckCircle = p => /*#__PURE__*/_jsxs(Svg, {
|
|
112
|
-
...p,
|
|
113
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
114
|
-
d: "M21.801 10A10 10 0 1 1 17 3.335"
|
|
115
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
116
|
-
d: "m9 11 3 3L22 4"
|
|
117
|
-
})]
|
|
118
|
-
});
|
|
119
|
-
const XCircle = p => /*#__PURE__*/_jsxs(Svg, {
|
|
120
|
-
...p,
|
|
121
|
-
children: [/*#__PURE__*/_jsx("circle", {
|
|
122
|
-
cx: "12",
|
|
123
|
-
cy: "12",
|
|
124
|
-
r: "10"
|
|
125
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
126
|
-
d: "m15 9-6 6"
|
|
127
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
128
|
-
d: "m9 9 6 6"
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
131
|
-
const Clock = p => /*#__PURE__*/_jsxs(Svg, {
|
|
132
|
-
...p,
|
|
133
|
-
children: [/*#__PURE__*/_jsx("circle", {
|
|
134
|
-
cx: "12",
|
|
135
|
-
cy: "12",
|
|
136
|
-
r: "10"
|
|
137
|
-
}), /*#__PURE__*/_jsx("polyline", {
|
|
138
|
-
points: "12 6 12 12 16 14"
|
|
139
|
-
})]
|
|
140
|
-
});
|
|
141
|
-
const Trash2 = p => /*#__PURE__*/_jsxs(Svg, {
|
|
142
|
-
...p,
|
|
143
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
144
|
-
d: "M3 6h18"
|
|
145
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
146
|
-
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"
|
|
147
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
148
|
-
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
|
149
|
-
}), /*#__PURE__*/_jsx("line", {
|
|
150
|
-
x1: "10",
|
|
151
|
-
x2: "10",
|
|
152
|
-
y1: "11",
|
|
153
|
-
y2: "17"
|
|
154
|
-
}), /*#__PURE__*/_jsx("line", {
|
|
155
|
-
x1: "14",
|
|
156
|
-
x2: "14",
|
|
157
|
-
y1: "11",
|
|
158
|
-
y2: "17"
|
|
159
|
-
})]
|
|
160
|
-
});
|
|
161
|
-
const Bookmark = p => /*#__PURE__*/_jsx(Svg, {
|
|
162
|
-
...p,
|
|
163
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
164
|
-
d: "m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"
|
|
165
|
-
})
|
|
166
|
-
});
|
|
167
|
-
const Pin = ({
|
|
168
|
-
active,
|
|
169
|
-
...p
|
|
170
|
-
}) => /*#__PURE__*/_jsx(Svg, {
|
|
171
|
-
...p,
|
|
172
|
-
children: /*#__PURE__*/_jsxs("g", {
|
|
173
|
-
transform: active ? "rotate(-45 12 12) translate(12 12) scale(0.92) translate(-12 -12)" : undefined,
|
|
174
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
175
|
-
d: "M2.97 21.03 8.18 15.82"
|
|
176
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
177
|
-
d: "M4.4 10.81 13.19 19.6"
|
|
178
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
179
|
-
d: "M5.17 10.54 11.43 8.83"
|
|
180
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
181
|
-
d: "M13.46 18.83 15.17 12.57"
|
|
182
|
-
}), /*#__PURE__*/_jsx("rect", {
|
|
183
|
-
x: "12.15",
|
|
184
|
-
y: "5.4",
|
|
185
|
-
width: "9.38",
|
|
186
|
-
height: "3.52",
|
|
187
|
-
rx: "1.07",
|
|
188
|
-
transform: "rotate(-45 16.84 7.16)"
|
|
189
|
-
})]
|
|
190
|
-
})
|
|
191
|
-
});
|
|
192
|
-
const Copy = p => /*#__PURE__*/_jsxs(Svg, {
|
|
193
|
-
...p,
|
|
194
|
-
children: [/*#__PURE__*/_jsx("rect", {
|
|
195
|
-
width: "14",
|
|
196
|
-
height: "14",
|
|
197
|
-
x: "8",
|
|
198
|
-
y: "8",
|
|
199
|
-
rx: "2",
|
|
200
|
-
ry: "2"
|
|
201
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
202
|
-
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
203
|
-
})]
|
|
204
|
-
});
|
|
205
|
-
const CheckCircle2 = p => /*#__PURE__*/_jsxs(Svg, {
|
|
206
|
-
...p,
|
|
207
|
-
children: [/*#__PURE__*/_jsx("circle", {
|
|
208
|
-
cx: "12",
|
|
209
|
-
cy: "12",
|
|
210
|
-
r: "10"
|
|
211
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
212
|
-
d: "m9 12 2 2 4-4"
|
|
213
|
-
})]
|
|
214
|
-
});
|
|
215
|
-
const AlertTriangle = p => /*#__PURE__*/_jsxs(Svg, {
|
|
216
|
-
...p,
|
|
217
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
218
|
-
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
|
|
219
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
220
|
-
d: "M12 9v4"
|
|
221
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
222
|
-
d: "M12 17h.01"
|
|
223
|
-
})]
|
|
224
|
-
});
|
|
225
|
-
/** Success / error / pending chips — tap to toggle the status filter. */
|
|
226
|
-
export function NetworkHeaderBadges({
|
|
227
|
-
activeStatus,
|
|
228
|
-
onToggleStatus,
|
|
229
|
-
ignoredPatterns,
|
|
230
|
-
paused
|
|
231
|
-
}) {
|
|
232
|
-
const counts = useNetworkBadgeCounts({
|
|
233
|
-
ignoredPatterns,
|
|
234
|
-
paused
|
|
235
|
-
});
|
|
236
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
237
|
-
style: styles.headerChipRow,
|
|
238
|
-
children: [/*#__PURE__*/_jsxs("button", {
|
|
239
|
-
type: "button",
|
|
240
|
-
style: {
|
|
241
|
-
...styles.headerChip,
|
|
242
|
-
...(activeStatus === "success" ? styles.headerChipActive : null)
|
|
243
|
-
},
|
|
244
|
-
onClick: () => onToggleStatus("success"),
|
|
245
|
-
children: [/*#__PURE__*/_jsx(CheckCircle, {
|
|
246
|
-
size: 12,
|
|
247
|
-
color: macOSColors.semantic.success
|
|
248
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
249
|
-
style: {
|
|
250
|
-
...styles.headerChipValue,
|
|
251
|
-
color: macOSColors.semantic.success
|
|
252
|
-
},
|
|
253
|
-
children: counts.successful
|
|
254
|
-
})]
|
|
255
|
-
}), /*#__PURE__*/_jsxs("button", {
|
|
256
|
-
type: "button",
|
|
257
|
-
style: {
|
|
258
|
-
...styles.headerChip,
|
|
259
|
-
...(activeStatus === "error" ? styles.headerChipActive : null)
|
|
260
|
-
},
|
|
261
|
-
onClick: () => onToggleStatus("error"),
|
|
262
|
-
children: [/*#__PURE__*/_jsx(XCircle, {
|
|
263
|
-
size: 12,
|
|
264
|
-
color: macOSColors.semantic.error
|
|
265
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
266
|
-
style: {
|
|
267
|
-
...styles.headerChipValue,
|
|
268
|
-
color: macOSColors.semantic.error
|
|
269
|
-
},
|
|
270
|
-
children: counts.failed
|
|
271
|
-
})]
|
|
272
|
-
}), /*#__PURE__*/_jsxs("button", {
|
|
273
|
-
type: "button",
|
|
274
|
-
style: {
|
|
275
|
-
...styles.headerChip,
|
|
276
|
-
...(activeStatus === "pending" ? styles.headerChipActive : null)
|
|
277
|
-
},
|
|
278
|
-
onClick: () => onToggleStatus("pending"),
|
|
279
|
-
children: [/*#__PURE__*/_jsx(Clock, {
|
|
280
|
-
size: 12,
|
|
281
|
-
color: macOSColors.semantic.warning
|
|
282
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
283
|
-
style: {
|
|
284
|
-
...styles.headerChipValue,
|
|
285
|
-
color: macOSColors.semantic.warning
|
|
286
|
-
},
|
|
287
|
-
children: counts.pending
|
|
288
|
-
})]
|
|
289
|
-
})]
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
/** Trash button — handler co-located; enabled while the store has events.
|
|
293
|
-
* Subscribes to a flip-guarded boolean, so it renders when the store goes
|
|
294
|
-
* empty↔non-empty, not on every count change. */
|
|
295
|
-
export function NetworkClearButton({
|
|
296
|
-
paused
|
|
297
|
-
}) {
|
|
298
|
-
const hasEvents = useNetworkHasEvents({
|
|
299
|
-
paused
|
|
300
|
-
});
|
|
301
|
-
return /*#__PURE__*/_jsx("button", {
|
|
302
|
-
type: "button",
|
|
303
|
-
"aria-label": "Clear network requests",
|
|
304
|
-
onClick: () => networkEventStore.clearEvents(),
|
|
305
|
-
style: {
|
|
306
|
-
...styles.headerActionButton,
|
|
307
|
-
...(!hasEvents ? styles.headerActionButtonDisabled : null)
|
|
308
|
-
},
|
|
309
|
-
disabled: !hasEvents,
|
|
310
|
-
children: /*#__PURE__*/_jsx(Trash2, {
|
|
311
|
-
size: 14,
|
|
312
|
-
color: hasEvents ? macOSColors.text.muted : macOSColors.text.disabled
|
|
313
|
-
})
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Entry point to the Saved screen, with its count. A self-subscribing leaf so
|
|
318
|
-
* the badge tracks the store without the modal header re-rendering.
|
|
319
|
-
*/
|
|
320
|
-
export function NetworkSavedButton({
|
|
321
|
-
onPress
|
|
322
|
-
}) {
|
|
323
|
-
const {
|
|
324
|
-
savedRecords
|
|
325
|
-
} = useNetworkSaved();
|
|
326
|
-
const count = savedRecords.length;
|
|
327
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
328
|
-
type: "button",
|
|
329
|
-
onClick: onPress,
|
|
330
|
-
"aria-label": "Saved requests",
|
|
331
|
-
style: styles.headerActionButton,
|
|
332
|
-
children: [/*#__PURE__*/_jsx(Bookmark, {
|
|
333
|
-
size: 14,
|
|
334
|
-
color: count > 0 ? macOSColors.semantic.debug : macOSColors.text.muted
|
|
335
|
-
}), count > 0 ? /*#__PURE__*/_jsx("span", {
|
|
336
|
-
style: styles.savedBadge,
|
|
337
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
338
|
-
style: styles.savedBadgeText,
|
|
339
|
-
children: count > 99 ? "99+" : count
|
|
340
|
-
})
|
|
341
|
-
}) : null]
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Pin + Save toggles for the request-detail header — same self-subscribing
|
|
346
|
-
* leaf as native, for the same two reasons: the host root stays free of
|
|
347
|
-
* subscriptions, and these buttons deliberately do NOT live inside
|
|
348
|
-
* `NetworkEventDetailView` (the Events tool renders that same detail view
|
|
349
|
-
* with no saved store behind it).
|
|
350
|
-
*
|
|
351
|
-
* The event object is resolved at PRESS time (live store first, then the
|
|
352
|
-
* saved snapshot), and the selected id is SUBSCRIBED here rather than passed
|
|
353
|
-
* down, so stepping through requests doesn't rebuild the host header.
|
|
354
|
-
*/
|
|
355
|
-
export function NetworkDetailPinActions({
|
|
356
|
-
isPro,
|
|
357
|
-
onUpgradePress
|
|
358
|
-
}) {
|
|
359
|
-
const eventId = useSelectedNetworkEventId();
|
|
360
|
-
const state = useNetworkSaved();
|
|
361
|
-
const {
|
|
362
|
-
pinned,
|
|
363
|
-
saved
|
|
364
|
-
} = flagsForEventId(state, eventId);
|
|
365
|
-
const savedLimit = useLimit("network.saved");
|
|
366
|
-
const atPinCap = !pinned && state.pinnedEvents.length >= MAX_PINNED;
|
|
367
|
-
const atSavedCap = !saved && state.savedRecords.length >= savedLimit;
|
|
368
|
-
const resolveEvent = () => {
|
|
369
|
-
if (!eventId) return null;
|
|
370
|
-
return networkEventStore.getEvents().find(event => event.id === eventId) ?? networkSavedStore.getEventById(eventId);
|
|
371
|
-
};
|
|
372
|
-
const handlePin = () => {
|
|
373
|
-
const event = resolveEvent();
|
|
374
|
-
if (event) state.togglePin(event);
|
|
375
|
-
};
|
|
376
|
-
const handleSave = () => {
|
|
377
|
-
// Hitting the free ceiling is an upgrade moment, not a dead button.
|
|
378
|
-
if (atSavedCap && !isPro) {
|
|
379
|
-
onUpgradePress();
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
const event = resolveEvent();
|
|
383
|
-
if (event) state.toggleSave(event);
|
|
384
|
-
};
|
|
385
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
386
|
-
children: [/*#__PURE__*/_jsx("button", {
|
|
387
|
-
type: "button",
|
|
388
|
-
onClick: handlePin,
|
|
389
|
-
disabled: atPinCap,
|
|
390
|
-
"aria-label": pinned ? "Unpin request" : "Pin request",
|
|
391
|
-
title: atPinCap ? `Pin limit reached (${MAX_PINNED})` : undefined,
|
|
392
|
-
style: {
|
|
393
|
-
...styles.headerActionButton,
|
|
394
|
-
...(pinned ? styles.headerActionButtonActive : null),
|
|
395
|
-
...(atPinCap ? styles.headerActionButtonDisabled : null)
|
|
396
|
-
},
|
|
397
|
-
children: /*#__PURE__*/_jsx(Pin, {
|
|
398
|
-
size: 14,
|
|
399
|
-
active: pinned,
|
|
400
|
-
color: pinned ? macOSColors.semantic.info : atPinCap ? macOSColors.text.disabled : macOSColors.text.secondary
|
|
401
|
-
})
|
|
402
|
-
}), /*#__PURE__*/_jsx("button", {
|
|
403
|
-
type: "button",
|
|
404
|
-
onClick: handleSave,
|
|
405
|
-
disabled: atSavedCap && isPro,
|
|
406
|
-
"aria-label": saved ? "Remove from saved" : "Save request",
|
|
407
|
-
title: atSavedCap && isPro ? `Saved limit reached (${MAX_SAVED})` : undefined,
|
|
408
|
-
style: {
|
|
409
|
-
...styles.headerActionButton,
|
|
410
|
-
...(saved ? styles.headerActionButtonSaved : null),
|
|
411
|
-
...(atSavedCap && isPro ? styles.headerActionButtonDisabled : null)
|
|
412
|
-
},
|
|
413
|
-
children: /*#__PURE__*/_jsx(Bookmark, {
|
|
414
|
-
size: 14,
|
|
415
|
-
color: saved ? macOSColors.semantic.debug : atSavedCap && isPro ? macOSColors.text.disabled : macOSColors.text.secondary
|
|
416
|
-
})
|
|
417
|
-
})]
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Copy-all-requests button. Subscribes to a flip-guarded boolean (its
|
|
422
|
-
* enabled state); the copy text is generated at PRESS time from a live
|
|
423
|
-
* store read, so there's no per-event work and no stale closure.
|
|
424
|
-
*
|
|
425
|
-
* The Pro branch inlines shared-ui CopyButton's copy/feedback loop (same
|
|
426
|
-
* icon set, 1500ms feedback, label keeps its own color while the icon
|
|
427
|
-
* follows the state — native's `labelStyle` wins over the state color).
|
|
428
|
-
*/
|
|
429
|
-
export function NetworkHeaderCopyButton({
|
|
430
|
-
isPro,
|
|
431
|
-
filter,
|
|
432
|
-
ignoredPatterns,
|
|
433
|
-
copySettings,
|
|
434
|
-
paused,
|
|
435
|
-
onUpgradePress,
|
|
436
|
-
label
|
|
437
|
-
}) {
|
|
438
|
-
const hasEvents = useNetworkHasMatches({
|
|
439
|
-
filter,
|
|
440
|
-
ignoredPatterns,
|
|
441
|
-
paused
|
|
442
|
-
});
|
|
443
|
-
const [copyState, setCopyState] = useState("idle");
|
|
444
|
-
const timeoutRef = useRef(null);
|
|
445
|
-
useEffect(() => () => {
|
|
446
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
447
|
-
}, []);
|
|
448
|
-
if (!isPro) {
|
|
449
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
450
|
-
type: "button",
|
|
451
|
-
onClick: onUpgradePress,
|
|
452
|
-
style: {
|
|
453
|
-
...(label ? styles.copyMenuRow : styles.headerActionButton),
|
|
454
|
-
...(!hasEvents ? styles.headerActionButtonDisabled : null)
|
|
455
|
-
},
|
|
456
|
-
disabled: !hasEvents,
|
|
457
|
-
"aria-label": label ?? "Copy requests",
|
|
458
|
-
children: [/*#__PURE__*/_jsx(Copy, {
|
|
459
|
-
size: 14,
|
|
460
|
-
color: hasEvents ? macOSColors.text.secondary : macOSColors.text.disabled
|
|
461
|
-
}), label ? /*#__PURE__*/_jsx("span", {
|
|
462
|
-
style: styles.copyMenuLabel,
|
|
463
|
-
children: label
|
|
464
|
-
}) : null]
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
const settle = state => {
|
|
468
|
-
setCopyState(state);
|
|
469
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
470
|
-
// 1500ms — shared-ui CopyButton's `feedbackDuration` default.
|
|
471
|
-
timeoutRef.current = setTimeout(() => {
|
|
472
|
-
setCopyState("idle");
|
|
473
|
-
timeoutRef.current = null;
|
|
474
|
-
}, 1500);
|
|
475
|
-
};
|
|
476
|
-
const handleCopy = async () => {
|
|
477
|
-
try {
|
|
478
|
-
// Lazy value: resolved at copy time from the LIVE store — no per-event
|
|
479
|
-
// work, no staleness (native's CopyButton function-value contract).
|
|
480
|
-
const text = generateNetworkCopyText(filterNetworkEvents(applyIgnoredPatterns(networkEventStore.getEvents(), ignoredPatterns), filter), copySettings);
|
|
481
|
-
await navigator.clipboard.writeText(text);
|
|
482
|
-
settle("success");
|
|
483
|
-
} catch {
|
|
484
|
-
settle("error");
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
const iconColor = copyState === "success" ? macOSColors.semantic.success : copyState === "error" ? macOSColors.semantic.error : hasEvents ? macOSColors.text.secondary : macOSColors.text.disabled;
|
|
488
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
489
|
-
type: "button",
|
|
490
|
-
onClick: copyState === "idle" ? handleCopy : undefined,
|
|
491
|
-
style: {
|
|
492
|
-
...(label ? styles.copyMenuRow : styles.headerActionButton),
|
|
493
|
-
...(!hasEvents ? styles.headerActionButtonDisabled : null)
|
|
494
|
-
},
|
|
495
|
-
disabled: !hasEvents,
|
|
496
|
-
"aria-label": copyState === "idle" ? label ?? "Copy to clipboard" : copyState === "success" ? "Copied to clipboard" : "Failed to copy",
|
|
497
|
-
children: [copyState === "success" ? /*#__PURE__*/_jsx(CheckCircle2, {
|
|
498
|
-
size: 14,
|
|
499
|
-
color: iconColor
|
|
500
|
-
}) : copyState === "error" ? /*#__PURE__*/_jsx(AlertTriangle, {
|
|
501
|
-
size: 14,
|
|
502
|
-
color: iconColor
|
|
503
|
-
}) : /*#__PURE__*/_jsx(Copy, {
|
|
504
|
-
size: 14,
|
|
505
|
-
color: iconColor
|
|
506
|
-
}), label ? /*#__PURE__*/_jsx("span", {
|
|
507
|
-
style: styles.copyMenuLabel,
|
|
508
|
-
children: label
|
|
509
|
-
}) : null]
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
// Values mirror the native StyleSheet block 1:1.
|
|
514
|
-
const styles = {
|
|
515
|
-
/** The overflow-menu variant: a full-width row, matching the other items. */
|
|
516
|
-
copyMenuRow: {
|
|
517
|
-
display: "flex",
|
|
518
|
-
width: "100%",
|
|
519
|
-
boxSizing: "border-box",
|
|
520
|
-
flexDirection: "row",
|
|
521
|
-
alignItems: "center",
|
|
522
|
-
gap: 10,
|
|
523
|
-
padding: "11px 6px",
|
|
524
|
-
justifyContent: "flex-start",
|
|
525
|
-
background: "none",
|
|
526
|
-
border: "none",
|
|
527
|
-
cursor: "pointer",
|
|
528
|
-
margin: 0,
|
|
529
|
-
fontFamily: "inherit",
|
|
530
|
-
textAlign: "left"
|
|
531
|
-
},
|
|
532
|
-
copyMenuLabel: {
|
|
533
|
-
fontSize: 13,
|
|
534
|
-
fontWeight: 600,
|
|
535
|
-
color: macOSColors.text.primary
|
|
536
|
-
},
|
|
537
|
-
headerChipRow: {
|
|
538
|
-
display: "flex",
|
|
539
|
-
flexDirection: "row",
|
|
540
|
-
alignItems: "center",
|
|
541
|
-
gap: 8
|
|
542
|
-
},
|
|
543
|
-
/**
|
|
544
|
-
* Counter chips and toolbar buttons carry a permanent outline; the fill
|
|
545
|
-
* marks the active filter.
|
|
546
|
-
*/
|
|
547
|
-
headerChip: {
|
|
548
|
-
display: "inline-flex",
|
|
549
|
-
flexDirection: "row",
|
|
550
|
-
alignItems: "center",
|
|
551
|
-
gap: 4,
|
|
552
|
-
backgroundColor: macOSColors.background.hover,
|
|
553
|
-
padding: "5px 10px",
|
|
554
|
-
borderRadius: 12,
|
|
555
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
556
|
-
cursor: "pointer",
|
|
557
|
-
margin: 0
|
|
558
|
-
},
|
|
559
|
-
headerChipActive: {
|
|
560
|
-
backgroundColor: macOSColors.semantic.infoBackground,
|
|
561
|
-
border: `1px solid ${macOSColors.semantic.info}50`,
|
|
562
|
-
// Native: shadowColor info, offset 0/1, opacity 0.08, radius 2.
|
|
563
|
-
boxShadow: "0 1px 2px rgba(0, 184, 230, 0.08)"
|
|
564
|
-
},
|
|
565
|
-
headerChipValue: {
|
|
566
|
-
fontSize: 12,
|
|
567
|
-
fontWeight: 600,
|
|
568
|
-
fontFamily: "ui-monospace, Menlo, monospace"
|
|
569
|
-
},
|
|
570
|
-
headerActionButton: {
|
|
571
|
-
position: "relative",
|
|
572
|
-
display: "inline-flex",
|
|
573
|
-
width: 32,
|
|
574
|
-
height: 32,
|
|
575
|
-
boxSizing: "border-box",
|
|
576
|
-
borderRadius: 8,
|
|
577
|
-
backgroundColor: macOSColors.background.hover,
|
|
578
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
579
|
-
alignItems: "center",
|
|
580
|
-
justifyContent: "center",
|
|
581
|
-
cursor: "pointer",
|
|
582
|
-
padding: 0,
|
|
583
|
-
margin: 0
|
|
584
|
-
},
|
|
585
|
-
headerActionButtonDisabled: {
|
|
586
|
-
opacity: 0.55,
|
|
587
|
-
cursor: "default"
|
|
588
|
-
},
|
|
589
|
-
headerActionButtonActive: {
|
|
590
|
-
backgroundColor: macOSColors.semantic.infoBackground,
|
|
591
|
-
border: `1px solid ${macOSColors.semantic.info}50`
|
|
592
|
-
},
|
|
593
|
-
headerActionButtonSaved: {
|
|
594
|
-
backgroundColor: `${macOSColors.semantic.debug}1A`,
|
|
595
|
-
border: `1px solid ${macOSColors.semantic.debug}50`
|
|
596
|
-
},
|
|
597
|
-
savedBadge: {
|
|
598
|
-
position: "absolute",
|
|
599
|
-
top: -3,
|
|
600
|
-
right: -3,
|
|
601
|
-
minWidth: 14,
|
|
602
|
-
height: 14,
|
|
603
|
-
boxSizing: "border-box",
|
|
604
|
-
padding: "0 3px",
|
|
605
|
-
borderRadius: 7,
|
|
606
|
-
backgroundColor: macOSColors.semantic.debug,
|
|
607
|
-
display: "inline-flex",
|
|
608
|
-
alignItems: "center",
|
|
609
|
-
justifyContent: "center"
|
|
610
|
-
},
|
|
611
|
-
savedBadgeText: {
|
|
612
|
-
color: "#FFFFFF",
|
|
613
|
-
fontSize: 9,
|
|
614
|
-
fontWeight: 700,
|
|
615
|
-
fontFamily: "ui-monospace, Menlo, monospace"
|
|
616
|
-
}
|
|
617
|
-
};
|
|
1
|
+
"use strict";import{useEffect as B,useRef as F,useState as S}from"react";import{useLimit as E}from"@buoy-gg/shared-ui";import{networkEventStore as v}from"../utils/networkEventStore";import{flagsForEventId as M,networkSavedStore as z,MAX_PINNED as C,MAX_SAVED as D}from"../utils/networkSavedStore";import{useNetworkSaved as k}from"../hooks/useNetworkSaved";import{useSelectedNetworkEventId as N}from"../hooks/useNetworkSelection";import{useNetworkBadgeCounts as R}from"../hooks/useNetworkBadgeCounts";import{useNetworkHasEvents as I,useNetworkHasMatches as V}from"../hooks/useNetworkHasMatches";import{generateNetworkCopyText as j}from"../utils/generateNetworkCopyText";import{applyIgnoredPatterns as L,filterNetworkEvents as $}from"../utils/filterNetworkEvents";import{jsx as e,jsxs as a,Fragment as T}from"react/jsx-runtime";const n={background:{hover:"#1D1D1F"},border:{default:"#2D2D2F"},text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",disabled:"#9E9EA0"},semantic:{success:"#34C759",error:"#FF453A",warning:"#FFEB3B",info:"#00B8E6",infoBackground:"rgba(0, 184, 230, 0.1)",debug:"#BF5AF2"}};function p({size:t=14,color:r="currentColor",children:i}){return e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:i})}const q=t=>a(p,{...t,children:[e("path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}),e("path",{d:"m9 11 3 3L22 4"})]});const H=t=>a(p,{...t,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m15 9-6 6"}),e("path",{d:"m9 9 6 6"})]});const W=t=>a(p,{...t,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})]});const _=t=>a(p,{...t,children:[e("path",{d:"M3 6h18"}),e("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),e("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]});const A=t=>e(p,{...t,children:e("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})});const P=({active:t,...r})=>e(p,{...r,children:a("g",{transform:t?"rotate(-45 12 12) translate(12 12) scale(0.92) translate(-12 -12)":void 0,children:[e("path",{d:"M2.97 21.03 8.18 15.82"}),e("path",{d:"M4.4 10.81 13.19 19.6"}),e("path",{d:"M5.17 10.54 11.43 8.83"}),e("path",{d:"M13.46 18.83 15.17 12.57"}),e("rect",{x:"12.15",y:"5.4",width:"9.38",height:"3.52",rx:"1.07",transform:"rotate(-45 16.84 7.16)"})]})});const w=t=>a(p,{...t,children:[e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]});const X=t=>a(p,{...t,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m9 12 2 2 4-4"})]});const O=t=>a(p,{...t,children:[e("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),e("path",{d:"M12 9v4"}),e("path",{d:"M12 17h.01"})]});export function NetworkHeaderBadges({activeStatus:t,onToggleStatus:r,ignoredPatterns:i,paused:u}){const s=R({ignoredPatterns:i,paused:u});return a("div",{style:o.headerChipRow,children:[a("button",{type:"button",style:{...o.headerChip,...t==="success"?o.headerChipActive:null},onClick:()=>r("success"),children:[e(q,{size:12,color:n.semantic.success}),e("span",{style:{...o.headerChipValue,color:n.semantic.success},children:s.successful})]}),a("button",{type:"button",style:{...o.headerChip,...t==="error"?o.headerChipActive:null},onClick:()=>r("error"),children:[e(H,{size:12,color:n.semantic.error}),e("span",{style:{...o.headerChipValue,color:n.semantic.error},children:s.failed})]}),a("button",{type:"button",style:{...o.headerChip,...t==="pending"?o.headerChipActive:null},onClick:()=>r("pending"),children:[e(W,{size:12,color:n.semantic.warning}),e("span",{style:{...o.headerChipValue,color:n.semantic.warning},children:s.pending})]})]})}export function NetworkClearButton({paused:t}){const r=I({paused:t});return e("button",{type:"button","aria-label":"Clear network requests",onClick:()=>v.clearEvents(),style:{...o.headerActionButton,...!r?o.headerActionButtonDisabled:null},disabled:!r,children:e(_,{size:14,color:r?n.text.muted:n.text.disabled})})}export function NetworkSavedButton({onPress:t}){const{savedRecords:r}=k();const i=r.length;return a("button",{type:"button",onClick:t,"aria-label":"Saved requests",style:o.headerActionButton,children:[e(A,{size:14,color:i>0?n.semantic.debug:n.text.muted}),i>0?e("span",{style:o.savedBadge,children:e("span",{style:o.savedBadgeText,children:i>99?"99+":i})}):null]})}export function NetworkDetailPinActions({isPro:t,onUpgradePress:r}){const i=N();const u=k();const{pinned:s,saved:b}=M(u,i);const l=E("network.saved");const d=!s&&u.pinnedEvents.length>=C;const c=!b&&u.savedRecords.length>=l;const y=()=>{if(!i)return null;return v.getEvents().find(h=>h.id===i)??z.getEventById(i)};const m=()=>{const h=y();if(h)u.togglePin(h)};const g=()=>{if(c&&!t){r();return}const h=y();if(h)u.toggleSave(h)};return a(T,{children:[e("button",{type:"button",onClick:m,disabled:d,"aria-label":s?"Unpin request":"Pin request",title:d?`Pin limit reached (${C})`:void 0,style:{...o.headerActionButton,...s?o.headerActionButtonActive:null,...d?o.headerActionButtonDisabled:null},children:e(P,{size:14,active:s,color:s?n.semantic.info:d?n.text.disabled:n.text.secondary})}),e("button",{type:"button",onClick:g,disabled:c&&t,"aria-label":b?"Remove from saved":"Save request",title:c&&t?`Saved limit reached (${D})`:void 0,style:{...o.headerActionButton,...b?o.headerActionButtonSaved:null,...c&&t?o.headerActionButtonDisabled:null},children:e(A,{size:14,color:b?n.semantic.debug:c&&t?n.text.disabled:n.text.secondary})})]})}export function NetworkHeaderCopyButton({isPro:t,filter:r,ignoredPatterns:i,copySettings:u,paused:s,onUpgradePress:b,label:l}){const d=V({filter:r,ignoredPatterns:i,paused:s});const[c,y]=S("idle");const m=F(null);B(()=>()=>{if(m.current)clearTimeout(m.current)},[]);if(!t){return a("button",{type:"button",onClick:b,style:{...l?o.copyMenuRow:o.headerActionButton,...!d?o.headerActionButtonDisabled:null},disabled:!d,"aria-label":l??"Copy requests",children:[e(w,{size:14,color:d?n.text.secondary:n.text.disabled}),l?e("span",{style:o.copyMenuLabel,children:l}):null]})}const g=x=>{y(x);if(m.current)clearTimeout(m.current);m.current=setTimeout(()=>{y("idle");m.current=null},1500)};const h=async()=>{try{const x=j($(L(v.getEvents(),i),r),u);await navigator.clipboard.writeText(x);g("success")}catch{g("error")}};const f=c==="success"?n.semantic.success:c==="error"?n.semantic.error:d?n.text.secondary:n.text.disabled;return a("button",{type:"button",onClick:c==="idle"?h:void 0,style:{...l?o.copyMenuRow:o.headerActionButton,...!d?o.headerActionButtonDisabled:null},disabled:!d,"aria-label":c==="idle"?l??"Copy to clipboard":c==="success"?"Copied to clipboard":"Failed to copy",children:[c==="success"?e(X,{size:14,color:f}):c==="error"?e(O,{size:14,color:f}):e(w,{size:14,color:f}),l?e("span",{style:o.copyMenuLabel,children:l}):null]})}const o={copyMenuRow:{display:"flex",width:"100%",boxSizing:"border-box",flexDirection:"row",alignItems:"center",gap:10,padding:"11px 6px",justifyContent:"flex-start",background:"none",border:"none",cursor:"pointer",margin:0,fontFamily:"inherit",textAlign:"left"},copyMenuLabel:{fontSize:13,fontWeight:600,color:n.text.primary},headerChipRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:8},headerChip:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:4,backgroundColor:n.background.hover,padding:"5px 10px",borderRadius:12,border:`1px solid ${n.border.default}`,cursor:"pointer",margin:0},headerChipActive:{backgroundColor:n.semantic.infoBackground,border:`1px solid ${n.semantic.info}50`,boxShadow:"0 1px 2px rgba(0, 184, 230, 0.08)"},headerChipValue:{fontSize:12,fontWeight:600,fontFamily:"ui-monospace, Menlo, monospace"},headerActionButton:{position:"relative",display:"inline-flex",width:32,height:32,boxSizing:"border-box",borderRadius:8,backgroundColor:n.background.hover,border:`1px solid ${n.border.default}`,alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,margin:0},headerActionButtonDisabled:{opacity:.55,cursor:"default"},headerActionButtonActive:{backgroundColor:n.semantic.infoBackground,border:`1px solid ${n.semantic.info}50`},headerActionButtonSaved:{backgroundColor:`${n.semantic.debug}1A`,border:`1px solid ${n.semantic.debug}50`},savedBadge:{position:"absolute",top:-3,right:-3,minWidth:14,height:14,boxSizing:"border-box",padding:"0 3px",borderRadius:7,backgroundColor:n.semantic.debug,display:"inline-flex",alignItems:"center",justifyContent:"center"},savedBadgeText:{color:"#FFFFFF",fontSize:9,fontWeight:700,fontFamily:"ui-monospace, Menlo, monospace"}};
|