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