bitty-tui 0.0.12 → 0.0.13

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 CHANGED
@@ -3,4 +3,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { render } from "ink";
4
4
  import App from "./app.js";
5
5
  import { StatusMessageProvider } from "./hooks/status-message.js";
6
+ import { readPackageUpSync } from "read-package-up";
7
+ import { art } from "./theme/art.js";
8
+ const args = process.argv.slice(2);
9
+ if (args.includes("--version") || args.includes("-v")) {
10
+ const pkg = readPackageUpSync();
11
+ console.log(pkg?.packageJson.version ?? "unknown");
12
+ process.exit(0);
13
+ }
14
+ if (args.includes("--help") || args.includes("-h")) {
15
+ console.log(`${art}
16
+ Usage
17
+ $ bitty
18
+
19
+ Options
20
+ --help Show help
21
+ --version Show version
22
+ `);
23
+ process.exit(0);
24
+ }
6
25
  render(_jsx(StatusMessageProvider, { children: _jsx(App, {}) }));
@@ -66,6 +66,13 @@ export function DashboardView({ onLogout }) {
66
66
  focus("search");
67
67
  return;
68
68
  }
69
+ if (key.ctrl && input === "n") {
70
+ setDetailMode("new");
71
+ setEditedCipher(emptyCipher);
72
+ setFocusedComponent("detail");
73
+ setShowDetails(false);
74
+ return;
75
+ }
69
76
  if (key.escape) {
70
77
  setFocusedComponent("list");
71
78
  setDetailMode("view");
@@ -85,12 +92,6 @@ export function DashboardView({ onLogout }) {
85
92
  setFocusedComponent("detail");
86
93
  setShowDetails(false);
87
94
  }
88
- if (input === "n") {
89
- setDetailMode("new");
90
- setEditedCipher(emptyCipher);
91
- setFocusedComponent("detail");
92
- setShowDetails(false);
93
- }
94
95
  }
95
96
  });
96
97
  useEffect(() => {
@@ -138,5 +139,5 @@ export function DashboardView({ onLogout }) {
138
139
  showStatusMessage("Synchronization error", "error");
139
140
  }
140
141
  }
141
- } })] }), _jsx(HelpBar, { focus: focusedComponent, cipher: selectedCipher })] }));
142
+ } })] }), _jsx(HelpBar, { focus: focusedComponent, cipher: selectedCipher, mode: detailMode })] }));
142
143
  }
@@ -1,5 +1,6 @@
1
1
  import { Cipher } from "../../clients/bw.js";
2
- export declare function HelpBar({ focus, cipher, }: {
2
+ export declare function HelpBar({ focus, cipher, mode, }: {
3
3
  focus: "list" | "search" | "detail";
4
+ mode: "view" | "new";
4
5
  cipher: Cipher | null | undefined;
5
6
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
3
  import { CipherType } from "../../clients/bw.js";
4
- export function HelpBar({ focus, cipher, }) {
5
- return (_jsxs(Box, { borderStyle: "single", borderColor: "gray", marginTop: 1, paddingX: 1, flexShrink: 0, justifyContent: "space-around", children: [_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "/ " }), "Search"] }), focus === "list" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "\u2191/\u2193 " }), "Navigate"] })) : focus === "detail" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Next Field"] })) : (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Esc " }), "Clear Search"] })), focus === "list" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Select"] })) : focus === "detail" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Esc " }), "Focus List"] })) : (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Focus List"] })), ...copyButtons(focus, cipher), _jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Ctrl+w " }), "Logout"] })] }));
4
+ export function HelpBar({ focus, cipher, mode, }) {
5
+ return (_jsxs(Box, { borderStyle: "single", borderColor: "gray", marginTop: 1, paddingX: 1, flexShrink: 0, justifyContent: "space-around", children: [_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "/ " }), "Search"] }), focus === "list" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "\u2191/\u2193 " }), "Navigate"] })) : focus === "detail" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Next Field"] })) : (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Esc " }), "Clear Search"] })), focus === "list" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Select"] })) : focus === "detail" ? (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Esc " }), "Focus List"] })) : (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Tab/Enter " }), "Focus List"] })), mode !== "new" && (_jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Ctrl+n " }), "New"] })), ...copyButtons(focus, cipher), _jsxs(Text, { color: "gray", children: [_jsx(Text, { bold: true, children: "Ctrl+w " }), "Logout"] })] }));
6
6
  }
7
7
  const copyButtons = (focus, cipher) => {
8
8
  if (focus === "detail") {
@@ -8,16 +8,7 @@ import { bwClient, loadConfig, saveConfig } from "../hooks/bw.js";
8
8
  import { useStatusMessage } from "../hooks/status-message.js";
9
9
  import { Checkbox } from "../components/Checkbox.js";
10
10
  import { FetchError, TwoFactorProvider } from "../clients/bw.js";
11
- const art = `
12
- ███████████ ███ ███████████ ███████████ █████ █████
13
- ░░███░░░░░███ ░░░ ░█░░░███░░░█░█░░░███░░░█░░███ ░░███
14
- ░███ ░███ ████ ░ ░███ ░ ░ ░███ ░ ░░███ ███
15
- ░██████████ ░░███ ░███ ░███ ░░█████
16
- ░███░░░░░███ ░███ ░███ ░███ ░░███
17
- ░███ ░███ ░███ ░███ ░███ ░███
18
- ███████████ █████ █████ █████ █████
19
- ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
20
- `;
11
+ import { art } from "../theme/art.js";
21
12
  export function LoginView({ onLogin }) {
22
13
  const [loading, setLoading] = useState(true);
23
14
  const [url, setUrl] = useState("https://vault.bitwarden.eu");
@@ -0,0 +1 @@
1
+ export declare const art = "\n \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\n\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2588\u2591\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2591 \u2591\u2588\u2588\u2588 \u2591 \u2591 \u2591\u2588\u2588\u2588 \u2591 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\n \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\n \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\n\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\n";
@@ -0,0 +1,10 @@
1
+ export const art = `
2
+ ███████████ ███ ███████████ ███████████ █████ █████
3
+ ░░███░░░░░███ ░░░ ░█░░░███░░░█░█░░░███░░░█░░███ ░░███
4
+ ░███ ░███ ████ ░ ░███ ░ ░ ░███ ░ ░░███ ███
5
+ ░██████████ ░░███ ░███ ░███ ░░█████
6
+ ░███░░░░░███ ░███ ░███ ░███ ░░███
7
+ ░███ ░███ ░███ ░███ ░███ ░███
8
+ ███████████ █████ █████ █████ █████
9
+ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
10
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitty-tui",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/mceck/bitty",
6
6
  "keywords": [
@@ -34,7 +34,8 @@
34
34
  "clipboardy": "^4.0.0",
35
35
  "ink": "^6.3.0",
36
36
  "otplib": "^12.0.1",
37
- "react": "^19.1.0"
37
+ "react": "^19.1.0",
38
+ "read-package-up": "^12.0.0"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@sindresorhus/tsconfig": "^8.0.1",