@yeshwanthyk/open-tui 0.1.0 → 0.1.1

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.jsx +28 -0
  4. package/dist/app.jsx.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.jsx +31 -0
  20. package/dist/components/badge.jsx.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.jsx +34 -0
  24. package/dist/components/code-block.jsx.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.jsx +29 -0
  28. package/dist/components/dialog.jsx.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.jsx +17 -0
  32. package/dist/components/diff.jsx.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.jsx +13 -0
  36. package/dist/components/divider.jsx.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.jsx +146 -0
  40. package/dist/components/editor.jsx.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.jsx +319 -0
  44. package/dist/components/image.jsx.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.jsx +31 -0
  48. package/dist/components/loader.jsx.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.jsx +30 -0
  52. package/dist/components/markdown.jsx.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.jsx +51 -0
  56. package/dist/components/panel.jsx.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.jsx +135 -0
  60. package/dist/components/select-list.jsx.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.jsx +27 -0
  64. package/dist/components/spacer.jsx.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.jsx +52 -0
  68. package/dist/components/toast.jsx.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.jsx +6 -0
  72. package/dist/context/terminal.jsx.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.jsx +650 -0
  76. package/dist/context/theme.jsx.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,52 @@
1
+ /**
2
+ * Clipboard utilities for terminal applications
3
+ * Uses native clipboard commands with OSC 52 fallback
4
+ */
5
+ import { spawnSync } from "child_process";
6
+ /**
7
+ * Copy text to clipboard using platform-native commands
8
+ * Falls back to OSC 52 escape sequence for terminal support
9
+ *
10
+ * @returns true if clipboard command succeeded, false if only OSC 52 was attempted
11
+ */
12
+ export function copyToClipboard(text) {
13
+ if (!text)
14
+ return false;
15
+ // Try platform-native clipboard first (verifiable)
16
+ if (process.platform === "darwin") {
17
+ try {
18
+ const result = spawnSync("pbcopy", { input: text, encoding: "utf-8" });
19
+ if (result.status === 0)
20
+ return true;
21
+ }
22
+ catch {
23
+ // pbcopy not available
24
+ }
25
+ }
26
+ else if (process.platform === "linux") {
27
+ // Try xclip first, then xsel, then wl-copy (Wayland)
28
+ const tools = [
29
+ ["xclip", ["-selection", "clipboard"]],
30
+ ["xsel", ["--clipboard", "--input"]],
31
+ ["wl-copy"],
32
+ ];
33
+ for (const [cmd, args = []] of tools) {
34
+ try {
35
+ const result = spawnSync(cmd, args, { input: text, encoding: "utf-8" });
36
+ if (result.status === 0)
37
+ return true;
38
+ }
39
+ catch {
40
+ // Tool not available, try next
41
+ }
42
+ }
43
+ }
44
+ // Fall back to OSC 52 (works in iTerm2, kitty, Ghostty, tmux with set-clipboard on)
45
+ // Note: We cannot verify if OSC 52 succeeded
46
+ const base64 = Buffer.from(text).toString("base64");
47
+ const osc52 = `\x1b]52;c;${base64}\x07`;
48
+ process.stdout.write(osc52);
49
+ // Return false to indicate we couldn't verify success
50
+ return false;
51
+ }
52
+ //# sourceMappingURL=clipboard.js.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AoF;IACpF,6CAA6C;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACnD,MAAM,KAAK,GAAG,aAAa,MAAM,MAAM,CAAA;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAE3B,sDAAsD;IACtD,OAAO,KAAK,CAAA;AACb,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Text width utilities for handling ANSI codes and terminal column widths
3
+ *
4
+ * Note: OpenTUI provides its own buffer-based width calculations, but these
5
+ * utilities are useful for components that need to work with raw strings.
6
+ */
7
+ /**
8
+ * Calculate the visible width of a string in terminal columns.
9
+ * Excludes ANSI escape sequences from the count.
10
+ */
11
+ export declare function visibleWidth(str: string): number;
12
+ /**
13
+ * Strip ANSI escape codes from a string
14
+ */
15
+ export declare function stripAnsi(str: string): string;
16
+ /**
17
+ * Truncate text to fit within a maximum visible width, adding ellipsis if needed.
18
+ * Properly handles ANSI escape codes (they don't count toward width).
19
+ *
20
+ * @param text - Text to truncate (may contain ANSI codes)
21
+ * @param maxWidth - Maximum visible width
22
+ * @param ellipsis - Ellipsis string to append when truncating (default: "...")
23
+ * @returns Truncated text with ellipsis if it exceeded maxWidth
24
+ */
25
+ export declare function truncateToWidth(text: string, maxWidth: number, ellipsis?: string): string;
26
+ //# sourceMappingURL=text-width.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-width.d.ts","sourceRoot":"","sources":["../../src/utils/text-width.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAiDD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAc,GAAG,MAAM,CAqChG"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Text width utilities for handling ANSI codes and terminal column widths
3
+ *
4
+ * Note: OpenTUI provides its own buffer-based width calculations, but these
5
+ * utilities are useful for components that need to work with raw strings.
6
+ */
7
+ // ANSI escape sequence pattern - uses ESC (0x1b) followed by CSI sequences
8
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: Required for ANSI escape detection
9
+ const ANSI_PATTERN = /\x1b\[[0-9;]*[mGKHJ]/g;
10
+ /**
11
+ * Calculate the visible width of a string in terminal columns.
12
+ * Excludes ANSI escape sequences from the count.
13
+ */
14
+ export function visibleWidth(str) {
15
+ // Strip ANSI codes and normalize tabs
16
+ const stripped = stripAnsi(str).replace(/\t/g, " ");
17
+ // Use Bun's built-in string width calculation
18
+ return Bun.stringWidth(stripped);
19
+ }
20
+ /**
21
+ * Strip ANSI escape codes from a string
22
+ */
23
+ export function stripAnsi(str) {
24
+ return str.replace(ANSI_PATTERN, "");
25
+ }
26
+ // Cache segmenter instance - it's stateless and reusable
27
+ const graphemeSegmenter = new Intl.Segmenter();
28
+ /**
29
+ * Parse text into segments of ANSI codes and graphemes
30
+ */
31
+ function parseTextSegments(text) {
32
+ const segments = [];
33
+ let i = 0;
34
+ while (i < text.length) {
35
+ // Check for ANSI escape sequence (ESC [)
36
+ if (text[i] === "\x1b" && text[i + 1] === "[") {
37
+ let j = i + 2;
38
+ while (j < text.length && !/[mGKHJ]/.test(text[j] ?? "")) {
39
+ j++;
40
+ }
41
+ if (j < text.length) {
42
+ segments.push({ type: "ansi", value: text.substring(i, j + 1) });
43
+ i = j + 1;
44
+ continue;
45
+ }
46
+ }
47
+ // Find next ANSI code or end of string
48
+ let end = i;
49
+ while (end < text.length) {
50
+ if (text[end] === "\x1b" && text[end + 1] === "[")
51
+ break;
52
+ end++;
53
+ }
54
+ // Segment this non-ANSI portion into graphemes
55
+ const textPortion = text.slice(i, end);
56
+ for (const seg of graphemeSegmenter.segment(textPortion)) {
57
+ segments.push({ type: "grapheme", value: seg.segment });
58
+ }
59
+ i = end;
60
+ }
61
+ return segments;
62
+ }
63
+ /**
64
+ * Truncate text to fit within a maximum visible width, adding ellipsis if needed.
65
+ * Properly handles ANSI escape codes (they don't count toward width).
66
+ *
67
+ * @param text - Text to truncate (may contain ANSI codes)
68
+ * @param maxWidth - Maximum visible width
69
+ * @param ellipsis - Ellipsis string to append when truncating (default: "...")
70
+ * @returns Truncated text with ellipsis if it exceeded maxWidth
71
+ */
72
+ export function truncateToWidth(text, maxWidth, ellipsis = "...") {
73
+ const textVisibleWidth = visibleWidth(text);
74
+ if (textVisibleWidth <= maxWidth) {
75
+ return text;
76
+ }
77
+ const ellipsisWidth = visibleWidth(ellipsis);
78
+ const targetWidth = maxWidth - ellipsisWidth;
79
+ if (targetWidth <= 0) {
80
+ return ellipsis.substring(0, maxWidth);
81
+ }
82
+ const segments = parseTextSegments(text);
83
+ let result = "";
84
+ let currentWidth = 0;
85
+ for (const seg of segments) {
86
+ if (seg.type === "ansi") {
87
+ result += seg.value;
88
+ continue;
89
+ }
90
+ const grapheme = seg.value;
91
+ const graphemeWidth = visibleWidth(grapheme);
92
+ if (currentWidth + graphemeWidth > targetWidth) {
93
+ break;
94
+ }
95
+ result += grapheme;
96
+ currentWidth += graphemeWidth;
97
+ }
98
+ // Add reset code before ellipsis to prevent styling leaking
99
+ return `${result}\x1b[0m${ellipsis}`;
100
+ }
101
+ //# sourceMappingURL=text-width.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-width.js","sourceRoot":"","sources":["../../src/utils/text-width.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2EAA2E;AAC3E,8FAA8F;AAC9F,MAAM,YAAY,GAAG,uBAAuB,CAAA;AAE5C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,sCAAsC;IACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,G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YACzB,MAAM,IAAI,GAAG,CAAC,KAAK,CAAA;YACnB,SAAQ;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAA;QAC1B,MAAM,aAAa,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QAE5C,IAAI,YAAY,GAAG,aAAa,GAAG,WAAW,EAAE,CAAC;YAChD,MAAK;QACN,CAAC;QAED,MAAM,IAAI,QAAQ,CAAA;QAClB,YAAY,IAAI,aAAa,CAAA;IAC9B,CAAC;IAED,4DAA4D;IAC5D,OAAO,GAAG,MAAM,UAAU,QAAQ,EAAE,CAAA;AACrC,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "@yeshwanthyk/open-tui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenTUI-based Terminal User Interface with SolidJS reactive rendering",
5
5
  "type": "module",
6
- "main": "src/index.ts",
7
- "types": "src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
8
15
  "scripts": {
9
16
  "clean": "rm -rf dist",
10
17
  "lint": "biome check --write . && oxlint .",
11
18
  "lint:check": "biome check . && oxlint .",
12
19
  "typecheck": "tsc --noEmit",
20
+ "build": "tsc -b tsconfig.build.json --force",
13
21
  "check": "bun run lint:check && bun run typecheck",
14
22
  "test": "bun test",
15
- "demo": "bun run examples/run.ts"
23
+ "demo": "bun run examples/run.ts",
24
+ "prepublishOnly": "npm run clean && npm run build"
16
25
  },
17
26
  "files": [
18
27
  "dist/**/*",
package/src/index.ts DELETED
@@ -1,121 +0,0 @@
1
- /**
2
- * @yeshwanthyk/open-tui
3
- *
4
- * OpenTUI-based Terminal User Interface with SolidJS reactive rendering
5
- */
6
-
7
- import "./opentui-augmentations.js"
8
-
9
- // Re-export commonly used OpenTUI types and utilities
10
- export {
11
- BoxRenderable,
12
- // Renderer config
13
- type CliRendererConfig,
14
- type ColorInput,
15
- InputRenderable,
16
- MouseButton,
17
- // Mouse events
18
- MouseEvent,
19
- // Color utilities
20
- parseColor,
21
- // Renderable types for advanced usage
22
- type Renderable,
23
- ScrollBoxRenderable,
24
- SelectRenderable,
25
- // Text attributes
26
- TextAttributes,
27
- TextareaRenderable,
28
- TextRenderable,
29
- } from "@opentui/core"
30
- // Re-export SolidJS render and hooks
31
- export { render, testRender } from "@opentui/solid"
32
- // App entry point
33
- export { type AppConfig, startApp } from "./app.js"
34
- export {
35
- type CliRenderer,
36
- type KeyEvent,
37
- onResize,
38
- type PasteEvent,
39
- RendererContext,
40
- type Selection,
41
- useRenderer,
42
- useSelectionHandler,
43
- useTerminalDimensions,
44
- } from "./context/terminal.js"
45
- // Context providers
46
- export {
47
- BUILTIN_THEMES,
48
- createSyntaxStyle,
49
- RGBA,
50
- type SyntaxVariant,
51
- type Theme,
52
- type ThemeColors,
53
- type ThemeMode,
54
- ThemeProvider,
55
- type ThemeProviderProps,
56
- toRGBA,
57
- useTheme,
58
- } from "./context/theme.js"
59
- export type { UseKeyboardOptions } from "./hooks/use-keyboard.js"
60
- // Hooks
61
- export { useKeyboard, usePaste } from "./hooks/use-keyboard.js"
62
- // Utilities
63
- export { copyToClipboard } from "./utils/clipboard.js"
64
- export {
65
- stripAnsi,
66
- truncateToWidth,
67
- visibleWidth,
68
- } from "./utils/text-width.js"
69
- // Components
70
- export { Editor, Input, type EditorProps, type EditorRef, type EditorTheme, type InputProps } from "./components/editor.js"
71
- export {
72
- getCellDimensions,
73
- getCapabilities,
74
- getImageDimensions,
75
- Image,
76
- type ImageDimensions,
77
- type ImageProps,
78
- type ImageProtocol,
79
- resetCapabilitiesCache,
80
- setCellDimensions,
81
- type TerminalCapabilities,
82
- } from "./components/image.js"
83
- export { Loader, type LoaderProps } from "./components/loader.js"
84
- export { Markdown, type MarkdownProps, type MarkdownTheme } from "./components/markdown.js"
85
- export {
86
- SelectList,
87
- SelectListKeys,
88
- type SelectItem,
89
- type SelectListProps,
90
- type SelectListRef,
91
- type SelectListTheme,
92
- } from "./components/select-list.js"
93
- export { Spacer, type SpacerProps } from "./components/spacer.js"
94
- export { Badge, type BadgeProps, type BadgeVariant } from "./components/badge.js"
95
- export { CodeBlock, type CodeBlockProps } from "./components/code-block.js"
96
- export { Dialog, type DialogProps } from "./components/dialog.js"
97
- export { Diff, type DiffProps, type DiffView, type DiffWrapMode } from "./components/diff.js"
98
- export { Divider, type DividerOrientation, type DividerProps } from "./components/divider.js"
99
- export { Panel, type PanelProps, type PanelVariant } from "./components/panel.js"
100
- export {
101
- Toast,
102
- ToastViewport,
103
- type ToastItem,
104
- type ToastVariant,
105
- type ToastViewportPosition,
106
- type ToastViewportProps,
107
- } from "./components/toast.js"
108
-
109
- // Autocomplete support
110
- export {
111
- type AutocompleteItem,
112
- type AutocompleteProvider,
113
- CombinedAutocompleteProvider,
114
- FileIndex,
115
- type FileIndexOptions,
116
- type FileSearchResult,
117
- type SlashCommand,
118
- } from "./autocomplete/index.js"
119
-
120
- // Tree-sitter parser configuration
121
- export { parsersConfig } from "./parsers-config.js"