@yeshwanthyk/open-tui 0.1.0 → 0.1.2

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.
Files changed (132) hide show
  1. package/dist/app.d.ts +18 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/app.js +28 -0
  4. package/dist/app.js.map +1 -0
  5. package/dist/autocomplete/autocomplete.d.ts +48 -0
  6. package/dist/autocomplete/autocomplete.d.ts.map +1 -0
  7. package/dist/autocomplete/autocomplete.js +391 -0
  8. package/dist/autocomplete/autocomplete.js.map +1 -0
  9. package/dist/autocomplete/file-index.d.ts +36 -0
  10. package/dist/autocomplete/file-index.d.ts.map +1 -0
  11. package/dist/autocomplete/file-index.js +143 -0
  12. package/dist/autocomplete/file-index.js.map +1 -0
  13. package/dist/autocomplete/index.d.ts +3 -0
  14. package/dist/autocomplete/index.d.ts.map +1 -0
  15. package/dist/autocomplete/index.js +3 -0
  16. package/dist/autocomplete/index.js.map +1 -0
  17. package/dist/components/badge.d.ts +11 -0
  18. package/dist/components/badge.d.ts.map +1 -0
  19. package/dist/components/badge.js +28 -0
  20. package/dist/components/badge.js.map +1 -0
  21. package/dist/components/code-block.d.ts +12 -0
  22. package/dist/components/code-block.d.ts.map +1 -0
  23. package/dist/components/code-block.js +21 -0
  24. package/dist/components/code-block.js.map +1 -0
  25. package/dist/components/dialog.d.ts +12 -0
  26. package/dist/components/dialog.d.ts.map +1 -0
  27. package/dist/components/dialog.js +15 -0
  28. package/dist/components/dialog.js.map +1 -0
  29. package/dist/components/diff.d.ts +11 -0
  30. package/dist/components/diff.d.ts.map +1 -0
  31. package/dist/components/diff.js +18 -0
  32. package/dist/components/diff.js.map +1 -0
  33. package/dist/components/divider.d.ts +9 -0
  34. package/dist/components/divider.d.ts.map +1 -0
  35. package/dist/components/divider.js +14 -0
  36. package/dist/components/divider.js.map +1 -0
  37. package/dist/components/editor.d.ts +87 -0
  38. package/dist/components/editor.d.ts.map +1 -0
  39. package/dist/components/editor.js +145 -0
  40. package/dist/components/editor.js.map +1 -0
  41. package/dist/components/image.d.ts +65 -0
  42. package/dist/components/image.d.ts.map +1 -0
  43. package/dist/components/image.js +315 -0
  44. package/dist/components/image.js.map +1 -0
  45. package/dist/components/loader.d.ts +25 -0
  46. package/dist/components/loader.d.ts.map +1 -0
  47. package/dist/components/loader.js +24 -0
  48. package/dist/components/loader.js.map +1 -0
  49. package/dist/components/markdown.d.ts +28 -0
  50. package/dist/components/markdown.d.ts.map +1 -0
  51. package/dist/components/markdown.js +28 -0
  52. package/dist/components/markdown.js.map +1 -0
  53. package/dist/components/panel.d.ts +12 -0
  54. package/dist/components/panel.d.ts.map +1 -0
  55. package/dist/components/panel.js +47 -0
  56. package/dist/components/panel.js.map +1 -0
  57. package/dist/components/select-list.d.ts +55 -0
  58. package/dist/components/select-list.d.ts.map +1 -0
  59. package/dist/components/select-list.js +116 -0
  60. package/dist/components/select-list.js.map +1 -0
  61. package/dist/components/spacer.d.ts +25 -0
  62. package/dist/components/spacer.d.ts.map +1 -0
  63. package/dist/components/spacer.js +25 -0
  64. package/dist/components/spacer.js.map +1 -0
  65. package/dist/components/toast.d.ts +19 -0
  66. package/dist/components/toast.d.ts.map +1 -0
  67. package/dist/components/toast.js +42 -0
  68. package/dist/components/toast.js.map +1 -0
  69. package/dist/context/terminal.d.ts +7 -0
  70. package/dist/context/terminal.d.ts.map +1 -0
  71. package/dist/context/terminal.js +6 -0
  72. package/dist/context/terminal.js.map +1 -0
  73. package/dist/context/theme.d.ts +117 -0
  74. package/dist/context/theme.d.ts.map +1 -0
  75. package/dist/context/theme.js +648 -0
  76. package/dist/context/theme.js.map +1 -0
  77. package/dist/hooks/use-keyboard.d.ts +7 -0
  78. package/dist/hooks/use-keyboard.d.ts.map +1 -0
  79. package/dist/hooks/use-keyboard.js +6 -0
  80. package/dist/hooks/use-keyboard.js.map +1 -0
  81. package/dist/index.d.ts +31 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +45 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/opentui-augmentations.d.ts +9 -0
  86. package/dist/opentui-augmentations.d.ts.map +1 -0
  87. package/dist/opentui-augmentations.js +1 -0
  88. package/dist/opentui-augmentations.js.map +1 -0
  89. package/dist/parsers-config.d.ts +16 -0
  90. package/dist/parsers-config.d.ts.map +1 -0
  91. package/dist/parsers-config.js +119 -0
  92. package/dist/parsers-config.js.map +1 -0
  93. package/dist/themes/aura.json +69 -0
  94. package/dist/themes/ayu.json +80 -0
  95. package/dist/themes/catppuccin-macchiato.json +233 -0
  96. package/dist/themes/catppuccin.json +112 -0
  97. package/dist/themes/cobalt2.json +228 -0
  98. package/dist/themes/dracula.json +219 -0
  99. package/dist/themes/everforest.json +241 -0
  100. package/dist/themes/flexoki.json +237 -0
  101. package/dist/themes/github.json +233 -0
  102. package/dist/themes/gruvbox.json +95 -0
  103. package/dist/themes/kanagawa.json +77 -0
  104. package/dist/themes/lucent-orng.json +227 -0
  105. package/dist/themes/marvin.json +97 -0
  106. package/dist/themes/material.json +235 -0
  107. package/dist/themes/matrix.json +77 -0
  108. package/dist/themes/mercury.json +245 -0
  109. package/dist/themes/monokai.json +221 -0
  110. package/dist/themes/nightowl.json +221 -0
  111. package/dist/themes/nord.json +223 -0
  112. package/dist/themes/one-dark.json +84 -0
  113. package/dist/themes/opencode.json +245 -0
  114. package/dist/themes/orng.json +245 -0
  115. package/dist/themes/palenight.json +222 -0
  116. package/dist/themes/rosepine.json +234 -0
  117. package/dist/themes/solarized.json +223 -0
  118. package/dist/themes/synthwave84.json +226 -0
  119. package/dist/themes/tokyonight.json +243 -0
  120. package/dist/themes/vercel.json +245 -0
  121. package/dist/themes/vesper.json +218 -0
  122. package/dist/themes/zenburn.json +223 -0
  123. package/dist/utils/clipboard.d.ts +12 -0
  124. package/dist/utils/clipboard.d.ts.map +1 -0
  125. package/dist/utils/clipboard.js +52 -0
  126. package/dist/utils/clipboard.js.map +1 -0
  127. package/dist/utils/text-width.d.ts +26 -0
  128. package/dist/utils/text-width.d.ts.map +1 -0
  129. package/dist/utils/text-width.js +101 -0
  130. package/dist/utils/text-width.js.map +1 -0
  131. package/package.json +13 -4
  132. package/src/index.ts +0 -121
