@kolisachint/hoocode-tui 0.5.66 → 0.5.68
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/components/editor.d.ts +20 -18
- package/dist/components/editor.d.ts.map +1 -1
- package/dist/components/editor.js +54 -58
- package/dist/components/editor.js.map +1 -1
- package/dist/components/frame.d.ts +117 -0
- package/dist/components/frame.d.ts.map +1 -0
- package/dist/components/frame.js +203 -0
- package/dist/components/frame.js.map +1 -0
- package/dist/components/select-list.d.ts.map +1 -1
- package/dist/components/select-list.js +8 -2
- package/dist/components/select-list.js.map +1 -1
- package/dist/components/settings-list.d.ts.map +1 -1
- package/dist/components/settings-list.js +7 -2
- package/dist/components/settings-list.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/keybindings.d.ts +9 -4
- package/dist/keybindings.d.ts.map +1 -1
- package/dist/keybindings.js +14 -2
- package/dist/keybindings.js.map +1 -1
- package/dist/mouse.d.ts +75 -0
- package/dist/mouse.d.ts.map +1 -0
- package/dist/mouse.js +115 -0
- package/dist/mouse.js.map +1 -0
- package/dist/terminal.d.ts +30 -0
- package/dist/terminal.d.ts.map +1 -1
- package/dist/terminal.js +49 -0
- package/dist/terminal.js.map +1 -1
- package/dist/tui.d.ts +286 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +642 -1
- package/dist/tui.js.map +1 -1
- package/dist/undo-stack.d.ts +39 -6
- package/dist/undo-stack.d.ts.map +1 -1
- package/dist/undo-stack.js +59 -6
- package/dist/undo-stack.js.map +1 -1
- package/package.json +1 -1
package/dist/undo-stack.d.ts
CHANGED
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Undo and redo over snapshots of some state.
|
|
3
3
|
*
|
|
4
|
-
* Stores deep clones
|
|
5
|
-
*
|
|
4
|
+
* Stores deep clones on the way in; hands snapshots back directly on the way
|
|
5
|
+
* out, since a popped one is already detached and nobody else holds it.
|
|
6
|
+
*
|
|
7
|
+
* ## Why redo is here rather than in the caller
|
|
8
|
+
*
|
|
9
|
+
* The invariant that makes redo correct is easy to state and easy to forget:
|
|
10
|
+
* **a fresh edit invalidates every redo.** Once you undo twice and then type,
|
|
11
|
+
* the future you undid never happened and offering to restore it would drop the
|
|
12
|
+
* character you just typed. Keeping `push`, `undo` and `redo` in one object is
|
|
13
|
+
* what lets `push` clear the redo side itself, so no caller can forget to — and
|
|
14
|
+
* the caller here is an editor with twenty-odd `pushUndoSnapshot()` sites.
|
|
6
15
|
*/
|
|
7
16
|
export declare class UndoStack<S> {
|
|
8
17
|
private stack;
|
|
9
|
-
|
|
18
|
+
private redoStack;
|
|
19
|
+
/**
|
|
20
|
+
* Record a state that can be returned to, and abandon any undone future.
|
|
21
|
+
*
|
|
22
|
+
* The clone is the point: callers hold a live state object and keep mutating
|
|
23
|
+
* it, so storing the reference would store something that changes underneath
|
|
24
|
+
* the stack.
|
|
25
|
+
*/
|
|
10
26
|
push(state: S): void;
|
|
11
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Step back, given the state to return to if the step is later redone.
|
|
29
|
+
*
|
|
30
|
+
* `current` is asked for rather than remembered because the stack never sees
|
|
31
|
+
* the live state between pushes — the caller mutates it directly. Without it
|
|
32
|
+
* the first redo would have nothing to restore.
|
|
33
|
+
*/
|
|
34
|
+
undo(current: S): S | undefined;
|
|
35
|
+
/** Step forward again, if an undo has left somewhere to go. */
|
|
36
|
+
redo(current: S): S | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Pop and return the most recent snapshot, or undefined if empty.
|
|
39
|
+
*
|
|
40
|
+
* The pre-redo entry point: it steps back without recording anywhere to
|
|
41
|
+
* step forward to. Prefer `undo`, which keeps redo working.
|
|
42
|
+
*/
|
|
12
43
|
pop(): S | undefined;
|
|
13
|
-
/** Remove all snapshots. */
|
|
44
|
+
/** Remove all snapshots, in both directions. */
|
|
14
45
|
clear(): void;
|
|
15
46
|
get length(): number;
|
|
47
|
+
get canUndo(): boolean;
|
|
48
|
+
get canRedo(): boolean;
|
|
16
49
|
}
|
|
17
50
|
//# sourceMappingURL=undo-stack.d.ts.map
|
package/dist/undo-stack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undo-stack.d.ts","sourceRoot":"","sources":["../src/undo-stack.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"undo-stack.d.ts","sourceRoot":"","sources":["../src/undo-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,SAAS,CAAW;IAE5B;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAInB;IAED;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAK9B;IAED,+DAA+D;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAK9B;IAED;;;;;OAKG;IACH,GAAG,IAAI,CAAC,GAAG,SAAS,CAEnB;IAED,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAGZ;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;CACD","sourcesContent":["/**\n * Undo and redo over snapshots of some state.\n *\n * Stores deep clones on the way in; hands snapshots back directly on the way\n * out, since a popped one is already detached and nobody else holds it.\n *\n * ## Why redo is here rather than in the caller\n *\n * The invariant that makes redo correct is easy to state and easy to forget:\n * **a fresh edit invalidates every redo.** Once you undo twice and then type,\n * the future you undid never happened and offering to restore it would drop the\n * character you just typed. Keeping `push`, `undo` and `redo` in one object is\n * what lets `push` clear the redo side itself, so no caller can forget to — and\n * the caller here is an editor with twenty-odd `pushUndoSnapshot()` sites.\n */\nexport class UndoStack<S> {\n\tprivate stack: S[] = [];\n\tprivate redoStack: S[] = [];\n\n\t/**\n\t * Record a state that can be returned to, and abandon any undone future.\n\t *\n\t * The clone is the point: callers hold a live state object and keep mutating\n\t * it, so storing the reference would store something that changes underneath\n\t * the stack.\n\t */\n\tpush(state: S): void {\n\t\tthis.stack.push(structuredClone(state));\n\t\t// A new edit is a new branch. Whatever was undone is unreachable now.\n\t\tif (this.redoStack.length > 0) this.redoStack.length = 0;\n\t}\n\n\t/**\n\t * Step back, given the state to return to if the step is later redone.\n\t *\n\t * `current` is asked for rather than remembered because the stack never sees\n\t * the live state between pushes — the caller mutates it directly. Without it\n\t * the first redo would have nothing to restore.\n\t */\n\tundo(current: S): S | undefined {\n\t\tconst snapshot = this.stack.pop();\n\t\tif (snapshot === undefined) return undefined;\n\t\tthis.redoStack.push(structuredClone(current));\n\t\treturn snapshot;\n\t}\n\n\t/** Step forward again, if an undo has left somewhere to go. */\n\tredo(current: S): S | undefined {\n\t\tconst snapshot = this.redoStack.pop();\n\t\tif (snapshot === undefined) return undefined;\n\t\tthis.stack.push(structuredClone(current));\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Pop and return the most recent snapshot, or undefined if empty.\n\t *\n\t * The pre-redo entry point: it steps back without recording anywhere to\n\t * step forward to. Prefer `undo`, which keeps redo working.\n\t */\n\tpop(): S | undefined {\n\t\treturn this.stack.pop();\n\t}\n\n\t/** Remove all snapshots, in both directions. */\n\tclear(): void {\n\t\tthis.stack.length = 0;\n\t\tthis.redoStack.length = 0;\n\t}\n\n\tget length(): number {\n\t\treturn this.stack.length;\n\t}\n\n\tget canUndo(): boolean {\n\t\treturn this.stack.length > 0;\n\t}\n\n\tget canRedo(): boolean {\n\t\treturn this.redoStack.length > 0;\n\t}\n}\n"]}
|
package/dist/undo-stack.js
CHANGED
|
@@ -1,25 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Undo and redo over snapshots of some state.
|
|
3
3
|
*
|
|
4
|
-
* Stores deep clones
|
|
5
|
-
*
|
|
4
|
+
* Stores deep clones on the way in; hands snapshots back directly on the way
|
|
5
|
+
* out, since a popped one is already detached and nobody else holds it.
|
|
6
|
+
*
|
|
7
|
+
* ## Why redo is here rather than in the caller
|
|
8
|
+
*
|
|
9
|
+
* The invariant that makes redo correct is easy to state and easy to forget:
|
|
10
|
+
* **a fresh edit invalidates every redo.** Once you undo twice and then type,
|
|
11
|
+
* the future you undid never happened and offering to restore it would drop the
|
|
12
|
+
* character you just typed. Keeping `push`, `undo` and `redo` in one object is
|
|
13
|
+
* what lets `push` clear the redo side itself, so no caller can forget to — and
|
|
14
|
+
* the caller here is an editor with twenty-odd `pushUndoSnapshot()` sites.
|
|
6
15
|
*/
|
|
7
16
|
export class UndoStack {
|
|
8
17
|
stack = [];
|
|
9
|
-
|
|
18
|
+
redoStack = [];
|
|
19
|
+
/**
|
|
20
|
+
* Record a state that can be returned to, and abandon any undone future.
|
|
21
|
+
*
|
|
22
|
+
* The clone is the point: callers hold a live state object and keep mutating
|
|
23
|
+
* it, so storing the reference would store something that changes underneath
|
|
24
|
+
* the stack.
|
|
25
|
+
*/
|
|
10
26
|
push(state) {
|
|
11
27
|
this.stack.push(structuredClone(state));
|
|
28
|
+
// A new edit is a new branch. Whatever was undone is unreachable now.
|
|
29
|
+
if (this.redoStack.length > 0)
|
|
30
|
+
this.redoStack.length = 0;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Step back, given the state to return to if the step is later redone.
|
|
34
|
+
*
|
|
35
|
+
* `current` is asked for rather than remembered because the stack never sees
|
|
36
|
+
* the live state between pushes — the caller mutates it directly. Without it
|
|
37
|
+
* the first redo would have nothing to restore.
|
|
38
|
+
*/
|
|
39
|
+
undo(current) {
|
|
40
|
+
const snapshot = this.stack.pop();
|
|
41
|
+
if (snapshot === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
this.redoStack.push(structuredClone(current));
|
|
44
|
+
return snapshot;
|
|
12
45
|
}
|
|
13
|
-
/**
|
|
46
|
+
/** Step forward again, if an undo has left somewhere to go. */
|
|
47
|
+
redo(current) {
|
|
48
|
+
const snapshot = this.redoStack.pop();
|
|
49
|
+
if (snapshot === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
this.stack.push(structuredClone(current));
|
|
52
|
+
return snapshot;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pop and return the most recent snapshot, or undefined if empty.
|
|
56
|
+
*
|
|
57
|
+
* The pre-redo entry point: it steps back without recording anywhere to
|
|
58
|
+
* step forward to. Prefer `undo`, which keeps redo working.
|
|
59
|
+
*/
|
|
14
60
|
pop() {
|
|
15
61
|
return this.stack.pop();
|
|
16
62
|
}
|
|
17
|
-
/** Remove all snapshots. */
|
|
63
|
+
/** Remove all snapshots, in both directions. */
|
|
18
64
|
clear() {
|
|
19
65
|
this.stack.length = 0;
|
|
66
|
+
this.redoStack.length = 0;
|
|
20
67
|
}
|
|
21
68
|
get length() {
|
|
22
69
|
return this.stack.length;
|
|
23
70
|
}
|
|
71
|
+
get canUndo() {
|
|
72
|
+
return this.stack.length > 0;
|
|
73
|
+
}
|
|
74
|
+
get canRedo() {
|
|
75
|
+
return this.redoStack.length > 0;
|
|
76
|
+
}
|
|
24
77
|
}
|
|
25
78
|
//# sourceMappingURL=undo-stack.js.map
|
package/dist/undo-stack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undo-stack.js","sourceRoot":"","sources":["../src/undo-stack.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"undo-stack.js","sourceRoot":"","sources":["../src/undo-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,SAAS;IACb,KAAK,GAAQ,EAAE,CAAC;IAChB,SAAS,GAAQ,EAAE,CAAC;IAE5B;;;;;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,CAAC,CAAC;IAAA,CAC7B;IAED,IAAI,OAAO,GAAY;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAAA,CACjC;CACD","sourcesContent":["/**\n * Undo and redo over snapshots of some state.\n *\n * Stores deep clones on the way in; hands snapshots back directly on the way\n * out, since a popped one is already detached and nobody else holds it.\n *\n * ## Why redo is here rather than in the caller\n *\n * The invariant that makes redo correct is easy to state and easy to forget:\n * **a fresh edit invalidates every redo.** Once you undo twice and then type,\n * the future you undid never happened and offering to restore it would drop the\n * character you just typed. Keeping `push`, `undo` and `redo` in one object is\n * what lets `push` clear the redo side itself, so no caller can forget to — and\n * the caller here is an editor with twenty-odd `pushUndoSnapshot()` sites.\n */\nexport class UndoStack<S> {\n\tprivate stack: S[] = [];\n\tprivate redoStack: S[] = [];\n\n\t/**\n\t * Record a state that can be returned to, and abandon any undone future.\n\t *\n\t * The clone is the point: callers hold a live state object and keep mutating\n\t * it, so storing the reference would store something that changes underneath\n\t * the stack.\n\t */\n\tpush(state: S): void {\n\t\tthis.stack.push(structuredClone(state));\n\t\t// A new edit is a new branch. Whatever was undone is unreachable now.\n\t\tif (this.redoStack.length > 0) this.redoStack.length = 0;\n\t}\n\n\t/**\n\t * Step back, given the state to return to if the step is later redone.\n\t *\n\t * `current` is asked for rather than remembered because the stack never sees\n\t * the live state between pushes — the caller mutates it directly. Without it\n\t * the first redo would have nothing to restore.\n\t */\n\tundo(current: S): S | undefined {\n\t\tconst snapshot = this.stack.pop();\n\t\tif (snapshot === undefined) return undefined;\n\t\tthis.redoStack.push(structuredClone(current));\n\t\treturn snapshot;\n\t}\n\n\t/** Step forward again, if an undo has left somewhere to go. */\n\tredo(current: S): S | undefined {\n\t\tconst snapshot = this.redoStack.pop();\n\t\tif (snapshot === undefined) return undefined;\n\t\tthis.stack.push(structuredClone(current));\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Pop and return the most recent snapshot, or undefined if empty.\n\t *\n\t * The pre-redo entry point: it steps back without recording anywhere to\n\t * step forward to. Prefer `undo`, which keeps redo working.\n\t */\n\tpop(): S | undefined {\n\t\treturn this.stack.pop();\n\t}\n\n\t/** Remove all snapshots, in both directions. */\n\tclear(): void {\n\t\tthis.stack.length = 0;\n\t\tthis.redoStack.length = 0;\n\t}\n\n\tget length(): number {\n\t\treturn this.stack.length;\n\t}\n\n\tget canUndo(): boolean {\n\t\treturn this.stack.length > 0;\n\t}\n\n\tget canRedo(): boolean {\n\t\treturn this.redoStack.length > 0;\n\t}\n}\n"]}
|
package/package.json
CHANGED