@bastani/atomic-tui 0.0.0-stage → 0.9.88
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/LICENSE +22 -0
- package/NOTICE.md +13 -0
- package/README.md +76 -2
- package/dist/alt-screen-search.d.ts +46 -0
- package/dist/alt-screen-search.d.ts.map +1 -0
- package/dist/alt-screen-search.js +282 -0
- package/dist/alt-screen-search.js.map +1 -0
- package/dist/autocomplete.d.ts +57 -0
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +690 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/colors.d.ts +73 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +273 -0
- package/dist/colors.js.map +1 -0
- package/dist/components/alt-screen-flash.d.ts +13 -0
- package/dist/components/alt-screen-flash.d.ts.map +1 -0
- package/dist/components/alt-screen-flash.js +37 -0
- package/dist/components/alt-screen-flash.js.map +1 -0
- package/dist/components/box.d.ts +25 -0
- package/dist/components/box.d.ts.map +1 -0
- package/dist/components/box.js +138 -0
- package/dist/components/box.js.map +1 -0
- package/dist/components/cancellable-loader.d.ts +22 -0
- package/dist/components/cancellable-loader.d.ts.map +1 -0
- package/dist/components/cancellable-loader.js +35 -0
- package/dist/components/cancellable-loader.js.map +1 -0
- package/dist/components/editor.d.ts +274 -0
- package/dist/components/editor.d.ts.map +1 -0
- package/dist/components/editor.js +2074 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/h-stack.d.ts +7 -0
- package/dist/components/h-stack.d.ts.map +1 -0
- package/dist/components/h-stack.js +43 -0
- package/dist/components/h-stack.js.map +1 -0
- package/dist/components/image.d.ts +40 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +123 -0
- package/dist/components/image.js.map +1 -0
- package/dist/components/input.d.ts +50 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +421 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/loader.d.ts +33 -0
- package/dist/components/loader.d.ts.map +1 -0
- package/dist/components/loader.js +76 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/markdown.d.ts +110 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +939 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/mouse-region.d.ts +12 -0
- package/dist/components/mouse-region.d.ts.map +1 -0
- package/dist/components/mouse-region.js +21 -0
- package/dist/components/mouse-region.js.map +1 -0
- package/dist/components/scroll-view.d.ts +59 -0
- package/dist/components/scroll-view.d.ts.map +1 -0
- package/dist/components/scroll-view.js +195 -0
- package/dist/components/scroll-view.js.map +1 -0
- package/dist/components/select-list.d.ts +54 -0
- package/dist/components/select-list.d.ts.map +1 -0
- package/dist/components/select-list.js +215 -0
- package/dist/components/select-list.js.map +1 -0
- package/dist/components/settings-list.d.ts +61 -0
- package/dist/components/settings-list.d.ts.map +1 -0
- package/dist/components/settings-list.js +259 -0
- package/dist/components/settings-list.js.map +1 -0
- package/dist/components/spacer.d.ts +12 -0
- package/dist/components/spacer.d.ts.map +1 -0
- package/dist/components/spacer.js +23 -0
- package/dist/components/spacer.js.map +1 -0
- package/dist/components/stack.d.ts +32 -0
- package/dist/components/stack.d.ts.map +1 -0
- package/dist/components/stack.js +111 -0
- package/dist/components/stack.js.map +1 -0
- package/dist/components/text.d.ts +20 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +98 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/truncated-text.d.ts +13 -0
- package/dist/components/truncated-text.d.ts.map +1 -0
- package/dist/components/truncated-text.js +51 -0
- package/dist/components/truncated-text.js.map +1 -0
- package/dist/components/v-stack.d.ts +8 -0
- package/dist/components/v-stack.d.ts.map +1 -0
- package/dist/components/v-stack.js +26 -0
- package/dist/components/v-stack.js.map +1 -0
- package/dist/editor-component.d.ts +39 -0
- package/dist/editor-component.d.ts.map +1 -0
- package/dist/editor-component.js +2 -0
- package/dist/editor-component.js.map +1 -0
- package/dist/env.d.ts +5 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +7 -0
- package/dist/env.js.map +1 -0
- package/dist/fuzzy.d.ts +16 -0
- package/dist/fuzzy.d.ts.map +1 -0
- package/dist/fuzzy.js +126 -0
- package/dist/fuzzy.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/keybindings.d.ts +279 -0
- package/dist/keybindings.d.ts.map +1 -0
- package/dist/keybindings.js +248 -0
- package/dist/keybindings.js.map +1 -0
- package/dist/keys.d.ts +184 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +1260 -0
- package/dist/keys.js.map +1 -0
- package/dist/kill-ring.d.ts +28 -0
- package/dist/kill-ring.d.ts.map +1 -0
- package/dist/kill-ring.js +44 -0
- package/dist/kill-ring.js.map +1 -0
- package/dist/latex.d.ts +10 -0
- package/dist/latex.d.ts.map +1 -0
- package/dist/latex.js +1402 -0
- package/dist/latex.js.map +1 -0
- package/dist/layout-node.d.ts +40 -0
- package/dist/layout-node.d.ts.map +1 -0
- package/dist/layout-node.js +6 -0
- package/dist/layout-node.js.map +1 -0
- package/dist/layout.d.ts +42 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +349 -0
- package/dist/layout.js.map +1 -0
- package/dist/native-modifiers.d.ts +4 -0
- package/dist/native-modifiers.d.ts.map +1 -0
- package/dist/native-modifiers.js +13 -0
- package/dist/native-modifiers.js.map +1 -0
- package/dist/native-module-path.d.ts +7 -0
- package/dist/native-module-path.d.ts.map +1 -0
- package/dist/native-module-path.js +19 -0
- package/dist/native-module-path.js.map +1 -0
- package/dist/native-platform.d.ts +20 -0
- package/dist/native-platform.d.ts.map +1 -0
- package/dist/native-platform.js +42 -0
- package/dist/native-platform.js.map +1 -0
- package/dist/oklab.d.ts +43 -0
- package/dist/oklab.d.ts.map +1 -0
- package/dist/oklab.js +210 -0
- package/dist/oklab.js.map +1 -0
- package/dist/paste.d.ts +2 -0
- package/dist/paste.d.ts.map +1 -0
- package/dist/paste.js +16 -0
- package/dist/paste.js.map +1 -0
- package/dist/program-status.d.ts +23 -0
- package/dist/program-status.d.ts.map +1 -0
- package/dist/program-status.js +43 -0
- package/dist/program-status.js.map +1 -0
- package/dist/stdin-buffer.d.ts +58 -0
- package/dist/stdin-buffer.d.ts.map +1 -0
- package/dist/stdin-buffer.js +401 -0
- package/dist/stdin-buffer.js.map +1 -0
- package/dist/terminal-colors.d.ts +27 -0
- package/dist/terminal-colors.d.ts.map +1 -0
- package/dist/terminal-colors.js +64 -0
- package/dist/terminal-colors.js.map +1 -0
- package/dist/terminal-image.d.ts +125 -0
- package/dist/terminal-image.d.ts.map +1 -0
- package/dist/terminal-image.js +624 -0
- package/dist/terminal-image.js.map +1 -0
- package/dist/terminal.d.ts +149 -0
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +519 -0
- package/dist/terminal.js.map +1 -0
- package/dist/tui-alt-screen.d.ts +179 -0
- package/dist/tui-alt-screen.d.ts.map +1 -0
- package/dist/tui-alt-screen.js +1616 -0
- package/dist/tui-alt-screen.js.map +1 -0
- package/dist/tui-main-screen.d.ts +39 -0
- package/dist/tui-main-screen.d.ts.map +1 -0
- package/dist/tui-main-screen.js +599 -0
- package/dist/tui-main-screen.js.map +1 -0
- package/dist/tui.d.ts +412 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +1123 -0
- package/dist/tui.js.map +1 -0
- package/dist/undo-stack.d.ts +17 -0
- package/dist/undo-stack.d.ts.map +1 -0
- package/dist/undo-stack.js +25 -0
- package/dist/undo-stack.js.map +1 -0
- package/dist/utils.d.ts +115 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +1325 -0
- package/dist/utils.js.map +1 -0
- package/dist/wheel-scroll.d.ts +23 -0
- package/dist/wheel-scroll.d.ts.map +1 -0
- package/dist/wheel-scroll.js +73 -0
- package/dist/wheel-scroll.js.map +1 -0
- package/dist/word-navigation.d.ts +25 -0
- package/dist/word-navigation.d.ts.map +1 -0
- package/dist/word-navigation.js +96 -0
- package/dist/word-navigation.js.map +1 -0
- package/native/clipboard.h +208 -0
- package/native/darwin/README.md +22 -0
- package/native/darwin/build.sh +69 -0
- package/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/native/darwin/src/darwin-platform.m +132 -0
- package/native/linux/README.md +23 -0
- package/native/linux/build.sh +65 -0
- package/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/native/linux/src/clipboard-worker.h +70 -0
- package/native/linux/src/linux-platform-x11.c +274 -0
- package/native/napi.h +91 -0
- package/native/win32/README.md +31 -0
- package/native/win32/build.mjs +232 -0
- package/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/native/win32/src/win32-platform.c +241 -0
- package/package.json +74 -4
package/dist/fuzzy.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuzzy matching utilities.
|
|
3
|
+
* Matches if all query characters appear in order (not necessarily consecutive).
|
|
4
|
+
* Lower score = better match.
|
|
5
|
+
*/
|
|
6
|
+
function scorePositions(textLower, positions) {
|
|
7
|
+
let score = 0;
|
|
8
|
+
let lastMatchIndex = -1;
|
|
9
|
+
let consecutiveMatches = 0;
|
|
10
|
+
for (const i of positions) {
|
|
11
|
+
// Reward consecutive matches
|
|
12
|
+
if (lastMatchIndex === i - 1) {
|
|
13
|
+
consecutiveMatches++;
|
|
14
|
+
score -= consecutiveMatches * 5;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
consecutiveMatches = 0;
|
|
18
|
+
// Penalize gaps
|
|
19
|
+
if (lastMatchIndex >= 0) {
|
|
20
|
+
score += (i - lastMatchIndex - 1) * 2;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Reward word boundary matches
|
|
24
|
+
if (i === 0 || /[\s\-_./:]/.test(textLower[i - 1])) {
|
|
25
|
+
score -= 10;
|
|
26
|
+
}
|
|
27
|
+
// Slight penalty for later matches
|
|
28
|
+
score += i * 0.1;
|
|
29
|
+
lastMatchIndex = i;
|
|
30
|
+
}
|
|
31
|
+
return score;
|
|
32
|
+
}
|
|
33
|
+
function matchQuery(normalizedQuery, textLower) {
|
|
34
|
+
if (normalizedQuery.length === 0) {
|
|
35
|
+
return { matches: true, score: 0 };
|
|
36
|
+
}
|
|
37
|
+
if (normalizedQuery.length > textLower.length) {
|
|
38
|
+
return { matches: false, score: 0 };
|
|
39
|
+
}
|
|
40
|
+
// Greedy alignment: each query character at its first occurrence after the previous one.
|
|
41
|
+
const positions = [];
|
|
42
|
+
let lastMatchIndex = -1;
|
|
43
|
+
for (let queryIndex = 0; queryIndex < normalizedQuery.length; queryIndex++) {
|
|
44
|
+
const i = textLower.indexOf(normalizedQuery[queryIndex], lastMatchIndex + 1);
|
|
45
|
+
if (i === -1) {
|
|
46
|
+
return { matches: false, score: 0 };
|
|
47
|
+
}
|
|
48
|
+
positions.push(i);
|
|
49
|
+
lastMatchIndex = i;
|
|
50
|
+
}
|
|
51
|
+
let score = scorePositions(textLower, positions);
|
|
52
|
+
// The greedy alignment can scatter the query over an earlier, unrelated part of the text,
|
|
53
|
+
// e.g. "opus" in "openrouter openrouter/anthropic/claude-opus" takes o, p, u from "openrouter".
|
|
54
|
+
// Also score every contiguous occurrence and keep the best alignment.
|
|
55
|
+
for (let start = textLower.indexOf(normalizedQuery); start !== -1; start = textLower.indexOf(normalizedQuery, start + 1)) {
|
|
56
|
+
for (let k = 0; k < positions.length; k++) {
|
|
57
|
+
positions[k] = start + k;
|
|
58
|
+
}
|
|
59
|
+
score = Math.min(score, scorePositions(textLower, positions));
|
|
60
|
+
}
|
|
61
|
+
if (normalizedQuery === textLower) {
|
|
62
|
+
score -= 100;
|
|
63
|
+
}
|
|
64
|
+
return { matches: true, score };
|
|
65
|
+
}
|
|
66
|
+
export function fuzzyMatch(query, text) {
|
|
67
|
+
const queryLower = query.toLowerCase();
|
|
68
|
+
const textLower = text.toLowerCase();
|
|
69
|
+
const primaryMatch = matchQuery(queryLower, textLower);
|
|
70
|
+
if (primaryMatch.matches) {
|
|
71
|
+
return primaryMatch;
|
|
72
|
+
}
|
|
73
|
+
const alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);
|
|
74
|
+
const numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);
|
|
75
|
+
const swappedQuery = alphaNumericMatch
|
|
76
|
+
? `${alphaNumericMatch.groups?.digits ?? ""}${alphaNumericMatch.groups?.letters ?? ""}`
|
|
77
|
+
: numericAlphaMatch
|
|
78
|
+
? `${numericAlphaMatch.groups?.letters ?? ""}${numericAlphaMatch.groups?.digits ?? ""}`
|
|
79
|
+
: "";
|
|
80
|
+
if (!swappedQuery) {
|
|
81
|
+
return primaryMatch;
|
|
82
|
+
}
|
|
83
|
+
const swappedMatch = matchQuery(swappedQuery, textLower);
|
|
84
|
+
if (!swappedMatch.matches) {
|
|
85
|
+
return primaryMatch;
|
|
86
|
+
}
|
|
87
|
+
return { matches: true, score: swappedMatch.score + 5 };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Filter and sort items by fuzzy match quality (best matches first).
|
|
91
|
+
* Supports whitespace- and slash-separated tokens: all tokens must match.
|
|
92
|
+
*/
|
|
93
|
+
export function fuzzyFilter(items, query, getText) {
|
|
94
|
+
if (!query.trim()) {
|
|
95
|
+
return items;
|
|
96
|
+
}
|
|
97
|
+
const tokens = query
|
|
98
|
+
.trim()
|
|
99
|
+
.split(/[\s/]+/)
|
|
100
|
+
.filter((t) => t.length > 0);
|
|
101
|
+
if (tokens.length === 0) {
|
|
102
|
+
return items;
|
|
103
|
+
}
|
|
104
|
+
const results = [];
|
|
105
|
+
for (const item of items) {
|
|
106
|
+
const text = getText(item);
|
|
107
|
+
let totalScore = 0;
|
|
108
|
+
let allMatch = true;
|
|
109
|
+
for (const token of tokens) {
|
|
110
|
+
const match = fuzzyMatch(token, text);
|
|
111
|
+
if (match.matches) {
|
|
112
|
+
totalScore += match.score;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
allMatch = false;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (allMatch) {
|
|
120
|
+
results.push({ item, totalScore });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
results.sort((a, b) => a.totalScore - b.totalScore);
|
|
124
|
+
return results.map((r) => r.item);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=fuzzy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,SAAS,cAAc,CAAC,SAAiB,EAAE,SAA4B;IACtE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;IACxB,IAAI,kBAAkB,GAAG,CAAC,CAAC;IAE3B,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC3B,6BAA6B;QAC7B,IAAI,cAAc,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,kBAAkB,EAAE,CAAC;YACrB,KAAK,IAAI,kBAAkB,GAAG,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACP,kBAAkB,GAAG,CAAC,CAAC;YACvB,gBAAgB;YAChB,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;gBACzB,KAAK,IAAI,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;QAED,+BAA+B;QAC/B,IAA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UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnB,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACP,QAAQ,GAAG,KAAK,CAAC;gBACjB,MAAM;YACP,CAAC;QACF,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Fuzzy matching utilities.\n * Matches if all query characters appear in order (not necessarily consecutive).\n * Lower score = better match.\n */\n\nexport interface FuzzyMatch {\n\tmatches: boolean;\n\tscore: number;\n}\n\nfunction scorePositions(textLower: string, positions: readonly number[]): number {\n\tlet score = 0;\n\tlet lastMatchIndex = -1;\n\tlet consecutiveMatches = 0;\n\n\tfor (const i of positions) {\n\t\t// Reward consecutive matches\n\t\tif (lastMatchIndex === i - 1) {\n\t\t\tconsecutiveMatches++;\n\t\t\tscore -= consecutiveMatches * 5;\n\t\t} else {\n\t\t\tconsecutiveMatches = 0;\n\t\t\t// Penalize gaps\n\t\t\tif (lastMatchIndex >= 0) {\n\t\t\t\tscore += (i - lastMatchIndex - 1) * 2;\n\t\t\t}\n\t\t}\n\n\t\t// Reward word boundary matches\n\t\tif (i === 0 || /[\\s\\-_./:]/.test(textLower[i - 1]!)) {\n\t\t\tscore -= 10;\n\t\t}\n\n\t\t// Slight penalty for later matches\n\t\tscore += i * 0.1;\n\n\t\tlastMatchIndex = i;\n\t}\n\n\treturn score;\n}\n\nfunction matchQuery(normalizedQuery: string, textLower: string): FuzzyMatch {\n\tif (normalizedQuery.length === 0) {\n\t\treturn { matches: true, score: 0 };\n\t}\n\n\tif (normalizedQuery.length > textLower.length) {\n\t\treturn { matches: false, score: 0 };\n\t}\n\n\t// Greedy alignment: each query character at its first occurrence after the previous one.\n\tconst positions: number[] = [];\n\tlet lastMatchIndex = -1;\n\tfor (let queryIndex = 0; queryIndex < normalizedQuery.length; queryIndex++) {\n\t\tconst i = textLower.indexOf(normalizedQuery[queryIndex]!, lastMatchIndex + 1);\n\t\tif (i === -1) {\n\t\t\treturn { matches: false, score: 0 };\n\t\t}\n\t\tpositions.push(i);\n\t\tlastMatchIndex = i;\n\t}\n\n\tlet score = scorePositions(textLower, positions);\n\n\t// The greedy alignment can scatter the query over an earlier, unrelated part of the text,\n\t// e.g. \"opus\" in \"openrouter openrouter/anthropic/claude-opus\" takes o, p, u from \"openrouter\".\n\t// Also score every contiguous occurrence and keep the best alignment.\n\tfor (\n\t\tlet start = textLower.indexOf(normalizedQuery);\n\t\tstart !== -1;\n\t\tstart = textLower.indexOf(normalizedQuery, start + 1)\n\t) {\n\t\tfor (let k = 0; k < positions.length; k++) {\n\t\t\tpositions[k] = start + k;\n\t\t}\n\t\tscore = Math.min(score, scorePositions(textLower, positions));\n\t}\n\n\tif (normalizedQuery === textLower) {\n\t\tscore -= 100;\n\t}\n\n\treturn { matches: true, score };\n}\n\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch {\n\tconst queryLower = query.toLowerCase();\n\tconst textLower = text.toLowerCase();\n\n\tconst primaryMatch = matchQuery(queryLower, textLower);\n\tif (primaryMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);\n\tconst numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);\n\tconst swappedQuery = alphaNumericMatch\n\t\t? `${alphaNumericMatch.groups?.digits ?? \"\"}${alphaNumericMatch.groups?.letters ?? \"\"}`\n\t\t: numericAlphaMatch\n\t\t\t? `${numericAlphaMatch.groups?.letters ?? \"\"}${numericAlphaMatch.groups?.digits ?? \"\"}`\n\t\t\t: \"\";\n\n\tif (!swappedQuery) {\n\t\treturn primaryMatch;\n\t}\n\n\tconst swappedMatch = matchQuery(swappedQuery, textLower);\n\tif (!swappedMatch.matches) {\n\t\treturn primaryMatch;\n\t}\n\n\treturn { matches: true, score: swappedMatch.score + 5 };\n}\n\n/**\n * Filter and sort items by fuzzy match quality (best matches first).\n * Supports whitespace- and slash-separated tokens: all tokens must match.\n */\nexport function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {\n\tif (!query.trim()) {\n\t\treturn items;\n\t}\n\n\tconst tokens = query\n\t\t.trim()\n\t\t.split(/[\\s/]+/)\n\t\t.filter((t) => t.length > 0);\n\n\tif (tokens.length === 0) {\n\t\treturn items;\n\t}\n\n\tconst results: { item: T; totalScore: number }[] = [];\n\n\tfor (const item of items) {\n\t\tconst text = getText(item);\n\t\tlet totalScore = 0;\n\t\tlet allMatch = true;\n\n\t\tfor (const token of tokens) {\n\t\t\tconst match = fuzzyMatch(token, text);\n\t\t\tif (match.matches) {\n\t\t\t\ttotalScore += match.score;\n\t\t\t} else {\n\t\t\t\tallMatch = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (allMatch) {\n\t\t\tresults.push({ item, totalScore });\n\t\t}\n\t}\n\n\tresults.sort((a, b) => a.totalScore - b.totalScore);\n\treturn results.map((r) => r.item);\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { Marked, type Token, type Tokens } from "marked";
|
|
2
|
+
export { type AutocompleteItem, type AutocompleteProvider, type AutocompleteSuggestions, CombinedAutocompleteProvider, type SlashCommand, } from "./autocomplete.ts";
|
|
3
|
+
export { backgroundAnsi, type Color, type ColorMixSpace, colorToHex, colorToOkhsl, colorToOklch, colorToRgb, foregroundAnsi, type IndexedColor, indexedColor, mixColors, type OkhslChannels, type OklchChannels, type OklchColorValue, okhslColor, oklchColor, parseColor, type RgbColorValue, rgbColor, styleText, styleTextWithAnsi, type TerminalColorMode, type TextAttributes, type TextStyle, } from "./colors.ts";
|
|
4
|
+
export { Box } from "./components/box.ts";
|
|
5
|
+
export { CancellableLoader } from "./components/cancellable-loader.ts";
|
|
6
|
+
export { Editor, type EditorOptions, type EditorTheme } from "./components/editor.ts";
|
|
7
|
+
export { HStack } from "./components/h-stack.ts";
|
|
8
|
+
export { Image, type ImageOptions, type ImageTheme, type ImageTranscoder, setImageTranscoder, } from "./components/image.ts";
|
|
9
|
+
export { Input } from "./components/input.ts";
|
|
10
|
+
export { Loader, type LoaderIndicatorOptions } from "./components/loader.ts";
|
|
11
|
+
export { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from "./components/markdown.ts";
|
|
12
|
+
export { MouseRegion, type MouseRegionHandler } from "./components/mouse-region.ts";
|
|
13
|
+
export { ScrollView, type ScrollViewOptions, type ScrollViewScrollbar, type ScrollViewScrollToOptions, } from "./components/scroll-view.ts";
|
|
14
|
+
export { type SelectItem, SelectList, type SelectListLayoutOptions, type SelectListTheme, type SelectListTruncatePrimaryContext, } from "./components/select-list.ts";
|
|
15
|
+
export { type SettingItem, SettingsList, type SettingsListTheme } from "./components/settings-list.ts";
|
|
16
|
+
export { Spacer } from "./components/spacer.ts";
|
|
17
|
+
export { Text } from "./components/text.ts";
|
|
18
|
+
export { TruncatedText } from "./components/truncated-text.ts";
|
|
19
|
+
export { type StackChild, type StackEntry, type StackEntryOptions, type StackOptions, VStack, } from "./components/v-stack.ts";
|
|
20
|
+
export type { EditorComponent } from "./editor-component.ts";
|
|
21
|
+
export { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from "./fuzzy.ts";
|
|
22
|
+
export { getKeybindings, getSelectPageIndex, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.ts";
|
|
23
|
+
export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, type KeyEventType, type KeyId, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.ts";
|
|
24
|
+
export { type RenderLatexOptions, renderLatex } from "./latex.ts";
|
|
25
|
+
export { getNativeClipboard, type NativeClipboard } from "./native-platform.ts";
|
|
26
|
+
export { oklabToOkhslLightness } from "./oklab.ts";
|
|
27
|
+
export { normalizePastedText } from "./paste.ts";
|
|
28
|
+
export { formatProgramStatus, type ProgramStatus } from "./program-status.ts";
|
|
29
|
+
export { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from "./stdin-buffer.ts";
|
|
30
|
+
export { isAppleTerminalSession, ProcessTerminal, type Terminal } from "./terminal.ts";
|
|
31
|
+
export { parseTerminalColorSchemeReport, type RgbColor, type TerminalColorScheme, type TerminalColors, } from "./terminal-colors.ts";
|
|
32
|
+
export { allocateImageId, type CellDimensions, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getTerminalColorMode, getWebpDimensions, hyperlink, type ImageDimensions, type ImageProtocol, type ImageRenderOptions, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCapabilityOverrides, setCellDimensions, type TerminalCapabilities, } from "./terminal-image.ts";
|
|
33
|
+
export { type Component, Container, CURSOR_MARKER, compositeTuiLine, type Focusable, isFocusable, isViewportTUI, type OverlayAnchor, type OverlayBounds, type OverlayHandle, type OverlayMargin, type OverlayOptions, type OverlayUnfocusOptions, renderFakeCursor, type SizeValue, type TUI, type TuiInputListener, type TuiInputListenerResult, type TuiMode, type TuiMouseButton, type TuiMouseEvent, type TuiMouseEventResult, type TuiMouseEventType, type TuiStopOptions, type ViewportTUI, } from "./tui.ts";
|
|
34
|
+
export { TuiAltScreen, type TuiAltScreenOptions, turnPromptAbove } from "./tui-alt-screen.ts";
|
|
35
|
+
export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
|
|
36
|
+
export { getOsc8LinkAtColumn, replaceControlCharacters, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
|
|
37
|
+
export type { WheelScrollLines } from "./wheel-scroll.ts";
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,cAAc,EACd,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,KAAK,YAAY,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,SAAS,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CA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eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,KAAK,SAAS,EACd,WAAW,EACX,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,WAAW,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Core TUI interfaces and classes
|
|
2
|
+
export { Marked } from "marked";
|
|
3
|
+
// Autocomplete support
|
|
4
|
+
export { CombinedAutocompleteProvider, } from "./autocomplete.js";
|
|
5
|
+
// Colors and styling
|
|
6
|
+
export { backgroundAnsi, colorToHex, colorToOkhsl, colorToOklch, colorToRgb, foregroundAnsi, indexedColor, mixColors, okhslColor, oklchColor, parseColor, rgbColor, styleText, styleTextWithAnsi, } from "./colors.js";
|
|
7
|
+
// Components
|
|
8
|
+
export { Box } from "./components/box.js";
|
|
9
|
+
export { CancellableLoader } from "./components/cancellable-loader.js";
|
|
10
|
+
export { Editor } from "./components/editor.js";
|
|
11
|
+
export { HStack } from "./components/h-stack.js";
|
|
12
|
+
export { Image, setImageTranscoder, } from "./components/image.js";
|
|
13
|
+
export { Input } from "./components/input.js";
|
|
14
|
+
export { Loader } from "./components/loader.js";
|
|
15
|
+
export { Markdown } from "./components/markdown.js";
|
|
16
|
+
export { MouseRegion } from "./components/mouse-region.js";
|
|
17
|
+
export { ScrollView, } from "./components/scroll-view.js";
|
|
18
|
+
export { SelectList, } from "./components/select-list.js";
|
|
19
|
+
export { SettingsList } from "./components/settings-list.js";
|
|
20
|
+
export { Spacer } from "./components/spacer.js";
|
|
21
|
+
export { Text } from "./components/text.js";
|
|
22
|
+
export { TruncatedText } from "./components/truncated-text.js";
|
|
23
|
+
export { VStack, } from "./components/v-stack.js";
|
|
24
|
+
// Fuzzy matching
|
|
25
|
+
export { fuzzyFilter, fuzzyMatch } from "./fuzzy.js";
|
|
26
|
+
// Keybindings
|
|
27
|
+
export { getKeybindings, getSelectPageIndex, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.js";
|
|
28
|
+
// Keyboard input handling
|
|
29
|
+
export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.js";
|
|
30
|
+
// LaTeX rendering
|
|
31
|
+
export { renderLatex } from "./latex.js";
|
|
32
|
+
// Native platform integration
|
|
33
|
+
export { getNativeClipboard } from "./native-platform.js";
|
|
34
|
+
export { oklabToOkhslLightness } from "./oklab.js";
|
|
35
|
+
export { normalizePastedText } from "./paste.js";
|
|
36
|
+
// Program status reporting (OSC 7501)
|
|
37
|
+
export { formatProgramStatus } from "./program-status.js";
|
|
38
|
+
// Input buffering for batch splitting
|
|
39
|
+
export { StdinBuffer } from "./stdin-buffer.js";
|
|
40
|
+
// Terminal interface and implementations
|
|
41
|
+
export { isAppleTerminalSession, ProcessTerminal } from "./terminal.js";
|
|
42
|
+
// Terminal colors
|
|
43
|
+
export { parseTerminalColorSchemeReport, } from "./terminal-colors.js";
|
|
44
|
+
// Terminal image support
|
|
45
|
+
export { allocateImageId, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getTerminalColorMode, getWebpDimensions, hyperlink, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCapabilityOverrides, setCellDimensions, } from "./terminal-image.js";
|
|
46
|
+
export { Container, CURSOR_MARKER, compositeTuiLine, isFocusable, isViewportTUI, renderFakeCursor, } from "./tui.js";
|
|
47
|
+
export { TuiAltScreen, turnPromptAbove } from "./tui-alt-screen.js";
|
|
48
|
+
export { TuiMainScreen } from "./tui-main-screen.js";
|
|
49
|
+
// Utilities
|
|
50
|
+
export { getOsc8LinkAtColumn, replaceControlCharacters, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.js";
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAA2B,MAAM,QAAQ,CAAC;AACzD,uBAAuB;AACvB,OAAO,EAIN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,qBAAqB;AACrB,OAAO,EACN,cAAc,EAGd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EAEd,YAAY,EACZ,SAAS,EAIT,UAAU,EACV,UAAU,EACV,UAAU,EAEV,QAAQ,EACR,SAAS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AAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\nexport { Marked, type Token, type Tokens } from \"marked\";\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Colors and styling\nexport {\n\tbackgroundAnsi,\n\ttype Color,\n\ttype ColorMixSpace,\n\tcolorToHex,\n\tcolorToOkhsl,\n\tcolorToOklch,\n\tcolorToRgb,\n\tforegroundAnsi,\n\ttype IndexedColor,\n\tindexedColor,\n\tmixColors,\n\ttype OkhslChannels,\n\ttype OklchChannels,\n\ttype OklchColorValue,\n\tokhslColor,\n\toklchColor,\n\tparseColor,\n\ttype RgbColorValue,\n\trgbColor,\n\tstyleText,\n\tstyleTextWithAnsi,\n\ttype TerminalColorMode,\n\ttype TextAttributes,\n\ttype TextStyle,\n} from \"./colors.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport { Editor, type EditorOptions, type EditorTheme } from \"./components/editor.ts\";\nexport { HStack } from \"./components/h-stack.ts\";\nexport {\n\tImage,\n\ttype ImageOptions,\n\ttype ImageTheme,\n\ttype ImageTranscoder,\n\tsetImageTranscoder,\n} from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from \"./components/markdown.ts\";\nexport { MouseRegion, type MouseRegionHandler } from \"./components/mouse-region.ts\";\nexport {\n\tScrollView,\n\ttype ScrollViewOptions,\n\ttype ScrollViewScrollbar,\n\ttype ScrollViewScrollToOptions,\n} from \"./components/scroll-view.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\nexport {\n\ttype StackChild,\n\ttype StackEntry,\n\ttype StackEntryOptions,\n\ttype StackOptions,\n\tVStack,\n} from \"./components/v-stack.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\tgetSelectPageIndex,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tdecodePrintableKey,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\n// LaTeX rendering\nexport { type RenderLatexOptions, renderLatex } from \"./latex.ts\";\n// Native platform integration\nexport { getNativeClipboard, type NativeClipboard } from \"./native-platform.ts\";\nexport { oklabToOkhslLightness } from \"./oklab.ts\";\nexport { normalizePastedText } from \"./paste.ts\";\n// Program status reporting (OSC 7501)\nexport { formatProgramStatus, type ProgramStatus } from \"./program-status.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { isAppleTerminalSession, ProcessTerminal, type Terminal } from \"./terminal.ts\";\n// Terminal colors\nexport {\n\tparseTerminalColorSchemeReport,\n\ttype RgbColor,\n\ttype TerminalColorScheme,\n\ttype TerminalColors,\n} from \"./terminal-colors.ts\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetTerminalColorMode,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCapabilityOverrides,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\tcompositeTuiLine,\n\ttype Focusable,\n\tisFocusable,\n\tisViewportTUI,\n\ttype OverlayAnchor,\n\ttype OverlayBounds,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\trenderFakeCursor,\n\ttype SizeValue,\n\ttype TUI,\n\ttype TuiInputListener,\n\ttype TuiInputListenerResult,\n\ttype TuiMode,\n\ttype TuiMouseButton,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttype TuiMouseEventType,\n\ttype TuiStopOptions,\n\ttype ViewportTUI,\n} from \"./tui.ts\";\nexport { TuiAltScreen, type TuiAltScreenOptions, turnPromptAbove } from \"./tui-alt-screen.ts\";\nexport { TuiMainScreen, type TuiMainScreenRenderState } from \"./tui-main-screen.ts\";\n// Utilities\nexport {\n\tgetOsc8LinkAtColumn,\n\treplaceControlCharacters,\n\tsliceByColumn,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"./utils.ts\";\nexport type { WheelScrollLines } from \"./wheel-scroll.ts\";\n"]}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { type KeyId } from "./keys.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Global keybinding registry.
|
|
4
|
+
* Downstream packages can add keybindings via declaration merging.
|
|
5
|
+
*/
|
|
6
|
+
export interface Keybindings {
|
|
7
|
+
"tui.editor.cursorUp": true;
|
|
8
|
+
"tui.editor.cursorDown": true;
|
|
9
|
+
"tui.editor.historyPrevious": true;
|
|
10
|
+
"tui.editor.historyNext": true;
|
|
11
|
+
"tui.editor.cursorLeft": true;
|
|
12
|
+
"tui.editor.cursorRight": true;
|
|
13
|
+
"tui.editor.cursorWordLeft": true;
|
|
14
|
+
"tui.editor.cursorWordRight": true;
|
|
15
|
+
"tui.editor.cursorLineStart": true;
|
|
16
|
+
"tui.editor.cursorLineEnd": true;
|
|
17
|
+
"tui.editor.jumpForward": true;
|
|
18
|
+
"tui.editor.jumpBackward": true;
|
|
19
|
+
"tui.editor.pageUp": true;
|
|
20
|
+
"tui.editor.pageDown": true;
|
|
21
|
+
"tui.editor.deleteCharBackward": true;
|
|
22
|
+
"tui.editor.deleteCharForward": true;
|
|
23
|
+
"tui.editor.deleteWordBackward": true;
|
|
24
|
+
"tui.editor.deleteWordForward": true;
|
|
25
|
+
"tui.editor.deleteToLineStart": true;
|
|
26
|
+
"tui.editor.deleteToLineEnd": true;
|
|
27
|
+
"tui.editor.yank": true;
|
|
28
|
+
"tui.editor.yankPop": true;
|
|
29
|
+
"tui.editor.undo": true;
|
|
30
|
+
"tui.input.newLine": true;
|
|
31
|
+
"tui.input.submit": true;
|
|
32
|
+
"tui.input.tab": true;
|
|
33
|
+
"tui.input.copy": true;
|
|
34
|
+
"tui.select.up": true;
|
|
35
|
+
"tui.select.down": true;
|
|
36
|
+
"tui.select.pageUp": true;
|
|
37
|
+
"tui.select.pageDown": true;
|
|
38
|
+
"tui.select.confirm": true;
|
|
39
|
+
"tui.select.cancel": true;
|
|
40
|
+
"tui.altScreen.pageUp": true;
|
|
41
|
+
"tui.altScreen.pageDown": true;
|
|
42
|
+
"tui.altScreen.halfPageUp": true;
|
|
43
|
+
"tui.altScreen.halfPageDown": true;
|
|
44
|
+
"tui.altScreen.lineUp": true;
|
|
45
|
+
"tui.altScreen.lineDown": true;
|
|
46
|
+
"tui.altScreen.previousPrompt": true;
|
|
47
|
+
"tui.altScreen.nextPrompt": true;
|
|
48
|
+
"tui.altScreen.search": true;
|
|
49
|
+
"tui.altScreen.searchNext": true;
|
|
50
|
+
"tui.altScreen.searchPrevious": true;
|
|
51
|
+
"tui.altScreen.searchClose": true;
|
|
52
|
+
"tui.altScreen.top": true;
|
|
53
|
+
"tui.altScreen.bottom": true;
|
|
54
|
+
}
|
|
55
|
+
export type Keybinding = keyof Keybindings;
|
|
56
|
+
export interface KeybindingDefinition {
|
|
57
|
+
defaultKeys: KeyId | KeyId[];
|
|
58
|
+
description?: string;
|
|
59
|
+
}
|
|
60
|
+
export type KeybindingDefinitions = Record<string, KeybindingDefinition>;
|
|
61
|
+
export type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;
|
|
62
|
+
export declare const TUI_KEYBINDINGS: {
|
|
63
|
+
readonly "tui.editor.cursorUp": {
|
|
64
|
+
readonly defaultKeys: "up";
|
|
65
|
+
readonly description: "Move cursor up";
|
|
66
|
+
};
|
|
67
|
+
readonly "tui.editor.cursorDown": {
|
|
68
|
+
readonly defaultKeys: "down";
|
|
69
|
+
readonly description: "Move cursor down";
|
|
70
|
+
};
|
|
71
|
+
readonly "tui.editor.historyPrevious": {
|
|
72
|
+
readonly defaultKeys: [];
|
|
73
|
+
readonly description: "Select previous prompt history entry";
|
|
74
|
+
};
|
|
75
|
+
readonly "tui.editor.historyNext": {
|
|
76
|
+
readonly defaultKeys: [];
|
|
77
|
+
readonly description: "Select next prompt history entry";
|
|
78
|
+
};
|
|
79
|
+
readonly "tui.editor.cursorLeft": {
|
|
80
|
+
readonly defaultKeys: ["left", "ctrl+b"];
|
|
81
|
+
readonly description: "Move cursor left";
|
|
82
|
+
};
|
|
83
|
+
readonly "tui.editor.cursorRight": {
|
|
84
|
+
readonly defaultKeys: ["right", "ctrl+f"];
|
|
85
|
+
readonly description: "Move cursor right";
|
|
86
|
+
};
|
|
87
|
+
readonly "tui.editor.cursorWordLeft": {
|
|
88
|
+
readonly defaultKeys: ["alt+left", "ctrl+left", "alt+b"];
|
|
89
|
+
readonly description: "Move cursor word left";
|
|
90
|
+
};
|
|
91
|
+
readonly "tui.editor.cursorWordRight": {
|
|
92
|
+
readonly defaultKeys: ["alt+right", "ctrl+right", "alt+f"];
|
|
93
|
+
readonly description: "Move cursor word right";
|
|
94
|
+
};
|
|
95
|
+
readonly "tui.editor.cursorLineStart": {
|
|
96
|
+
readonly defaultKeys: ["home", "ctrl+a"];
|
|
97
|
+
readonly description: "Move to line start";
|
|
98
|
+
};
|
|
99
|
+
readonly "tui.editor.cursorLineEnd": {
|
|
100
|
+
readonly defaultKeys: ["end", "ctrl+e"];
|
|
101
|
+
readonly description: "Move to line end";
|
|
102
|
+
};
|
|
103
|
+
readonly "tui.editor.jumpForward": {
|
|
104
|
+
readonly defaultKeys: "ctrl+]";
|
|
105
|
+
readonly description: "Jump forward to character";
|
|
106
|
+
};
|
|
107
|
+
readonly "tui.editor.jumpBackward": {
|
|
108
|
+
readonly defaultKeys: "ctrl+alt+]";
|
|
109
|
+
readonly description: "Jump backward to character";
|
|
110
|
+
};
|
|
111
|
+
readonly "tui.editor.pageUp": {
|
|
112
|
+
readonly defaultKeys: ["pageUp", "ctrl+pageUp"];
|
|
113
|
+
readonly description: "Page up";
|
|
114
|
+
};
|
|
115
|
+
readonly "tui.editor.pageDown": {
|
|
116
|
+
readonly defaultKeys: ["pageDown", "ctrl+pageDown"];
|
|
117
|
+
readonly description: "Page down";
|
|
118
|
+
};
|
|
119
|
+
readonly "tui.editor.deleteCharBackward": {
|
|
120
|
+
readonly defaultKeys: "backspace";
|
|
121
|
+
readonly description: "Delete character backward";
|
|
122
|
+
};
|
|
123
|
+
readonly "tui.editor.deleteCharForward": {
|
|
124
|
+
readonly defaultKeys: ["delete", "ctrl+d"];
|
|
125
|
+
readonly description: "Delete character forward";
|
|
126
|
+
};
|
|
127
|
+
readonly "tui.editor.deleteWordBackward": {
|
|
128
|
+
readonly defaultKeys: ["ctrl+w", "alt+backspace"];
|
|
129
|
+
readonly description: "Delete word backward";
|
|
130
|
+
};
|
|
131
|
+
readonly "tui.editor.deleteWordForward": {
|
|
132
|
+
readonly defaultKeys: ["alt+d", "alt+delete"];
|
|
133
|
+
readonly description: "Delete word forward";
|
|
134
|
+
};
|
|
135
|
+
readonly "tui.editor.deleteToLineStart": {
|
|
136
|
+
readonly defaultKeys: "ctrl+u";
|
|
137
|
+
readonly description: "Delete to line start";
|
|
138
|
+
};
|
|
139
|
+
readonly "tui.editor.deleteToLineEnd": {
|
|
140
|
+
readonly defaultKeys: "ctrl+k";
|
|
141
|
+
readonly description: "Delete to line end";
|
|
142
|
+
};
|
|
143
|
+
readonly "tui.editor.yank": {
|
|
144
|
+
readonly defaultKeys: "ctrl+y";
|
|
145
|
+
readonly description: "Yank";
|
|
146
|
+
};
|
|
147
|
+
readonly "tui.editor.yankPop": {
|
|
148
|
+
readonly defaultKeys: "alt+y";
|
|
149
|
+
readonly description: "Yank pop";
|
|
150
|
+
};
|
|
151
|
+
readonly "tui.editor.undo": {
|
|
152
|
+
readonly defaultKeys: "ctrl+-";
|
|
153
|
+
readonly description: "Undo";
|
|
154
|
+
};
|
|
155
|
+
readonly "tui.input.newLine": {
|
|
156
|
+
readonly defaultKeys: ["shift+enter", "ctrl+j"];
|
|
157
|
+
readonly description: "Insert newline";
|
|
158
|
+
};
|
|
159
|
+
readonly "tui.input.submit": {
|
|
160
|
+
readonly defaultKeys: "enter";
|
|
161
|
+
readonly description: "Submit input";
|
|
162
|
+
};
|
|
163
|
+
readonly "tui.input.tab": {
|
|
164
|
+
readonly defaultKeys: "tab";
|
|
165
|
+
readonly description: "Tab / autocomplete";
|
|
166
|
+
};
|
|
167
|
+
readonly "tui.input.copy": {
|
|
168
|
+
readonly defaultKeys: "ctrl+c";
|
|
169
|
+
readonly description: "Copy selection";
|
|
170
|
+
};
|
|
171
|
+
readonly "tui.select.up": {
|
|
172
|
+
readonly defaultKeys: "up";
|
|
173
|
+
readonly description: "Move selection up";
|
|
174
|
+
};
|
|
175
|
+
readonly "tui.select.down": {
|
|
176
|
+
readonly defaultKeys: "down";
|
|
177
|
+
readonly description: "Move selection down";
|
|
178
|
+
};
|
|
179
|
+
readonly "tui.select.pageUp": {
|
|
180
|
+
readonly defaultKeys: "pageUp";
|
|
181
|
+
readonly description: "Selection page up";
|
|
182
|
+
};
|
|
183
|
+
readonly "tui.select.pageDown": {
|
|
184
|
+
readonly defaultKeys: "pageDown";
|
|
185
|
+
readonly description: "Selection page down";
|
|
186
|
+
};
|
|
187
|
+
readonly "tui.select.confirm": {
|
|
188
|
+
readonly defaultKeys: "enter";
|
|
189
|
+
readonly description: "Confirm selection";
|
|
190
|
+
};
|
|
191
|
+
readonly "tui.select.cancel": {
|
|
192
|
+
readonly defaultKeys: ["escape", "ctrl+c"];
|
|
193
|
+
readonly description: "Cancel selection";
|
|
194
|
+
};
|
|
195
|
+
readonly "tui.altScreen.pageUp": {
|
|
196
|
+
readonly defaultKeys: "pageUp";
|
|
197
|
+
readonly description: "Scroll viewport up one page";
|
|
198
|
+
};
|
|
199
|
+
readonly "tui.altScreen.pageDown": {
|
|
200
|
+
readonly defaultKeys: "pageDown";
|
|
201
|
+
readonly description: "Scroll viewport down one page";
|
|
202
|
+
};
|
|
203
|
+
readonly "tui.altScreen.halfPageUp": {
|
|
204
|
+
readonly defaultKeys: [];
|
|
205
|
+
readonly description: "Scroll viewport up half a page";
|
|
206
|
+
};
|
|
207
|
+
readonly "tui.altScreen.halfPageDown": {
|
|
208
|
+
readonly defaultKeys: [];
|
|
209
|
+
readonly description: "Scroll viewport down half a page";
|
|
210
|
+
};
|
|
211
|
+
readonly "tui.altScreen.lineUp": {
|
|
212
|
+
readonly defaultKeys: [];
|
|
213
|
+
readonly description: "Scroll viewport up one line";
|
|
214
|
+
};
|
|
215
|
+
readonly "tui.altScreen.lineDown": {
|
|
216
|
+
readonly defaultKeys: [];
|
|
217
|
+
readonly description: "Scroll viewport down one line";
|
|
218
|
+
};
|
|
219
|
+
readonly "tui.altScreen.previousPrompt": {
|
|
220
|
+
readonly defaultKeys: ["ctrl+shift+up", "ctrl+up"];
|
|
221
|
+
readonly description: "Jump to previous semantic prompt";
|
|
222
|
+
};
|
|
223
|
+
readonly "tui.altScreen.nextPrompt": {
|
|
224
|
+
readonly defaultKeys: ["ctrl+shift+down", "ctrl+down"];
|
|
225
|
+
readonly description: "Jump to next semantic prompt";
|
|
226
|
+
};
|
|
227
|
+
readonly "tui.altScreen.search": {
|
|
228
|
+
readonly defaultKeys: "ctrl+shift+f";
|
|
229
|
+
readonly description: "Search the primary scroll view";
|
|
230
|
+
};
|
|
231
|
+
readonly "tui.altScreen.searchNext": {
|
|
232
|
+
readonly defaultKeys: ["enter", "ctrl+g"];
|
|
233
|
+
readonly description: "Select the next search match";
|
|
234
|
+
};
|
|
235
|
+
readonly "tui.altScreen.searchPrevious": {
|
|
236
|
+
readonly defaultKeys: ["shift+enter", "ctrl+shift+g"];
|
|
237
|
+
readonly description: "Select the previous search match";
|
|
238
|
+
};
|
|
239
|
+
readonly "tui.altScreen.searchClose": {
|
|
240
|
+
readonly defaultKeys: "escape";
|
|
241
|
+
readonly description: "Close transcript search";
|
|
242
|
+
};
|
|
243
|
+
readonly "tui.altScreen.top": {
|
|
244
|
+
readonly defaultKeys: "ctrl+home";
|
|
245
|
+
readonly description: "Scroll viewport to top";
|
|
246
|
+
};
|
|
247
|
+
readonly "tui.altScreen.bottom": {
|
|
248
|
+
readonly defaultKeys: "ctrl+end";
|
|
249
|
+
readonly description: "Scroll viewport to bottom";
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
export interface KeybindingConflict {
|
|
253
|
+
key: KeyId;
|
|
254
|
+
keybindings: string[];
|
|
255
|
+
}
|
|
256
|
+
export declare class KeybindingsManager {
|
|
257
|
+
private definitions;
|
|
258
|
+
private userBindings;
|
|
259
|
+
private keysById;
|
|
260
|
+
private conflicts;
|
|
261
|
+
constructor(definitions: KeybindingDefinitions, userBindings?: KeybindingsConfig);
|
|
262
|
+
private rebuild;
|
|
263
|
+
matches(data: string, keybinding: Keybinding): boolean;
|
|
264
|
+
getKeys(keybinding: Keybinding): KeyId[];
|
|
265
|
+
getDefinition(keybinding: Keybinding): KeybindingDefinition;
|
|
266
|
+
getConflicts(): KeybindingConflict[];
|
|
267
|
+
setUserBindings(userBindings: KeybindingsConfig): void;
|
|
268
|
+
getUserBindings(): KeybindingsConfig;
|
|
269
|
+
getResolvedBindings(): KeybindingsConfig;
|
|
270
|
+
}
|
|
271
|
+
export declare function setKeybindings(keybindings: KeybindingsManager): void;
|
|
272
|
+
export declare function getKeybindings(): KeybindingsManager;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the selection index after a `tui.select.pageUp` or `tui.select.pageDown` key, moved by `pageSize` and
|
|
275
|
+
* clamped to `0..itemCount - 1`. Returns undefined when `data` is not a selection page key, and 0 for a page key on
|
|
276
|
+
* an empty list, so callers must still check that the list has items before selecting.
|
|
277
|
+
*/
|
|
278
|
+
export declare function getSelectPageIndex(keybindings: KeybindingsManager, data: string, selectedIndex: number, itemCount: number, pageSize: number): number | undefined;
|
|
279
|
+
//# sourceMappingURL=keybindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keybindings.d.ts","sourceRoot":"","sources":["../src/keybindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,WAAW,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAE3B,qBAAqB,EAAE,IAAI,CAAC;IAC5B,uBAAuB,EAAE,IAAI,CAAC;IAC9B,4BAA4B,EAAE,IAAI,C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