@@ -0,0 +1,143 @@
1
+ import { spawn } from "child_process";
2
+ import fuzzysort from "fuzzysort";
3
+ import { dirname } from "path";
4
+ /**
5
+ * Fast file index using ripgrep for listing and fuzzysort for matching.
6
+ * Respects .gitignore by default.
7
+ */
8
+ export class FileIndex {
9
+ cwd;
10
+ files = [];
11
+ indexing = false;
12
+ indexed = false;
13
+ pendingCallbacks = [];
14
+ searchItemsFilesOnly = [];
15
+ searchItemsWithDirs = [];
16
+ lastRefreshTime = 0;
17
+ staleTime;
18
+ constructor(options) {
19
+ this.cwd = options.cwd;
20
+ this.staleTime = options.staleTime ?? 5_000; // Default 5s - short for quick file visibility
21
+ if (!options.lazy) {
22
+ this.refresh().catch(() => { });
23
+ }
24
+ }
25
+ async refresh() {
26
+ if (this.indexing) {
27
+ return new Promise((resolve) => {
28
+ this.pendingCallbacks.push(resolve);
29
+ });
30
+ }
31
+ this.indexing = true;
32
+ const files = [];
33
+ const dirs = new Set();
34
+ try {
35
+ await new Promise((resolve) => {
36
+ const proc = spawn("rg", ["--files", "--follow", "--hidden", "--glob=!.git/*"], {
37
+ cwd: this.cwd,
38
+ stdio: ["ignore", "pipe", "ignore"],
39
+ });
40
+ let buffer = "";
41
+ proc.stdout.on("data", (chunk) => {
42
+ buffer += chunk.toString();
43
+ const lines = buffer.split("\n");
44
+ buffer = lines.pop() || "";
45
+ for (const line of lines) {
46
+ if (line) {
47
+ files.push(line);
48
+ let current = line;
49
+ while (true) {
50
+ const dir = dirname(current);
51
+ if (dir === "." || dir === current)
52
+ break;
53
+ current = dir;
54
+ if (dirs.has(dir))
55
+ break;
56
+ dirs.add(dir);
57
+ }
58
+ }
59
+ }
60
+ });
61
+ proc.on("close", () => {
62
+ if (buffer) {
63
+ files.push(buffer);
64
+ let current = buffer;
65
+ while (true) {
66
+ const dir = dirname(current);
67
+ if (dir === "." || dir === current)
68
+ break;
69
+ current = dir;
70
+ if (dirs.has(dir))
71
+ break;
72
+ dirs.add(dir);
73
+ }
74
+ }
75
+ resolve();
76
+ });
77
+ proc.on("error", () => {
78
+ resolve();
79
+ });
80
+ });
81
+ this.files = files;
82
+ this.searchItemsFilesOnly = files.map((f) => ({ path: f, isDirectory: false }));
83
+ this.searchItemsWithDirs = [
84
+ ...this.searchItemsFilesOnly,
85
+ ...Array.from(dirs, (dir) => ({ path: dir + "/", isDirectory: true })),
86
+ ];
87
+ this.indexed = true;
88
+ this.lastRefreshTime = Date.now();
89
+ }
90
+ finally {
91
+ this.indexing = false;
92
+ for (const cb of this.pendingCallbacks) {
93
+ cb();
94
+ }
95
+ this.pendingCallbacks = [];
96
+ }
97
+ }
98
+ search(query, options) {
99
+ const limit = options?.limit ?? 20;
100
+ const includeDirs = options?.includeDirs ?? true;
101
+ if (!this.indexed && !this.indexing) {
102
+ this.refresh().catch(() => { });
103
+ return [];
104
+ }
105
+ // Trigger background refresh if stale (doesn't block current search)
106
+ if (this.indexed && !this.indexing && Date.now() - this.lastRefreshTime > this.staleTime) {
107
+ this.refresh().catch(() => { });
108
+ }
109
+ if (!this.indexed) {
110
+ return [];
111
+ }
112
+ const items = includeDirs ? this.searchItemsWithDirs : this.searchItemsFilesOnly;
113
+ if (!query) {
114
+ return items.slice(0, limit).map((item) => ({
115
+ path: item.path,
116
+ isDirectory: item.isDirectory,
117
+ score: 0,
118
+ }));
119
+ }
120
+ const results = fuzzysort.go(query, items, {
121
+ key: "path",
122
+ limit,
123
+ threshold: 0.2,
124
+ });
125
+ return results
126
+ .filter((r) => r.obj?.path != null)
127
+ .map((r) => ({
128
+ path: r.obj.path,
129
+ isDirectory: r.obj.isDirectory,
130
+ score: r.score,
131
+ }));
132
+ }
133
+ get fileCount() {
134
+ return this.files.length;
135
+ }
136
+ get isIndexing() {
137
+ return this.indexing;
138
+ }
139
+ get isReady() {
140
+ return this.indexed;
141
+ }
142
+ }
143
+ //# sourceMappingURL=file-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-index.js","sourceRoot":"","sources":["../../src/autocomplete/file-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAiB/B;;;GAGG;AACH,MAAM,OAAO,SAAS;IACb,GAAG,CAAS;IACZ,KAAK,GAAa,EAAE,CAAC;IACrB,QAAQ,GAAG,KAAK,CAAC;IACjB,OAAO,GAAG,KAAK,CAAC;IAChB,gBAAgB,GAAsB,EAAE,CAAC;IACzC,oBAAoB,GAAiB,EAAE,CAAC;IACxC,mBAAmB,GAAiB,EAAE,CAAC;IACvC,eAAe,GAAG,CAAC,CAAC;IACpB,SAAS,CAAS;IAE1B,YAAY,OAAyB;QACpC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,+CAA+C;QAC5F,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAc,CAAC,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC9B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,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;QACL,CAAC;QAED,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE;YAC1C,GAAG,EAAE,MAAM;YACX,KAAK;YACL,SAAS,EAAE,GAAG;SACd,CAAC,CAAC;QAEH,OAAO,OAAO;aACZ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,IAAI,CAAC;aAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACZ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI;YAChB,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW;YAC9B,KAAK,EAAE,CAAC,CAAC,KAAK;SACd,CAAC,CAAC,CAAC;IACN,CAAC;IAED,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD"}
@@ -0,0 +1,3 @@
1
+ export { type AutocompleteItem, type AutocompleteProvider, CombinedAutocompleteProvider, type SlashCommand, } from "./autocomplete.js";
2
+ export { FileIndex, type FileIndexOptions, type FileSearchResult } from "./file-index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { CombinedAutocompleteProvider, } from "./autocomplete.js";
2
+ export { FileIndex } from "./file-index.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAgD,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { JSX } from "@opentui/solid";
2
+ import { type RGBA } from "../context/theme.js";
3
+ export type BadgeVariant = "neutral" | "info" | "success" | "warning" | "error";
4
+ export type BadgeProps = Omit<JSX.IntrinsicElements["box"], "children"> & {
5
+ label: string;
6
+ variant?: BadgeVariant;
7
+ fg?: RGBA;
8
+ bg?: RGBA;
9
+ };
10
+ export declare function Badge(props: BadgeProps): JSX.Element;
11
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAGzC,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE/E,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACzE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,EAAE,CAAC,EAAE,IAAI,CAAA;IACT,EAAE,CAAC,EAAE,IAAI,CAAA;CACT,CAAA;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAwCpD"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "@opentui/solid/jsx-runtime";
2
+ import { splitProps } from "solid-js";
3
+ import { TextAttributes } from "@opentui/core";
4
+ import { useTheme } from "../context/theme.js";
5
+ export function Badge(props) {
6
+ const { theme } = useTheme();
7
+ const [local, rest] = splitProps(props, ["label", "variant", "fg", "bg"]);
8
+ const resolvedFg = () => {
9
+ if (local.fg)
10
+ return local.fg;
11
+ switch (local.variant ?? "neutral") {
12
+ case "info":
13
+ return theme.info;
14
+ case "success":
15
+ return theme.success;
16
+ case "warning":
17
+ return theme.warning;
18
+ case "error":
19
+ return theme.error;
20
+ case "neutral":
21
+ default:
22
+ return theme.textMuted;
23
+ }
24
+ };
25
+ const resolvedBg = () => local.bg ?? theme.backgroundElement;
26
+ return (_jsx("box", { backgroundColor: resolvedBg(), border: true, borderColor: theme.borderSubtle, paddingLeft: 1, paddingRight: 1, paddingTop: 0, paddingBottom: 0, flexShrink: 0, ...rest, children: _jsx("text", { fg: resolvedFg(), attributes: TextAttributes.BOLD, children: local.label }) }));
27
+ }
28
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAa,MAAM,qBAAqB,CAAA;AAWzD,MAAM,UAAU,KAAK,CAAC,KAAiB;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAEzE,MAAM,UAAU,GAAG,GAAS,EAAE;QAC7B,IAAI,KAAK,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC,EAAE,CAAA;QAC7B,QAAQ,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,KAAK,MAAM;gBACV,OAAO,KAAK,CAAC,IAAI,CAAA;YAClB,KAAK,SAAS;gBACb,OAAO,KAAK,CAAC,OAAO,CAAA;YACrB,KAAK,SAAS;gBACb,OAAO,KAAK,CAAC,OAAO,CAAA;YACrB,KAAK,OAAO;gBACX,OAAO,KAAK,CAAC,KAAK,CAAA;YACnB,KAAK,SAAS,CAAC;YACf;gBACC,OAAO,KAAK,CAAC,SAAS,CAAA;QACxB,CAAC;IACF,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,iBAAiB,CAAA;IAElE,OAAO,CACN,cACC,eAAe,EAAE,UAAU,EAAE,EAC7B,MAAM,QACN,WAAW,EAAE,KAAK,CAAC,YAAY,EAC/B,WAAW,EAAE,CAAC,EACd,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,aAAa,EAAE,CAAC,EAChB,UAAU,EAAE,CAAC,KACT,IAAI,YAER,eAAM,EAAE,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,cAAc,CAAC,IAAI,YACrD,KAAK,CAAC,KAAK,GACN,GACF,CACN,CAAA;AACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { JSX } from "@opentui/solid";
2
+ export type CodeBlockProps = Omit<JSX.IntrinsicElements["box"], "children"> & {
3
+ content: string;
4
+ filetype?: string;
5
+ title?: string;
6
+ showLineNumbers?: boolean;
7
+ wrapMode?: "word" | "char" | "none";
8
+ streaming?: boolean;
9
+ conceal?: boolean;
10
+ };
11
+ export declare function CodeBlock(props: CodeBlockProps): JSX.Element;
12
+ //# sourceMappingURL=code-block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../src/components/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CA8D5D"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/solid/jsx-runtime";
2
+ import { getTreeSitterClient } from "@opentui/core";
3
+ import { Show, createSignal, splitProps } from "solid-js";
4
+ import { useTheme } from "../context/theme.js";
5
+ export function CodeBlock(props) {
6
+ const { theme, syntaxStyle } = useTheme();
7
+ const [local, rest] = splitProps(props, [
8
+ "content",
9
+ "filetype",
10
+ "title",
11
+ "showLineNumbers",
12
+ "wrapMode",
13
+ "streaming",
14
+ "conceal",
15
+ ]);
16
+ const [codeRef, setCodeRef] = createSignal(undefined);
17
+ const showLineNumbers = () => local.showLineNumbers ?? true;
18
+ // Minimal: no border, subtle bg tint
19
+ return (_jsxs("box", { flexDirection: "column", backgroundColor: theme.backgroundElement, paddingLeft: 1, paddingRight: 1, ...rest, children: [_jsx(Show, { when: local.title, children: _jsx("box", { flexDirection: "row", alignItems: "center", gap: 1, paddingBottom: 1, children: _jsx("text", { fg: theme.textMuted, children: local.title }) }) }), _jsxs("box", { flexDirection: "row", children: [_jsx(Show, { when: showLineNumbers() && codeRef(), children: (ref) => (_jsx("line_number", { target: ref(), fg: theme.diffLineNumberFg, bg: theme.diffLineNumberBg, paddingRight: 1, flexShrink: 0 })) }), _jsx("code", { ref: setCodeRef, content: local.content, filetype: local.filetype ?? "text", syntaxStyle: syntaxStyle, treeSitterClient: getTreeSitterClient(), wrapMode: local.wrapMode ?? "word", streaming: local.streaming ?? false, conceal: local.conceal ?? false, drawUnstyledText: true, selectionBg: theme.selectionBg, selectionFg: theme.selectionFg, width: "100%", height: "100%" })] })] }));
20
+ }
21
+ //# sourceMappingURL=code-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.js","sourceRoot":"","sources":["../../src/components/code-block.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAiB,MAAM,UAAU,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAY9C,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC9C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,CAAA;IACzC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE;QACvC,SAAS;QACT,UAAU;QACV,OAAO;QACP,iBAAiB;QACjB,UAAU;QACV,WAAW;QACX,SAAS;KACT,CAAC,CAAA;IAEF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,YAAY,CAA6B,SAAS,CAAC,CAAA;IAEjF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,IAAI,IAAI,CAAA;IAE3D,qCAAqC;IACrC,OAAO,CACN,eACC,aAAa,EAAC,QAAQ,EACtB,eAAe,EAAE,KAAK,CAAC,iBAAiB,EACxC,WAAW,EAAE,CAAC,EACd,YAAY,EAAE,CAAC,KACX,IAAI,aAER,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,KAAK,YACtB,cAAK,aAAa,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,YACpE,eAAM,EAAE,EAAE,KAAK,CAAC,SAAS,YACvB,KAAK,CAAC,KAAK,GACN,GACF,GACA,EACP,eAAK,aAAa,EAAC,KAAK,aACvB,KAAC,IAAI,IAAC,IAAI,EAAE,eAAe,EAAE,IAAI,OAAO,EAAE,YACxC,CAAC,GAA6B,EAAE,EAAE,CAAC,CACnC,sBACC,MAAM,EAAE,GAAG,EAAE,EACb,EAAE,EAAE,KAAK,CAAC,gBAAgB,EAC1B,EAAE,EAAE,KAAK,CAAC,gBAAgB,EAC1B,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,GACZ,CACF,GACK,EACP,eACC,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,EAClC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,EAClC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK,EACnC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,EAC/B,gBAAgB,QAChB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,GACZ,IACG,IACD,CACN,CAAA;AACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { JSX } from "@opentui/solid";
2
+ import { type RGBA } from "../context/theme.js";
3
+ export type DialogProps = Omit<JSX.IntrinsicElements["box"], "children"> & {
4
+ open: boolean;
5
+ title?: string;
6
+ borderColor?: RGBA;
7
+ closeOnOverlayClick?: boolean;
8
+ onClose?: () => void;
9
+ children?: JSX.Element;
10
+ };
11
+ export declare function Dialog(props: DialogProps): JSX.Element;
12
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAGzC,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAGzD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACtB,CAAA;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA0CtD"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/solid/jsx-runtime";
2
+ import { Show, splitProps } from "solid-js";
3
+ import { TextAttributes } from "@opentui/core";
4
+ import { useTheme } from "../context/theme.js";
5
+ import { Panel } from "./panel.js";
6
+ export function Dialog(props) {
7
+ const { theme } = useTheme();
8
+ const [local, rest] = splitProps(props, ["open", "title", "borderColor", "closeOnOverlayClick", "onClose", "children"]);
9
+ return (_jsx(Show, { when: local.open, children: _jsxs("box", { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: 900, children: [_jsx("box", { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", backgroundColor: theme.background, opacity: 0.8, onMouseUp: () => {
10
+ if (local.closeOnOverlayClick === false)
11
+ return;
12
+ local.onClose?.();
13
+ } }), _jsx("box", { position: "absolute", top: "15%", left: "15%", width: "70%", maxHeight: "70%", zIndex: 901, ...rest, children: _jsxs(Panel, { variant: "panel", borderColor: local.borderColor ?? theme.borderActive, paddingX: 2, paddingY: 1, children: [_jsxs(Show, { when: local.title, children: [_jsx("text", { fg: theme.text, attributes: TextAttributes.BOLD, children: local.title }), _jsx("box", { height: 1 })] }), local.children] }) })] }) }));
14
+ }
15
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAa,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAWlC,MAAM,UAAU,MAAM,CAAC,KAAkB;IACxC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAA;IAEvH,OAAO,CACN,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YACrB,eAAK,QAAQ,EAAC,UAAU,EAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAE,GAAG,aAC/E,cACC,QAAQ,EAAC,UAAU,EACnB,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,CAAC,EACP,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,eAAe,EAAE,KAAK,CAAC,UAAU,EACjC,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,GAAG,EAAE;wBACf,IAAI,KAAK,CAAC,mBAAmB,KAAK,KAAK;4BAAE,OAAM;wBAC/C,KAAK,CAAC,OAAO,EAAE,EAAE,CAAA;oBAClB,CAAC,GACA,EACF,cACC,QAAQ,EAAC,UAAU,EACnB,GAAG,EAAC,KAAK,EACT,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,KAAK,EACX,SAAS,EAAC,KAAK,EACf,MAAM,EAAE,GAAG,KACP,IAAI,YAER,MAAC,KAAK,IAAC,OAAO,EAAC,OAAO,EAAC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,aACpG,MAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,KAAK,aACtB,eAAM,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,CAAC,IAAI,YACnD,KAAK,CAAC,KAAK,GACN,EACP,cAAK,MAAM,EAAE,CAAC,GAAI,IACZ,EACN,KAAK,CAAC,QAAQ,IACR,GACH,IACD,GACA,CACP,CAAA;AACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { JSX } from "@opentui/solid";
2
+ export type DiffView = "auto" | "unified" | "split";
3
+ export type DiffWrapMode = "word" | "char" | "none";
4
+ export type DiffProps = Omit<JSX.IntrinsicElements["diff"], "diff" | "view" | "filetype" | "syntaxStyle" | "treeSitterClient"> & {
5
+ diffText: string;
6
+ filetype?: string;
7
+ view?: DiffView;
8
+ wrapMode?: DiffWrapMode;
9
+ };
10
+ export declare function Diff(props: DiffProps): JSX.Element;
11
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/components/diff.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAMzC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAEnD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEnD,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,kBAAkB,CAAC,GAAG;IAChI,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAqClD"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "@opentui/solid/jsx-runtime";
2
+ import { splitProps } from "solid-js";
3
+ import { getTreeSitterClient } from "@opentui/core";
4
+ import { useTerminalDimensions } from "../context/terminal.js";
5
+ import { useTheme } from "../context/theme.js";
6
+ export function Diff(props) {
7
+ const dimensions = useTerminalDimensions();
8
+ const { theme, syntaxStyle } = useTheme();
9
+ const [local, rest] = splitProps(props, ["diffText", "filetype", "view", "wrapMode"]);
10
+ const computedView = () => {
11
+ const requested = local.view ?? "auto";
12
+ if (requested === "unified" || requested === "split")
13
+ return requested;
14
+ return dimensions().width > 120 ? "split" : "unified";
15
+ };
16
+ return (_jsx("diff", { diff: local.diffText, view: computedView(), filetype: local.filetype ?? "text", wrapMode: local.wrapMode ?? "word", syntaxStyle: syntaxStyle, treeSitterClient: getTreeSitterClient(), showLineNumbers: true, lineNumberFg: theme.diffLineNumberFg, lineNumberBg: theme.diffLineNumberBg, addedBg: theme.diffAddedBg, removedBg: theme.diffRemovedBg, contextBg: theme.diffContextBg, addedContentBg: theme.diffHighlightAddedBg, removedContentBg: theme.diffHighlightRemovedBg, addedSignColor: theme.diffAddedSign, removedSignColor: theme.diffRemovedSign, addedLineNumberBg: theme.diffAddedLineNumberBg, removedLineNumberBg: theme.diffRemovedLineNumberBg, selectionBg: theme.selectionBg, selectionFg: theme.selectionFg, ...rest }));
17
+ }
18
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/components/diff.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAa9C,MAAM,UAAU,IAAI,CAAC,KAAgB;IACpC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAA;IAC1C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,CAAA;IAEzC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;IAErF,MAAM,YAAY,GAAG,GAAwB,EAAE;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,CAAA;QACtC,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,OAAO;YAAE,OAAO,SAAS,CAAA;QACtE,OAAO,UAAU,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;IACtD,CAAC,CAAA;IAED,OAAO,CACN,eACC,IAAI,EAAE,KAAK,CAAC,QAAQ,EACpB,IAAI,EAAE,YAAY,EAAE,EACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,EAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,EAClC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,eAAe,QACf,YAAY,EAAE,KAAK,CAAC,gBAAgB,EACpC,YAAY,EAAE,KAAK,CAAC,gBAAgB,EACpC,OAAO,EAAE,KAAK,CAAC,WAAW,EAC1B,SAAS,EAAE,KAAK,CAAC,aAAa,EAC9B,SAAS,EAAE,KAAK,CAAC,aAAa,EAC9B,cAAc,EAAE,KAAK,CAAC,oBAAoB,EAC1C,gBAAgB,EAAE,KAAK,CAAC,sBAAsB,EAC9C,cAAc,EAAE,KAAK,CAAC,aAAa,EACnC,gBAAgB,EAAE,KAAK,CAAC,eAAe,EACvC,iBAAiB,EAAE,KAAK,CAAC,qBAAqB,EAC9C,mBAAmB,EAAE,KAAK,CAAC,uBAAuB,EAClD,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,WAAW,EAAE,KAAK,CAAC,WAAW,KAC1B,IAAI,GACP,CACF,CAAA;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { JSX } from "@opentui/solid";
2
+ import { type RGBA } from "../context/theme.js";
3
+ export type DividerOrientation = "horizontal" | "vertical";
4
+ export type DividerProps = Omit<JSX.IntrinsicElements["box"], "children"> & {
5
+ orientation?: DividerOrientation;
6
+ color?: RGBA;
7
+ };
8
+ export declare function Divider(props: DividerProps): JSX.Element;
9
+ //# sourceMappingURL=divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../src/components/divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC3E,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,KAAK,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAYxD"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "@opentui/solid/jsx-runtime";
2
+ import { splitProps } from "solid-js";
3
+ import { useTheme } from "../context/theme.js";
4
+ export function Divider(props) {
5
+ const { theme } = useTheme();
6
+ const [local, rest] = splitProps(props, ["orientation", "color"]);
7
+ const color = () => local.color ?? theme.borderSubtle;
8
+ const orientation = () => local.orientation ?? "horizontal";
9
+ if (orientation() === "vertical") {
10
+ return _jsx("box", { border: ["left"], borderColor: color(), width: 1, height: rest.height ?? "100%", flexShrink: 0, ...rest });
11
+ }
12
+ return _jsx("box", { border: ["top"], borderColor: color(), height: 1, width: rest.width ?? "100%", flexShrink: 0, ...rest });
13
+ }
14
+ //# sourceMappingURL=divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.js","sourceRoot":"","sources":["../../src/components/divider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAa,MAAM,qBAAqB,CAAA;AASzD,MAAM,UAAU,OAAO,CAAC,KAAmB;IAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAA;IAEjE,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAA;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,IAAI,YAAY,CAAA;IAE3D,IAAI,WAAW,EAAE,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,cAAK,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,KAAM,IAAI,GAAI,CAAA;IACzH,CAAC;IAED,OAAO,cAAK,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,KAAM,IAAI,GAAI,CAAA;AACvH,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Editor component - wrapper around OpenTUI's TextareaRenderable
3
+ *
4
+ * Provides a multi-line text input with keyboard navigation, history,
5
+ * and autocomplete support.
6
+ */
7
+ import { TextareaRenderable } from "@opentui/core";
8
+ import { type RGBA } from "../context/theme.js";
9
+ export interface EditorTheme {
10
+ border: RGBA;
11
+ borderActive: RGBA;
12
+ text: RGBA;
13
+ cursor: RGBA;
14
+ placeholder: RGBA;
15
+ background: RGBA;
16
+ }
17
+ export interface EditorProps {
18
+ /** Initial text content */
19
+ initialValue?: string;
20
+ /** Placeholder text when empty */
21
+ placeholder?: string;
22
+ /** Whether the editor is focused */
23
+ focused?: boolean;
24
+ /** Whether input is disabled */
25
+ disabled?: boolean;
26
+ /** Minimum height in lines */
27
+ minHeight?: number;
28
+ /** Maximum height in lines */
29
+ maxHeight?: number;
30
+ /** Optional width constraint */
31
+ width?: number | "auto" | `${number}%`;
32
+ /** Optional max width constraint */
33
+ maxWidth?: number | "auto" | `${number}%`;
34
+ /** Theme overrides */
35
+ theme?: Partial<EditorTheme>;
36
+ /** Called when content changes */
37
+ onChange?: (text: string) => void;
38
+ /** Called when Enter is pressed (submit) */
39
+ onSubmit?: (text: string) => void;
40
+ /** Called when Escape is pressed */
41
+ onEscape?: () => void;
42
+ /** Ref callback to get the textarea renderable */
43
+ ref?: (ref: EditorRef) => void;
44
+ }
45
+ export interface EditorRef {
46
+ /** Get current text content */
47
+ getText: () => string;
48
+ /** Set text content */
49
+ setText: (text: string) => void;
50
+ /** Clear the editor */
51
+ clear: () => void;
52
+ /** Focus the editor */
53
+ focus: () => void;
54
+ /** Blur the editor */
55
+ blur: () => void;
56
+ /** Get the underlying TextareaRenderable */
57
+ getTextarea: () => TextareaRenderable | undefined;
58
+ }
59
+ /**
60
+ * Editor component for multi-line text input
61
+ */
62
+ export declare function Editor(props: EditorProps): any;
63
+ /**
64
+ * Simple single-line input component
65
+ */
66
+ export interface InputProps {
67
+ /** Current value */
68
+ value?: string;
69
+ /** Placeholder text */
70
+ placeholder?: string;
71
+ /** Whether the input is focused */
72
+ focused?: boolean;
73
+ /** Called when value changes */
74
+ onChange?: (value: string) => void;
75
+ /** Called when Enter is pressed */
76
+ onSubmit?: (value: string) => void;
77
+ /** Called when Escape is pressed */
78
+ onEscape?: () => void;
79
+ /** Theme overrides */
80
+ theme?: Partial<EditorTheme>;
81
+ /** Optional width constraint */
82
+ width?: EditorProps["width"];
83
+ /** Optional max width constraint */
84
+ maxWidth?: EditorProps["maxWidth"];
85
+ }
86
+ export declare function Input(props: InputProps): any;
87
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/components/editor.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAiB,MAAM,eAAe,CAAA;AAEjE,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,qBAAqB,CAAA;AAEzD,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,IAAI,CAAA;IACZ,YAAY,EAAE,IAAI,CAAA;IAClB,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,IAAI,CAAA;IACZ,WAAW,EAAE,IAAI,CAAA;IACjB,UAAU,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC3B,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kCAAk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AgGxC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,sBAAsB;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;CAClC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,OAgBtC"}
@@ -0,0 +1,145 @@
1
+ import { jsx as _jsx } from "@opentui/solid/jsx-runtime";
2
+ /**
3
+ * Editor component - wrapper around OpenTUI's TextareaRenderable
4
+ *
5
+ * Provides a multi-line text input with keyboard navigation, history,
6
+ * and autocomplete support.
7
+ */
8
+ import { TextareaRenderable } from "@opentui/core";
9
+ import { createEffect } from "solid-js";
10
+ import { useTheme } from "../context/theme.js";
11
+ // Default keybindings for the textarea
12
+ const defaultKeybindings = [
13
+ { name: "left", action: "move-left" },
14
+ { name: "right", action: "move-right" },
15
+ { name: "up", action: "move-up" },
16
+ { name: "down", action: "move-down" },
17
+ { name: "home", action: "buffer-home" },
18
+ { name: "end", action: "buffer-end" },
19
+ { name: "a", ctrl: true, action: "line-home" },
20
+ { name: "e", ctrl: true, action: "line-end" },
21
+ { name: "backspace", action: "backspace" },
22
+ { name: "delete", action: "delete" },
23
+ { name: "w", ctrl: true, action: "delete-word-backward" },
24
+ { name: "k", ctrl: true, action: "delete-to-line-end" },
25
+ { name: "u", ctrl: true, action: "delete-to-line-start" },
26
+ { name: "return", shift: true, action: "newline" },
27
+ { name: "return", ctrl: true, action: "newline" },
28
+ { name: "return", meta: true, action: "newline" },
29
+ { name: "return", action: "submit" },
30
+ { name: "z", super: true, action: "undo" },
31
+ { name: "z", super: true, shift: true, action: "redo" },
32
+ ];
33
+ /**
34
+ * Editor component for multi-line text input
35
+ */
36
+ export function Editor(props) {
37
+ const { theme: globalTheme } = useTheme();
38
+ let textareaRef;
39
+ const theme = () => ({
40
+ border: props.theme?.border ?? globalTheme.border,
41
+ borderActive: props.theme?.borderActive ?? globalTheme.borderActive,
42
+ text: props.theme?.text ?? globalTheme.text,
43
+ cursor: props.theme?.cursor ?? globalTheme.text,
44
+ placeholder: props.theme?.placeholder ?? globalTheme.textMuted,
45
+ background: props.theme?.background ?? globalTheme.backgroundPanel,
46
+ });
47
+ const editorRef = {
48
+ getText: () => textareaRef?.plainText ?? "",
49
+ setText: (text) => textareaRef?.setText(text),
50
+ clear: () => textareaRef?.clear(),
51
+ focus: () => textareaRef?.focus(),
52
+ blur: () => textareaRef?.blur(),
53
+ getTextarea: () => textareaRef,
54
+ };
55
+ createEffect(() => {
56
+ if (props.ref && textareaRef)
57
+ props.ref(editorRef);
58
+ });
59
+ const handleKeyDown = (e) => {
60
+ if (props.disabled) {
61
+ e.preventDefault();
62
+ return;
63
+ }
64
+ if (e.name === "escape") {
65
+ props.onEscape?.();
66
+ e.preventDefault();
67
+ }
68
+ };
69
+ const handleSubmit = () => {
70
+ if (props.disabled)
71
+ return;
72
+ const text = textareaRef?.plainText?.trim() ?? "";
73
+ if (!text)
74
+ return;
75
+ props.onSubmit?.(text);
76
+ };
77
+ const handleContentChange = () => {
78
+ props.onChange?.(textareaRef?.plainText ?? "");
79
+ };
80
+ const borderColor = () => (props.focused ? theme().borderActive : theme().border);
81
+ const textareaProps = {
82
+ minHeight: props.minHeight ?? 1,
83
+ maxHeight: props.maxHeight ?? 10,
84
+ backgroundColor: theme().background,
85
+ focusedBackgroundColor: theme().background,
86
+ textColor: theme().text,
87
+ focusedTextColor: theme().text,
88
+ cursorColor: theme().cursor,
89
+ keyBindings: defaultKeybindings,
90
+ onKeyDown: handleKeyDown,
91
+ onSubmit: handleSubmit,
92
+ onContentChange: handleContentChange,
93
+ };
94
+ if (props.initialValue !== undefined) {
95
+ textareaProps["initialValue"] = props.initialValue;
96
+ }
97
+ if (props.placeholder) {
98
+ textareaProps["placeholder"] = props.placeholder;
99
+ }
100
+ if (props.focused !== undefined) {
101
+ textareaProps["focused"] = props.focused;
102
+ }
103
+ const boxProps = {
104
+ flexDirection: "column",
105
+ border: true,
106
+ borderColor: borderColor(),
107
+ backgroundColor: theme().background,
108
+ paddingLeft: 1,
109
+ paddingRight: 1,
110
+ };
111
+ if (props.width !== undefined)
112
+ boxProps["width"] = props.width;
113
+ if (props.maxWidth !== undefined)
114
+ boxProps["maxWidth"] = props.maxWidth;
115
+ return (_jsx("box", { ...boxProps, children: _jsx("textarea", { ref: (r) => {
116
+ textareaRef = r;
117
+ props.ref?.(editorRef);
118
+ }, ...textareaProps }) }));
119
+ }
120
+ export function Input(props) {
121
+ const editorProps = {
122
+ minHeight: 1,
123
+ maxHeight: 1,
124
+ };
125
+ if (props.value !== undefined)
126
+ editorProps.initialValue = props.value;
127
+ if (props.placeholder !== undefined)
128
+ editorProps.placeholder = props.placeholder;
129
+ if (props.focused !== undefined)
130
+ editorProps.focused = props.focused;
131
+ if (props.theme !== undefined)
132
+ editorProps.theme = props.theme;
133
+ if (props.onChange !== undefined)
134
+ editorProps.onChange = props.onChange;
135
+ if (props.onSubmit !== undefined)
136
+ editorProps.onSubmit = props.onSubmit;
137
+ if (props.onEscape !== undefined)
138
+ editorProps.onEscape = props.onEscape;
139
+ if (props.width !== undefined)
140
+ editorProps.width = props.width;
141
+ if (props.maxWidth !== undefined)
142
+ editorProps.maxWidth = props.maxWidth;
143
+ return _jsx(Editor, { ...editorProps });
144
+ }
145
+ //# sourceMappingURL=editor.js.map