@slate-terminal/native 2.0.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.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @slate-terminal/native
2
+
3
+ Binding N-API oficial da Slate 2.0.0, compilado em Rust para Node.js. O addon expõe renderização ANSI, eventos de teclado e mouse, resize, paste, mudanças de foco e os controles de ciclo de vida do terminal.
4
+
5
+ O loader seleciona o artefato da plataforma atual em Linux, Windows e macOS. A compilação local usa `npm run native:build`; releases geram os arquivos `.node` em uma matriz dos três sistemas.
package/index.d.ts ADDED
@@ -0,0 +1,76 @@
1
+ export declare function clearScreen(): void
2
+
3
+ export declare function disableAlternateScreen(): void
4
+
5
+ export declare function disableBracketedPaste(): void
6
+
7
+ export declare function disableFocusChange(): void
8
+
9
+ export declare function disableMouseCapture(): void
10
+
11
+ export declare function disableRawMode(): void
12
+
13
+ export interface EffectOptions {
14
+ text: string
15
+ color: string
16
+ to?: string
17
+ width?: number
18
+ height?: number
19
+ x?: number
20
+ y?: number
21
+ radius?: number
22
+ intensity?: number
23
+ elapsedMs?: number
24
+ }
25
+
26
+ export declare function enableAlternateScreen(): void
27
+
28
+ export declare function enableBracketedPaste(): void
29
+
30
+ export declare function enableFocusChange(): void
31
+
32
+ export declare function enableMouseCapture(): void
33
+
34
+ export declare function enableRawMode(): void
35
+
36
+ export declare function hideCursor(): void
37
+
38
+ export interface NativeEvent {
39
+ kind: string
40
+ code?: string
41
+ text?: string
42
+ phase?: string
43
+ modifiers: number
44
+ x?: number
45
+ y?: number
46
+ width?: number
47
+ height?: number
48
+ action?: string
49
+ button?: string
50
+ deltaX?: number
51
+ deltaY?: number
52
+ }
53
+
54
+ export declare function pollEvent(timeoutMs?: number | undefined | null): NativeEvent | null
55
+
56
+ export declare function render(options: RenderOptions): string
57
+
58
+ export declare function renderColorShift(options: EffectOptions): string
59
+
60
+ export declare function renderGlow(options: EffectOptions): string
61
+
62
+ export interface RenderOptions {
63
+ text: string
64
+ width?: number
65
+ height?: number
66
+ x?: number
67
+ y?: number
68
+ foreground?: string
69
+ background?: string
70
+ }
71
+
72
+ export declare function renderText(text: string): string
73
+
74
+ export declare function showCursor(): void
75
+
76
+ export declare function version(): string
package/index.js ADDED
@@ -0,0 +1,23 @@
1
+ const path = require("node:path");
2
+ const fs = require("node:fs");
3
+
4
+ const platformTarget = process.platform === "win32" ? `win32-${process.arch}-msvc` : process.platform === "linux" ? `linux-${process.arch}-gnu` : process.platform === "darwin" ? `darwin-${process.arch}` : undefined;
5
+ if (!platformTarget) throw new Error(`Slate native does not support ${process.platform}-${process.arch}`);
6
+ const names = [
7
+ `slate_node.${platformTarget}.node`,
8
+ "slate_node.node",
9
+ `index.${platformTarget}.node`,
10
+ "index.node",
11
+ ];
12
+ const candidates = names.map((name) => path.join(__dirname, name));
13
+ candidates.push(path.join(__dirname, "..", "..", "target", "release", "slate_node.dll"));
14
+ candidates.push(path.join(__dirname, "..", "..", "target", "release", "libslate_node.so"));
15
+ candidates.push(path.join(__dirname, "..", "..", "target", "release", "libslate_node.dylib"));
16
+ for (const candidate of candidates) {
17
+ if (fs.existsSync(candidate)) {
18
+ if (candidate.endsWith(".node")) module.exports = require(candidate);
19
+ else process.dlopen(module, candidate);
20
+ break;
21
+ }
22
+ }
23
+ if (!module.exports || Object.keys(module.exports).length === 0) throw new Error("Addon Slate não compilado. Execute npm run native:build e empacote o arquivo .node.");
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@slate-terminal/native",
3
+ "version": "2.0.0",
4
+ "description": "Binding N-API Rust multiplataforma da Slate para Node.js.",
5
+ "keywords": ["nodejs", "napi", "rust", "terminal-ui", "tui", "mouse", "keyboard", "linux", "windows", "macos"],
6
+ "repository": { "type": "git", "url": "https://github.com/AnThophicous/Slate.git", "directory": "packages/slate-native" },
7
+ "homepage": "https://github.com/AnThophicous/Slate/tree/main/packages/slate-native",
8
+ "bugs": { "url": "https://github.com/AnThophicous/Slate/issues" },
9
+ "license": "Apache-2.0",
10
+ "engines": { "node": ">=18" },
11
+ "publishConfig": { "access": "public" },
12
+ "type": "commonjs",
13
+ "main": "./index.js",
14
+ "types": "./index.d.ts",
15
+ "files": ["index.js", "index.d.ts", "slate_node.*.node", "README.md"],
16
+ "napi": { "binaryName": "slate_node", "packageName": "@slate-terminal/native" },
17
+ "scripts": {
18
+ "build": "napi build --manifest-path ../../crates/slate-node/Cargo.toml --output-dir . --package-json-path package.json --platform --release --no-js --no-dts-header"
19
+ }
20
+ }
Binary file