@nghyane/arcane-natives 0.1.7 → 0.1.9

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@nghyane/arcane-natives",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
6
6
  "homepage": "https://github.com/nghyane/arcane",
7
7
  "author": "Can Bölük",
@@ -41,7 +41,7 @@
41
41
  "bench": "bun bench/grep.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@nghyane/arcane-utils": "^0.1.6"
44
+ "@nghyane/arcane-utils": "^0.1.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/bun": "^1.3.9"
@@ -90,3 +90,20 @@ export async function readImageFromClipboard(): Promise<ClipboardImage | null> {
90
90
 
91
91
  return native.readImageFromClipboard();
92
92
  }
93
+
94
+ /**
95
+ * Read plain text from the system clipboard.
96
+ *
97
+ * Returns null on Termux or when no display server is available.
98
+ */
99
+ export async function readTextFromClipboard(): Promise<string | null> {
100
+ if (process.env.TERMUX_VERSION) {
101
+ return null;
102
+ }
103
+
104
+ if (!hasDisplay) {
105
+ return null;
106
+ }
107
+
108
+ return native.readTextFromClipboard();
109
+ }
@@ -23,5 +23,10 @@ declare module "../bindings" {
23
23
  * @returns PNG payload or null when no image is available.
24
24
  */
25
25
  readImageFromClipboard(): Promise<ClipboardImage | null>;
26
+ /**
27
+ * Read plain text from the clipboard.
28
+ * @returns Text or null when no text is available.
29
+ */
30
+ readTextFromClipboard(): Promise<string | null>;
26
31
  }
27
32
  }
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  // Clipboard
7
7
  // =============================================================================
8
8
 
9
- export { type ClipboardImage, copyToClipboard, readImageFromClipboard } from "./clipboard";
9
+ export { type ClipboardImage, copyToClipboard, readImageFromClipboard, readTextFromClipboard } from "./clipboard";
10
10
 
11
11
  // =============================================================================
12
12
  // Grep (ripgrep-based regex search)
package/src/native.ts CHANGED
@@ -241,6 +241,7 @@ function validateNative(bindings: NativeBindings, source: string): void {
241
241
  };
242
242
  checkFn("copyToClipboard");
243
243
  checkFn("readImageFromClipboard");
244
+ checkFn("readTextFromClipboard");
244
245
  checkFn("glob");
245
246
  checkFn("fuzzyFind");
246
247
  checkFn("grep");