nutstore-webdav-secret-cli 0.1.0

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.
@@ -0,0 +1,94 @@
1
+ import type { BaseRenderable } from "@opentui/core";
2
+ import type {
3
+ AsciiFontProps,
4
+ BoxProps,
5
+ CodeProps,
6
+ ExtendedIntrinsicElements,
7
+ InputProps,
8
+ LinkProps,
9
+ MarkdownProps,
10
+ OpenTUIComponents,
11
+ ScrollBoxProps,
12
+ SelectProps,
13
+ SpanProps,
14
+ TabSelectProps,
15
+ TextareaProps,
16
+ TextProps,
17
+ } from "../node_modules/@opentui/solid/src/types/elements.js";
18
+
19
+ export type OpenTUIElement =
20
+ | BaseRenderable
21
+ | OpenTUIArrayElement
22
+ | string
23
+ | number
24
+ | boolean
25
+ | null
26
+ | undefined;
27
+
28
+ export interface OpenTUIArrayElement extends Array<OpenTUIElement> {}
29
+
30
+ interface OpenTUIIntrinsicElements
31
+ extends ExtendedIntrinsicElements<OpenTUIComponents> {
32
+ box: BoxProps;
33
+ text: TextProps;
34
+ span: SpanProps;
35
+ input: InputProps;
36
+ select: SelectProps;
37
+ ascii_font: AsciiFontProps;
38
+ tab_select: TabSelectProps;
39
+ scrollbox: ScrollBoxProps;
40
+ code: CodeProps;
41
+ textarea: TextareaProps;
42
+ markdown: MarkdownProps;
43
+
44
+ b: SpanProps;
45
+ strong: SpanProps;
46
+ i: SpanProps;
47
+ em: SpanProps;
48
+ u: SpanProps;
49
+ br: Record<string, never>;
50
+ a: LinkProps;
51
+ }
52
+
53
+ declare module "@opentui/solid/jsx-runtime" {
54
+ export function jsx(
55
+ type: unknown,
56
+ props: unknown,
57
+ key?: unknown,
58
+ ): JSX.Element;
59
+
60
+ export function jsxs(
61
+ type: unknown,
62
+ props: unknown,
63
+ key?: unknown,
64
+ ): JSX.Element;
65
+
66
+ export const Fragment: (props: { children?: JSX.Element }) => JSX.Element;
67
+
68
+ export namespace JSX {
69
+ type Element = OpenTUIElement;
70
+ type ArrayElement = OpenTUIArrayElement;
71
+
72
+ interface IntrinsicElements extends OpenTUIIntrinsicElements {}
73
+
74
+ interface ElementChildrenAttribute {
75
+ children: Record<string, never>;
76
+ }
77
+ }
78
+ }
79
+
80
+ declare global {
81
+ namespace JSX {
82
+ type Element = OpenTUIElement;
83
+
84
+ type ArrayElement = OpenTUIArrayElement;
85
+
86
+ interface IntrinsicElements extends OpenTUIIntrinsicElements {}
87
+
88
+ interface ElementChildrenAttribute {
89
+ children: Record<string, never>;
90
+ }
91
+ }
92
+ }
93
+
94
+ export {};
package/src/theme.ts ADDED
@@ -0,0 +1,49 @@
1
+ import type { ThemeMode } from "@opentui/core";
2
+
3
+ const DANGER_FG = "#dc2626";
4
+ const NUTSTORE_LOGO_COLORS = [
5
+ "#D89F44",
6
+ "#C78A3D",
7
+ "#B67535",
8
+ "#9E5726",
9
+ "#965B25",
10
+ "#854A21",
11
+ "#713F1D",
12
+ "#623718",
13
+ ];
14
+
15
+ export type Palette = {
16
+ fg: string;
17
+ muted: string;
18
+ border: string;
19
+ brandLogo: string[];
20
+ cursor: string;
21
+ selectedFg: string;
22
+ selectedBg: string;
23
+ danger: string;
24
+ };
25
+
26
+ const lightPalette: Palette = {
27
+ fg: "#111827",
28
+ muted: "#4b5563",
29
+ border: "#6b7280",
30
+ brandLogo: NUTSTORE_LOGO_COLORS,
31
+ cursor: "#111827",
32
+ selectedFg: "#ffffff",
33
+ selectedBg: "#111827",
34
+ danger: DANGER_FG,
35
+ };
36
+
37
+ const darkPalette: Palette = {
38
+ fg: "#f9fafb",
39
+ muted: "#9ca3af",
40
+ border: "#9ca3af",
41
+ brandLogo: NUTSTORE_LOGO_COLORS,
42
+ cursor: "#f9fafb",
43
+ selectedFg: "#111827",
44
+ selectedBg: "#f9fafb",
45
+ danger: "#f87171",
46
+ };
47
+
48
+ export const getPalette = (mode: ThemeMode | null): Palette =>
49
+ mode === "dark" ? darkPalette : lightPalette;
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ export type SecretItem = {
2
+ id: string;
3
+ name: string;
4
+ account?: string;
5
+ password: string;
6
+ createdAt: string;
7
+ };
package/src/utils.ts ADDED
@@ -0,0 +1,31 @@
1
+ export const clamp = (value: number, min: number, max: number) =>
2
+ Math.max(min, Math.min(value, max));
3
+
4
+ export const truncate = (value: string, maxLength: number) => {
5
+ if (value.length <= maxLength) {
6
+ return value;
7
+ }
8
+
9
+ return `${value.slice(0, Math.max(0, maxLength - 3))}...`;
10
+ };
11
+
12
+ export const maskPassword = (password: string) =>
13
+ `********${password.slice(-3)}`;
14
+
15
+ export const copyToClipboard = async (value: string) => {
16
+ if (typeof Bun === "undefined") {
17
+ return false;
18
+ }
19
+
20
+ const process = Bun.spawn(["pbcopy"], {
21
+ stdin: "pipe",
22
+ stdout: "ignore",
23
+ stderr: "ignore",
24
+ });
25
+
26
+ process.stdin.write(value);
27
+ process.stdin.end();
28
+
29
+ const exitCode = await process.exited;
30
+ return exitCode === 0;
31
+ };