postboy-tui 1.3.3 → 1.3.5
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/dist/cli.js +539 -203
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -67534,7 +67534,7 @@ var useFocusManager = () => {
|
|
|
67534
67534
|
};
|
|
67535
67535
|
var use_focus_manager_default = useFocusManager;
|
|
67536
67536
|
// src/ui/app/ui.tsx
|
|
67537
|
-
var
|
|
67537
|
+
var import_react32 = __toESM(require_react(), 1);
|
|
67538
67538
|
|
|
67539
67539
|
// src/utils/history.ts
|
|
67540
67540
|
import { promises as fs2 } from "fs";
|
|
@@ -67831,24 +67831,31 @@ var Spinner = ({ theme }) => {
|
|
|
67831
67831
|
// src/ui/app/components/Formfield.tsx
|
|
67832
67832
|
var import_react24 = __toESM(require_react(), 1);
|
|
67833
67833
|
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67834
|
-
var
|
|
67835
|
-
const
|
|
67834
|
+
var InputDialog = ({ label, value, onChange, onClose, theme, suggestions = [] }) => {
|
|
67835
|
+
const [localValue, setLocalValue] = import_react24.useState(value);
|
|
67836
67836
|
const [showSuggestions, setShowSuggestions] = import_react24.useState(false);
|
|
67837
67837
|
const [filteredSuggestions, setFilteredSuggestions] = import_react24.useState([]);
|
|
67838
67838
|
const [highlightedIndex, setHighlightedIndex] = import_react24.useState(0);
|
|
67839
67839
|
import_react24.useEffect(() => {
|
|
67840
|
-
if (
|
|
67841
|
-
const filtered = suggestions.filter((s) => s.toLowerCase().startsWith(
|
|
67840
|
+
if (suggestions.length > 0 && localValue) {
|
|
67841
|
+
const filtered = suggestions.filter((s) => s.toLowerCase().startsWith(localValue.toLowerCase()));
|
|
67842
67842
|
setFilteredSuggestions(filtered);
|
|
67843
67843
|
setShowSuggestions(filtered.length > 0);
|
|
67844
67844
|
setHighlightedIndex(0);
|
|
67845
67845
|
} else {
|
|
67846
67846
|
setShowSuggestions(false);
|
|
67847
67847
|
}
|
|
67848
|
-
}, [
|
|
67848
|
+
}, [localValue, suggestions]);
|
|
67849
67849
|
use_input_default((input, key) => {
|
|
67850
|
-
if (
|
|
67850
|
+
if (key.escape) {
|
|
67851
|
+
onClose();
|
|
67852
|
+
return;
|
|
67853
|
+
}
|
|
67854
|
+
if (key.return && !showSuggestions) {
|
|
67855
|
+
onChange(localValue);
|
|
67856
|
+
onClose();
|
|
67851
67857
|
return;
|
|
67858
|
+
}
|
|
67852
67859
|
if (showSuggestions && (key.upArrow || key.downArrow)) {
|
|
67853
67860
|
setHighlightedIndex((idx) => {
|
|
67854
67861
|
if (key.upArrow)
|
|
@@ -67861,88 +67868,411 @@ var FormField = ({ label, value, onChange, placeholder, theme, suggestions = []
|
|
|
67861
67868
|
}
|
|
67862
67869
|
if (showSuggestions && (key.return || key.tab)) {
|
|
67863
67870
|
if (filteredSuggestions.length > 0 && typeof filteredSuggestions[highlightedIndex] === "string") {
|
|
67864
|
-
|
|
67871
|
+
setLocalValue(filteredSuggestions[highlightedIndex]);
|
|
67865
67872
|
setShowSuggestions(false);
|
|
67866
67873
|
}
|
|
67867
67874
|
return;
|
|
67868
67875
|
}
|
|
67869
67876
|
if (key.backspace || key.delete) {
|
|
67870
|
-
|
|
67877
|
+
setLocalValue((v) => v.slice(0, -1));
|
|
67871
67878
|
return;
|
|
67872
67879
|
}
|
|
67873
67880
|
if (!key.upArrow && !key.downArrow && !key.leftArrow && !key.rightArrow && !key.return && !key.tab) {
|
|
67874
|
-
|
|
67881
|
+
setLocalValue((v) => v + input);
|
|
67875
67882
|
}
|
|
67876
|
-
}
|
|
67883
|
+
});
|
|
67877
67884
|
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67878
67885
|
flexDirection: "column",
|
|
67886
|
+
borderStyle: "double",
|
|
67887
|
+
borderColor: theme.accent,
|
|
67888
|
+
padding: 1,
|
|
67889
|
+
marginY: 1,
|
|
67879
67890
|
children: [
|
|
67880
67891
|
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67892
|
+
marginBottom: 1,
|
|
67881
67893
|
children: [
|
|
67882
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(
|
|
67883
|
-
|
|
67884
|
-
|
|
67885
|
-
|
|
67886
|
-
|
|
67887
|
-
|
|
67888
|
-
|
|
67889
|
-
|
|
67890
|
-
|
|
67894
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67895
|
+
color: theme.accent,
|
|
67896
|
+
bold: true,
|
|
67897
|
+
children: [
|
|
67898
|
+
"Edit ",
|
|
67899
|
+
label
|
|
67900
|
+
]
|
|
67901
|
+
}, undefined, true, undefined, this),
|
|
67902
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67903
|
+
color: theme.muted,
|
|
67904
|
+
children: " (Enter to save, Esc to cancel)"
|
|
67905
|
+
}, undefined, false, undefined, this)
|
|
67906
|
+
]
|
|
67907
|
+
}, undefined, true, undefined, this),
|
|
67908
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67909
|
+
borderStyle: "round",
|
|
67910
|
+
borderColor: theme.primary,
|
|
67911
|
+
paddingX: 1,
|
|
67912
|
+
children: [
|
|
67913
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67914
|
+
color: theme.white,
|
|
67915
|
+
children: localValue
|
|
67891
67916
|
}, undefined, false, undefined, this),
|
|
67892
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(
|
|
67893
|
-
|
|
67894
|
-
|
|
67895
|
-
paddingX: 1,
|
|
67896
|
-
flexGrow: 1,
|
|
67897
|
-
children: value ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67898
|
-
color: isFocused ? theme.white : theme.primary,
|
|
67899
|
-
children: value
|
|
67900
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67901
|
-
color: theme.muted,
|
|
67902
|
-
children: placeholder
|
|
67903
|
-
}, undefined, false, undefined, this)
|
|
67917
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67918
|
+
color: theme.accent,
|
|
67919
|
+
children: "▌"
|
|
67904
67920
|
}, undefined, false, undefined, this)
|
|
67905
67921
|
]
|
|
67906
67922
|
}, undefined, true, undefined, this),
|
|
67907
67923
|
showSuggestions && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67908
67924
|
flexDirection: "column",
|
|
67909
|
-
|
|
67925
|
+
marginTop: 1,
|
|
67910
67926
|
borderStyle: "round",
|
|
67911
67927
|
borderColor: theme.muted,
|
|
67912
67928
|
children: filteredSuggestions.filter((s) => typeof s === "string" && s.trim().length > 0).map((s, idx) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67913
67929
|
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67914
|
-
color: idx === highlightedIndex ? theme.
|
|
67915
|
-
children:
|
|
67916
|
-
|
|
67930
|
+
color: idx === highlightedIndex ? theme.accent : theme.primary,
|
|
67931
|
+
children: [
|
|
67932
|
+
idx === highlightedIndex ? "▸ " : " ",
|
|
67933
|
+
typeof s === "string" ? s : "[invalid]"
|
|
67934
|
+
]
|
|
67935
|
+
}, undefined, true, undefined, this)
|
|
67917
67936
|
}, s || idx, false, undefined, this))
|
|
67918
67937
|
}, undefined, false, undefined, this)
|
|
67919
67938
|
]
|
|
67920
67939
|
}, undefined, true, undefined, this);
|
|
67921
67940
|
};
|
|
67941
|
+
var FormField = ({ label, value, onChange, placeholder, theme, suggestions = [], onFocusChange }) => {
|
|
67942
|
+
const { isFocused } = use_focus_default();
|
|
67943
|
+
const [showDialog, setShowDialog] = import_react24.useState(false);
|
|
67944
|
+
import_react24.useEffect(() => {
|
|
67945
|
+
onFocusChange?.(isFocused || showDialog);
|
|
67946
|
+
}, [isFocused, showDialog, onFocusChange]);
|
|
67947
|
+
use_input_default((_, key) => {
|
|
67948
|
+
if (isFocused && key.return && !showDialog) {
|
|
67949
|
+
setShowDialog(true);
|
|
67950
|
+
}
|
|
67951
|
+
}, { isActive: isFocused && !showDialog });
|
|
67952
|
+
const handleDialogClose = () => {
|
|
67953
|
+
setShowDialog(false);
|
|
67954
|
+
};
|
|
67955
|
+
const handleDialogSave = (newValue) => {
|
|
67956
|
+
onChange(newValue);
|
|
67957
|
+
};
|
|
67958
|
+
if (showDialog) {
|
|
67959
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(InputDialog, {
|
|
67960
|
+
label,
|
|
67961
|
+
value,
|
|
67962
|
+
onChange: handleDialogSave,
|
|
67963
|
+
onClose: handleDialogClose,
|
|
67964
|
+
theme,
|
|
67965
|
+
suggestions
|
|
67966
|
+
}, undefined, false, undefined, this);
|
|
67967
|
+
}
|
|
67968
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67969
|
+
flexDirection: "column",
|
|
67970
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67971
|
+
children: [
|
|
67972
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67973
|
+
width: 8,
|
|
67974
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67975
|
+
color: isFocused ? theme.accent : theme.muted,
|
|
67976
|
+
children: [
|
|
67977
|
+
label,
|
|
67978
|
+
":"
|
|
67979
|
+
]
|
|
67980
|
+
}, undefined, true, undefined, this)
|
|
67981
|
+
}, undefined, false, undefined, this),
|
|
67982
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
67983
|
+
borderStyle: "round",
|
|
67984
|
+
borderColor: isFocused ? theme.primary : theme.muted,
|
|
67985
|
+
paddingX: 1,
|
|
67986
|
+
flexGrow: 1,
|
|
67987
|
+
children: [
|
|
67988
|
+
value ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67989
|
+
color: isFocused ? theme.white : theme.primary,
|
|
67990
|
+
children: value
|
|
67991
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67992
|
+
color: theme.muted,
|
|
67993
|
+
children: placeholder
|
|
67994
|
+
}, undefined, false, undefined, this),
|
|
67995
|
+
isFocused && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
67996
|
+
color: theme.muted,
|
|
67997
|
+
children: " (Press Enter to edit)"
|
|
67998
|
+
}, undefined, false, undefined, this)
|
|
67999
|
+
]
|
|
68000
|
+
}, undefined, true, undefined, this)
|
|
68001
|
+
]
|
|
68002
|
+
}, undefined, true, undefined, this)
|
|
68003
|
+
}, undefined, false, undefined, this);
|
|
68004
|
+
};
|
|
67922
68005
|
|
|
67923
|
-
// src/ui/app/components/
|
|
68006
|
+
// src/ui/app/components/keyvaluefield.tsx
|
|
68007
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
67924
68008
|
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68009
|
+
var KeyValueDialog = ({ label, pairs, onSave, onClose, theme }) => {
|
|
68010
|
+
const [localPairs, setLocalPairs] = import_react25.useState(pairs.length > 0 ? pairs : [{ key: "", value: "" }]);
|
|
68011
|
+
const [activeField, setActiveField] = import_react25.useState("key");
|
|
68012
|
+
const [activeRow, setActiveRow] = import_react25.useState(0);
|
|
68013
|
+
use_input_default((input, key) => {
|
|
68014
|
+
if (key.escape) {
|
|
68015
|
+
onClose();
|
|
68016
|
+
return;
|
|
68017
|
+
}
|
|
68018
|
+
if (key.ctrl && key.return) {
|
|
68019
|
+
onSave(localPairs.filter((p) => p.key.trim() !== ""));
|
|
68020
|
+
onClose();
|
|
68021
|
+
return;
|
|
68022
|
+
}
|
|
68023
|
+
if (key.tab) {
|
|
68024
|
+
if (activeField === "key") {
|
|
68025
|
+
setActiveField("value");
|
|
68026
|
+
} else {
|
|
68027
|
+
setActiveField("key");
|
|
68028
|
+
if (activeRow < localPairs.length - 1) {
|
|
68029
|
+
setActiveRow((r) => r + 1);
|
|
68030
|
+
}
|
|
68031
|
+
}
|
|
68032
|
+
return;
|
|
68033
|
+
}
|
|
68034
|
+
if (key.upArrow) {
|
|
68035
|
+
if (activeRow > 0)
|
|
68036
|
+
setActiveRow((r) => r - 1);
|
|
68037
|
+
return;
|
|
68038
|
+
}
|
|
68039
|
+
if (key.downArrow) {
|
|
68040
|
+
if (activeRow < localPairs.length - 1)
|
|
68041
|
+
setActiveRow((r) => r + 1);
|
|
68042
|
+
return;
|
|
68043
|
+
}
|
|
68044
|
+
if (key.return) {
|
|
68045
|
+
setLocalPairs((p) => [...p, { key: "", value: "" }]);
|
|
68046
|
+
setActiveRow(localPairs.length);
|
|
68047
|
+
setActiveField("key");
|
|
68048
|
+
return;
|
|
68049
|
+
}
|
|
68050
|
+
if (key.backspace || key.delete) {
|
|
68051
|
+
setLocalPairs((p) => {
|
|
68052
|
+
const newPairs = [...p];
|
|
68053
|
+
const current = newPairs[activeRow];
|
|
68054
|
+
if (!current)
|
|
68055
|
+
return newPairs;
|
|
68056
|
+
if (activeField === "key") {
|
|
68057
|
+
if (current.key === "" && newPairs.length > 1) {
|
|
68058
|
+
newPairs.splice(activeRow, 1);
|
|
68059
|
+
setActiveRow(Math.max(0, activeRow - 1));
|
|
68060
|
+
} else {
|
|
68061
|
+
newPairs[activeRow] = { key: current.key.slice(0, -1), value: current.value };
|
|
68062
|
+
}
|
|
68063
|
+
} else {
|
|
68064
|
+
newPairs[activeRow] = { key: current.key, value: current.value.slice(0, -1) };
|
|
68065
|
+
}
|
|
68066
|
+
return newPairs;
|
|
68067
|
+
});
|
|
68068
|
+
return;
|
|
68069
|
+
}
|
|
68070
|
+
if (!key.upArrow && !key.downArrow && !key.leftArrow && !key.rightArrow && !key.return && !key.tab) {
|
|
68071
|
+
setLocalPairs((p) => {
|
|
68072
|
+
const newPairs = [...p];
|
|
68073
|
+
const current = newPairs[activeRow];
|
|
68074
|
+
if (!current)
|
|
68075
|
+
return newPairs;
|
|
68076
|
+
if (activeField === "key") {
|
|
68077
|
+
newPairs[activeRow] = { key: current.key + input, value: current.value };
|
|
68078
|
+
} else {
|
|
68079
|
+
newPairs[activeRow] = { key: current.key, value: current.value + input };
|
|
68080
|
+
}
|
|
68081
|
+
return newPairs;
|
|
68082
|
+
});
|
|
68083
|
+
}
|
|
68084
|
+
});
|
|
68085
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68086
|
+
flexDirection: "column",
|
|
68087
|
+
borderStyle: "double",
|
|
68088
|
+
borderColor: theme.accent,
|
|
68089
|
+
padding: 1,
|
|
68090
|
+
marginY: 1,
|
|
68091
|
+
children: [
|
|
68092
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68093
|
+
marginBottom: 1,
|
|
68094
|
+
children: [
|
|
68095
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68096
|
+
color: theme.accent,
|
|
68097
|
+
bold: true,
|
|
68098
|
+
children: [
|
|
68099
|
+
"Edit ",
|
|
68100
|
+
label
|
|
68101
|
+
]
|
|
68102
|
+
}, undefined, true, undefined, this),
|
|
68103
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68104
|
+
color: theme.muted,
|
|
68105
|
+
children: " (Tab: switch field, Enter: new row, Ctrl+Enter: save, Esc: cancel)"
|
|
68106
|
+
}, undefined, false, undefined, this)
|
|
68107
|
+
]
|
|
68108
|
+
}, undefined, true, undefined, this),
|
|
68109
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68110
|
+
flexDirection: "column",
|
|
68111
|
+
gap: 1,
|
|
68112
|
+
children: localPairs.map((pair, idx) => /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68113
|
+
gap: 1,
|
|
68114
|
+
children: [
|
|
68115
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68116
|
+
width: 4,
|
|
68117
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68118
|
+
color: theme.muted,
|
|
68119
|
+
children: [
|
|
68120
|
+
idx + 1,
|
|
68121
|
+
"."
|
|
68122
|
+
]
|
|
68123
|
+
}, undefined, true, undefined, this)
|
|
68124
|
+
}, undefined, false, undefined, this),
|
|
68125
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68126
|
+
borderStyle: "round",
|
|
68127
|
+
borderColor: idx === activeRow && activeField === "key" ? theme.accent : theme.muted,
|
|
68128
|
+
paddingX: 1,
|
|
68129
|
+
width: "40%",
|
|
68130
|
+
children: [
|
|
68131
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68132
|
+
color: theme.muted,
|
|
68133
|
+
children: "Key: "
|
|
68134
|
+
}, undefined, false, undefined, this),
|
|
68135
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68136
|
+
color: idx === activeRow && activeField === "key" ? theme.white : theme.primary,
|
|
68137
|
+
children: pair.key
|
|
68138
|
+
}, undefined, false, undefined, this),
|
|
68139
|
+
idx === activeRow && activeField === "key" && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68140
|
+
color: theme.accent,
|
|
68141
|
+
children: "▌"
|
|
68142
|
+
}, undefined, false, undefined, this)
|
|
68143
|
+
]
|
|
68144
|
+
}, undefined, true, undefined, this),
|
|
68145
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68146
|
+
borderStyle: "round",
|
|
68147
|
+
borderColor: idx === activeRow && activeField === "value" ? theme.accent : theme.muted,
|
|
68148
|
+
paddingX: 1,
|
|
68149
|
+
flexGrow: 1,
|
|
68150
|
+
children: [
|
|
68151
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68152
|
+
color: theme.muted,
|
|
68153
|
+
children: "Value: "
|
|
68154
|
+
}, undefined, false, undefined, this),
|
|
68155
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68156
|
+
color: idx === activeRow && activeField === "value" ? theme.white : theme.primary,
|
|
68157
|
+
children: pair.value
|
|
68158
|
+
}, undefined, false, undefined, this),
|
|
68159
|
+
idx === activeRow && activeField === "value" && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68160
|
+
color: theme.accent,
|
|
68161
|
+
children: "▌"
|
|
68162
|
+
}, undefined, false, undefined, this)
|
|
68163
|
+
]
|
|
68164
|
+
}, undefined, true, undefined, this)
|
|
68165
|
+
]
|
|
68166
|
+
}, idx, true, undefined, this))
|
|
68167
|
+
}, undefined, false, undefined, this)
|
|
68168
|
+
]
|
|
68169
|
+
}, undefined, true, undefined, this);
|
|
68170
|
+
};
|
|
68171
|
+
var KeyValueField = ({ label, value, onChange, placeholder, theme, onFocusChange }) => {
|
|
68172
|
+
const { isFocused } = use_focus_default();
|
|
68173
|
+
const [showDialog, setShowDialog] = import_react25.useState(false);
|
|
68174
|
+
import_react25.useEffect(() => {
|
|
68175
|
+
onFocusChange?.(isFocused || showDialog);
|
|
68176
|
+
}, [isFocused, showDialog, onFocusChange]);
|
|
68177
|
+
const parseJsonToPairs = (json) => {
|
|
68178
|
+
try {
|
|
68179
|
+
const obj = JSON.parse(json || "{}");
|
|
68180
|
+
return Object.entries(obj).map(([key, val]) => ({ key, value: String(val) }));
|
|
68181
|
+
} catch {
|
|
68182
|
+
return [];
|
|
68183
|
+
}
|
|
68184
|
+
};
|
|
68185
|
+
const pairsToJson = (pairs2) => {
|
|
68186
|
+
const obj = {};
|
|
68187
|
+
pairs2.forEach((p) => {
|
|
68188
|
+
if (p.key.trim())
|
|
68189
|
+
obj[p.key] = p.value;
|
|
68190
|
+
});
|
|
68191
|
+
return Object.keys(obj).length > 0 ? JSON.stringify(obj) : "";
|
|
68192
|
+
};
|
|
68193
|
+
use_input_default((_, key) => {
|
|
68194
|
+
if (isFocused && key.return && !showDialog) {
|
|
68195
|
+
setShowDialog(true);
|
|
68196
|
+
}
|
|
68197
|
+
}, { isActive: isFocused && !showDialog });
|
|
68198
|
+
const handleDialogClose = () => {
|
|
68199
|
+
setShowDialog(false);
|
|
68200
|
+
};
|
|
68201
|
+
const handleDialogSave = (pairs2) => {
|
|
68202
|
+
onChange(pairsToJson(pairs2));
|
|
68203
|
+
};
|
|
68204
|
+
const pairs = parseJsonToPairs(value);
|
|
68205
|
+
const displayValue = pairs.length > 0 ? pairs.map((p) => `${p.key}: ${p.value}`).join(", ") : "";
|
|
68206
|
+
if (showDialog) {
|
|
68207
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(KeyValueDialog, {
|
|
68208
|
+
label,
|
|
68209
|
+
pairs,
|
|
68210
|
+
onSave: handleDialogSave,
|
|
68211
|
+
onClose: handleDialogClose,
|
|
68212
|
+
theme
|
|
68213
|
+
}, undefined, false, undefined, this);
|
|
68214
|
+
}
|
|
68215
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68216
|
+
flexDirection: "column",
|
|
68217
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68218
|
+
children: [
|
|
68219
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68220
|
+
width: 8,
|
|
68221
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68222
|
+
color: isFocused ? theme.accent : theme.muted,
|
|
68223
|
+
children: [
|
|
68224
|
+
label,
|
|
68225
|
+
":"
|
|
68226
|
+
]
|
|
68227
|
+
}, undefined, true, undefined, this)
|
|
68228
|
+
}, undefined, false, undefined, this),
|
|
68229
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
68230
|
+
borderStyle: "round",
|
|
68231
|
+
borderColor: isFocused ? theme.primary : theme.muted,
|
|
68232
|
+
paddingX: 1,
|
|
68233
|
+
flexGrow: 1,
|
|
68234
|
+
children: [
|
|
68235
|
+
displayValue ? /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68236
|
+
color: isFocused ? theme.white : theme.primary,
|
|
68237
|
+
children: displayValue
|
|
68238
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68239
|
+
color: theme.muted,
|
|
68240
|
+
children: placeholder
|
|
68241
|
+
}, undefined, false, undefined, this),
|
|
68242
|
+
isFocused && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
68243
|
+
color: theme.muted,
|
|
68244
|
+
children: " (Press Enter to edit)"
|
|
68245
|
+
}, undefined, false, undefined, this)
|
|
68246
|
+
]
|
|
68247
|
+
}, undefined, true, undefined, this)
|
|
68248
|
+
]
|
|
68249
|
+
}, undefined, true, undefined, this)
|
|
68250
|
+
}, undefined, false, undefined, this);
|
|
68251
|
+
};
|
|
68252
|
+
|
|
68253
|
+
// src/ui/app/components/tabcomps.tsx
|
|
68254
|
+
var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67925
68255
|
var TabItem = ({ name, label, isActive, onChange, theme }) => {
|
|
67926
68256
|
const { isFocused } = use_focus_default();
|
|
67927
68257
|
use_input_default((_, key) => {
|
|
67928
68258
|
if (isFocused && key.return)
|
|
67929
68259
|
onChange(name);
|
|
67930
68260
|
});
|
|
67931
|
-
return /* @__PURE__ */
|
|
68261
|
+
return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
67932
68262
|
borderStyle: "round",
|
|
67933
68263
|
borderTopColor: "grey",
|
|
67934
68264
|
borderColor: isActive ? theme.colors.accent : isFocused ? theme.colors.primary : "transparent",
|
|
67935
68265
|
paddingX: 1,
|
|
67936
68266
|
marginRight: 1,
|
|
67937
|
-
children: /* @__PURE__ */
|
|
68267
|
+
children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
67938
68268
|
color: isActive ? theme.colors.accent : isFocused ? theme.colors.primary : theme.colors.white,
|
|
67939
68269
|
bold: isActive || isFocused,
|
|
67940
68270
|
children: label
|
|
67941
68271
|
}, undefined, false, undefined, this)
|
|
67942
68272
|
}, undefined, false, undefined, this);
|
|
67943
68273
|
};
|
|
67944
|
-
var Tabs = ({ tabs, activeTab, onChange, theme }) => /* @__PURE__ */
|
|
67945
|
-
children: tabs.map((tab2) => /* @__PURE__ */
|
|
68274
|
+
var Tabs = ({ tabs, activeTab, onChange, theme }) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
68275
|
+
children: tabs.map((tab2) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(TabItem, {
|
|
67946
68276
|
...tab2,
|
|
67947
68277
|
isActive: activeTab === tab2.name,
|
|
67948
68278
|
onChange,
|
|
@@ -67951,7 +68281,7 @@ var Tabs = ({ tabs, activeTab, onChange, theme }) => /* @__PURE__ */ jsx_dev_run
|
|
|
67951
68281
|
}, undefined, false, undefined, this);
|
|
67952
68282
|
|
|
67953
68283
|
// src/ui/app/components/historylist.tsx
|
|
67954
|
-
var
|
|
68284
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
67955
68285
|
|
|
67956
68286
|
// src/utils/colors.ts
|
|
67957
68287
|
var getStatusColor = (status, theme) => {
|
|
@@ -67965,7 +68295,7 @@ var getStatusColor = (status, theme) => {
|
|
|
67965
68295
|
};
|
|
67966
68296
|
|
|
67967
68297
|
// src/ui/app/components/historylist.tsx
|
|
67968
|
-
var
|
|
68298
|
+
var jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67969
68299
|
var HistoryListItem = ({ item, isSelected, theme }) => {
|
|
67970
68300
|
const shortenUrl = (url) => {
|
|
67971
68301
|
try {
|
|
@@ -67977,43 +68307,43 @@ var HistoryListItem = ({ item, isSelected, theme }) => {
|
|
|
67977
68307
|
}
|
|
67978
68308
|
};
|
|
67979
68309
|
const statusColor = item.responseStatus ? getStatusColor(item.responseStatus.toString(), theme) : theme.colors.muted;
|
|
67980
|
-
return /* @__PURE__ */
|
|
68310
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
67981
68311
|
paddingX: 1,
|
|
67982
68312
|
borderColor: isSelected ? theme.colors.accent : "transparent",
|
|
67983
|
-
children: /* @__PURE__ */
|
|
68313
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
67984
68314
|
flexDirection: "column",
|
|
67985
68315
|
children: [
|
|
67986
|
-
/* @__PURE__ */
|
|
68316
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
67987
68317
|
children: [
|
|
67988
|
-
/* @__PURE__ */
|
|
68318
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
67989
68319
|
marginRight: 1,
|
|
67990
68320
|
width: 5,
|
|
67991
|
-
children: /* @__PURE__ */
|
|
68321
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
67992
68322
|
color: statusColor,
|
|
67993
68323
|
bold: isSelected,
|
|
67994
68324
|
children: String(item.responseStatus || "---").padStart(3, " ")
|
|
67995
68325
|
}, undefined, false, undefined, this)
|
|
67996
68326
|
}, undefined, false, undefined, this),
|
|
67997
|
-
/* @__PURE__ */
|
|
68327
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
67998
68328
|
width: 7,
|
|
67999
|
-
children: /* @__PURE__ */
|
|
68329
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
68000
68330
|
color: isSelected ? theme.colors.accent : theme.colors.primary,
|
|
68001
68331
|
bold: isSelected,
|
|
68002
68332
|
children: item.method.padEnd(7)
|
|
68003
68333
|
}, undefined, false, undefined, this)
|
|
68004
68334
|
}, undefined, false, undefined, this),
|
|
68005
|
-
/* @__PURE__ */
|
|
68335
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
68006
68336
|
flexGrow: 1,
|
|
68007
|
-
children: /* @__PURE__ */
|
|
68337
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
68008
68338
|
color: isSelected ? theme.colors.white : theme.colors.muted,
|
|
68009
68339
|
children: shortenUrl(item.url)
|
|
68010
68340
|
}, undefined, false, undefined, this)
|
|
68011
68341
|
}, undefined, false, undefined, this)
|
|
68012
68342
|
]
|
|
68013
68343
|
}, undefined, true, undefined, this),
|
|
68014
|
-
/* @__PURE__ */
|
|
68344
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
68015
68345
|
paddingLeft: 13,
|
|
68016
|
-
children: /* @__PURE__ */
|
|
68346
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
68017
68347
|
color: theme.colors.muted,
|
|
68018
68348
|
dimColor: !isSelected,
|
|
68019
68349
|
children: [
|
|
@@ -68030,9 +68360,9 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68030
68360
|
const { stdout } = use_stdout_default();
|
|
68031
68361
|
const { isFocused } = use_focus_default();
|
|
68032
68362
|
const { focusNext } = use_focus_manager_default();
|
|
68033
|
-
const [selectedIndex, setSelectedIndex] =
|
|
68034
|
-
const [scrollPosition, setScrollPosition] =
|
|
68035
|
-
const listRef =
|
|
68363
|
+
const [selectedIndex, setSelectedIndex] = import_react26.useState(0);
|
|
68364
|
+
const [scrollPosition, setScrollPosition] = import_react26.useState(0);
|
|
68365
|
+
const listRef = import_react26.useRef(null);
|
|
68036
68366
|
const maxHeight = stdout.rows - 8;
|
|
68037
68367
|
use_input_default((_, key) => {
|
|
68038
68368
|
if (key.upArrow) {
|
|
@@ -68054,20 +68384,20 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68054
68384
|
setScrollPosition((prev) => Math.min(history.length - maxHeight, prev + maxHeight));
|
|
68055
68385
|
}
|
|
68056
68386
|
}, { isActive: isFocused });
|
|
68057
|
-
|
|
68387
|
+
import_react26.useEffect(() => {
|
|
68058
68388
|
if (selectedIndex < scrollPosition) {
|
|
68059
68389
|
setScrollPosition(selectedIndex);
|
|
68060
68390
|
} else if (selectedIndex >= scrollPosition + maxHeight) {
|
|
68061
68391
|
setScrollPosition(selectedIndex - maxHeight + 1);
|
|
68062
68392
|
}
|
|
68063
68393
|
}, [selectedIndex, maxHeight, scrollPosition]);
|
|
68064
|
-
return /* @__PURE__ */
|
|
68394
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
68065
68395
|
flexDirection: "column",
|
|
68066
68396
|
flexGrow: 1,
|
|
68067
|
-
children: /* @__PURE__ */
|
|
68397
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
68068
68398
|
flexDirection: "column",
|
|
68069
68399
|
ref: listRef,
|
|
68070
|
-
children: history.slice(scrollPosition, scrollPosition + maxHeight).map((item, index) => /* @__PURE__ */
|
|
68400
|
+
children: history.slice(scrollPosition, scrollPosition + maxHeight).map((item, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(HistoryListItem, {
|
|
68071
68401
|
item,
|
|
68072
68402
|
isSelected: isFocused && selectedIndex === scrollPosition + index,
|
|
68073
68403
|
theme
|
|
@@ -68077,19 +68407,19 @@ var HistoryList = ({ history, onItemClick, theme }) => {
|
|
|
68077
68407
|
};
|
|
68078
68408
|
|
|
68079
68409
|
// src/ui/app/components/footer.tsx
|
|
68080
|
-
var
|
|
68081
|
-
var
|
|
68082
|
-
var Footer =
|
|
68083
|
-
return /* @__PURE__ */
|
|
68410
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
68411
|
+
var jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68412
|
+
var Footer = import_react27.default.memo(({ theme }) => {
|
|
68413
|
+
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
68084
68414
|
borderStyle: "round",
|
|
68085
68415
|
borderTopColor: theme.muted,
|
|
68086
68416
|
marginTop: 1,
|
|
68087
68417
|
paddingX: 1,
|
|
68088
|
-
children: /* @__PURE__ */
|
|
68418
|
+
children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
68089
68419
|
color: theme.cool,
|
|
68090
68420
|
children: [
|
|
68091
68421
|
"╰─ \uD83D\uDE80 ",
|
|
68092
|
-
/* @__PURE__ */
|
|
68422
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
68093
68423
|
color: theme.primary,
|
|
68094
68424
|
children: "PostBoy"
|
|
68095
68425
|
}, undefined, false, undefined, this),
|
|
@@ -68100,8 +68430,8 @@ var Footer = import_react26.default.memo(({ theme }) => {
|
|
|
68100
68430
|
});
|
|
68101
68431
|
|
|
68102
68432
|
// src/ui/app/components/themeselector.tsx
|
|
68103
|
-
var
|
|
68104
|
-
var
|
|
68433
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
68434
|
+
var jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68105
68435
|
var getIndex = (theme) => {
|
|
68106
68436
|
let index = 0;
|
|
68107
68437
|
switch (theme) {
|
|
@@ -68141,9 +68471,9 @@ var getIndex = (theme) => {
|
|
|
68141
68471
|
return index;
|
|
68142
68472
|
};
|
|
68143
68473
|
var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
68144
|
-
const [selectedIndex, setSelectedIndex] =
|
|
68474
|
+
const [selectedIndex, setSelectedIndex] = import_react28.useState(getIndex(theme.name));
|
|
68145
68475
|
const themeNames = Object.keys(themes);
|
|
68146
|
-
|
|
68476
|
+
import_react28.useEffect(() => {
|
|
68147
68477
|
const currentThemeIndex = themeNames.findIndex((name) => {
|
|
68148
68478
|
const themeColors = themes[name].colors;
|
|
68149
68479
|
return Object.entries(themeColors).every(([key, value]) => theme[key] === value);
|
|
@@ -68168,7 +68498,7 @@ var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
|
68168
68498
|
}
|
|
68169
68499
|
}
|
|
68170
68500
|
}, { isActive: true });
|
|
68171
|
-
return /* @__PURE__ */
|
|
68501
|
+
return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
|
|
68172
68502
|
flexDirection: "column",
|
|
68173
68503
|
padding: 1,
|
|
68174
68504
|
borderStyle: "round",
|
|
@@ -68176,17 +68506,17 @@ var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
|
68176
68506
|
width: "50%",
|
|
68177
68507
|
alignSelf: "center",
|
|
68178
68508
|
children: [
|
|
68179
|
-
/* @__PURE__ */
|
|
68509
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
|
|
68180
68510
|
marginBottom: 1,
|
|
68181
|
-
children: /* @__PURE__ */
|
|
68511
|
+
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
|
|
68182
68512
|
color: theme.colors.primary,
|
|
68183
68513
|
bold: true,
|
|
68184
68514
|
children: "Theme Menu (↑/↓ to change, Esc to close)"
|
|
68185
68515
|
}, undefined, false, undefined, this)
|
|
68186
68516
|
}, undefined, false, undefined, this),
|
|
68187
|
-
themeNames.map((name, idx) => /* @__PURE__ */
|
|
68517
|
+
themeNames.map((name, idx) => /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
|
|
68188
68518
|
paddingX: 1,
|
|
68189
|
-
children: /* @__PURE__ */
|
|
68519
|
+
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
|
|
68190
68520
|
color: idx === selectedIndex ? theme.colors.accent : theme.colors.muted,
|
|
68191
68521
|
children: [
|
|
68192
68522
|
idx === selectedIndex ? "▶ " : " ",
|
|
@@ -68199,20 +68529,20 @@ var ThemeSelector = ({ onThemeChange, theme }) => {
|
|
|
68199
68529
|
};
|
|
68200
68530
|
|
|
68201
68531
|
// src/ui/app/components/scrollablebox.tsx
|
|
68202
|
-
var
|
|
68203
|
-
var
|
|
68532
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
68533
|
+
var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68204
68534
|
var ScrollableBox = ({ children }) => {
|
|
68205
68535
|
const { stdout } = use_stdout_default();
|
|
68206
|
-
const [scrollPosition, setScrollPosition] =
|
|
68536
|
+
const [scrollPosition, setScrollPosition] = import_react29.useState(0);
|
|
68207
68537
|
const maxHeight = stdout.rows - 10;
|
|
68208
|
-
const [contentHeight, setContentHeight] =
|
|
68538
|
+
const [contentHeight, setContentHeight] = import_react29.useState(0);
|
|
68209
68539
|
use_input_default((_, key) => {
|
|
68210
68540
|
if (key.pageUp)
|
|
68211
68541
|
setScrollPosition((prev) => Math.max(0, prev - maxHeight));
|
|
68212
68542
|
if (key.pageDown)
|
|
68213
68543
|
setScrollPosition((prev) => Math.min(contentHeight - maxHeight, prev + maxHeight));
|
|
68214
68544
|
});
|
|
68215
|
-
|
|
68545
|
+
import_react29.useEffect(() => {
|
|
68216
68546
|
const estimateHeight = (node) => {
|
|
68217
68547
|
if (!node)
|
|
68218
68548
|
return 0;
|
|
@@ -68221,29 +68551,29 @@ var ScrollableBox = ({ children }) => {
|
|
|
68221
68551
|
`).length;
|
|
68222
68552
|
if (Array.isArray(node))
|
|
68223
68553
|
return node.reduce((acc, child) => acc + estimateHeight(child), 0);
|
|
68224
|
-
if (
|
|
68554
|
+
if (import_react29.default.isValidElement(node))
|
|
68225
68555
|
return estimateHeight(node.props.children);
|
|
68226
68556
|
return 1;
|
|
68227
68557
|
};
|
|
68228
68558
|
setContentHeight(estimateHeight(children));
|
|
68229
68559
|
}, [children]);
|
|
68230
|
-
return /* @__PURE__ */
|
|
68560
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
68231
68561
|
flexDirection: "column",
|
|
68232
68562
|
overflow: "hidden",
|
|
68233
68563
|
flexGrow: 1,
|
|
68234
68564
|
children: [
|
|
68235
|
-
/* @__PURE__ */
|
|
68565
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
68236
68566
|
flexGrow: 1,
|
|
68237
68567
|
flexDirection: "column",
|
|
68238
|
-
children: /* @__PURE__ */
|
|
68568
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
68239
68569
|
marginTop: -scrollPosition,
|
|
68240
68570
|
flexDirection: "column",
|
|
68241
|
-
children:
|
|
68571
|
+
children: import_react29.default.Children.map(children, (child) => import_react29.default.isValidElement(child) ? import_react29.default.cloneElement(child) : child)
|
|
68242
68572
|
}, undefined, false, undefined, this)
|
|
68243
68573
|
}, undefined, false, undefined, this),
|
|
68244
|
-
contentHeight > maxHeight && /* @__PURE__ */
|
|
68574
|
+
contentHeight > maxHeight && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
68245
68575
|
justifyContent: "center",
|
|
68246
|
-
children: /* @__PURE__ */
|
|
68576
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
68247
68577
|
color: "gray",
|
|
68248
68578
|
children: `Scroll (PgUp/PgDn) ${scrollPosition + 1}-${Math.min(scrollPosition + maxHeight, contentHeight)}/${contentHeight}`
|
|
68249
68579
|
}, undefined, false, undefined, this)
|
|
@@ -68253,13 +68583,13 @@ var ScrollableBox = ({ children }) => {
|
|
|
68253
68583
|
};
|
|
68254
68584
|
|
|
68255
68585
|
// src/ui/app/components/syntaxhighlighter.tsx
|
|
68256
|
-
var
|
|
68257
|
-
var
|
|
68258
|
-
var JsonSyntaxHighlight =
|
|
68586
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
68587
|
+
var jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68588
|
+
var JsonSyntaxHighlight = import_react30.default.memo(({ jsonString, theme }) => {
|
|
68259
68589
|
try {
|
|
68260
68590
|
const json = JSON.parse(jsonString);
|
|
68261
68591
|
const prettyJson = JSON.stringify(json, null, 2);
|
|
68262
|
-
return /* @__PURE__ */
|
|
68592
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
|
|
68263
68593
|
flexDirection: "column",
|
|
68264
68594
|
children: prettyJson.split(`
|
|
68265
68595
|
`).map((line, i) => {
|
|
@@ -68272,37 +68602,37 @@ var JsonSyntaxHighlight = import_react29.default.memo(({ jsonString, theme }) =>
|
|
|
68272
68602
|
const hasComma2 = (keyMatch[2] || "").endsWith(",");
|
|
68273
68603
|
let valueNode;
|
|
68274
68604
|
if (valueString.startsWith('"')) {
|
|
68275
|
-
valueNode = /* @__PURE__ */
|
|
68605
|
+
valueNode = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68276
68606
|
color: theme.colors.success,
|
|
68277
68607
|
children: valueString
|
|
68278
68608
|
}, undefined, false, undefined, this);
|
|
68279
68609
|
} else if (valueString === "true" || valueString === "false") {
|
|
68280
|
-
valueNode = /* @__PURE__ */
|
|
68610
|
+
valueNode = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68281
68611
|
color: theme.colors.accent,
|
|
68282
68612
|
children: valueString
|
|
68283
68613
|
}, undefined, false, undefined, this);
|
|
68284
68614
|
} else if (valueString === "null") {
|
|
68285
|
-
valueNode = /* @__PURE__ */
|
|
68615
|
+
valueNode = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68286
68616
|
color: theme.colors.muted,
|
|
68287
68617
|
children: valueString
|
|
68288
68618
|
}, undefined, false, undefined, this);
|
|
68289
68619
|
} else if (["{", "["].includes(valueString)) {
|
|
68290
|
-
valueNode = /* @__PURE__ */
|
|
68620
|
+
valueNode = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68291
68621
|
color: theme.colors.muted,
|
|
68292
68622
|
children: valueString
|
|
68293
68623
|
}, undefined, false, undefined, this);
|
|
68294
68624
|
} else {
|
|
68295
|
-
valueNode = /* @__PURE__ */
|
|
68625
|
+
valueNode = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68296
68626
|
color: theme.colors.secondary,
|
|
68297
68627
|
children: valueString
|
|
68298
68628
|
}, undefined, false, undefined, this);
|
|
68299
68629
|
}
|
|
68300
|
-
return /* @__PURE__ */
|
|
68630
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68301
68631
|
children: [
|
|
68302
|
-
/* @__PURE__ */
|
|
68632
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68303
68633
|
children: indent
|
|
68304
68634
|
}, undefined, false, undefined, this),
|
|
68305
|
-
/* @__PURE__ */
|
|
68635
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68306
68636
|
color: theme.colors.primary,
|
|
68307
68637
|
children: [
|
|
68308
68638
|
'"',
|
|
@@ -68310,11 +68640,11 @@ var JsonSyntaxHighlight = import_react29.default.memo(({ jsonString, theme }) =>
|
|
|
68310
68640
|
'"'
|
|
68311
68641
|
]
|
|
68312
68642
|
}, undefined, true, undefined, this),
|
|
68313
|
-
/* @__PURE__ */
|
|
68643
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68314
68644
|
children: ": "
|
|
68315
68645
|
}, undefined, false, undefined, this),
|
|
68316
68646
|
valueNode,
|
|
68317
|
-
hasComma2 && /* @__PURE__ */
|
|
68647
|
+
hasComma2 && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68318
68648
|
children: ","
|
|
68319
68649
|
}, undefined, false, undefined, this)
|
|
68320
68650
|
]
|
|
@@ -68333,16 +68663,16 @@ var JsonSyntaxHighlight = import_react29.default.memo(({ jsonString, theme }) =>
|
|
|
68333
68663
|
color = "muted";
|
|
68334
68664
|
else if (!isNaN(Number(value)))
|
|
68335
68665
|
color = "secondary";
|
|
68336
|
-
return /* @__PURE__ */
|
|
68666
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68337
68667
|
children: [
|
|
68338
|
-
/* @__PURE__ */
|
|
68668
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68339
68669
|
children: indent
|
|
68340
68670
|
}, undefined, false, undefined, this),
|
|
68341
|
-
/* @__PURE__ */
|
|
68671
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68342
68672
|
color: theme.colors[color],
|
|
68343
68673
|
children: value
|
|
68344
68674
|
}, undefined, false, undefined, this),
|
|
68345
|
-
hasComma && /* @__PURE__ */
|
|
68675
|
+
hasComma && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68346
68676
|
children: ","
|
|
68347
68677
|
}, undefined, false, undefined, this)
|
|
68348
68678
|
]
|
|
@@ -68350,7 +68680,7 @@ var JsonSyntaxHighlight = import_react29.default.memo(({ jsonString, theme }) =>
|
|
|
68350
68680
|
})
|
|
68351
68681
|
}, undefined, false, undefined, this);
|
|
68352
68682
|
} catch (e) {
|
|
68353
|
-
return /* @__PURE__ */
|
|
68683
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
|
|
68354
68684
|
color: theme.colors.error,
|
|
68355
68685
|
children: jsonString
|
|
68356
68686
|
}, undefined, false, undefined, this);
|
|
@@ -68358,26 +68688,26 @@ var JsonSyntaxHighlight = import_react29.default.memo(({ jsonString, theme }) =>
|
|
|
68358
68688
|
});
|
|
68359
68689
|
|
|
68360
68690
|
// src/ui/app/components/responsepanel.tsx
|
|
68361
|
-
var
|
|
68362
|
-
var
|
|
68363
|
-
var ResponsePanel =
|
|
68364
|
-
const [activeTab, setActiveTab] =
|
|
68691
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
68692
|
+
var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68693
|
+
var ResponsePanel = import_react31.default.memo(({ response, theme }) => {
|
|
68694
|
+
const [activeTab, setActiveTab] = import_react31.useState("body");
|
|
68365
68695
|
const tabs = [{ name: "headers", label: "Headers" }, { name: "body", label: "Body" }];
|
|
68366
|
-
return /* @__PURE__ */
|
|
68696
|
+
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68367
68697
|
flexDirection: "column",
|
|
68368
68698
|
flexGrow: 1,
|
|
68369
68699
|
children: [
|
|
68370
|
-
/* @__PURE__ */
|
|
68700
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68371
68701
|
marginBottom: 1,
|
|
68372
68702
|
children: [
|
|
68373
|
-
/* @__PURE__ */
|
|
68703
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68374
68704
|
width: 8,
|
|
68375
|
-
children: /* @__PURE__ */
|
|
68705
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68376
68706
|
color: theme.colors.primary,
|
|
68377
68707
|
children: "STATUS:"
|
|
68378
68708
|
}, undefined, false, undefined, this)
|
|
68379
68709
|
}, undefined, false, undefined, this),
|
|
68380
|
-
/* @__PURE__ */
|
|
68710
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68381
68711
|
color: getStatusColor(response.status, theme),
|
|
68382
68712
|
bold: true,
|
|
68383
68713
|
children: [
|
|
@@ -68388,30 +68718,30 @@ var ResponsePanel = import_react30.default.memo(({ response, theme }) => {
|
|
|
68388
68718
|
}, undefined, true, undefined, this)
|
|
68389
68719
|
]
|
|
68390
68720
|
}, undefined, true, undefined, this),
|
|
68391
|
-
/* @__PURE__ */
|
|
68721
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Tabs, {
|
|
68392
68722
|
tabs,
|
|
68393
68723
|
activeTab,
|
|
68394
68724
|
onChange: setActiveTab,
|
|
68395
68725
|
theme
|
|
68396
68726
|
}, undefined, false, undefined, this),
|
|
68397
|
-
/* @__PURE__ */
|
|
68727
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68398
68728
|
marginTop: 1,
|
|
68399
68729
|
flexGrow: 1,
|
|
68400
68730
|
children: [
|
|
68401
|
-
activeTab === "headers" && /* @__PURE__ */
|
|
68402
|
-
children: /* @__PURE__ */
|
|
68731
|
+
activeTab === "headers" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ScrollableBox, {
|
|
68732
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68403
68733
|
flexDirection: "column",
|
|
68404
|
-
children: Object.entries(JSON.parse(response.headers || "{}")).map(([key, value]) => /* @__PURE__ */
|
|
68734
|
+
children: Object.entries(JSON.parse(response.headers || "{}")).map(([key, value]) => /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68405
68735
|
children: [
|
|
68406
|
-
/* @__PURE__ */
|
|
68736
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68407
68737
|
color: theme.colors.accent,
|
|
68408
68738
|
children: key
|
|
68409
68739
|
}, undefined, false, undefined, this),
|
|
68410
|
-
/* @__PURE__ */
|
|
68740
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68411
68741
|
color: theme.colors.muted,
|
|
68412
68742
|
children: ": "
|
|
68413
68743
|
}, undefined, false, undefined, this),
|
|
68414
|
-
/* @__PURE__ */
|
|
68744
|
+
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
68415
68745
|
color: theme.colors.success,
|
|
68416
68746
|
children: String(value)
|
|
68417
68747
|
}, undefined, false, undefined, this)
|
|
@@ -68419,11 +68749,11 @@ var ResponsePanel = import_react30.default.memo(({ response, theme }) => {
|
|
|
68419
68749
|
}, key, true, undefined, this))
|
|
68420
68750
|
}, undefined, false, undefined, this)
|
|
68421
68751
|
}, undefined, false, undefined, this),
|
|
68422
|
-
activeTab === "body" && /* @__PURE__ */
|
|
68423
|
-
children: /* @__PURE__ */
|
|
68752
|
+
activeTab === "body" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ScrollableBox, {
|
|
68753
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68424
68754
|
flexDirection: "column",
|
|
68425
68755
|
flexGrow: 1,
|
|
68426
|
-
children: /* @__PURE__ */
|
|
68756
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(JsonSyntaxHighlight, {
|
|
68427
68757
|
jsonString: response.body,
|
|
68428
68758
|
theme
|
|
68429
68759
|
}, undefined, false, undefined, this)
|
|
@@ -68538,21 +68868,21 @@ class ThemeManager {
|
|
|
68538
68868
|
var themeManager = new ThemeManager;
|
|
68539
68869
|
|
|
68540
68870
|
// src/ui/app/ui.tsx
|
|
68541
|
-
var
|
|
68871
|
+
var jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68542
68872
|
var SendButton = ({ onPress, loading, theme }) => {
|
|
68543
68873
|
const { isFocused } = use_focus_default();
|
|
68544
68874
|
use_input_default((_, key) => {
|
|
68545
68875
|
if (isFocused && key.return)
|
|
68546
68876
|
onPress();
|
|
68547
68877
|
});
|
|
68548
|
-
return /* @__PURE__ */
|
|
68878
|
+
return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68549
68879
|
borderStyle: "round",
|
|
68550
68880
|
paddingX: 2,
|
|
68551
68881
|
borderTopDimColor: true,
|
|
68552
68882
|
borderColor: isFocused ? theme.accent : theme.primary,
|
|
68553
|
-
children: loading ? /* @__PURE__ */
|
|
68883
|
+
children: loading ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Spinner, {
|
|
68554
68884
|
theme
|
|
68555
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
68885
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68556
68886
|
bold: true,
|
|
68557
68887
|
color: isFocused ? theme.accent : theme.white,
|
|
68558
68888
|
children: "\uD83D\uDE80 Send"
|
|
@@ -68560,45 +68890,49 @@ var SendButton = ({ onPress, loading, theme }) => {
|
|
|
68560
68890
|
}, undefined, false, undefined, this);
|
|
68561
68891
|
};
|
|
68562
68892
|
var HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"];
|
|
68563
|
-
var RequestPanel =
|
|
68893
|
+
var RequestPanel = import_react32.default.memo(({ request, onMethodChange, onUrlChange, onHeadersChange, onBodyChange, onSend, loading, theme, historyUrls = [], onInputFocus }) => /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68564
68894
|
flexDirection: "column",
|
|
68565
68895
|
gap: 1,
|
|
68566
68896
|
flexGrow: 1,
|
|
68567
68897
|
children: [
|
|
68568
|
-
/* @__PURE__ */
|
|
68898
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(FormField, {
|
|
68569
68899
|
label: "Method",
|
|
68570
68900
|
value: request.method,
|
|
68571
68901
|
onChange: onMethodChange,
|
|
68572
68902
|
placeholder: "GET",
|
|
68573
68903
|
theme,
|
|
68574
|
-
suggestions: HTTP_METHODS
|
|
68904
|
+
suggestions: HTTP_METHODS,
|
|
68905
|
+
onFocusChange: onInputFocus
|
|
68575
68906
|
}, undefined, false, undefined, this),
|
|
68576
|
-
/* @__PURE__ */
|
|
68907
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(FormField, {
|
|
68577
68908
|
label: "URL",
|
|
68578
68909
|
value: request.url,
|
|
68579
68910
|
onChange: onUrlChange,
|
|
68580
68911
|
placeholder: "https://api.example.com",
|
|
68581
68912
|
theme,
|
|
68582
|
-
suggestions: historyUrls
|
|
68913
|
+
suggestions: historyUrls,
|
|
68914
|
+
onFocusChange: onInputFocus
|
|
68583
68915
|
}, undefined, false, undefined, this),
|
|
68584
|
-
/* @__PURE__ */
|
|
68916
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyValueField, {
|
|
68585
68917
|
label: "Headers",
|
|
68586
68918
|
value: request.headers,
|
|
68587
68919
|
onChange: onHeadersChange,
|
|
68588
|
-
placeholder:
|
|
68589
|
-
theme
|
|
68920
|
+
placeholder: "Press Enter to add headers",
|
|
68921
|
+
theme,
|
|
68922
|
+
onFocusChange: onInputFocus
|
|
68590
68923
|
}, undefined, false, undefined, this),
|
|
68591
|
-
/* @__PURE__ */
|
|
68924
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(KeyValueField, {
|
|
68592
68925
|
label: "Body",
|
|
68593
68926
|
value: request.body,
|
|
68594
68927
|
onChange: onBodyChange,
|
|
68595
|
-
placeholder:
|
|
68596
|
-
theme
|
|
68928
|
+
placeholder: "Press Enter to add body",
|
|
68929
|
+
theme,
|
|
68930
|
+
onFocusChange: onInputFocus
|
|
68597
68931
|
}, undefined, false, undefined, this),
|
|
68598
|
-
/* @__PURE__ */
|
|
68932
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68599
68933
|
marginTop: 1,
|
|
68600
68934
|
justifyContent: "center",
|
|
68601
|
-
children: /* @__PURE__ */
|
|
68935
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(SendButton, {
|
|
68602
68936
|
onPress: onSend,
|
|
68603
68937
|
loading,
|
|
68604
68938
|
theme
|
|
@@ -68607,27 +68941,27 @@ var RequestPanel = import_react31.default.memo(({ request, onMethodChange, onUrl
|
|
|
68607
68941
|
]
|
|
68608
68942
|
}, undefined, true, undefined, this));
|
|
68609
68943
|
var UI = () => {
|
|
68610
|
-
const [theme, setTheme] =
|
|
68944
|
+
const [theme, setTheme] = import_react32.useState(themes.catppuccin);
|
|
68611
68945
|
const { exit } = use_app_default();
|
|
68612
|
-
const [activeTab, setActiveTab] =
|
|
68613
|
-
const [request, setRequest] =
|
|
68614
|
-
const [response, setResponse] =
|
|
68615
|
-
const [history, setHistory] =
|
|
68616
|
-
const [loading, setLoading] =
|
|
68617
|
-
const requestRef =
|
|
68946
|
+
const [activeTab, setActiveTab] = import_react32.useState("request");
|
|
68947
|
+
const [request, setRequest] = import_react32.useState({ method: "GET", url: "", headers: "", body: "" });
|
|
68948
|
+
const [response, setResponse] = import_react32.useState({ statustext: "", status: "", headers: "", body: "", error: "" });
|
|
68949
|
+
const [history, setHistory] = import_react32.useState([]);
|
|
68950
|
+
const [loading, setLoading] = import_react32.useState(false);
|
|
68951
|
+
const requestRef = import_react32.useRef(request);
|
|
68618
68952
|
requestRef.current = request;
|
|
68619
|
-
|
|
68953
|
+
import_react32.useEffect(() => {
|
|
68620
68954
|
const loadHistory = async () => setHistory((await historyManager.loadHistory()).entries);
|
|
68621
68955
|
loadHistory();
|
|
68622
68956
|
}, []);
|
|
68623
|
-
|
|
68957
|
+
import_react32.useEffect(() => {
|
|
68624
68958
|
const loadTheme = async () => {
|
|
68625
68959
|
const loadedTheme = await themeManager.loadCurrTheme();
|
|
68626
68960
|
setTheme(loadedTheme);
|
|
68627
68961
|
};
|
|
68628
68962
|
loadTheme();
|
|
68629
68963
|
}, []);
|
|
68630
|
-
const handleSend =
|
|
68964
|
+
const handleSend = import_react32.useCallback(async () => {
|
|
68631
68965
|
setLoading(true);
|
|
68632
68966
|
const startTime = Date.now();
|
|
68633
68967
|
const currentRequest = requestRef.current;
|
|
@@ -68668,7 +69002,7 @@ var UI = () => {
|
|
|
68668
69002
|
themeManager.ChangeTheme(theme2);
|
|
68669
69003
|
setTheme(theme2);
|
|
68670
69004
|
};
|
|
68671
|
-
const handleHistoryClick =
|
|
69005
|
+
const handleHistoryClick = import_react32.useCallback((item) => {
|
|
68672
69006
|
setRequest({
|
|
68673
69007
|
method: item.method,
|
|
68674
69008
|
url: item.url,
|
|
@@ -68679,7 +69013,8 @@ var UI = () => {
|
|
|
68679
69013
|
}, []);
|
|
68680
69014
|
const tabs = [{ name: "request", label: "Request" }, { name: "response", label: "Response" }];
|
|
68681
69015
|
const activeIndex = tabs.findIndex((t) => t.name === activeTab);
|
|
68682
|
-
const [showThemeSelector, setShowThemeSelector] =
|
|
69016
|
+
const [showThemeSelector, setShowThemeSelector] = import_react32.useState(false);
|
|
69017
|
+
const [inputFocused, setInputFocused] = import_react32.useState(false);
|
|
68683
69018
|
use_input_default((input, key) => {
|
|
68684
69019
|
if (input === "q")
|
|
68685
69020
|
exit();
|
|
@@ -68691,87 +69026,87 @@ var UI = () => {
|
|
|
68691
69026
|
setActiveTab(tabs[(activeIndex - 1 + tabs.length) % tabs.length]?.name ?? "request");
|
|
68692
69027
|
if (key.escape && showThemeSelector)
|
|
68693
69028
|
setShowThemeSelector(false);
|
|
68694
|
-
if ((input === "t" || input === "T") && !key.ctrl && !key.meta)
|
|
69029
|
+
if ((input === "t" || input === "T") && !key.ctrl && !key.meta && !inputFocused)
|
|
68695
69030
|
setShowThemeSelector((prev) => !prev);
|
|
68696
69031
|
}, { isActive: true });
|
|
68697
|
-
const onMethodChange =
|
|
68698
|
-
const onUrlChange =
|
|
68699
|
-
const onHeadersChange =
|
|
68700
|
-
const onBodyChange =
|
|
69032
|
+
const onMethodChange = import_react32.useCallback((method) => setRequest((r) => ({ ...r, method })), []);
|
|
69033
|
+
const onUrlChange = import_react32.useCallback((url) => setRequest((r) => ({ ...r, url })), []);
|
|
69034
|
+
const onHeadersChange = import_react32.useCallback((headers) => setRequest((r) => ({ ...r, headers })), []);
|
|
69035
|
+
const onBodyChange = import_react32.useCallback((body) => setRequest((r) => ({ ...r, body })), []);
|
|
68701
69036
|
const historyUrls = Array.from(new Set(history.map((h) => h.url))).filter(Boolean);
|
|
68702
|
-
return /* @__PURE__ */
|
|
69037
|
+
return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68703
69038
|
padding: 1,
|
|
68704
69039
|
flexDirection: "column",
|
|
68705
69040
|
flexGrow: 1,
|
|
68706
69041
|
children: [
|
|
68707
|
-
showThemeSelector && /* @__PURE__ */
|
|
69042
|
+
showThemeSelector && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68708
69043
|
flexDirection: "row",
|
|
68709
69044
|
justifyContent: "center",
|
|
68710
69045
|
marginBottom: 1,
|
|
68711
|
-
children: /* @__PURE__ */
|
|
69046
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemeSelector, {
|
|
68712
69047
|
theme,
|
|
68713
69048
|
onThemeChange: (themeName) => {
|
|
68714
69049
|
handleThemeChange(themes[themeName]);
|
|
68715
69050
|
}
|
|
68716
69051
|
}, undefined, false, undefined, this)
|
|
68717
69052
|
}, undefined, false, undefined, this),
|
|
68718
|
-
/* @__PURE__ */
|
|
69053
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68719
69054
|
alignSelf: "center",
|
|
68720
69055
|
marginBottom: 1,
|
|
68721
|
-
children: /* @__PURE__ */
|
|
69056
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68722
69057
|
color: theme.colors.accent,
|
|
68723
69058
|
bold: true,
|
|
68724
69059
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
68725
69060
|
}, undefined, false, undefined, this)
|
|
68726
69061
|
}, undefined, false, undefined, this),
|
|
68727
|
-
/* @__PURE__ */
|
|
69062
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68728
69063
|
alignSelf: "center",
|
|
68729
69064
|
marginBottom: 1,
|
|
68730
|
-
children: /* @__PURE__ */
|
|
69065
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68731
69066
|
color: theme.colors.primary,
|
|
68732
69067
|
bold: true,
|
|
68733
69068
|
children: `┃ \uD83D\uDEF0️ Welcome to PostBoy — The Modern Terminal API Client ┃`
|
|
68734
69069
|
}, undefined, false, undefined, this)
|
|
68735
69070
|
}, undefined, false, undefined, this),
|
|
68736
|
-
/* @__PURE__ */
|
|
69071
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68737
69072
|
alignSelf: "center",
|
|
68738
69073
|
marginBottom: 1,
|
|
68739
|
-
children: /* @__PURE__ */
|
|
69074
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68740
69075
|
color: theme.colors.accent,
|
|
68741
69076
|
bold: true,
|
|
68742
69077
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
68743
69078
|
}, undefined, false, undefined, this)
|
|
68744
69079
|
}, undefined, false, undefined, this),
|
|
68745
|
-
/* @__PURE__ */
|
|
69080
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68746
69081
|
flexGrow: 1,
|
|
68747
69082
|
children: [
|
|
68748
|
-
/* @__PURE__ */
|
|
69083
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68749
69084
|
width: "40%",
|
|
68750
69085
|
borderColor: theme.colors.muted,
|
|
68751
69086
|
flexDirection: "column",
|
|
68752
69087
|
marginRight: 1,
|
|
68753
69088
|
children: [
|
|
68754
|
-
/* @__PURE__ */
|
|
69089
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68755
69090
|
alignSelf: "center",
|
|
68756
69091
|
marginBottom: 1,
|
|
68757
|
-
children: /* @__PURE__ */
|
|
69092
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68758
69093
|
color: theme.colors.accent,
|
|
68759
69094
|
bold: true,
|
|
68760
69095
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
68761
69096
|
}, undefined, false, undefined, this)
|
|
68762
69097
|
}, undefined, false, undefined, this),
|
|
68763
|
-
/* @__PURE__ */
|
|
69098
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68764
69099
|
borderTopColor: "grey",
|
|
68765
69100
|
borderColor: theme.colors.secondary,
|
|
68766
69101
|
paddingX: 1,
|
|
68767
69102
|
alignSelf: "center",
|
|
68768
|
-
children: /* @__PURE__ */
|
|
69103
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68769
69104
|
color: theme.colors.accent,
|
|
68770
69105
|
bold: true,
|
|
68771
69106
|
children: "\uD83D\uDCDC History"
|
|
68772
69107
|
}, undefined, false, undefined, this)
|
|
68773
69108
|
}, undefined, false, undefined, this),
|
|
68774
|
-
/* @__PURE__ */
|
|
69109
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68775
69110
|
flexDirection: "column",
|
|
68776
69111
|
flexGrow: 1,
|
|
68777
69112
|
borderRightColor: "grey",
|
|
@@ -68780,22 +69115,22 @@ var UI = () => {
|
|
|
68780
69115
|
borderLeft: false,
|
|
68781
69116
|
borderBottom: false,
|
|
68782
69117
|
paddingY: 1,
|
|
68783
|
-
children: history.length === 0 ? /* @__PURE__ */
|
|
69118
|
+
children: history.length === 0 ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68784
69119
|
padding: 1,
|
|
68785
|
-
children: /* @__PURE__ */
|
|
69120
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68786
69121
|
color: theme.colors.muted,
|
|
68787
69122
|
children: "No requests yet..."
|
|
68788
69123
|
}, undefined, false, undefined, this)
|
|
68789
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
69124
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(HistoryList, {
|
|
68790
69125
|
history,
|
|
68791
69126
|
onItemClick: handleHistoryClick,
|
|
68792
69127
|
theme
|
|
68793
69128
|
}, undefined, false, undefined, this)
|
|
68794
69129
|
}, undefined, false, undefined, this),
|
|
68795
|
-
/* @__PURE__ */
|
|
69130
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68796
69131
|
alignSelf: "center",
|
|
68797
69132
|
marginBottom: 1,
|
|
68798
|
-
children: /* @__PURE__ */
|
|
69133
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68799
69134
|
color: theme.colors.accent,
|
|
68800
69135
|
bold: true,
|
|
68801
69136
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
@@ -68803,36 +69138,36 @@ var UI = () => {
|
|
|
68803
69138
|
}, undefined, false, undefined, this)
|
|
68804
69139
|
]
|
|
68805
69140
|
}, undefined, true, undefined, this),
|
|
68806
|
-
/* @__PURE__ */
|
|
69141
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68807
69142
|
width: "60%",
|
|
68808
69143
|
borderColor: theme.colors.muted,
|
|
68809
69144
|
padding: 1,
|
|
68810
69145
|
flexDirection: "column",
|
|
68811
69146
|
children: [
|
|
68812
|
-
/* @__PURE__ */
|
|
69147
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68813
69148
|
alignSelf: "center",
|
|
68814
69149
|
marginBottom: 1,
|
|
68815
|
-
children: /* @__PURE__ */
|
|
69150
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68816
69151
|
color: theme.colors.accent,
|
|
68817
69152
|
bold: true,
|
|
68818
69153
|
children: `┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`
|
|
68819
69154
|
}, undefined, false, undefined, this)
|
|
68820
69155
|
}, undefined, false, undefined, this),
|
|
68821
|
-
/* @__PURE__ */
|
|
69156
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Tabs, {
|
|
68822
69157
|
tabs,
|
|
68823
69158
|
activeTab,
|
|
68824
69159
|
onChange: setActiveTab,
|
|
68825
69160
|
theme
|
|
68826
69161
|
}, undefined, false, undefined, this),
|
|
68827
|
-
/* @__PURE__ */
|
|
69162
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68828
69163
|
marginTop: 1,
|
|
68829
69164
|
flexDirection: "column",
|
|
68830
69165
|
flexGrow: 1,
|
|
68831
69166
|
children: [
|
|
68832
|
-
/* @__PURE__ */
|
|
69167
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68833
69168
|
display: activeTab === "request" ? "flex" : "none",
|
|
68834
69169
|
flexGrow: 1,
|
|
68835
|
-
children: /* @__PURE__ */
|
|
69170
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(RequestPanel, {
|
|
68836
69171
|
request,
|
|
68837
69172
|
onMethodChange,
|
|
68838
69173
|
onUrlChange,
|
|
@@ -68841,23 +69176,24 @@ var UI = () => {
|
|
|
68841
69176
|
onSend: handleSend,
|
|
68842
69177
|
loading,
|
|
68843
69178
|
theme: theme.colors,
|
|
68844
|
-
historyUrls
|
|
69179
|
+
historyUrls,
|
|
69180
|
+
onInputFocus: setInputFocused
|
|
68845
69181
|
}, undefined, false, undefined, this)
|
|
68846
69182
|
}, undefined, false, undefined, this),
|
|
68847
|
-
/* @__PURE__ */
|
|
69183
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68848
69184
|
display: activeTab === "response" ? "flex" : "none",
|
|
68849
69185
|
flexGrow: 1,
|
|
68850
|
-
children: /* @__PURE__ */
|
|
69186
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ResponsePanel, {
|
|
68851
69187
|
response,
|
|
68852
69188
|
theme
|
|
68853
69189
|
}, undefined, false, undefined, this)
|
|
68854
69190
|
}, undefined, false, undefined, this)
|
|
68855
69191
|
]
|
|
68856
69192
|
}, undefined, true, undefined, this),
|
|
68857
|
-
/* @__PURE__ */
|
|
69193
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Box_default, {
|
|
68858
69194
|
alignSelf: "center",
|
|
68859
69195
|
marginBottom: 1,
|
|
68860
|
-
children: /* @__PURE__ */
|
|
69196
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
|
|
68861
69197
|
color: theme.colors.accent,
|
|
68862
69198
|
bold: true,
|
|
68863
69199
|
children: `┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`
|
|
@@ -68867,7 +69203,7 @@ var UI = () => {
|
|
|
68867
69203
|
}, undefined, true, undefined, this)
|
|
68868
69204
|
]
|
|
68869
69205
|
}, undefined, true, undefined, this),
|
|
68870
|
-
/* @__PURE__ */
|
|
69206
|
+
/* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Footer, {
|
|
68871
69207
|
theme: theme.colors
|
|
68872
69208
|
}, undefined, false, undefined, this)
|
|
68873
69209
|
]
|
|
@@ -68876,14 +69212,14 @@ var UI = () => {
|
|
|
68876
69212
|
var ui_default = UI;
|
|
68877
69213
|
|
|
68878
69214
|
// src/ui/app/app.tsx
|
|
68879
|
-
var
|
|
69215
|
+
var jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68880
69216
|
function App2() {
|
|
68881
|
-
return /* @__PURE__ */
|
|
69217
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ui_default, {}, undefined, false, undefined, this);
|
|
68882
69218
|
}
|
|
68883
69219
|
|
|
68884
69220
|
// src/commands/ui.tsx
|
|
68885
69221
|
var import_chalk5 = __toESM(require_source(), 1);
|
|
68886
|
-
var
|
|
69222
|
+
var jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68887
69223
|
var UIWrapper = () => {
|
|
68888
69224
|
const { exit } = use_app_default();
|
|
68889
69225
|
use_input_default((input) => {
|
|
@@ -68891,18 +69227,18 @@ var UIWrapper = () => {
|
|
|
68891
69227
|
exit();
|
|
68892
69228
|
}
|
|
68893
69229
|
});
|
|
68894
|
-
return /* @__PURE__ */
|
|
69230
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Box_default, {
|
|
68895
69231
|
flexDirection: "column",
|
|
68896
69232
|
children: [
|
|
68897
|
-
/* @__PURE__ */
|
|
69233
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
68898
69234
|
children: import_chalk5.default.cyanBright(`PostBoy \uD83D\uDC8C`)
|
|
68899
69235
|
}, undefined, false, undefined, this),
|
|
68900
|
-
/* @__PURE__ */
|
|
69236
|
+
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(App2, {}, undefined, false, undefined, this)
|
|
68901
69237
|
]
|
|
68902
69238
|
}, undefined, true, undefined, this);
|
|
68903
69239
|
};
|
|
68904
69240
|
var uiCommand = () => {
|
|
68905
|
-
render_default(/* @__PURE__ */
|
|
69241
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(UIWrapper, {}, undefined, false, undefined, this));
|
|
68906
69242
|
};
|
|
68907
69243
|
|
|
68908
69244
|
// src/commands/test.ts
|
|
@@ -69071,7 +69407,7 @@ async function mockApis() {
|
|
|
69071
69407
|
|
|
69072
69408
|
// src/index.ts
|
|
69073
69409
|
var program2 = new Command;
|
|
69074
|
-
program2.version("1.3.
|
|
69410
|
+
program2.version("1.3.5").description(import_chalk8.default.yellow("PostBoy CLI - Test your APIs with ease"));
|
|
69075
69411
|
program2.command("run").description("Run a test API request").action(testCommand);
|
|
69076
69412
|
program2.command("mock-list").description("List the mock API servers").action(mockApis);
|
|
69077
69413
|
program2.command("ui").description("UI for PostBoy").action(uiCommand);
|