ink 6.7.0 → 7.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/build/ansi-tokenizer.d.ts +38 -0
- package/build/ansi-tokenizer.js +316 -0
- package/build/ansi-tokenizer.js.map +1 -0
- package/build/components/AnimationContext.d.ts +9 -0
- package/build/components/AnimationContext.js +13 -0
- package/build/components/AnimationContext.js.map +1 -0
- package/build/components/App.d.ts +5 -2
- package/build/components/App.js +192 -41
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +33 -3
- package/build/components/AppContext.js +2 -1
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +16 -3
- package/build/components/ErrorBoundary.d.ts +2 -2
- package/build/components/ErrorOverview.js +6 -6
- package/build/components/ErrorOverview.js.map +1 -1
- package/build/components/Static.js.map +1 -1
- package/build/components/StdinContext.d.ts +7 -1
- package/build/components/StdinContext.js +1 -0
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/Text.d.ts +1 -1
- package/build/components/Text.js +1 -1
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +1 -1
- package/build/devtools-window-polyfill.js +7 -4
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/devtools.js +31 -6
- package/build/devtools.js.map +1 -1
- package/build/dom.d.ts +5 -1
- package/build/dom.js +25 -5
- package/build/dom.js.map +1 -1
- package/build/hooks/use-animation.d.ts +49 -0
- package/build/hooks/use-animation.js +87 -0
- package/build/hooks/use-animation.js.map +1 -0
- package/build/hooks/use-app.d.ts +5 -2
- package/build/hooks/use-app.js +1 -1
- package/build/hooks/use-box-metrics.d.ts +59 -0
- package/build/hooks/use-box-metrics.js +88 -0
- package/build/hooks/use-box-metrics.js.map +1 -0
- package/build/hooks/use-cursor.d.ts +1 -1
- package/build/hooks/use-cursor.js +1 -1
- package/build/hooks/use-focus-manager.d.ts +17 -2
- package/build/hooks/use-focus-manager.js +2 -1
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +2 -1
- package/build/hooks/use-focus.js +5 -4
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +2 -1
- package/build/hooks/use-input.js +82 -80
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-is-screen-reader-enabled.d.ts +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/build/hooks/use-paste.d.ts +35 -0
- package/build/hooks/use-paste.js +62 -0
- package/build/hooks/use-paste.js.map +1 -0
- package/build/hooks/use-stderr.d.ts +1 -1
- package/build/hooks/use-stderr.js +1 -1
- package/build/hooks/use-stdin.d.ts +4 -2
- package/build/hooks/use-stdin.js +2 -1
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +1 -1
- package/build/hooks/use-stdout.js +1 -1
- package/build/hooks/use-window-size.d.ts +18 -0
- package/build/hooks/use-window-size.js +22 -0
- package/build/hooks/use-window-size.js.map +1 -0
- package/build/index.d.ts +10 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +55 -6
- package/build/ink.js +433 -162
- package/build/ink.js.map +1 -1
- package/build/input-parser.d.ts +10 -0
- package/build/input-parser.js +194 -0
- package/build/input-parser.js.map +1 -0
- package/build/log-update.d.ts +1 -0
- package/build/log-update.js +13 -1
- package/build/log-update.js.map +1 -1
- package/build/measure-element.d.ts +4 -0
- package/build/measure-element.js +4 -0
- package/build/measure-element.js.map +1 -1
- package/build/output.d.ts +1 -0
- package/build/output.js +63 -5
- package/build/output.js.map +1 -1
- package/build/parse-keypress.d.ts +1 -3
- package/build/parse-keypress.js +19 -17
- package/build/parse-keypress.js.map +1 -1
- package/build/reconciler.js +48 -19
- package/build/reconciler.js.map +1 -1
- package/build/render-border.js +29 -18
- package/build/render-border.js.map +1 -1
- package/build/render-to-string.d.ts +38 -0
- package/build/render-to-string.js +116 -0
- package/build/render-to-string.js.map +1 -0
- package/build/render.d.ts +69 -3
- package/build/render.js +18 -11
- package/build/render.js.map +1 -1
- package/build/sanitize-ansi.d.ts +2 -0
- package/build/sanitize-ansi.js +27 -0
- package/build/sanitize-ansi.js.map +1 -0
- package/build/squash-text-nodes.js +2 -1
- package/build/squash-text-nodes.js.map +1 -1
- package/build/styles.d.ts +78 -16
- package/build/styles.js +102 -31
- package/build/styles.js.map +1 -1
- package/build/utils.d.ts +9 -0
- package/build/utils.js +19 -0
- package/build/utils.js.map +1 -0
- package/build/wrap-text.js +7 -0
- package/build/wrap-text.js.map +1 -1
- package/build/write-synchronized.d.ts +1 -1
- package/build/write-synchronized.js +4 -2
- package/build/write-synchronized.js.map +1 -1
- package/package.json +40 -101
- package/readme.md +674 -56
- package/build/apply-styles.js +0 -175
- package/build/build-layout.js +0 -77
- package/build/calculate-wrapped-text.js +0 -53
- package/build/components/Color.js +0 -62
- package/build/experimental/apply-style.js +0 -140
- package/build/experimental/dom.js +0 -123
- package/build/experimental/output.js +0 -91
- package/build/experimental/reconciler.js +0 -141
- package/build/experimental/renderer.js +0 -81
- package/build/hooks/useInput.js +0 -38
- package/build/instance.js +0 -205
- package/build/options.d.ts +0 -52
- package/build/options.js +0 -2
- package/build/options.js.map +0 -1
- package/build/screen-reader-update.d.ts +0 -13
- package/build/screen-reader-update.js +0 -38
- package/build/screen-reader-update.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type ControlStringType = 'osc' | 'dcs' | 'pm' | 'apc' | 'sos';
|
|
2
|
+
type CsiToken = {
|
|
3
|
+
readonly type: 'csi';
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly parameterString: string;
|
|
6
|
+
readonly intermediateString: string;
|
|
7
|
+
readonly finalCharacter: string;
|
|
8
|
+
};
|
|
9
|
+
type EscToken = {
|
|
10
|
+
readonly type: 'esc';
|
|
11
|
+
readonly value: string;
|
|
12
|
+
readonly intermediateString: string;
|
|
13
|
+
readonly finalCharacter: string;
|
|
14
|
+
};
|
|
15
|
+
type ControlStringToken = {
|
|
16
|
+
readonly type: ControlStringType;
|
|
17
|
+
readonly value: string;
|
|
18
|
+
};
|
|
19
|
+
type TextToken = {
|
|
20
|
+
readonly type: 'text';
|
|
21
|
+
readonly value: string;
|
|
22
|
+
};
|
|
23
|
+
type StToken = {
|
|
24
|
+
readonly type: 'st';
|
|
25
|
+
readonly value: string;
|
|
26
|
+
};
|
|
27
|
+
type C1Token = {
|
|
28
|
+
readonly type: 'c1';
|
|
29
|
+
readonly value: string;
|
|
30
|
+
};
|
|
31
|
+
type InvalidToken = {
|
|
32
|
+
readonly type: 'invalid';
|
|
33
|
+
readonly value: string;
|
|
34
|
+
};
|
|
35
|
+
export type AnsiToken = TextToken | CsiToken | EscToken | ControlStringToken | StToken | C1Token | InvalidToken;
|
|
36
|
+
export declare const hasAnsiControlCharacters: (text: string) => boolean;
|
|
37
|
+
export declare const tokenizeAnsi: (text: string) => AnsiToken[];
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
const bellCharacter = '\u0007';
|
|
2
|
+
const escapeCharacter = '\u001B';
|
|
3
|
+
const stringTerminatorCharacter = '\u009C';
|
|
4
|
+
const csiCharacter = '\u009B';
|
|
5
|
+
const oscCharacter = '\u009D';
|
|
6
|
+
const dcsCharacter = '\u0090';
|
|
7
|
+
const pmCharacter = '\u009E';
|
|
8
|
+
const apcCharacter = '\u009F';
|
|
9
|
+
const sosCharacter = '\u0098';
|
|
10
|
+
const isCsiParameterCharacter = (character) => {
|
|
11
|
+
const codePoint = character.codePointAt(0);
|
|
12
|
+
return codePoint !== undefined && codePoint >= 0x30 && codePoint <= 0x3f;
|
|
13
|
+
};
|
|
14
|
+
const isCsiIntermediateCharacter = (character) => {
|
|
15
|
+
const codePoint = character.codePointAt(0);
|
|
16
|
+
return codePoint !== undefined && codePoint >= 0x20 && codePoint <= 0x2f;
|
|
17
|
+
};
|
|
18
|
+
const isCsiFinalCharacter = (character) => {
|
|
19
|
+
const codePoint = character.codePointAt(0);
|
|
20
|
+
return codePoint !== undefined && codePoint >= 0x40 && codePoint <= 0x7e;
|
|
21
|
+
};
|
|
22
|
+
const isEscapeIntermediateCharacter = (character) => {
|
|
23
|
+
const codePoint = character.codePointAt(0);
|
|
24
|
+
return codePoint !== undefined && codePoint >= 0x20 && codePoint <= 0x2f;
|
|
25
|
+
};
|
|
26
|
+
const isEscapeFinalCharacter = (character) => {
|
|
27
|
+
const codePoint = character.codePointAt(0);
|
|
28
|
+
return codePoint !== undefined && codePoint >= 0x30 && codePoint <= 0x7e;
|
|
29
|
+
};
|
|
30
|
+
const isC1ControlCharacter = (character) => {
|
|
31
|
+
const codePoint = character.codePointAt(0);
|
|
32
|
+
return codePoint !== undefined && codePoint >= 0x80 && codePoint <= 0x9f;
|
|
33
|
+
};
|
|
34
|
+
// Standards references:
|
|
35
|
+
// ECMA-48 control functions and CSI byte classes: https://ecma-international.org/publications-and-standards/standards/ecma-48/
|
|
36
|
+
// xterm CSI parameter/intermediate/final format notes: https://invisible-island.net/xterm/ecma-48-parameter-format.html
|
|
37
|
+
// xterm/OSC BEL termination behavior: https://davidrg.github.io/ckwin/dev/ctlseqs.html
|
|
38
|
+
const readCsiSequence = (text, fromIndex) => {
|
|
39
|
+
let index = fromIndex;
|
|
40
|
+
while (index < text.length) {
|
|
41
|
+
const character = text[index];
|
|
42
|
+
if (!isCsiParameterCharacter(character)) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
index++;
|
|
46
|
+
}
|
|
47
|
+
const parameterString = text.slice(fromIndex, index);
|
|
48
|
+
const intermediateStartIndex = index;
|
|
49
|
+
while (index < text.length) {
|
|
50
|
+
const character = text[index];
|
|
51
|
+
if (!isCsiIntermediateCharacter(character)) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
index++;
|
|
55
|
+
}
|
|
56
|
+
const intermediateString = text.slice(intermediateStartIndex, index);
|
|
57
|
+
const finalCharacter = text[index];
|
|
58
|
+
if (finalCharacter === undefined || !isCsiFinalCharacter(finalCharacter)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
endIndex: index + 1,
|
|
63
|
+
parameterString,
|
|
64
|
+
intermediateString,
|
|
65
|
+
finalCharacter,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const findControlStringTerminatorIndex = (text, fromIndex, allowBellTerminator) => {
|
|
69
|
+
for (let index = fromIndex; index < text.length; index++) {
|
|
70
|
+
const character = text[index];
|
|
71
|
+
if (allowBellTerminator && character === bellCharacter) {
|
|
72
|
+
return index + 1;
|
|
73
|
+
}
|
|
74
|
+
if (character === stringTerminatorCharacter) {
|
|
75
|
+
return index + 1;
|
|
76
|
+
}
|
|
77
|
+
if (character === escapeCharacter) {
|
|
78
|
+
const followingCharacter = text[index + 1];
|
|
79
|
+
// Tmux escapes ESC bytes in payload as ESC ESC.
|
|
80
|
+
if (followingCharacter === escapeCharacter) {
|
|
81
|
+
index++;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (followingCharacter === '\\') {
|
|
85
|
+
return index + 2;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
};
|
|
91
|
+
const readEscapeSequence = (text, fromIndex) => {
|
|
92
|
+
let index = fromIndex;
|
|
93
|
+
while (index < text.length) {
|
|
94
|
+
const character = text[index];
|
|
95
|
+
if (!isEscapeIntermediateCharacter(character)) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
index++;
|
|
99
|
+
}
|
|
100
|
+
const intermediateString = text.slice(fromIndex, index);
|
|
101
|
+
const finalCharacter = text[index];
|
|
102
|
+
if (finalCharacter === undefined || !isEscapeFinalCharacter(finalCharacter)) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
endIndex: index + 1,
|
|
107
|
+
intermediateString,
|
|
108
|
+
finalCharacter,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
// Centralize control-string rules so ESC and C1 paths do not diverge.
|
|
112
|
+
const getControlStringFromEscapeIntroducer = (character) => {
|
|
113
|
+
switch (character) {
|
|
114
|
+
case ']': {
|
|
115
|
+
return { type: 'osc', allowBellTerminator: true };
|
|
116
|
+
}
|
|
117
|
+
case 'P': {
|
|
118
|
+
return { type: 'dcs', allowBellTerminator: false };
|
|
119
|
+
}
|
|
120
|
+
case '^': {
|
|
121
|
+
return { type: 'pm', allowBellTerminator: false };
|
|
122
|
+
}
|
|
123
|
+
case '_': {
|
|
124
|
+
return { type: 'apc', allowBellTerminator: false };
|
|
125
|
+
}
|
|
126
|
+
case 'X': {
|
|
127
|
+
return { type: 'sos', allowBellTerminator: false };
|
|
128
|
+
}
|
|
129
|
+
default: {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const getControlStringFromC1Introducer = (character) => {
|
|
135
|
+
switch (character) {
|
|
136
|
+
case oscCharacter: {
|
|
137
|
+
return { type: 'osc', allowBellTerminator: true };
|
|
138
|
+
}
|
|
139
|
+
case dcsCharacter: {
|
|
140
|
+
return { type: 'dcs', allowBellTerminator: false };
|
|
141
|
+
}
|
|
142
|
+
case pmCharacter: {
|
|
143
|
+
return { type: 'pm', allowBellTerminator: false };
|
|
144
|
+
}
|
|
145
|
+
case apcCharacter: {
|
|
146
|
+
return { type: 'apc', allowBellTerminator: false };
|
|
147
|
+
}
|
|
148
|
+
case sosCharacter: {
|
|
149
|
+
return { type: 'sos', allowBellTerminator: false };
|
|
150
|
+
}
|
|
151
|
+
default: {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
export const hasAnsiControlCharacters = (text) => {
|
|
157
|
+
if (text.includes(escapeCharacter)) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
for (const character of text) {
|
|
161
|
+
if (isC1ControlCharacter(character)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
};
|
|
167
|
+
const malformedFromIndex = (tokens, text, textStartIndex, fromIndex) => {
|
|
168
|
+
if (fromIndex > textStartIndex) {
|
|
169
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, fromIndex) });
|
|
170
|
+
}
|
|
171
|
+
// Treat the remainder as invalid so callers can drop it as one unsafe unit.
|
|
172
|
+
tokens.push({ type: 'invalid', value: text.slice(fromIndex) });
|
|
173
|
+
return tokens;
|
|
174
|
+
};
|
|
175
|
+
export const tokenizeAnsi = (text) => {
|
|
176
|
+
if (!hasAnsiControlCharacters(text)) {
|
|
177
|
+
return [{ type: 'text', value: text }];
|
|
178
|
+
}
|
|
179
|
+
const tokens = [];
|
|
180
|
+
let textStartIndex = 0;
|
|
181
|
+
for (let index = 0; index < text.length;) {
|
|
182
|
+
const character = text[index];
|
|
183
|
+
if (character === undefined) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
if (character === escapeCharacter) {
|
|
187
|
+
const followingCharacter = text[index + 1];
|
|
188
|
+
if (followingCharacter === undefined) {
|
|
189
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
190
|
+
}
|
|
191
|
+
if (followingCharacter === '[') {
|
|
192
|
+
const csiSequence = readCsiSequence(text, index + 2);
|
|
193
|
+
if (csiSequence === undefined) {
|
|
194
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
195
|
+
}
|
|
196
|
+
if (index > textStartIndex) {
|
|
197
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
198
|
+
}
|
|
199
|
+
tokens.push({
|
|
200
|
+
type: 'csi',
|
|
201
|
+
value: text.slice(index, csiSequence.endIndex),
|
|
202
|
+
parameterString: csiSequence.parameterString,
|
|
203
|
+
intermediateString: csiSequence.intermediateString,
|
|
204
|
+
finalCharacter: csiSequence.finalCharacter,
|
|
205
|
+
});
|
|
206
|
+
index = csiSequence.endIndex;
|
|
207
|
+
textStartIndex = index;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const escapeControlString = getControlStringFromEscapeIntroducer(followingCharacter);
|
|
211
|
+
if (escapeControlString !== undefined) {
|
|
212
|
+
const controlStringTerminatorIndex = findControlStringTerminatorIndex(text, index + 2, escapeControlString.allowBellTerminator);
|
|
213
|
+
if (controlStringTerminatorIndex === undefined) {
|
|
214
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
215
|
+
}
|
|
216
|
+
if (index > textStartIndex) {
|
|
217
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
218
|
+
}
|
|
219
|
+
tokens.push({
|
|
220
|
+
type: escapeControlString.type,
|
|
221
|
+
value: text.slice(index, controlStringTerminatorIndex),
|
|
222
|
+
});
|
|
223
|
+
index = controlStringTerminatorIndex;
|
|
224
|
+
textStartIndex = index;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const escapeSequence = readEscapeSequence(text, index + 1);
|
|
228
|
+
if (escapeSequence === undefined) {
|
|
229
|
+
// Incomplete escape sequences with intermediates are malformed control strings.
|
|
230
|
+
if (isEscapeIntermediateCharacter(followingCharacter)) {
|
|
231
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
232
|
+
}
|
|
233
|
+
if (index > textStartIndex) {
|
|
234
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
235
|
+
}
|
|
236
|
+
// Ignore lone ESC and continue tokenizing the rest.
|
|
237
|
+
index++;
|
|
238
|
+
textStartIndex = index;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (index > textStartIndex) {
|
|
242
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
243
|
+
}
|
|
244
|
+
tokens.push({
|
|
245
|
+
type: 'esc',
|
|
246
|
+
value: text.slice(index, escapeSequence.endIndex),
|
|
247
|
+
intermediateString: escapeSequence.intermediateString,
|
|
248
|
+
finalCharacter: escapeSequence.finalCharacter,
|
|
249
|
+
});
|
|
250
|
+
index = escapeSequence.endIndex;
|
|
251
|
+
textStartIndex = index;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (character === csiCharacter) {
|
|
255
|
+
const csiSequence = readCsiSequence(text, index + 1);
|
|
256
|
+
if (csiSequence === undefined) {
|
|
257
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
258
|
+
}
|
|
259
|
+
if (index > textStartIndex) {
|
|
260
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
261
|
+
}
|
|
262
|
+
tokens.push({
|
|
263
|
+
type: 'csi',
|
|
264
|
+
value: text.slice(index, csiSequence.endIndex),
|
|
265
|
+
parameterString: csiSequence.parameterString,
|
|
266
|
+
intermediateString: csiSequence.intermediateString,
|
|
267
|
+
finalCharacter: csiSequence.finalCharacter,
|
|
268
|
+
});
|
|
269
|
+
index = csiSequence.endIndex;
|
|
270
|
+
textStartIndex = index;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const c1ControlString = getControlStringFromC1Introducer(character);
|
|
274
|
+
if (c1ControlString !== undefined) {
|
|
275
|
+
const controlStringTerminatorIndex = findControlStringTerminatorIndex(text, index + 1, c1ControlString.allowBellTerminator);
|
|
276
|
+
if (controlStringTerminatorIndex === undefined) {
|
|
277
|
+
return malformedFromIndex(tokens, text, textStartIndex, index);
|
|
278
|
+
}
|
|
279
|
+
if (index > textStartIndex) {
|
|
280
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
281
|
+
}
|
|
282
|
+
tokens.push({
|
|
283
|
+
type: c1ControlString.type,
|
|
284
|
+
value: text.slice(index, controlStringTerminatorIndex),
|
|
285
|
+
});
|
|
286
|
+
index = controlStringTerminatorIndex;
|
|
287
|
+
textStartIndex = index;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (character === stringTerminatorCharacter) {
|
|
291
|
+
if (index > textStartIndex) {
|
|
292
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
293
|
+
}
|
|
294
|
+
tokens.push({ type: 'st', value: character });
|
|
295
|
+
index++;
|
|
296
|
+
textStartIndex = index;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
// Strip remaining C1 controls as standalone functions.
|
|
300
|
+
if (isC1ControlCharacter(character)) {
|
|
301
|
+
if (index > textStartIndex) {
|
|
302
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex, index) });
|
|
303
|
+
}
|
|
304
|
+
tokens.push({ type: 'c1', value: character });
|
|
305
|
+
index++;
|
|
306
|
+
textStartIndex = index;
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
index++;
|
|
310
|
+
}
|
|
311
|
+
if (textStartIndex < text.length) {
|
|
312
|
+
tokens.push({ type: 'text', value: text.slice(textStartIndex) });
|
|
313
|
+
}
|
|
314
|
+
return tokens;
|
|
315
|
+
};
|
|
316
|
+
//# sourceMappingURL=ansi-tokenizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi-tokenizer.js","sourceRoot":"","sources":["../src/ansi-tokenizer.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,eAAe,GAAG,QAAQ,CAAC;AACjC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAC3C,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,WAAW,GAAG,QAAQ,CAAC;AAC7B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAqD9B,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAW,EAAE;IAC9D,MAAM,SAAS,GAAG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AAC,EAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type AnimationContextValue = {
|
|
2
|
+
readonly renderThrottleMs: number;
|
|
3
|
+
readonly subscribe: (callback: (currentTime: number) => void, interval: number) => {
|
|
4
|
+
readonly startTime: number;
|
|
5
|
+
readonly unsubscribe: () => void;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
declare const animationContext: import("react").Context<AnimationContextValue>;
|
|
9
|
+
export default animationContext;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const animationContext = createContext({
|
|
3
|
+
renderThrottleMs: 0,
|
|
4
|
+
subscribe() {
|
|
5
|
+
return {
|
|
6
|
+
startTime: 0,
|
|
7
|
+
unsubscribe() { },
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
animationContext.displayName = 'InternalAnimationContext';
|
|
12
|
+
export default animationContext;
|
|
13
|
+
//# sourceMappingURL=AnimationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationContext.js","sourceRoot":"","sources":["../../src/components/AnimationContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAapC,MAAM,gBAAgB,GAAG,aAAa,CAAwB;IAC7D,gBAAgB,EAAE,CAAC;IACnB,SAAS;QACR,OAAO;YACN,SAAS,EAAE,CAAC;YACZ,WAAW,KAAI,CAAC;SAChB,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH,gBAAgB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAE1D,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,10 +8,13 @@ type Props = {
|
|
|
8
8
|
readonly writeToStdout: (data: string) => void;
|
|
9
9
|
readonly writeToStderr: (data: string) => void;
|
|
10
10
|
readonly exitOnCtrlC: boolean;
|
|
11
|
-
readonly onExit: (
|
|
11
|
+
readonly onExit: (errorOrResult?: unknown) => void;
|
|
12
|
+
readonly onWaitUntilRenderFlush: () => Promise<void>;
|
|
12
13
|
readonly setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
14
|
+
readonly interactive: boolean;
|
|
15
|
+
readonly renderThrottleMs: number;
|
|
13
16
|
};
|
|
14
|
-
declare function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, exitOnCtrlC, onExit, setCursorPosition, }: Props): React.ReactNode;
|
|
17
|
+
declare function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, exitOnCtrlC, onExit, onWaitUntilRenderFlush, setCursorPosition, interactive, renderThrottleMs, }: Props): React.ReactNode;
|
|
15
18
|
declare namespace App {
|
|
16
19
|
var displayName: string;
|
|
17
20
|
}
|