postboy-tui 1.3.3 → 1.3.4
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 +18 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -67831,8 +67831,11 @@ 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 FormField = ({ label, value, onChange, placeholder, theme, suggestions = [] }) => {
|
|
67834
|
+
var FormField = ({ label, value, onChange, placeholder, theme, suggestions = [], onFocusChange }) => {
|
|
67835
67835
|
const { isFocused } = use_focus_default();
|
|
67836
|
+
import_react24.useEffect(() => {
|
|
67837
|
+
onFocusChange?.(isFocused);
|
|
67838
|
+
}, [isFocused, onFocusChange]);
|
|
67836
67839
|
const [showSuggestions, setShowSuggestions] = import_react24.useState(false);
|
|
67837
67840
|
const [filteredSuggestions, setFilteredSuggestions] = import_react24.useState([]);
|
|
67838
67841
|
const [highlightedIndex, setHighlightedIndex] = import_react24.useState(0);
|
|
@@ -68560,7 +68563,7 @@ var SendButton = ({ onPress, loading, theme }) => {
|
|
|
68560
68563
|
}, undefined, false, undefined, this);
|
|
68561
68564
|
};
|
|
68562
68565
|
var HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"];
|
|
68563
|
-
var RequestPanel = import_react31.default.memo(({ request, onMethodChange, onUrlChange, onHeadersChange, onBodyChange, onSend, loading, theme, historyUrls = [] }) => /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68566
|
+
var RequestPanel = import_react31.default.memo(({ request, onMethodChange, onUrlChange, onHeadersChange, onBodyChange, onSend, loading, theme, historyUrls = [], onInputFocus }) => /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68564
68567
|
flexDirection: "column",
|
|
68565
68568
|
gap: 1,
|
|
68566
68569
|
flexGrow: 1,
|
|
@@ -68571,7 +68574,8 @@ var RequestPanel = import_react31.default.memo(({ request, onMethodChange, onUrl
|
|
|
68571
68574
|
onChange: onMethodChange,
|
|
68572
68575
|
placeholder: "GET",
|
|
68573
68576
|
theme,
|
|
68574
|
-
suggestions: HTTP_METHODS
|
|
68577
|
+
suggestions: HTTP_METHODS,
|
|
68578
|
+
onFocusChange: onInputFocus
|
|
68575
68579
|
}, undefined, false, undefined, this),
|
|
68576
68580
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(FormField, {
|
|
68577
68581
|
label: "URL",
|
|
@@ -68579,21 +68583,24 @@ var RequestPanel = import_react31.default.memo(({ request, onMethodChange, onUrl
|
|
|
68579
68583
|
onChange: onUrlChange,
|
|
68580
68584
|
placeholder: "https://api.example.com",
|
|
68581
68585
|
theme,
|
|
68582
|
-
suggestions: historyUrls
|
|
68586
|
+
suggestions: historyUrls,
|
|
68587
|
+
onFocusChange: onInputFocus
|
|
68583
68588
|
}, undefined, false, undefined, this),
|
|
68584
68589
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(FormField, {
|
|
68585
68590
|
label: "Headers",
|
|
68586
68591
|
value: request.headers,
|
|
68587
68592
|
onChange: onHeadersChange,
|
|
68588
68593
|
placeholder: '{ "key": "value" }',
|
|
68589
|
-
theme
|
|
68594
|
+
theme,
|
|
68595
|
+
onFocusChange: onInputFocus
|
|
68590
68596
|
}, undefined, false, undefined, this),
|
|
68591
68597
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(FormField, {
|
|
68592
68598
|
label: "Body",
|
|
68593
68599
|
value: request.body,
|
|
68594
68600
|
onChange: onBodyChange,
|
|
68595
68601
|
placeholder: '{ "key": "value" }',
|
|
68596
|
-
theme
|
|
68602
|
+
theme,
|
|
68603
|
+
onFocusChange: onInputFocus
|
|
68597
68604
|
}, undefined, false, undefined, this),
|
|
68598
68605
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
68599
68606
|
marginTop: 1,
|
|
@@ -68680,6 +68687,7 @@ var UI = () => {
|
|
|
68680
68687
|
const tabs = [{ name: "request", label: "Request" }, { name: "response", label: "Response" }];
|
|
68681
68688
|
const activeIndex = tabs.findIndex((t) => t.name === activeTab);
|
|
68682
68689
|
const [showThemeSelector, setShowThemeSelector] = import_react31.useState(false);
|
|
68690
|
+
const [inputFocused, setInputFocused] = import_react31.useState(false);
|
|
68683
68691
|
use_input_default((input, key) => {
|
|
68684
68692
|
if (input === "q")
|
|
68685
68693
|
exit();
|
|
@@ -68691,7 +68699,7 @@ var UI = () => {
|
|
|
68691
68699
|
setActiveTab(tabs[(activeIndex - 1 + tabs.length) % tabs.length]?.name ?? "request");
|
|
68692
68700
|
if (key.escape && showThemeSelector)
|
|
68693
68701
|
setShowThemeSelector(false);
|
|
68694
|
-
if ((input === "t" || input === "T") && !key.ctrl && !key.meta)
|
|
68702
|
+
if ((input === "t" || input === "T") && !key.ctrl && !key.meta && !inputFocused)
|
|
68695
68703
|
setShowThemeSelector((prev) => !prev);
|
|
68696
68704
|
}, { isActive: true });
|
|
68697
68705
|
const onMethodChange = import_react31.useCallback((method) => setRequest((r) => ({ ...r, method })), []);
|
|
@@ -68841,7 +68849,8 @@ var UI = () => {
|
|
|
68841
68849
|
onSend: handleSend,
|
|
68842
68850
|
loading,
|
|
68843
68851
|
theme: theme.colors,
|
|
68844
|
-
historyUrls
|
|
68852
|
+
historyUrls,
|
|
68853
|
+
onInputFocus: setInputFocused
|
|
68845
68854
|
}, undefined, false, undefined, this)
|
|
68846
68855
|
}, undefined, false, undefined, this),
|
|
68847
68856
|
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
@@ -69071,7 +69080,7 @@ async function mockApis() {
|
|
|
69071
69080
|
|
|
69072
69081
|
// src/index.ts
|
|
69073
69082
|
var program2 = new Command;
|
|
69074
|
-
program2.version("1.3.
|
|
69083
|
+
program2.version("1.3.4").description(import_chalk8.default.yellow("PostBoy CLI - Test your APIs with ease"));
|
|
69075
69084
|
program2.command("run").description("Run a test API request").action(testCommand);
|
|
69076
69085
|
program2.command("mock-list").description("List the mock API servers").action(mockApis);
|
|
69077
69086
|
program2.command("ui").description("UI for PostBoy").action(uiCommand);
|