@buoy-gg/network 7.0.40 → 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 -79
- package/lib/commonjs/index.js +1 -325
- 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 -404
- package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -625
- 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 -110
- 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 -453
- package/lib/commonjs/network/overrides/engine.js +1 -93
- package/lib/commonjs/network/overrides/matchRule.js +1 -81
- package/lib/commonjs/network/overrides/overriddenRows.js +1 -0
- 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 -393
- package/lib/commonjs/network/utils/networkListener.js +4 -1259
- 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 -0
- package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -0
- package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
- package/lib/commonjs/network/utils/startNetworkCapture.js +1 -0
- package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
- package/lib/commonjs/preset.js +1 -102
- package/lib/module/index.js +1 -103
- 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 -400
- package/lib/module/network/components/NetworkListScreen.web.js +1 -623
- 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 -106
- 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 -446
- package/lib/module/network/overrides/engine.js +1 -85
- package/lib/module/network/overrides/matchRule.js +1 -75
- package/lib/module/network/overrides/overriddenRows.js +1 -0
- 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 -391
- package/lib/module/network/utils/networkListener.js +4 -1249
- 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 -0
- package/lib/module/network/utils/resolveRequestUrl.js +1 -0
- package/lib/module/network/utils/selectSavedEvents.js +1 -35
- package/lib/module/network/utils/startNetworkCapture.js +1 -0
- package/lib/module/network/utils/withPinnedFirst.js +1 -28
- package/lib/module/preset.js +1 -100
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/network/overrides/applyToXhr.d.ts +1 -0
- 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/overriddenRows.d.ts +16 -0
- 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 +14 -4
- package/lib/typescript/network/utils/networkSavedStore.d.ts +4 -4
- package/lib/typescript/network/utils/realNow.d.ts +18 -0
- package/lib/typescript/network/utils/requestId.d.ts +2 -0
- package/lib/typescript/network/utils/resolveRequestUrl.d.ts +3 -0
- package/lib/typescript/network/utils/startNetworkCapture.d.ts +6 -0
- package/lib/web/index.mjs +145 -0
- package/package.json +32 -10
- 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/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/selectSavedEvents.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,104 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { StyleSheet, Text, TouchableOpacity } from "react-native";
|
|
4
|
-
import { night } from "@buoy-gg/shared-ui";
|
|
5
|
-
import { useOverrideRules } from "../hooks/useOverrideRules";
|
|
6
|
-
import { useSelectedNetworkEventId } from "../hooks/useNetworkSelection";
|
|
7
|
-
import { ruleMatches } from "../overrides/matchRule";
|
|
8
|
-
import { draftFromEvent } from "../overrides/presets";
|
|
9
|
-
import { networkEventStore } from "../utils/networkEventStore";
|
|
10
|
-
import { networkSavedStore } from "../utils/networkSavedStore";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The Override action, in the request-detail header.
|
|
14
|
-
*
|
|
15
|
-
* A labelled word rather than an icon: every other control here is a glyph
|
|
16
|
-
* (back, pin, bookmark) and glyphs are fine for things you already know. This
|
|
17
|
-
* one is the least familiar action in the tool, and "Override" spelled out is
|
|
18
|
-
* the entire explanation.
|
|
19
|
-
*
|
|
20
|
-
* A self-subscribing leaf, for the same two reasons `NetworkDetailPinActions`
|
|
21
|
-
* is one: the modal root stays free of subscriptions, and the selected id is
|
|
22
|
-
* subscribed here so stepping between requests doesn't rebuild the header
|
|
23
|
-
* around a new prop.
|
|
24
|
-
*
|
|
25
|
-
* It lights up while a rule covers the request you're looking at — the same
|
|
26
|
-
* warning tint the OVERRIDDEN strip and the toolbar flask use, because "you are
|
|
27
|
-
* not seeing the truth" is one idea and should look like one.
|
|
28
|
-
*
|
|
29
|
-
* Tapping it goes straight to the Overrides screen with the rule open: a new
|
|
30
|
-
* one prefilled from this request, or the existing one if something already
|
|
31
|
-
* covers it. One destination, so there's never a question of where the thing
|
|
32
|
-
* you just made went.
|
|
33
|
-
*/
|
|
34
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
|
-
export function NetworkOverrideHeaderButton({
|
|
36
|
-
onOpen
|
|
37
|
-
}) {
|
|
38
|
-
const eventId = useSelectedNetworkEventId();
|
|
39
|
-
const {
|
|
40
|
-
rules,
|
|
41
|
-
isRuleSpent
|
|
42
|
-
} = useOverrideRules();
|
|
43
|
-
|
|
44
|
-
// Resolved here rather than held as a prop: the live store has the fresh copy
|
|
45
|
-
// while a request is in flight, and the saved store is the only copy once it
|
|
46
|
-
// has been cleared or aged out.
|
|
47
|
-
const event = eventId ? networkEventStore.getEvents().find(e => e.id === eventId) ?? networkSavedStore.getEventById(eventId) : null;
|
|
48
|
-
const existing = event ? rules.find(rule => rule.enabled && !isRuleSpent(rule) && ruleMatches(rule, event.url, String(event.method || "GET"))) ?? null : null;
|
|
49
|
-
const active = existing !== null;
|
|
50
|
-
const handlePress = () => {
|
|
51
|
-
if (!event) return;
|
|
52
|
-
if (existing) {
|
|
53
|
-
// Editing what's already there, rather than stacking a second rule the
|
|
54
|
-
// first would shadow — first enabled match wins.
|
|
55
|
-
const {
|
|
56
|
-
id,
|
|
57
|
-
hits: _h,
|
|
58
|
-
seen: _s,
|
|
59
|
-
createdAt: _c,
|
|
60
|
-
...draft
|
|
61
|
-
} = existing;
|
|
62
|
-
onOpen(draft, id);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
onOpen(draftFromEvent(event));
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
68
|
-
onPress: handlePress,
|
|
69
|
-
"sentry-label": "ignore open overrides",
|
|
70
|
-
testID: "buoy-network-override-request",
|
|
71
|
-
accessibilityRole: "button",
|
|
72
|
-
accessibilityLabel: active ? "Edit the override on this request" : "Override this request",
|
|
73
|
-
style: [styles.button, active && styles.buttonActive],
|
|
74
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
75
|
-
style: [styles.label, active && styles.labelActive],
|
|
76
|
-
children: "Override"
|
|
77
|
-
})
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
const styles = StyleSheet.create({
|
|
81
|
-
// Night: the header's dark-glass chip, with the accent label the night
|
|
82
|
-
// language gives labelled actions (plate + accent ink). Active keeps the
|
|
83
|
-
// warning tint — same "you are not seeing the truth" signal as the flask.
|
|
84
|
-
button: {
|
|
85
|
-
paddingHorizontal: 10,
|
|
86
|
-
paddingVertical: 6,
|
|
87
|
-
borderRadius: 8,
|
|
88
|
-
borderWidth: 1,
|
|
89
|
-
borderColor: night.color.border,
|
|
90
|
-
backgroundColor: night.color.buttonSurface
|
|
91
|
-
},
|
|
92
|
-
buttonActive: {
|
|
93
|
-
borderColor: night.color.warning + "77",
|
|
94
|
-
backgroundColor: night.color.warningSoft
|
|
95
|
-
},
|
|
96
|
-
label: {
|
|
97
|
-
fontSize: 11,
|
|
98
|
-
fontWeight: "700",
|
|
99
|
-
color: night.color.accent
|
|
100
|
-
},
|
|
101
|
-
labelActive: {
|
|
102
|
-
color: night.color.warning
|
|
103
|
-
}
|
|
104
|
-
});
|
|
1
|
+
"use strict";import{StyleSheet as f,Text as m,TouchableOpacity as v}from"react-native";import{night as t}from"@buoy-gg/shared-ui";import{useOverrideRules as h}from"../hooks/useOverrideRules";import{useSelectedNetworkEventId as g}from"../hooks/useNetworkSelection";import{ruleMatches as p}from"../overrides/matchRule";import{draftFromEvent as S}from"../overrides/presets";import{networkEventStore as y}from"../utils/networkEventStore";import{networkSavedStore as w}from"../utils/networkSavedStore";import{jsx as c}from"react/jsx-runtime";export function NetworkOverrideHeaderButton({onOpen:s}){const n=g();const{rules:d,isRuleSpent:a}=h();const r=n?y.getEvents().find(e=>e.id===n)??w.getEventById(n):null;const i=r?d.find(e=>e.enabled&&!a(e)&&p(e,r.url,String(r.method||"GET")))??null:null;const l=i!==null;const u=()=>{if(!r)return;if(i){const{id:e,hits:k,seen:E,createdAt:x,...b}=i;s(b,e);return}s(S(r))};return c(v,{onPress:u,"sentry-label":"ignore open overrides",testID:"buoy-network-override-request",accessibilityRole:"button",accessibilityLabel:l?"Edit the override on this request":"Override this request",style:[o.button,l&&o.buttonActive],children:c(m,{style:[o.label,l&&o.labelActive],children:"Override"})})}const o=f.create({button:{paddingHorizontal:10,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:t.color.border,backgroundColor:t.color.buttonSurface},buttonActive:{borderColor:t.color.warning+"77",backgroundColor:t.color.warningSoft},label:{fontSize:11,fontWeight:"700",color:t.color.accent},labelActive:{color:t.color.warning}});
|
|
@@ -1,131 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* NetworkOverrideHeaderButton.web — DOM twin of
|
|
5
|
-
* NetworkOverrideHeaderButton.tsx.
|
|
6
|
-
*
|
|
7
|
-
* The Override action, in the request-detail header. A labelled word rather
|
|
8
|
-
* than an icon — it's the least familiar action in the tool, and "Override"
|
|
9
|
-
* spelled out is the entire explanation. A self-subscribing leaf: the
|
|
10
|
-
* selected id and the rule list are subscribed HERE so stepping between
|
|
11
|
-
* requests doesn't rebuild the header around a new prop.
|
|
12
|
-
*
|
|
13
|
-
* It lights up while a rule covers the request you're looking at — the same
|
|
14
|
-
* warning tint the OVERRIDDEN strip and the toolbar flask use. Tapping it
|
|
15
|
-
* goes straight to the Overrides screen with the rule open: a new one
|
|
16
|
-
* prefilled from this request (`draftFromEvent`), or the existing one if
|
|
17
|
-
* something already covers it (first enabled match wins, so stacking a
|
|
18
|
-
* second rule the first would shadow is never offered). (Native comments.)
|
|
19
|
-
*
|
|
20
|
-
* REUSED, not forked (all platform-free): `useOverrideRules`,
|
|
21
|
-
* `useSelectedNetworkEventId`, `ruleMatches`, `draftFromEvent`,
|
|
22
|
-
* `networkEventStore`, `networkSavedStore`.
|
|
23
|
-
*
|
|
24
|
-
* shared-ui RN chrome is replicated as DOM with provenance:
|
|
25
|
-
* - `macOSColors` — inlined verbatim subset from
|
|
26
|
-
* shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts.
|
|
27
|
-
*
|
|
28
|
-
* @platform React DOM Web
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import { useOverrideRules } from "../hooks/useOverrideRules";
|
|
32
|
-
import { useSelectedNetworkEventId } from "../hooks/useNetworkSelection";
|
|
33
|
-
import { ruleMatches } from "../overrides/matchRule";
|
|
34
|
-
import { draftFromEvent } from "../overrides/presets";
|
|
35
|
-
import { networkEventStore } from "../utils/networkEventStore";
|
|
36
|
-
import { networkSavedStore } from "../utils/networkSavedStore";
|
|
37
|
-
|
|
38
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
39
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
40
|
-
const macOSColors = {
|
|
41
|
-
background: {
|
|
42
|
-
input: "#26262A"
|
|
43
|
-
},
|
|
44
|
-
border: {
|
|
45
|
-
input: "#3D3D42"
|
|
46
|
-
},
|
|
47
|
-
text: {
|
|
48
|
-
primary: "#F5F5F7"
|
|
49
|
-
},
|
|
50
|
-
semantic: {
|
|
51
|
-
warning: "#FFEB3B",
|
|
52
|
-
warningBackground: "rgba(255, 235, 59, 0.15)"
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
export function NetworkOverrideHeaderButton({
|
|
56
|
-
onOpen
|
|
57
|
-
}) {
|
|
58
|
-
const eventId = useSelectedNetworkEventId();
|
|
59
|
-
const {
|
|
60
|
-
rules,
|
|
61
|
-
isRuleSpent
|
|
62
|
-
} = useOverrideRules();
|
|
63
|
-
|
|
64
|
-
// Resolved here rather than held as a prop: the live store has the fresh
|
|
65
|
-
// copy while a request is in flight, and the saved store is the only copy
|
|
66
|
-
// once it has been cleared or aged out. (Native comment.)
|
|
67
|
-
const event = eventId ? networkEventStore.getEvents().find(e => e.id === eventId) ?? networkSavedStore.getEventById(eventId) : null;
|
|
68
|
-
const existing = event ? rules.find(rule => rule.enabled && !isRuleSpent(rule) && ruleMatches(rule, event.url, String(event.method || "GET"))) ?? null : null;
|
|
69
|
-
const active = existing !== null;
|
|
70
|
-
const handlePress = () => {
|
|
71
|
-
if (!event) return;
|
|
72
|
-
if (existing) {
|
|
73
|
-
// Editing what's already there, rather than stacking a second rule the
|
|
74
|
-
// first would shadow — first enabled match wins.
|
|
75
|
-
const {
|
|
76
|
-
id,
|
|
77
|
-
hits: _h,
|
|
78
|
-
seen: _s,
|
|
79
|
-
createdAt: _c,
|
|
80
|
-
...draft
|
|
81
|
-
} = existing;
|
|
82
|
-
onOpen(draft, id);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
onOpen(draftFromEvent(event));
|
|
86
|
-
};
|
|
87
|
-
return /*#__PURE__*/_jsx("button", {
|
|
88
|
-
type: "button",
|
|
89
|
-
onClick: handlePress,
|
|
90
|
-
"aria-label": active ? "Edit the override on this request" : "Override this request",
|
|
91
|
-
style: {
|
|
92
|
-
...styles.button,
|
|
93
|
-
...(active ? styles.buttonActive : null)
|
|
94
|
-
},
|
|
95
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
96
|
-
style: {
|
|
97
|
-
...styles.label,
|
|
98
|
-
...(active ? styles.labelActive : null)
|
|
99
|
-
},
|
|
100
|
-
children: "Override"
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Values mirror the native StyleSheet block 1:1.
|
|
106
|
-
const styles = {
|
|
107
|
-
button: {
|
|
108
|
-
display: "inline-flex",
|
|
109
|
-
alignItems: "center",
|
|
110
|
-
padding: "6px 10px",
|
|
111
|
-
borderRadius: 6,
|
|
112
|
-
border: `1px solid ${macOSColors.border.input}`,
|
|
113
|
-
backgroundColor: macOSColors.background.input,
|
|
114
|
-
cursor: "pointer",
|
|
115
|
-
margin: 0,
|
|
116
|
-
boxSizing: "border-box"
|
|
117
|
-
},
|
|
118
|
-
buttonActive: {
|
|
119
|
-
border: `1px solid ${macOSColors.semantic.warning}77`,
|
|
120
|
-
backgroundColor: macOSColors.semantic.warningBackground
|
|
121
|
-
},
|
|
122
|
-
label: {
|
|
123
|
-
fontSize: 11,
|
|
124
|
-
fontWeight: 700,
|
|
125
|
-
color: macOSColors.text.primary,
|
|
126
|
-
fontFamily: "inherit"
|
|
127
|
-
},
|
|
128
|
-
labelActive: {
|
|
129
|
-
color: macOSColors.semantic.warning
|
|
130
|
-
}
|
|
131
|
-
};
|
|
1
|
+
"use strict";import{useOverrideRules as b}from"../hooks/useOverrideRules";import{useSelectedNetworkEventId as p}from"../hooks/useNetworkSelection";import{ruleMatches as g}from"../overrides/matchRule";import{draftFromEvent as f}from"../overrides/presets";import{networkEventStore as v}from"../utils/networkEventStore";import{networkSavedStore as x}from"../utils/networkSavedStore";import{jsx as a}from"react/jsx-runtime";const e={background:{input:"#26262A"},border:{input:"#3D3D42"},text:{primary:"#F5F5F7"},semantic:{warning:"#FFEB3B",warningBackground:"rgba(255, 235, 59, 0.15)"}};export function NetworkOverrideHeaderButton({onOpen:l}){const o=p();const{rules:d,isRuleSpent:c}=b();const r=o?v.getEvents().find(t=>t.id===o)??x.getEventById(o):null;const i=r?d.find(t=>t.enabled&&!c(t)&&g(t,r.url,String(r.method||"GET")))??null:null;const s=i!==null;const u=()=>{if(!r)return;if(i){const{id:t,hits:h,seen:k,createdAt:w,...m}=i;l(m,t);return}l(f(r))};return a("button",{type:"button",onClick:u,"aria-label":s?"Edit the override on this request":"Override this request",style:{...n.button,...s?n.buttonActive:null},children:a("span",{style:{...n.label,...s?n.labelActive:null},children:"Override"})})}const n={button:{display:"inline-flex",alignItems:"center",padding:"6px 10px",borderRadius:6,border:`1px solid ${e.border.input}`,backgroundColor:e.background.input,cursor:"pointer",margin:0,boxSizing:"border-box"},buttonActive:{border:`1px solid ${e.semantic.warning}77`,backgroundColor:e.semantic.warningBackground},label:{fontSize:11,fontWeight:700,color:e.text.primary,fontFamily:"inherit"},labelActive:{color:e.semantic.warning}};
|
|
@@ -1,87 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import { FlaskConical, night } from "@buoy-gg/shared-ui";
|
|
5
|
-
import { useOverrideRules } from "../hooks/useOverrideRules";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Header button for the Overrides screen, and the always-visible "overrides
|
|
9
|
-
* are active" indicator.
|
|
10
|
-
*
|
|
11
|
-
* A self-subscribing LEAF, like the other live header pieces: the rule list
|
|
12
|
-
* changes on its own schedule (every hit bumps a counter) and the modal shell
|
|
13
|
-
* has no business re-rendering for it.
|
|
14
|
-
*
|
|
15
|
-
* The active tint is not decoration. A rule left enabled from yesterday makes
|
|
16
|
-
* the app behave wrongly in a way that looks exactly like a real bug, so the
|
|
17
|
-
* tool has to keep saying so from the top level — Chrome shows the same
|
|
18
|
-
* warning in its Overrides pane for the same reason.
|
|
19
|
-
*/
|
|
20
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
export function NetworkOverridesButton({
|
|
22
|
-
onPress
|
|
23
|
-
}) {
|
|
24
|
-
const {
|
|
25
|
-
activeCount
|
|
26
|
-
} = useOverrideRules();
|
|
27
|
-
const active = activeCount > 0;
|
|
28
|
-
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
29
|
-
onPress: onPress,
|
|
30
|
-
"sentry-label": "ignore open overrides",
|
|
31
|
-
testID: "buoy-network-overrides",
|
|
32
|
-
accessibilityRole: "button",
|
|
33
|
-
style: [styles.button, active && styles.buttonActive],
|
|
34
|
-
accessibilityLabel: active ? `Response overrides — ${activeCount} active` : "Response overrides",
|
|
35
|
-
children: [/*#__PURE__*/_jsx(FlaskConical, {
|
|
36
|
-
size: 14,
|
|
37
|
-
color: active ? night.color.warning : night.color.textSecondary
|
|
38
|
-
}), active ? /*#__PURE__*/_jsx(View, {
|
|
39
|
-
style: styles.badge,
|
|
40
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
41
|
-
style: styles.badgeText,
|
|
42
|
-
children: activeCount
|
|
43
|
-
})
|
|
44
|
-
}) : null]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const styles = StyleSheet.create({
|
|
48
|
-
// The header's standard 32×32 action box — same shape, fill, border and
|
|
49
|
-
// radius as search/power/clear. It was a bare padded glyph, which read as a
|
|
50
|
-
// different CLASS of control than its neighbours when it is exactly the same
|
|
51
|
-
// kind of thing.
|
|
52
|
-
button: {
|
|
53
|
-
width: 32,
|
|
54
|
-
height: 32,
|
|
55
|
-
borderRadius: 8,
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
justifyContent: "center",
|
|
58
|
-
backgroundColor: night.color.buttonSurface,
|
|
59
|
-
borderWidth: 1,
|
|
60
|
-
borderColor: night.color.border
|
|
61
|
-
},
|
|
62
|
-
// Active fills the whole box, the way the power toggle goes green — the
|
|
63
|
-
// warning now reads at a glance instead of as a tinted glyph.
|
|
64
|
-
buttonActive: {
|
|
65
|
-
backgroundColor: night.color.warningSoft,
|
|
66
|
-
borderColor: night.color.warning + "77"
|
|
67
|
-
},
|
|
68
|
-
badge: {
|
|
69
|
-
position: "absolute",
|
|
70
|
-
// Inside the box now that there is one; a corner-hung badge would clip
|
|
71
|
-
// against the neighbouring buttons' 8pt gap.
|
|
72
|
-
top: 1,
|
|
73
|
-
right: 1,
|
|
74
|
-
minWidth: 12,
|
|
75
|
-
height: 12,
|
|
76
|
-
borderRadius: 6,
|
|
77
|
-
paddingHorizontal: 3,
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
justifyContent: "center",
|
|
80
|
-
backgroundColor: night.color.warning
|
|
81
|
-
},
|
|
82
|
-
badgeText: {
|
|
83
|
-
fontSize: 8,
|
|
84
|
-
fontWeight: "800",
|
|
85
|
-
color: "#000000"
|
|
86
|
-
}
|
|
87
|
-
});
|
|
1
|
+
"use strict";import{StyleSheet as s,Text as c,TouchableOpacity as l,View as a}from"react-native";import{FlaskConical as d,night as e}from"@buoy-gg/shared-ui";import{useOverrideRules as b}from"../hooks/useOverrideRules";import{jsx as i,jsxs as u}from"react/jsx-runtime";export function NetworkOverridesButton({onPress:n}){const{activeCount:r}=b();const o=r>0;return u(l,{onPress:n,"sentry-label":"ignore open overrides",testID:"buoy-network-overrides",accessibilityRole:"button",style:[t.button,o&&t.buttonActive],accessibilityLabel:o?`Response overrides \u2014 ${r} active`:"Response overrides",children:[i(d,{size:14,color:o?e.color.warning:e.color.textSecondary}),o?i(a,{style:t.badge,children:i(c,{style:t.badgeText,children:r})}):null]})}const t=s.create({button:{width:32,height:32,borderRadius:8,alignItems:"center",justifyContent:"center",backgroundColor:e.color.buttonSurface,borderWidth:1,borderColor:e.color.border},buttonActive:{backgroundColor:e.color.warningSoft,borderColor:e.color.warning+"77"},badge:{position:"absolute",top:1,right:1,minWidth:12,height:12,borderRadius:6,paddingHorizontal:3,alignItems:"center",justifyContent:"center",backgroundColor:e.color.warning},badgeText:{fontSize:8,fontWeight:"800",color:"#000000"}});
|
|
@@ -1,141 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* NetworkOverridesButton.web — DOM twin of NetworkOverridesButton.tsx.
|
|
5
|
-
*
|
|
6
|
-
* Header button for the Overrides screen, and the always-visible "overrides
|
|
7
|
-
* are active" indicator. A self-subscribing LEAF, like the other live header
|
|
8
|
-
* pieces — the rule list changes on its own schedule (every hit bumps a
|
|
9
|
-
* counter) and the modal shell has no business re-rendering for it.
|
|
10
|
-
*
|
|
11
|
-
* The active tint is not decoration: a rule left enabled from yesterday makes
|
|
12
|
-
* the app behave wrongly in a way that looks exactly like a real bug, so the
|
|
13
|
-
* tool keeps saying so from the top level. (Native comment.)
|
|
14
|
-
*
|
|
15
|
-
* REUSED, not forked: `useOverrideRules` (platform-free).
|
|
16
|
-
*
|
|
17
|
-
* shared-ui RN chrome is replicated as DOM with provenance:
|
|
18
|
-
* - `macOSColors` — inlined verbatim subset from
|
|
19
|
-
* shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts.
|
|
20
|
-
* - `FlaskConical` — inline lucide SVG (shared-ui icons are lucide
|
|
21
|
-
* re-exports).
|
|
22
|
-
*
|
|
23
|
-
* @platform React DOM Web
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import { useOverrideRules } from "../hooks/useOverrideRules";
|
|
27
|
-
|
|
28
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
29
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
-
const macOSColors = {
|
|
31
|
-
background: {
|
|
32
|
-
base: "#0A0A0C",
|
|
33
|
-
hover: "#1D1D1F"
|
|
34
|
-
},
|
|
35
|
-
border: {
|
|
36
|
-
default: "#2D2D2F"
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
secondary: "#A1A1A6"
|
|
40
|
-
},
|
|
41
|
-
semantic: {
|
|
42
|
-
warning: "#FFEB3B",
|
|
43
|
-
warningBackground: "rgba(255, 235, 59, 0.15)"
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const FlaskConical = ({
|
|
47
|
-
size = 14,
|
|
48
|
-
color
|
|
49
|
-
}) => /*#__PURE__*/_jsxs("svg", {
|
|
50
|
-
width: size,
|
|
51
|
-
height: size,
|
|
52
|
-
viewBox: "0 0 24 24",
|
|
53
|
-
fill: "none",
|
|
54
|
-
stroke: color,
|
|
55
|
-
strokeWidth: 2,
|
|
56
|
-
strokeLinecap: "round",
|
|
57
|
-
strokeLinejoin: "round",
|
|
58
|
-
style: {
|
|
59
|
-
flexShrink: 0,
|
|
60
|
-
display: "block"
|
|
61
|
-
},
|
|
62
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
63
|
-
d: "M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"
|
|
64
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
65
|
-
d: "M8.5 2h7"
|
|
66
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
67
|
-
d: "M7 16h10"
|
|
68
|
-
})]
|
|
69
|
-
});
|
|
70
|
-
export function NetworkOverridesButton({
|
|
71
|
-
onPress
|
|
72
|
-
}) {
|
|
73
|
-
const {
|
|
74
|
-
activeCount
|
|
75
|
-
} = useOverrideRules();
|
|
76
|
-
const active = activeCount > 0;
|
|
77
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
78
|
-
type: "button",
|
|
79
|
-
onClick: onPress,
|
|
80
|
-
style: {
|
|
81
|
-
...styles.button,
|
|
82
|
-
...(active ? styles.buttonActive : null)
|
|
83
|
-
},
|
|
84
|
-
"aria-label": active ? `Response overrides — ${activeCount} active` : "Response overrides",
|
|
85
|
-
children: [/*#__PURE__*/_jsx(FlaskConical, {
|
|
86
|
-
size: 14,
|
|
87
|
-
color: active ? macOSColors.semantic.warning : macOSColors.text.secondary
|
|
88
|
-
}), active ? /*#__PURE__*/_jsx("span", {
|
|
89
|
-
style: styles.badge,
|
|
90
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
91
|
-
style: styles.badgeText,
|
|
92
|
-
children: activeCount
|
|
93
|
-
})
|
|
94
|
-
}) : null]
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Values mirror the native StyleSheet block 1:1: the header's standard 32×32
|
|
99
|
-
// action box; active fills the whole box the way the power toggle goes green,
|
|
100
|
-
// with the count badge INSIDE the box.
|
|
101
|
-
const styles = {
|
|
102
|
-
button: {
|
|
103
|
-
position: "relative",
|
|
104
|
-
display: "inline-flex",
|
|
105
|
-
width: 32,
|
|
106
|
-
height: 32,
|
|
107
|
-
boxSizing: "border-box",
|
|
108
|
-
borderRadius: 8,
|
|
109
|
-
alignItems: "center",
|
|
110
|
-
justifyContent: "center",
|
|
111
|
-
backgroundColor: macOSColors.background.hover,
|
|
112
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
113
|
-
cursor: "pointer",
|
|
114
|
-
padding: 0,
|
|
115
|
-
margin: 0
|
|
116
|
-
},
|
|
117
|
-
buttonActive: {
|
|
118
|
-
backgroundColor: macOSColors.semantic.warningBackground,
|
|
119
|
-
border: `1px solid ${macOSColors.semantic.warning}77`
|
|
120
|
-
},
|
|
121
|
-
badge: {
|
|
122
|
-
position: "absolute",
|
|
123
|
-
top: 1,
|
|
124
|
-
right: 1,
|
|
125
|
-
minWidth: 12,
|
|
126
|
-
height: 12,
|
|
127
|
-
borderRadius: 6,
|
|
128
|
-
padding: "0 3px",
|
|
129
|
-
boxSizing: "border-box",
|
|
130
|
-
display: "inline-flex",
|
|
131
|
-
alignItems: "center",
|
|
132
|
-
justifyContent: "center",
|
|
133
|
-
backgroundColor: macOSColors.semantic.warning
|
|
134
|
-
},
|
|
135
|
-
badgeText: {
|
|
136
|
-
fontSize: 8,
|
|
137
|
-
fontWeight: 800,
|
|
138
|
-
color: macOSColors.background.base,
|
|
139
|
-
lineHeight: 1
|
|
140
|
-
}
|
|
141
|
-
};
|
|
1
|
+
"use strict";import{useOverrideRules as a}from"../hooks/useOverrideRules";import{jsx as n,jsxs as s}from"react/jsx-runtime";const e={background:{base:"#0A0A0C",hover:"#1D1D1F"},border:{default:"#2D2D2F"},text:{secondary:"#A1A1A6"},semantic:{warning:"#FFEB3B",warningBackground:"rgba(255, 235, 59, 0.15)"}};const d=({size:o=14,color:t})=>s("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:[n("path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"}),n("path",{d:"M8.5 2h7"}),n("path",{d:"M7 16h10"})]});export function NetworkOverridesButton({onPress:o}){const{activeCount:t}=a();const r=t>0;return s("button",{type:"button",onClick:o,style:{...i.button,...r?i.buttonActive:null},"aria-label":r?`Response overrides \u2014 ${t} active`:"Response overrides",children:[n(d,{size:14,color:r?e.semantic.warning:e.text.secondary}),r?n("span",{style:i.badge,children:n("span",{style:i.badgeText,children:t})}):null]})}const i={button:{position:"relative",display:"inline-flex",width:32,height:32,boxSizing:"border-box",borderRadius:8,alignItems:"center",justifyContent:"center",backgroundColor:e.background.hover,border:`1px solid ${e.border.default}`,cursor:"pointer",padding:0,margin:0},buttonActive:{backgroundColor:e.semantic.warningBackground,border:`1px solid ${e.semantic.warning}77`},badge:{position:"absolute",top:1,right:1,minWidth:12,height:12,borderRadius:6,padding:"0 3px",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:e.semantic.warning},badgeText:{fontSize:8,fontWeight:800,color:e.background.base,lineHeight:1}};
|