@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,174 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native";
|
|
5
|
-
import { absoluteFill, macOSColors } from "@buoy-gg/shared-ui";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Entering one number, without the keyboard eating the screen.
|
|
9
|
-
*
|
|
10
|
-
* The custom status / delay / times fields used to be inline inputs sitting
|
|
11
|
-
* mid-form. Focusing one raises the keyboard, which on a phone covers roughly
|
|
12
|
-
* the bottom half of the tool — including, depending on where you'd scrolled,
|
|
13
|
-
* the field you were typing into and the Save button you needed next.
|
|
14
|
-
*
|
|
15
|
-
* Pinning the panel to the TOP is the fix, and it's the same one
|
|
16
|
-
* `StorageValueEditModal` reached for: a centred panel gets shoved up or
|
|
17
|
-
* covered the moment the field focuses, and a bottom sheet is simply
|
|
18
|
-
* underneath it. At the top it stays put and stays readable.
|
|
19
|
-
*
|
|
20
|
-
* Deliberately not a reuse of that component — this asks for a number and
|
|
21
|
-
* nothing else. It has no type inference, no raw-JSON escape hatch and no
|
|
22
|
-
* shape-preservation rules, so borrowing 400 lines to avoid writing 100 would
|
|
23
|
-
* be the wrong trade.
|
|
24
|
-
*/
|
|
25
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
export function NetworkNumberPrompt({
|
|
27
|
-
title,
|
|
28
|
-
hint,
|
|
29
|
-
value,
|
|
30
|
-
placeholder = "Number",
|
|
31
|
-
min,
|
|
32
|
-
max,
|
|
33
|
-
onSubmit,
|
|
34
|
-
onCancel
|
|
35
|
-
}) {
|
|
36
|
-
const [text, setText] = useState(value != null ? String(value) : "");
|
|
37
|
-
const submit = () => {
|
|
38
|
-
const trimmed = text.trim();
|
|
39
|
-
if (!trimmed) {
|
|
40
|
-
onSubmit(null);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const parsed = Number(trimmed);
|
|
44
|
-
if (!Number.isFinite(parsed)) {
|
|
45
|
-
onSubmit(null);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
// Clamped here rather than accepted-then-silently-changed: a field that
|
|
49
|
-
// takes 999 and stores 599 is a field that lies.
|
|
50
|
-
let next = parsed;
|
|
51
|
-
if (min != null) next = Math.max(min, next);
|
|
52
|
-
if (max != null) next = Math.min(max, next);
|
|
53
|
-
onSubmit(next);
|
|
54
|
-
};
|
|
55
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
56
|
-
style: styles.overlay,
|
|
57
|
-
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
58
|
-
style: styles.backdrop,
|
|
59
|
-
activeOpacity: 1,
|
|
60
|
-
onPress: onCancel,
|
|
61
|
-
"sentry-label": "ignore dismiss number prompt"
|
|
62
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
63
|
-
style: styles.panel,
|
|
64
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
65
|
-
style: styles.title,
|
|
66
|
-
children: title
|
|
67
|
-
}), /*#__PURE__*/_jsx(TextInput, {
|
|
68
|
-
style: styles.input,
|
|
69
|
-
value: text,
|
|
70
|
-
onChangeText: setText,
|
|
71
|
-
placeholder: placeholder,
|
|
72
|
-
placeholderTextColor: macOSColors.text.muted,
|
|
73
|
-
keyboardType: "number-pad",
|
|
74
|
-
autoFocus: true,
|
|
75
|
-
selectTextOnFocus: true,
|
|
76
|
-
onSubmitEditing: submit,
|
|
77
|
-
returnKeyType: "done",
|
|
78
|
-
"sentry-label": "ignore number prompt input",
|
|
79
|
-
accessibilityLabel: title
|
|
80
|
-
}), hint ? /*#__PURE__*/_jsx(Text, {
|
|
81
|
-
style: styles.hint,
|
|
82
|
-
children: hint
|
|
83
|
-
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
84
|
-
style: styles.actions,
|
|
85
|
-
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
86
|
-
onPress: onCancel,
|
|
87
|
-
"sentry-label": "ignore cancel number prompt",
|
|
88
|
-
style: [styles.button, styles.cancelButton],
|
|
89
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
90
|
-
style: styles.cancelText,
|
|
91
|
-
children: "Cancel"
|
|
92
|
-
})
|
|
93
|
-
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
94
|
-
onPress: submit,
|
|
95
|
-
"sentry-label": "ignore save number prompt",
|
|
96
|
-
style: [styles.button, styles.saveButton],
|
|
97
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
98
|
-
style: styles.saveText,
|
|
99
|
-
children: "Set"
|
|
100
|
-
})
|
|
101
|
-
})]
|
|
102
|
-
})]
|
|
103
|
-
})]
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
const styles = StyleSheet.create({
|
|
107
|
-
overlay: {
|
|
108
|
-
...absoluteFill,
|
|
109
|
-
zIndex: 40
|
|
110
|
-
},
|
|
111
|
-
backdrop: {
|
|
112
|
-
...absoluteFill,
|
|
113
|
-
backgroundColor: "rgba(0,0,0,0.6)"
|
|
114
|
-
},
|
|
115
|
-
panel: {
|
|
116
|
-
marginHorizontal: 12,
|
|
117
|
-
marginTop: 12,
|
|
118
|
-
padding: 14,
|
|
119
|
-
borderRadius: 10,
|
|
120
|
-
borderWidth: 1,
|
|
121
|
-
borderColor: macOSColors.border.hover,
|
|
122
|
-
backgroundColor: macOSColors.background.card,
|
|
123
|
-
gap: 10
|
|
124
|
-
},
|
|
125
|
-
title: {
|
|
126
|
-
fontSize: 13,
|
|
127
|
-
fontWeight: "700",
|
|
128
|
-
color: macOSColors.text.primary
|
|
129
|
-
},
|
|
130
|
-
input: {
|
|
131
|
-
backgroundColor: macOSColors.background.input,
|
|
132
|
-
borderWidth: 1,
|
|
133
|
-
borderColor: macOSColors.border.input,
|
|
134
|
-
borderRadius: 6,
|
|
135
|
-
paddingHorizontal: 12,
|
|
136
|
-
paddingVertical: 10,
|
|
137
|
-
fontSize: 16,
|
|
138
|
-
fontWeight: "700",
|
|
139
|
-
color: macOSColors.text.primary
|
|
140
|
-
},
|
|
141
|
-
hint: {
|
|
142
|
-
fontSize: 10,
|
|
143
|
-
color: macOSColors.text.muted
|
|
144
|
-
},
|
|
145
|
-
actions: {
|
|
146
|
-
flexDirection: "row",
|
|
147
|
-
gap: 8
|
|
148
|
-
},
|
|
149
|
-
button: {
|
|
150
|
-
flex: 1,
|
|
151
|
-
paddingVertical: 10,
|
|
152
|
-
borderRadius: 6,
|
|
153
|
-
alignItems: "center",
|
|
154
|
-
borderWidth: 1
|
|
155
|
-
},
|
|
156
|
-
cancelButton: {
|
|
157
|
-
borderColor: macOSColors.border.default,
|
|
158
|
-
backgroundColor: macOSColors.background.base
|
|
159
|
-
},
|
|
160
|
-
cancelText: {
|
|
161
|
-
fontSize: 12,
|
|
162
|
-
fontWeight: "600",
|
|
163
|
-
color: macOSColors.text.secondary
|
|
164
|
-
},
|
|
165
|
-
saveButton: {
|
|
166
|
-
borderColor: macOSColors.semantic.info,
|
|
167
|
-
backgroundColor: `${macOSColors.semantic.info}22`
|
|
168
|
-
},
|
|
169
|
-
saveText: {
|
|
170
|
-
fontSize: 12,
|
|
171
|
-
fontWeight: "700",
|
|
172
|
-
color: macOSColors.semantic.info
|
|
173
|
-
}
|
|
174
|
-
});
|
|
1
|
+
"use strict";import{useState as C}from"react";import{StyleSheet as S,Text as n,TextInput as v,TouchableOpacity as i,View as a}from"react-native";import{absoluteFill as f,macOSColors as e}from"@buoy-gg/shared-ui";import{jsx as r,jsxs as s}from"react/jsx-runtime";export function NetworkNumberPrompt({title:c,hint:d,value:u,placeholder:T="Number",min:b,max:p,onSubmit:l,onCancel:m}){const[g,k]=C(u!=null?String(u):"");const y=()=>{const h=g.trim();if(!h){l(null);return}const x=Number(h);if(!Number.isFinite(x)){l(null);return}let o=x;if(b!=null)o=Math.max(b,o);if(p!=null)o=Math.min(p,o);l(o)};return s(a,{style:t.overlay,children:[r(i,{style:t.backdrop,activeOpacity:1,onPress:m,"sentry-label":"ignore dismiss number prompt"}),s(a,{style:t.panel,children:[r(n,{style:t.title,children:c}),r(v,{style:t.input,value:g,onChangeText:k,placeholder:T,placeholderTextColor:e.text.muted,keyboardType:"number-pad",autoFocus:true,selectTextOnFocus:true,onSubmitEditing:y,returnKeyType:"done","sentry-label":"ignore number prompt input",accessibilityLabel:c}),d?r(n,{style:t.hint,children:d}):null,s(a,{style:t.actions,children:[r(i,{onPress:m,"sentry-label":"ignore cancel number prompt",style:[t.button,t.cancelButton],children:r(n,{style:t.cancelText,children:"Cancel"})}),r(i,{onPress:y,"sentry-label":"ignore save number prompt",style:[t.button,t.saveButton],children:r(n,{style:t.saveText,children:"Set"})})]})]})]})}const t=S.create({overlay:{...f,zIndex:40},backdrop:{...f,backgroundColor:"rgba(0,0,0,0.6)"},panel:{marginHorizontal:12,marginTop:12,padding:14,borderRadius:10,borderWidth:1,borderColor:e.border.hover,backgroundColor:e.background.card,gap:10},title:{fontSize:13,fontWeight:"700",color:e.text.primary},input:{backgroundColor:e.background.input,borderWidth:1,borderColor:e.border.input,borderRadius:6,paddingHorizontal:12,paddingVertical:10,fontSize:16,fontWeight:"700",color:e.text.primary},hint:{fontSize:10,color:e.text.muted},actions:{flexDirection:"row",gap:8},button:{flex:1,paddingVertical:10,borderRadius:6,alignItems:"center",borderWidth:1},cancelButton:{borderColor:e.border.default,backgroundColor:e.background.base},cancelText:{fontSize:12,fontWeight:"600",color:e.text.secondary},saveButton:{borderColor:e.semantic.info,backgroundColor:`${e.semantic.info}22`},saveText:{fontSize:12,fontWeight:"700",color:e.semantic.info}});
|
|
@@ -1,230 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* NetworkNumberPrompt.web — DOM twin of NetworkNumberPrompt.tsx.
|
|
5
|
-
*
|
|
6
|
-
* Entering one number, pinned to the TOP of the tool so the (mobile) keyboard
|
|
7
|
-
* can't cover it — the panel keeps the same placement so the two surfaces
|
|
8
|
-
* read identically. Same clamp-on-submit semantics: a field that takes 999
|
|
9
|
-
* and stores 599 is a field that lies, so min/max clamp BEFORE `onSubmit`.
|
|
10
|
-
*
|
|
11
|
-
* shared-ui RN chrome is replicated as DOM with provenance (web consumers
|
|
12
|
-
* resolve `@buoy-gg/shared-ui` to a minimal shim):
|
|
13
|
-
* - `macOSColors` — inlined verbatim subset from
|
|
14
|
-
* shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts.
|
|
15
|
-
* - `absoluteFill` — inset: 0.
|
|
16
|
-
*
|
|
17
|
-
* Intentional deviations (all logged):
|
|
18
|
-
* - `selectTextOnFocus` → an explicit `select()` in the autoFocus ref
|
|
19
|
-
* callback (DOM inputs don't select-all on focus by default).
|
|
20
|
-
* - `keyboardType="number-pad"` → `inputMode="numeric"`; Enter submits
|
|
21
|
-
* (native `onSubmitEditing`/`returnKeyType="done"`), Escape cancels (the
|
|
22
|
-
* keyboard affordance the backdrop tap covers on touch).
|
|
23
|
-
*
|
|
24
|
-
* @platform React DOM Web
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { useState } from "react";
|
|
28
|
-
|
|
29
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
30
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
|
-
const macOSColors = {
|
|
32
|
-
background: {
|
|
33
|
-
base: "#0A0A0C",
|
|
34
|
-
card: "#1A1A1C",
|
|
35
|
-
input: "#26262A"
|
|
36
|
-
},
|
|
37
|
-
border: {
|
|
38
|
-
default: "#2D2D2F",
|
|
39
|
-
input: "#3D3D42",
|
|
40
|
-
hover: "#4D4D4F"
|
|
41
|
-
},
|
|
42
|
-
text: {
|
|
43
|
-
primary: "#F5F5F7",
|
|
44
|
-
secondary: "#A1A1A6",
|
|
45
|
-
muted: "#8E8E93"
|
|
46
|
-
},
|
|
47
|
-
semantic: {
|
|
48
|
-
info: "#00B8E6"
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export function NetworkNumberPrompt({
|
|
52
|
-
title,
|
|
53
|
-
hint,
|
|
54
|
-
value,
|
|
55
|
-
placeholder = "Number",
|
|
56
|
-
min,
|
|
57
|
-
max,
|
|
58
|
-
onSubmit,
|
|
59
|
-
onCancel
|
|
60
|
-
}) {
|
|
61
|
-
const [text, setText] = useState(value != null ? String(value) : "");
|
|
62
|
-
const submit = () => {
|
|
63
|
-
const trimmed = text.trim();
|
|
64
|
-
if (!trimmed) {
|
|
65
|
-
onSubmit(null);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const parsed = Number(trimmed);
|
|
69
|
-
if (!Number.isFinite(parsed)) {
|
|
70
|
-
onSubmit(null);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// Clamped here rather than accepted-then-silently-changed: a field that
|
|
74
|
-
// takes 999 and stores 599 is a field that lies. (Native comment.)
|
|
75
|
-
let next = parsed;
|
|
76
|
-
if (min != null) next = Math.max(min, next);
|
|
77
|
-
if (max != null) next = Math.min(max, next);
|
|
78
|
-
onSubmit(next);
|
|
79
|
-
};
|
|
80
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
81
|
-
style: styles.overlay,
|
|
82
|
-
children: [/*#__PURE__*/_jsx("button", {
|
|
83
|
-
type: "button",
|
|
84
|
-
"aria-label": "Dismiss",
|
|
85
|
-
onClick: onCancel,
|
|
86
|
-
style: styles.backdrop
|
|
87
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
88
|
-
style: styles.panel,
|
|
89
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
90
|
-
style: styles.title,
|
|
91
|
-
children: title
|
|
92
|
-
}), /*#__PURE__*/_jsx("input", {
|
|
93
|
-
style: styles.input,
|
|
94
|
-
value: text,
|
|
95
|
-
onChange: e => setText(e.target.value),
|
|
96
|
-
placeholder: placeholder,
|
|
97
|
-
inputMode: "numeric"
|
|
98
|
-
// DEVIATION (logged in the file header): autoFocus + select() stands
|
|
99
|
-
// in for native `selectTextOnFocus`.
|
|
100
|
-
,
|
|
101
|
-
ref: node => {
|
|
102
|
-
if (node) {
|
|
103
|
-
node.focus();
|
|
104
|
-
node.select();
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
onKeyDown: e => {
|
|
108
|
-
if (e.key === "Enter") submit();
|
|
109
|
-
if (e.key === "Escape") onCancel();
|
|
110
|
-
},
|
|
111
|
-
"aria-label": title
|
|
112
|
-
}), hint ? /*#__PURE__*/_jsx("div", {
|
|
113
|
-
style: styles.hint,
|
|
114
|
-
children: hint
|
|
115
|
-
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
116
|
-
style: styles.actions,
|
|
117
|
-
children: [/*#__PURE__*/_jsx("button", {
|
|
118
|
-
type: "button",
|
|
119
|
-
onClick: onCancel,
|
|
120
|
-
style: {
|
|
121
|
-
...styles.button,
|
|
122
|
-
...styles.cancelButton
|
|
123
|
-
},
|
|
124
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
125
|
-
style: styles.cancelText,
|
|
126
|
-
children: "Cancel"
|
|
127
|
-
})
|
|
128
|
-
}), /*#__PURE__*/_jsx("button", {
|
|
129
|
-
type: "button",
|
|
130
|
-
onClick: submit,
|
|
131
|
-
style: {
|
|
132
|
-
...styles.button,
|
|
133
|
-
...styles.saveButton
|
|
134
|
-
},
|
|
135
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
136
|
-
style: styles.saveText,
|
|
137
|
-
children: "Set"
|
|
138
|
-
})
|
|
139
|
-
})]
|
|
140
|
-
})]
|
|
141
|
-
})]
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Values mirror the native StyleSheet block 1:1.
|
|
146
|
-
const styles = {
|
|
147
|
-
overlay: {
|
|
148
|
-
position: "absolute",
|
|
149
|
-
inset: 0,
|
|
150
|
-
zIndex: 40
|
|
151
|
-
},
|
|
152
|
-
backdrop: {
|
|
153
|
-
position: "absolute",
|
|
154
|
-
inset: 0,
|
|
155
|
-
backgroundColor: "rgba(0,0,0,0.6)",
|
|
156
|
-
border: "none",
|
|
157
|
-
padding: 0,
|
|
158
|
-
margin: 0,
|
|
159
|
-
cursor: "default",
|
|
160
|
-
width: "100%",
|
|
161
|
-
height: "100%"
|
|
162
|
-
},
|
|
163
|
-
panel: {
|
|
164
|
-
position: "relative",
|
|
165
|
-
margin: "12px 12px 0",
|
|
166
|
-
padding: 14,
|
|
167
|
-
borderRadius: 10,
|
|
168
|
-
border: `1px solid ${macOSColors.border.hover}`,
|
|
169
|
-
backgroundColor: macOSColors.background.card,
|
|
170
|
-
display: "flex",
|
|
171
|
-
flexDirection: "column",
|
|
172
|
-
gap: 10
|
|
173
|
-
},
|
|
174
|
-
title: {
|
|
175
|
-
fontSize: 13,
|
|
176
|
-
fontWeight: 700,
|
|
177
|
-
color: macOSColors.text.primary
|
|
178
|
-
},
|
|
179
|
-
input: {
|
|
180
|
-
backgroundColor: macOSColors.background.input,
|
|
181
|
-
border: `1px solid ${macOSColors.border.input}`,
|
|
182
|
-
borderRadius: 6,
|
|
183
|
-
padding: "10px 12px",
|
|
184
|
-
fontSize: 16,
|
|
185
|
-
fontWeight: 700,
|
|
186
|
-
color: macOSColors.text.primary,
|
|
187
|
-
outline: "none",
|
|
188
|
-
fontFamily: "inherit",
|
|
189
|
-
boxSizing: "border-box",
|
|
190
|
-
width: "100%"
|
|
191
|
-
},
|
|
192
|
-
hint: {
|
|
193
|
-
fontSize: 10,
|
|
194
|
-
color: macOSColors.text.muted
|
|
195
|
-
},
|
|
196
|
-
actions: {
|
|
197
|
-
display: "flex",
|
|
198
|
-
flexDirection: "row",
|
|
199
|
-
gap: 8
|
|
200
|
-
},
|
|
201
|
-
button: {
|
|
202
|
-
flex: 1,
|
|
203
|
-
padding: "10px 0",
|
|
204
|
-
borderRadius: 6,
|
|
205
|
-
display: "inline-flex",
|
|
206
|
-
alignItems: "center",
|
|
207
|
-
justifyContent: "center",
|
|
208
|
-
cursor: "pointer",
|
|
209
|
-
margin: 0,
|
|
210
|
-
boxSizing: "border-box"
|
|
211
|
-
},
|
|
212
|
-
cancelButton: {
|
|
213
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
214
|
-
backgroundColor: macOSColors.background.base
|
|
215
|
-
},
|
|
216
|
-
cancelText: {
|
|
217
|
-
fontSize: 12,
|
|
218
|
-
fontWeight: 600,
|
|
219
|
-
color: macOSColors.text.secondary
|
|
220
|
-
},
|
|
221
|
-
saveButton: {
|
|
222
|
-
border: `1px solid ${macOSColors.semantic.info}`,
|
|
223
|
-
backgroundColor: `${macOSColors.semantic.info}22`
|
|
224
|
-
},
|
|
225
|
-
saveText: {
|
|
226
|
-
fontSize: 12,
|
|
227
|
-
fontWeight: 700,
|
|
228
|
-
color: macOSColors.semantic.info
|
|
229
|
-
}
|
|
230
|
-
};
|
|
1
|
+
"use strict";import{useState as m}from"react";import{jsx as n,jsxs as a}from"react/jsx-runtime";const t={background:{base:"#0A0A0C",card:"#1A1A1C",input:"#26262A"},border:{default:"#2D2D2F",input:"#3D3D42",hover:"#4D4D4F"},text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93"},semantic:{info:"#00B8E6"}};export function NetworkNumberPrompt({title:s,hint:d,value:c,placeholder:g="Number",min:u,max:p,onSubmit:i,onCancel:l}){const[b,y]=m(c!=null?String(c):"");const x=()=>{const o=b.trim();if(!o){i(null);return}const f=Number(o);if(!Number.isFinite(f)){i(null);return}let r=f;if(u!=null)r=Math.max(u,r);if(p!=null)r=Math.min(p,r);i(r)};return a("div",{style:e.overlay,children:[n("button",{type:"button","aria-label":"Dismiss",onClick:l,style:e.backdrop}),a("div",{style:e.panel,children:[n("div",{style:e.title,children:s}),n("input",{style:e.input,value:b,onChange:o=>y(o.target.value),placeholder:g,inputMode:"numeric",ref:o=>{if(o){o.focus();o.select()}},onKeyDown:o=>{if(o.key==="Enter")x();if(o.key==="Escape")l()},"aria-label":s}),d?n("div",{style:e.hint,children:d}):null,a("div",{style:e.actions,children:[n("button",{type:"button",onClick:l,style:{...e.button,...e.cancelButton},children:n("span",{style:e.cancelText,children:"Cancel"})}),n("button",{type:"button",onClick:x,style:{...e.button,...e.saveButton},children:n("span",{style:e.saveText,children:"Set"})})]})]})]})}const e={overlay:{position:"absolute",inset:0,zIndex:40},backdrop:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.6)",border:"none",padding:0,margin:0,cursor:"default",width:"100%",height:"100%"},panel:{position:"relative",margin:"12px 12px 0",padding:14,borderRadius:10,border:`1px solid ${t.border.hover}`,backgroundColor:t.background.card,display:"flex",flexDirection:"column",gap:10},title:{fontSize:13,fontWeight:700,color:t.text.primary},input:{backgroundColor:t.background.input,border:`1px solid ${t.border.input}`,borderRadius:6,padding:"10px 12px",fontSize:16,fontWeight:700,color:t.text.primary,outline:"none",fontFamily:"inherit",boxSizing:"border-box",width:"100%"},hint:{fontSize:10,color:t.text.muted},actions:{display:"flex",flexDirection:"row",gap:8},button:{flex:1,padding:"10px 0",borderRadius:6,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:0,boxSizing:"border-box"},cancelButton:{border:`1px solid ${t.border.default}`,backgroundColor:t.background.base},cancelText:{fontSize:12,fontWeight:600,color:t.text.secondary},saveButton:{border:`1px solid ${t.semantic.info}`,backgroundColor:`${t.semantic.info}22`},saveText:{fontSize:12,fontWeight:700,color:t.semantic.info}};
|