@oh-my-pi/pi-natives 9.6.0 → 9.6.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.
- package/native/pi_natives.darwin-arm64.node +0 -0
- package/native/pi_natives.darwin-x64.node +0 -0
- package/native/pi_natives.linux-arm64.node +0 -0
- package/native/pi_natives.linux-x64.node +0 -0
- package/native/pi_natives.win32-x64.node +0 -0
- package/package.json +2 -2
- package/src/index.ts +6 -1
- package/src/keys/index.ts +10 -0
- package/src/native.ts +2 -2
- package/src/text/index.ts +0 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.1",
|
|
4
4
|
"description": "Native Rust functionality via N-API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"directory": "packages/natives"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@oh-my-pi/pi-utils": "9.6.
|
|
33
|
+
"@oh-my-pi/pi-utils": "9.6.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.0.10"
|
package/src/index.ts
CHANGED
|
@@ -75,7 +75,6 @@ export {
|
|
|
75
75
|
type SliceWithWidthResult,
|
|
76
76
|
sliceWithWidth,
|
|
77
77
|
truncateToWidth,
|
|
78
|
-
visibleWidth,
|
|
79
78
|
} from "./text/index";
|
|
80
79
|
|
|
81
80
|
// =============================================================================
|
|
@@ -89,6 +88,12 @@ export {
|
|
|
89
88
|
supportsLanguage,
|
|
90
89
|
} from "./highlight/index";
|
|
91
90
|
|
|
91
|
+
// =============================================================================
|
|
92
|
+
// Keyboard sequence helpers
|
|
93
|
+
// =============================================================================
|
|
94
|
+
|
|
95
|
+
export { matchesKittySequence } from "./keys/index";
|
|
96
|
+
|
|
92
97
|
// =============================================================================
|
|
93
98
|
// HTML to Markdown
|
|
94
99
|
// =============================================================================
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard sequence utilities powered by native bindings.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { native } from "../native";
|
|
6
|
+
|
|
7
|
+
/** Match Kitty protocol sequences for codepoint and modifier. */
|
|
8
|
+
export function matchesKittySequence(data: string, expectedCodepoint: number, expectedModifier: number): boolean {
|
|
9
|
+
return native.matchesKittySequence(data, expectedCodepoint, expectedModifier);
|
|
10
|
+
}
|
package/src/native.ts
CHANGED
|
@@ -55,7 +55,6 @@ export interface NativeBindings {
|
|
|
55
55
|
getSupportedLanguages(): string[];
|
|
56
56
|
SamplingFilter: NativeSamplingFilter;
|
|
57
57
|
PhotonImage: NativePhotonImageConstructor;
|
|
58
|
-
visibleWidth(text: TextInput): number;
|
|
59
58
|
truncateToWidth(text: TextInput, maxWidth: number, ellipsis: TextInput, pad: boolean): string;
|
|
60
59
|
sliceWithWidth(line: TextInput, startCol: number, length: number, strict: boolean): SliceWithWidthResult;
|
|
61
60
|
extractSegments(
|
|
@@ -65,6 +64,7 @@ export interface NativeBindings {
|
|
|
65
64
|
afterLen: number,
|
|
66
65
|
strictAfter: boolean,
|
|
67
66
|
): ExtractSegmentsResult;
|
|
67
|
+
matchesKittySequence(data: string, expectedCodepoint: number, expectedModifier: number): boolean;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const require = createRequire(import.meta.url);
|
|
@@ -133,10 +133,10 @@ function validateNative(bindings: NativeBindings, source: string): void {
|
|
|
133
133
|
checkFn("highlightCode");
|
|
134
134
|
checkFn("supportsLanguage");
|
|
135
135
|
checkFn("getSupportedLanguages");
|
|
136
|
-
checkFn("visibleWidth");
|
|
137
136
|
checkFn("truncateToWidth");
|
|
138
137
|
checkFn("sliceWithWidth");
|
|
139
138
|
checkFn("extractSegments");
|
|
139
|
+
checkFn("matchesKittySequence");
|
|
140
140
|
|
|
141
141
|
if (!bindings.PhotonImage?.newFromByteslice) {
|
|
142
142
|
missing.push("PhotonImage.newFromByteslice");
|
package/src/text/index.ts
CHANGED
|
@@ -18,11 +18,6 @@ export interface ExtractSegmentsResult {
|
|
|
18
18
|
|
|
19
19
|
export type TextInput = string | Uint8Array;
|
|
20
20
|
|
|
21
|
-
/** Compute the visible width of a string, ignoring ANSI codes. */
|
|
22
|
-
export function visibleWidth(text: TextInput): number {
|
|
23
|
-
return native.visibleWidth(text);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
21
|
/**
|
|
27
22
|
* Truncate a string to a visible width, preserving ANSI codes.
|
|
28
23
|
*/
|