@orkestrel/terminal 0.0.11 → 0.0.13
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/dist/src/core/index.cjs +19 -11
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +14 -11
- package/dist/src/core/index.d.ts +14 -11
- package/dist/src/core/index.js +19 -11
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.js.map +1 -1
- package/package.json +23 -17
|
@@ -68,15 +68,17 @@ export declare function confirmReduce(state: ReturnType<typeof createConfirmStat
|
|
|
68
68
|
export declare function confirmView(state: ReturnType<typeof createConfirmState>): string;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* The
|
|
72
|
-
* consults for the one-byte keys
|
|
73
|
-
* `ctrl` combination. The source of truth for
|
|
71
|
+
* The control BYTE (or CRLF pair) → key descriptor table {@link import('./helpers.js').parseKey}
|
|
72
|
+
* consults for the one-byte keys and the two-byte CRLF Enter chunk. Each entry carries the
|
|
73
|
+
* canonical `name` and whether it is a `ctrl` combination. The source of truth for that decode;
|
|
74
|
+
* frozen.
|
|
74
75
|
*
|
|
75
76
|
* @remarks
|
|
76
|
-
* `return` / `newline` map to `return` (one canonical Enter name)
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* `
|
|
77
|
+
* `return` / `newline` / `return + newline` all map to `return` (one canonical Enter name) — a
|
|
78
|
+
* terminal or a paste can deliver Enter as `\r`, `\n`, or the `\r\n` pair in one chunk;
|
|
79
|
+
* `delete` / `backspace` both map to `backspace` (the two Backspace bytes); the Ctrl combos
|
|
80
|
+
* (`c` / `d` / `u` / `a` / `e`) carry `ctrl: true` so a reducer can match
|
|
81
|
+
* `key.ctrl && key.name === 'c'`. `escape` / `tab` / `space` are plain named keys.
|
|
80
82
|
*/
|
|
81
83
|
export declare const CONTROL_NAMES: Readonly<Record<string, {
|
|
82
84
|
readonly name: string;
|
|
@@ -672,15 +674,15 @@ export declare interface ParkRequest {
|
|
|
672
674
|
|
|
673
675
|
/**
|
|
674
676
|
* Decode one keypress's bytes into a {@link KeyEvent} — total, never throws. A `Uint8Array` is
|
|
675
|
-
* read as UTF-8; the resulting string is matched against the known control bytes
|
|
676
|
-
* ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
677
|
+
* read as UTF-8; the resulting string is matched against the known control bytes and the CRLF
|
|
678
|
+
* pair ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
677
679
|
* single printable character. An unrecognized sequence yields `name: ''` with the raw `sequence`
|
|
678
680
|
* preserved.
|
|
679
681
|
*
|
|
680
682
|
* @remarks
|
|
681
683
|
* - **Single control byte.** A one-character control input (`return` / `backspace` / `tab` /
|
|
682
|
-
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`)
|
|
683
|
-
* {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
684
|
+
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`), or the two-byte `\r\n`
|
|
685
|
+
* CRLF pair, is looked up in {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
684
686
|
* - **Escape sequence.** A multi-byte ESC sequence (`up` / `down` / `left` / `right` in BOTH the
|
|
685
687
|
* `ESC[A` and `ESCOA` forms, plus `home` / `end` / `delete`) is looked up in
|
|
686
688
|
* {@link SEQUENCE_NAMES} and flagged `meta`.
|
|
@@ -696,6 +698,7 @@ export declare interface ParkRequest {
|
|
|
696
698
|
* @example
|
|
697
699
|
* ```ts
|
|
698
700
|
* parseKey('\r') // { name: 'return', sequence: '\r', ctrl: false, meta: false, shift: false }
|
|
701
|
+
* parseKey('\r\n') // { name: 'return', sequence: '\r\n', ctrl: false, meta: false, shift: false }
|
|
699
702
|
* parseKey('\x1b[A') // { name: 'up', sequence: '\x1b[A', ctrl: false, meta: true, shift: false }
|
|
700
703
|
* parseKey('A') // { name: 'A', sequence: 'A', ctrl: false, meta: false, shift: true }
|
|
701
704
|
* parseKey('\x03') // { name: 'c', sequence: '\x03', ctrl: true, meta: false, shift: false }
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -68,15 +68,17 @@ export declare function confirmReduce(state: ReturnType<typeof createConfirmStat
|
|
|
68
68
|
export declare function confirmView(state: ReturnType<typeof createConfirmState>): string;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* The
|
|
72
|
-
* consults for the one-byte keys
|
|
73
|
-
* `ctrl` combination. The source of truth for
|
|
71
|
+
* The control BYTE (or CRLF pair) → key descriptor table {@link import('./helpers.js').parseKey}
|
|
72
|
+
* consults for the one-byte keys and the two-byte CRLF Enter chunk. Each entry carries the
|
|
73
|
+
* canonical `name` and whether it is a `ctrl` combination. The source of truth for that decode;
|
|
74
|
+
* frozen.
|
|
74
75
|
*
|
|
75
76
|
* @remarks
|
|
76
|
-
* `return` / `newline` map to `return` (one canonical Enter name)
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* `
|
|
77
|
+
* `return` / `newline` / `return + newline` all map to `return` (one canonical Enter name) — a
|
|
78
|
+
* terminal or a paste can deliver Enter as `\r`, `\n`, or the `\r\n` pair in one chunk;
|
|
79
|
+
* `delete` / `backspace` both map to `backspace` (the two Backspace bytes); the Ctrl combos
|
|
80
|
+
* (`c` / `d` / `u` / `a` / `e`) carry `ctrl: true` so a reducer can match
|
|
81
|
+
* `key.ctrl && key.name === 'c'`. `escape` / `tab` / `space` are plain named keys.
|
|
80
82
|
*/
|
|
81
83
|
export declare const CONTROL_NAMES: Readonly<Record<string, {
|
|
82
84
|
readonly name: string;
|
|
@@ -672,15 +674,15 @@ export declare interface ParkRequest {
|
|
|
672
674
|
|
|
673
675
|
/**
|
|
674
676
|
* Decode one keypress's bytes into a {@link KeyEvent} — total, never throws. A `Uint8Array` is
|
|
675
|
-
* read as UTF-8; the resulting string is matched against the known control bytes
|
|
676
|
-
* ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
677
|
+
* read as UTF-8; the resulting string is matched against the known control bytes and the CRLF
|
|
678
|
+
* pair ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
677
679
|
* single printable character. An unrecognized sequence yields `name: ''` with the raw `sequence`
|
|
678
680
|
* preserved.
|
|
679
681
|
*
|
|
680
682
|
* @remarks
|
|
681
683
|
* - **Single control byte.** A one-character control input (`return` / `backspace` / `tab` /
|
|
682
|
-
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`)
|
|
683
|
-
* {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
684
|
+
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`), or the two-byte `\r\n`
|
|
685
|
+
* CRLF pair, is looked up in {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
684
686
|
* - **Escape sequence.** A multi-byte ESC sequence (`up` / `down` / `left` / `right` in BOTH the
|
|
685
687
|
* `ESC[A` and `ESCOA` forms, plus `home` / `end` / `delete`) is looked up in
|
|
686
688
|
* {@link SEQUENCE_NAMES} and flagged `meta`.
|
|
@@ -696,6 +698,7 @@ export declare interface ParkRequest {
|
|
|
696
698
|
* @example
|
|
697
699
|
* ```ts
|
|
698
700
|
* parseKey('\r') // { name: 'return', sequence: '\r', ctrl: false, meta: false, shift: false }
|
|
701
|
+
* parseKey('\r\n') // { name: 'return', sequence: '\r\n', ctrl: false, meta: false, shift: false }
|
|
699
702
|
* parseKey('\x1b[A') // { name: 'up', sequence: '\x1b[A', ctrl: false, meta: true, shift: false }
|
|
700
703
|
* parseKey('A') // { name: 'A', sequence: 'A', ctrl: false, meta: false, shift: true }
|
|
701
704
|
* parseKey('\x03') // { name: 'c', sequence: '\x03', ctrl: true, meta: false, shift: false }
|
package/dist/src/core/index.js
CHANGED
|
@@ -68,15 +68,17 @@ var SEQUENCE_NAMES = Object.freeze({
|
|
|
68
68
|
[`${KEY_CSI}8~`]: "end"
|
|
69
69
|
});
|
|
70
70
|
/**
|
|
71
|
-
* The
|
|
72
|
-
* consults for the one-byte keys
|
|
73
|
-
* `ctrl` combination. The source of truth for
|
|
71
|
+
* The control BYTE (or CRLF pair) → key descriptor table {@link import('./helpers.js').parseKey}
|
|
72
|
+
* consults for the one-byte keys and the two-byte CRLF Enter chunk. Each entry carries the
|
|
73
|
+
* canonical `name` and whether it is a `ctrl` combination. The source of truth for that decode;
|
|
74
|
+
* frozen.
|
|
74
75
|
*
|
|
75
76
|
* @remarks
|
|
76
|
-
* `return` / `newline` map to `return` (one canonical Enter name)
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* `
|
|
77
|
+
* `return` / `newline` / `return + newline` all map to `return` (one canonical Enter name) — a
|
|
78
|
+
* terminal or a paste can deliver Enter as `\r`, `\n`, or the `\r\n` pair in one chunk;
|
|
79
|
+
* `delete` / `backspace` both map to `backspace` (the two Backspace bytes); the Ctrl combos
|
|
80
|
+
* (`c` / `d` / `u` / `a` / `e`) carry `ctrl: true` so a reducer can match
|
|
81
|
+
* `key.ctrl && key.name === 'c'`. `escape` / `tab` / `space` are plain named keys.
|
|
80
82
|
*/
|
|
81
83
|
var CONTROL_NAMES = Object.freeze({
|
|
82
84
|
["\r"]: Object.freeze({
|
|
@@ -87,6 +89,11 @@ var CONTROL_NAMES = Object.freeze({
|
|
|
87
89
|
name: "return",
|
|
88
90
|
ctrl: false
|
|
89
91
|
}),
|
|
92
|
+
[`\r
|
|
93
|
+
`]: Object.freeze({
|
|
94
|
+
name: "return",
|
|
95
|
+
ctrl: false
|
|
96
|
+
}),
|
|
90
97
|
[" "]: Object.freeze({
|
|
91
98
|
name: "tab",
|
|
92
99
|
ctrl: false
|
|
@@ -339,15 +346,15 @@ var isTerminalSnapshot = recordOf({
|
|
|
339
346
|
//#region src/core/helpers.ts
|
|
340
347
|
/**
|
|
341
348
|
* Decode one keypress's bytes into a {@link KeyEvent} — total, never throws. A `Uint8Array` is
|
|
342
|
-
* read as UTF-8; the resulting string is matched against the known control bytes
|
|
343
|
-
* ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
349
|
+
* read as UTF-8; the resulting string is matched against the known control bytes and the CRLF
|
|
350
|
+
* pair ({@link CONTROL_NAMES}) and escape sequences ({@link SEQUENCE_NAMES}), falling back to a
|
|
344
351
|
* single printable character. An unrecognized sequence yields `name: ''` with the raw `sequence`
|
|
345
352
|
* preserved.
|
|
346
353
|
*
|
|
347
354
|
* @remarks
|
|
348
355
|
* - **Single control byte.** A one-character control input (`return` / `backspace` / `tab` /
|
|
349
|
-
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`)
|
|
350
|
-
* {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
356
|
+
* `escape` / `space`, or a Ctrl combo `c` / `d` / `u` / `a` / `e`), or the two-byte `\r\n`
|
|
357
|
+
* CRLF pair, is looked up in {@link CONTROL_NAMES}, carrying its `ctrl` flag.
|
|
351
358
|
* - **Escape sequence.** A multi-byte ESC sequence (`up` / `down` / `left` / `right` in BOTH the
|
|
352
359
|
* `ESC[A` and `ESCOA` forms, plus `home` / `end` / `delete`) is looked up in
|
|
353
360
|
* {@link SEQUENCE_NAMES} and flagged `meta`.
|
|
@@ -363,6 +370,7 @@ var isTerminalSnapshot = recordOf({
|
|
|
363
370
|
* @example
|
|
364
371
|
* ```ts
|
|
365
372
|
* parseKey('\r') // { name: 'return', sequence: '\r', ctrl: false, meta: false, shift: false }
|
|
373
|
+
* parseKey('\r\n') // { name: 'return', sequence: '\r\n', ctrl: false, meta: false, shift: false }
|
|
366
374
|
* parseKey('\x1b[A') // { name: 'up', sequence: '\x1b[A', ctrl: false, meta: true, shift: false }
|
|
367
375
|
* parseKey('A') // { name: 'A', sequence: 'A', ctrl: false, meta: false, shift: true }
|
|
368
376
|
* parseKey('\x03') // { name: 'c', sequence: '\x03', ctrl: true, meta: false, shift: false }
|