@prozilla-os/terminal 2.0.1 → 2.0.6
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/README.md +3 -3
- package/dist/main.d.ts +5 -1635
- package/dist/main.js +393 -359
- package/dist/main.js.map +1 -1
- package/package.json +20 -14
package/dist/main.js
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.
|
|
2
|
-
import { useShell as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import * as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import { Vector2 as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"ansi-
|
|
19
|
-
"ansi-
|
|
20
|
-
"ansi-
|
|
21
|
-
"ansi-
|
|
22
|
-
"ansi-
|
|
23
|
-
"ansi-
|
|
24
|
-
"ansi-
|
|
25
|
-
"ansi-
|
|
26
|
-
"ansi-bright-
|
|
27
|
-
"ansi-bright-
|
|
28
|
-
"ansi-bright-
|
|
29
|
-
"ansi-bright-
|
|
30
|
-
"ansi-
|
|
31
|
-
"ansi-
|
|
32
|
-
"ansi-
|
|
33
|
-
"ansi-
|
|
34
|
-
"ansi-
|
|
35
|
-
"ansi-
|
|
36
|
-
"ansi-
|
|
37
|
-
"ansi-
|
|
38
|
-
"ansi-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._Terminal_1y9ey_1{--char-width: .585rem;--char-height: 1.25rem;position:relative;display:flex;flex-direction:column;align-items:flex-start;padding:.5rem;overflow:auto;height:100%;cursor:text;box-sizing:border-box}._Terminal_1y9ey_1 *{font-family:var(--mono-font-family);letter-spacing:-.03em}._Terminal_1y9ey_1 p,._Terminal_1y9ey_1 pre{margin:0;height:var(--char-height);line-height:var(--char-height);font-size:1rem;letter-spacing:inherit}._VirtualCursor_1y9ey_29{position:absolute;margin-left:.5rem;margin-top:.5rem;width:var(--char-width);height:var(--char-height);background-color:var(--foreground-color-0);mix-blend-mode:difference;pointer-events:none;z-index:10;animation:_blink_1y9ey_1 1s step-end infinite}._History_1y9ey_44{width:100%}._Prefix_1y9ey_48{display:flex;width:max-content;white-space:nowrap}._Input_1y9ey_54,._Output_1y9ey_54{display:flex;flex-direction:row;align-items:center;width:100%;line-height:var(--char-height);font-size:1rem;text-align:start;white-space:pre}._Input_1y9ey_54{height:var(--char-height)}._Input-container_1y9ey_69{--cursor-width: var(--char-width);--cursor-offset: 0;position:relative;height:100%;width:fit-content}._Input-container_1y9ey_69:after{content:"";position:absolute;top:0;left:calc(var(--cursor-offset) * var(--char-width));width:var(--cursor-width);height:100%;background-color:var(--foreground-color-0);animation:_blink_1y9ey_1 1s step-end infinite}._Input-container_1y9ey_69 input{color:transparent;position:absolute;left:0;width:100%;padding:0;background:none;border:none;outline:none;font-size:inherit;caret-color:transparent}@keyframes _blink_1y9ey_1{0%,to{opacity:0}50%{opacity:1}}._Input_1y9ey_54 label{position:absolute;width:100%;height:100%;top:0;left:0;cursor:text}._InterruptButton_1y9ey_120{display:none;gap:.5rem;flex-direction:row-reverse;justify-content:center;align-items:center;position:absolute;bottom:1rem;right:1rem;padding:.5rem 1rem;border-radius:var(--border-radius-1)}._InterruptButton_1y9ey_120>svg{margin:0!important;width:auto}._InterruptButton_1y9ey_120 *{color:inherit}@media(pointer:coarse){._InterruptButton_1y9ey_120{display:flex}}._ansi-black-fg_1y9ey_148{color:var(--black-2)}._ansi-red-fg_1y9ey_149{color:var(--red-0)}._ansi-green-fg_1y9ey_150{color:var(--green-0)}._ansi-yellow-fg_1y9ey_151{color:var(--yellow-0)}._ansi-blue-fg_1y9ey_152{color:var(--blue-0)}._ansi-magenta-fg_1y9ey_153{color:var(--purple-0)}._ansi-cyan-fg_1y9ey_154{color:var(--cyan-0)}._ansi-white-fg_1y9ey_155{color:var(--foreground-color-0)}._ansi-bright-black-fg_1y9ey_157{color:var(--black-2)}._ansi-bright-red-fg_1y9ey_158{color:var(--red-0)}._ansi-bright-green-fg_1y9ey_159{color:var(--green-0)}._ansi-bright-yellow-fg_1y9ey_160{color:var(--yellow-0)}._ansi-bright-blue-fg_1y9ey_161{color:var(--blue-0)}._ansi-bright-magenta-fg_1y9ey_162{color:var(--purple-0)}._ansi-bright-cyan-fg_1y9ey_163{color:var(--cyan-0)}._ansi-bright-white-fg_1y9ey_164{color:var(--foreground-color-0)}._ansi-black-bg_1y9ey_166{background-color:var(--black-2)}._ansi-red-bg_1y9ey_167{background-color:var(--red-0)}._ansi-green-bg_1y9ey_168{background-color:var(--green-0)}._ansi-yellow-bg_1y9ey_169{background-color:var(--yellow-0)}._ansi-blue-bg_1y9ey_170{background-color:var(--blue-0)}._ansi-magenta-bg_1y9ey_171{background-color:var(--purple-0)}._ansi-cyan-bg_1y9ey_172{background-color:var(--cyan-0)}._ansi-white-bg_1y9ey_173{background-color:var(--foreground-color-0)}._ansi-dim_1y9ey_175{opacity:.65}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
+
import { useFontMetrics as G, useShell as Q, HistoryFlags as X, Button as Y, utilStyles as ee, App as te, AppsConfig as re, ExecutableResolver as se } from "@prozilla-os/core";
|
|
3
|
+
import { jsx as w, jsxs as D } from "react/jsx-runtime";
|
|
4
|
+
import * as R from "react";
|
|
5
|
+
import { memo as ne, forwardRef as ie, useState as $, useRef as I, useLayoutEffect as le, useEffect as O, useMemo as P } from "react";
|
|
6
|
+
import { Vector2 as oe, Ansi as ae } from "@prozilla-os/shared";
|
|
7
|
+
import { MacOsSkin as ce, Skin as L, Windows95Skin as ue, MinimalSkin as fe, PixelSkin as ge } from "@prozilla-os/skins";
|
|
8
|
+
const he = "_Terminal_1y9ey_1", pe = "_VirtualCursor_1y9ey_29", ye = "_blink_1y9ey_1", de = "_History_1y9ey_44", me = "_Prefix_1y9ey_48", _e = "_Input_1y9ey_54", be = "_Output_1y9ey_54", ke = "_InterruptButton_1y9ey_120", S = {
|
|
9
|
+
Terminal: he,
|
|
10
|
+
VirtualCursor: pe,
|
|
11
|
+
blink: ye,
|
|
12
|
+
History: de,
|
|
13
|
+
Prefix: me,
|
|
14
|
+
Input: _e,
|
|
15
|
+
Output: be,
|
|
16
|
+
"Input-container": "_Input-container_1y9ey_69",
|
|
17
|
+
InterruptButton: ke,
|
|
18
|
+
"ansi-black-fg": "_ansi-black-fg_1y9ey_148",
|
|
19
|
+
"ansi-red-fg": "_ansi-red-fg_1y9ey_149",
|
|
20
|
+
"ansi-green-fg": "_ansi-green-fg_1y9ey_150",
|
|
21
|
+
"ansi-yellow-fg": "_ansi-yellow-fg_1y9ey_151",
|
|
22
|
+
"ansi-blue-fg": "_ansi-blue-fg_1y9ey_152",
|
|
23
|
+
"ansi-magenta-fg": "_ansi-magenta-fg_1y9ey_153",
|
|
24
|
+
"ansi-cyan-fg": "_ansi-cyan-fg_1y9ey_154",
|
|
25
|
+
"ansi-white-fg": "_ansi-white-fg_1y9ey_155",
|
|
26
|
+
"ansi-bright-black-fg": "_ansi-bright-black-fg_1y9ey_157",
|
|
27
|
+
"ansi-bright-red-fg": "_ansi-bright-red-fg_1y9ey_158",
|
|
28
|
+
"ansi-bright-green-fg": "_ansi-bright-green-fg_1y9ey_159",
|
|
29
|
+
"ansi-bright-yellow-fg": "_ansi-bright-yellow-fg_1y9ey_160",
|
|
30
|
+
"ansi-bright-blue-fg": "_ansi-bright-blue-fg_1y9ey_161",
|
|
31
|
+
"ansi-bright-magenta-fg": "_ansi-bright-magenta-fg_1y9ey_162",
|
|
32
|
+
"ansi-bright-cyan-fg": "_ansi-bright-cyan-fg_1y9ey_163",
|
|
33
|
+
"ansi-bright-white-fg": "_ansi-bright-white-fg_1y9ey_164",
|
|
34
|
+
"ansi-black-bg": "_ansi-black-bg_1y9ey_166",
|
|
35
|
+
"ansi-red-bg": "_ansi-red-bg_1y9ey_167",
|
|
36
|
+
"ansi-green-bg": "_ansi-green-bg_1y9ey_168",
|
|
37
|
+
"ansi-yellow-bg": "_ansi-yellow-bg_1y9ey_169",
|
|
38
|
+
"ansi-blue-bg": "_ansi-blue-bg_1y9ey_170",
|
|
39
|
+
"ansi-magenta-bg": "_ansi-magenta-bg_1y9ey_171",
|
|
40
|
+
"ansi-cyan-bg": "_ansi-cyan-bg_1y9ey_172",
|
|
41
|
+
"ansi-white-bg": "_ansi-white-bg_1y9ey_173",
|
|
42
|
+
"ansi-dim": "_ansi-dim_1y9ey_175"
|
|
39
43
|
};
|
|
40
|
-
function
|
|
41
|
-
return
|
|
44
|
+
function we(n) {
|
|
45
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
42
46
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
const
|
|
47
|
+
var A, H;
|
|
48
|
+
function Se() {
|
|
49
|
+
if (H) return A;
|
|
50
|
+
H = 1;
|
|
51
|
+
const n = [
|
|
48
52
|
[
|
|
49
53
|
{ color: "0, 0, 0", class: "ansi-black" },
|
|
50
54
|
{ color: "187, 0, 0", class: "ansi-red" },
|
|
@@ -65,7 +69,7 @@ function ne() {
|
|
|
65
69
|
{ color: "85, 255, 255", class: "ansi-bright-cyan" },
|
|
66
70
|
{ color: "255, 255, 255", class: "ansi-bright-white" }
|
|
67
71
|
]
|
|
68
|
-
],
|
|
72
|
+
], c = /(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;
|
|
69
73
|
class g {
|
|
70
74
|
/**
|
|
71
75
|
* Anser.escapeForHtml
|
|
@@ -80,8 +84,8 @@ function ne() {
|
|
|
80
84
|
* @param {String} txt The input text (containing the ANSI snippets).
|
|
81
85
|
* @returns {String} The escaped html.
|
|
82
86
|
*/
|
|
83
|
-
static escapeForHtml(
|
|
84
|
-
return new g().escapeForHtml(
|
|
87
|
+
static escapeForHtml(t) {
|
|
88
|
+
return new g().escapeForHtml(t);
|
|
85
89
|
}
|
|
86
90
|
/**
|
|
87
91
|
* Anser.linkify
|
|
@@ -95,8 +99,8 @@ function ne() {
|
|
|
95
99
|
* @param {String} txt The input text.
|
|
96
100
|
* @returns {String} The HTML containing the <a> tags (unescaped).
|
|
97
101
|
*/
|
|
98
|
-
static linkify(
|
|
99
|
-
return new g().linkify(
|
|
102
|
+
static linkify(t) {
|
|
103
|
+
return new g().linkify(t);
|
|
100
104
|
}
|
|
101
105
|
/**
|
|
102
106
|
* Anser.ansiToHtml
|
|
@@ -122,8 +126,8 @@ function ne() {
|
|
|
122
126
|
* @param {Object} options The options passed to the ansiToHTML method.
|
|
123
127
|
* @returns {String} The HTML output.
|
|
124
128
|
*/
|
|
125
|
-
static ansiToHtml(
|
|
126
|
-
return new g().ansiToHtml(
|
|
129
|
+
static ansiToHtml(t, e) {
|
|
130
|
+
return new g().ansiToHtml(t, e);
|
|
127
131
|
}
|
|
128
132
|
/**
|
|
129
133
|
* Anser.ansiToJson
|
|
@@ -135,8 +139,8 @@ function ne() {
|
|
|
135
139
|
* @param {Object} options The options passed to the ansiToHTML method.
|
|
136
140
|
* @returns {String} The HTML output.
|
|
137
141
|
*/
|
|
138
|
-
static ansiToJson(
|
|
139
|
-
return new g().ansiToJson(
|
|
142
|
+
static ansiToJson(t, e) {
|
|
143
|
+
return new g().ansiToJson(t, e);
|
|
140
144
|
}
|
|
141
145
|
/**
|
|
142
146
|
* Anser.ansiToText
|
|
@@ -147,8 +151,8 @@ function ne() {
|
|
|
147
151
|
* @param {String} txt The input text.
|
|
148
152
|
* @returns {String} The text output.
|
|
149
153
|
*/
|
|
150
|
-
static ansiToText(
|
|
151
|
-
return new g().ansiToText(
|
|
154
|
+
static ansiToText(t) {
|
|
155
|
+
return new g().ansiToText(t);
|
|
152
156
|
}
|
|
153
157
|
/**
|
|
154
158
|
* Anser
|
|
@@ -170,16 +174,16 @@ function ne() {
|
|
|
170
174
|
*/
|
|
171
175
|
setupPalette() {
|
|
172
176
|
this.PALETTE_COLORS = [];
|
|
173
|
-
for (let
|
|
177
|
+
for (let r = 0; r < 2; ++r)
|
|
174
178
|
for (let l = 0; l < 8; ++l)
|
|
175
|
-
this.PALETTE_COLORS.push(
|
|
176
|
-
let
|
|
177
|
-
for (let
|
|
179
|
+
this.PALETTE_COLORS.push(n[r][l].color);
|
|
180
|
+
let t = [0, 95, 135, 175, 215, 255], e = (r, l, a) => t[r] + ", " + t[l] + ", " + t[a];
|
|
181
|
+
for (let r = 0; r < 6; ++r)
|
|
178
182
|
for (let l = 0; l < 6; ++l)
|
|
179
183
|
for (let a = 0; a < 6; ++a)
|
|
180
|
-
this.PALETTE_COLORS.push(
|
|
184
|
+
this.PALETTE_COLORS.push(e(r, l, a));
|
|
181
185
|
let h = 8;
|
|
182
|
-
for (let
|
|
186
|
+
for (let r = 0; r < 24; ++r, h += 10)
|
|
183
187
|
this.PALETTE_COLORS.push(h + ", " + h + ", " + h);
|
|
184
188
|
}
|
|
185
189
|
/**
|
|
@@ -191,10 +195,10 @@ function ne() {
|
|
|
191
195
|
* @param {String} txt The input text.
|
|
192
196
|
* @returns {String} The escpaed HTML output.
|
|
193
197
|
*/
|
|
194
|
-
escapeForHtml(
|
|
195
|
-
return
|
|
198
|
+
escapeForHtml(t) {
|
|
199
|
+
return t.replace(
|
|
196
200
|
/[&<>\"]/gm,
|
|
197
|
-
(
|
|
201
|
+
(e) => e == "&" ? "&" : e == '"' ? """ : e == "<" ? "<" : e == ">" ? ">" : ""
|
|
198
202
|
);
|
|
199
203
|
}
|
|
200
204
|
/**
|
|
@@ -206,8 +210,8 @@ function ne() {
|
|
|
206
210
|
* @param {String} txt The input text.
|
|
207
211
|
* @returns {String} The HTML output containing link elements.
|
|
208
212
|
*/
|
|
209
|
-
linkify(
|
|
210
|
-
return
|
|
213
|
+
linkify(t) {
|
|
214
|
+
return t.replace(c, (e) => `<a href="${e}">${e}</a>`);
|
|
211
215
|
}
|
|
212
216
|
/**
|
|
213
217
|
* ansiToHtml
|
|
@@ -219,8 +223,8 @@ function ne() {
|
|
|
219
223
|
* @param {Object} options The options passed ot the `process` method.
|
|
220
224
|
* @returns {String} The HTML output.
|
|
221
225
|
*/
|
|
222
|
-
ansiToHtml(
|
|
223
|
-
return this.process(
|
|
226
|
+
ansiToHtml(t, e) {
|
|
227
|
+
return this.process(t, e, !0);
|
|
224
228
|
}
|
|
225
229
|
/**
|
|
226
230
|
* ansiToJson
|
|
@@ -232,8 +236,8 @@ function ne() {
|
|
|
232
236
|
* @param {Object} options The options passed ot the `process` method.
|
|
233
237
|
* @returns {String} The JSON output.
|
|
234
238
|
*/
|
|
235
|
-
ansiToJson(
|
|
236
|
-
return
|
|
239
|
+
ansiToJson(t, e) {
|
|
240
|
+
return e = e || {}, e.json = !0, e.clearLine = !1, this.process(t, e, !0);
|
|
237
241
|
}
|
|
238
242
|
/**
|
|
239
243
|
* ansiToText
|
|
@@ -244,8 +248,8 @@ function ne() {
|
|
|
244
248
|
* @param {String} txt The input text.
|
|
245
249
|
* @returns {String} The text output.
|
|
246
250
|
*/
|
|
247
|
-
ansiToText(
|
|
248
|
-
return this.process(
|
|
251
|
+
ansiToText(t) {
|
|
252
|
+
return this.process(t, {}, !1);
|
|
249
253
|
}
|
|
250
254
|
/**
|
|
251
255
|
* process
|
|
@@ -261,16 +265,16 @@ function ne() {
|
|
|
261
265
|
*
|
|
262
266
|
* @param {Boolean} markup
|
|
263
267
|
*/
|
|
264
|
-
process(
|
|
265
|
-
let
|
|
266
|
-
|
|
267
|
-
let
|
|
268
|
-
if (
|
|
269
|
-
let
|
|
270
|
-
return
|
|
268
|
+
process(t, e, h) {
|
|
269
|
+
let r = this, l = t.split(/\033\[/), a = l.shift();
|
|
270
|
+
e == null && (e = {}), e.clearLine = /\r/.test(t);
|
|
271
|
+
let u = l.map((f) => this.processChunk(f, e, h));
|
|
272
|
+
if (e && e.json) {
|
|
273
|
+
let f = r.processChunkJson("");
|
|
274
|
+
return f.content = a, f.clearLine = e.clearLine, u.unshift(f), e.remove_empty && (u = u.filter((s) => !s.isEmpty())), u;
|
|
271
275
|
} else
|
|
272
|
-
|
|
273
|
-
return
|
|
276
|
+
u.unshift(a);
|
|
277
|
+
return u.join("");
|
|
274
278
|
}
|
|
275
279
|
/**
|
|
276
280
|
* processChunkJson
|
|
@@ -297,99 +301,99 @@ function ne() {
|
|
|
297
301
|
* - `isEmpty` (Function): A function returning `true` if the content is empty, or `false` otherwise.
|
|
298
302
|
*
|
|
299
303
|
*/
|
|
300
|
-
processChunkJson(
|
|
301
|
-
|
|
302
|
-
let
|
|
303
|
-
content:
|
|
304
|
+
processChunkJson(t, e, h) {
|
|
305
|
+
e = typeof e > "u" ? {} : e;
|
|
306
|
+
let r = e.use_classes = typeof e.use_classes < "u" && e.use_classes, l = e.key = r ? "class" : "color", a = {
|
|
307
|
+
content: t,
|
|
304
308
|
fg: null,
|
|
305
309
|
bg: null,
|
|
306
310
|
fg_truecolor: null,
|
|
307
311
|
bg_truecolor: null,
|
|
308
312
|
isInverted: !1,
|
|
309
|
-
clearLine:
|
|
313
|
+
clearLine: e.clearLine,
|
|
310
314
|
decoration: null,
|
|
311
315
|
decorations: [],
|
|
312
316
|
was_processed: !1,
|
|
313
317
|
isEmpty: () => !a.content
|
|
314
|
-
},
|
|
315
|
-
if (!
|
|
316
|
-
a.content =
|
|
317
|
-
let
|
|
318
|
-
if (
|
|
318
|
+
}, u = t.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
|
|
319
|
+
if (!u) return a;
|
|
320
|
+
a.content = u[4];
|
|
321
|
+
let f = u[2].split(";");
|
|
322
|
+
if (u[1] !== "" || u[3] !== "m" || !h)
|
|
319
323
|
return a;
|
|
320
|
-
let
|
|
321
|
-
for (;
|
|
322
|
-
let
|
|
324
|
+
let s = this;
|
|
325
|
+
for (; f.length > 0; ) {
|
|
326
|
+
let v = f.shift(), i = parseInt(v);
|
|
323
327
|
if (isNaN(i) || i === 0)
|
|
324
|
-
|
|
328
|
+
s.fg = s.bg = null, s.decorations = [];
|
|
325
329
|
else if (i === 1)
|
|
326
|
-
|
|
330
|
+
s.decorations.push("bold");
|
|
327
331
|
else if (i === 2)
|
|
328
|
-
|
|
332
|
+
s.decorations.push("dim");
|
|
329
333
|
else if (i === 3)
|
|
330
|
-
|
|
334
|
+
s.decorations.push("italic");
|
|
331
335
|
else if (i === 4)
|
|
332
|
-
|
|
336
|
+
s.decorations.push("underline");
|
|
333
337
|
else if (i === 5)
|
|
334
|
-
|
|
338
|
+
s.decorations.push("blink");
|
|
335
339
|
else if (i === 7)
|
|
336
|
-
|
|
340
|
+
s.decorations.push("reverse");
|
|
337
341
|
else if (i === 8)
|
|
338
|
-
|
|
342
|
+
s.decorations.push("hidden");
|
|
339
343
|
else if (i === 9)
|
|
340
|
-
|
|
344
|
+
s.decorations.push("strikethrough");
|
|
341
345
|
else if (i === 21)
|
|
342
|
-
|
|
346
|
+
s.removeDecoration("bold");
|
|
343
347
|
else if (i === 22)
|
|
344
|
-
|
|
348
|
+
s.removeDecoration("bold"), s.removeDecoration("dim");
|
|
345
349
|
else if (i === 23)
|
|
346
|
-
|
|
350
|
+
s.removeDecoration("italic");
|
|
347
351
|
else if (i === 24)
|
|
348
|
-
|
|
352
|
+
s.removeDecoration("underline");
|
|
349
353
|
else if (i === 25)
|
|
350
|
-
|
|
354
|
+
s.removeDecoration("blink");
|
|
351
355
|
else if (i === 27)
|
|
352
|
-
|
|
356
|
+
s.removeDecoration("reverse");
|
|
353
357
|
else if (i === 28)
|
|
354
|
-
|
|
358
|
+
s.removeDecoration("hidden");
|
|
355
359
|
else if (i === 29)
|
|
356
|
-
|
|
360
|
+
s.removeDecoration("strikethrough");
|
|
357
361
|
else if (i === 39)
|
|
358
|
-
|
|
362
|
+
s.fg = null;
|
|
359
363
|
else if (i === 49)
|
|
360
|
-
|
|
364
|
+
s.bg = null;
|
|
361
365
|
else if (i >= 30 && i < 38)
|
|
362
|
-
|
|
366
|
+
s.fg = n[0][i % 10][l];
|
|
363
367
|
else if (i >= 90 && i < 98)
|
|
364
|
-
|
|
368
|
+
s.fg = n[1][i % 10][l];
|
|
365
369
|
else if (i >= 40 && i < 48)
|
|
366
|
-
|
|
370
|
+
s.bg = n[0][i % 10][l];
|
|
367
371
|
else if (i >= 100 && i < 108)
|
|
368
|
-
|
|
372
|
+
s.bg = n[1][i % 10][l];
|
|
369
373
|
else if (i === 38 || i === 48) {
|
|
370
|
-
let
|
|
371
|
-
if (
|
|
372
|
-
let
|
|
373
|
-
if (
|
|
374
|
-
let
|
|
375
|
-
if (
|
|
376
|
-
if (!
|
|
377
|
-
this.PALETTE_COLORS ||
|
|
374
|
+
let b = i === 38;
|
|
375
|
+
if (f.length >= 1) {
|
|
376
|
+
let k = f.shift();
|
|
377
|
+
if (k === "5" && f.length >= 1) {
|
|
378
|
+
let d = parseInt(f.shift());
|
|
379
|
+
if (d >= 0 && d <= 255)
|
|
380
|
+
if (!r)
|
|
381
|
+
this.PALETTE_COLORS || s.setupPalette(), b ? s.fg = this.PALETTE_COLORS[d] : s.bg = this.PALETTE_COLORS[d];
|
|
378
382
|
else {
|
|
379
|
-
let
|
|
380
|
-
|
|
383
|
+
let m = d >= 16 ? "ansi-palette-" + d : n[d > 7 ? 1 : 0][d % 8].class;
|
|
384
|
+
b ? s.fg = m : s.bg = m;
|
|
381
385
|
}
|
|
382
|
-
} else if (
|
|
383
|
-
let
|
|
384
|
-
if (
|
|
385
|
-
let
|
|
386
|
-
|
|
386
|
+
} else if (k === "2" && f.length >= 3) {
|
|
387
|
+
let d = parseInt(f.shift()), m = parseInt(f.shift()), o = parseInt(f.shift());
|
|
388
|
+
if (d >= 0 && d <= 255 && m >= 0 && m <= 255 && o >= 0 && o <= 255) {
|
|
389
|
+
let T = d + ", " + m + ", " + o;
|
|
390
|
+
r ? b ? (s.fg = "ansi-truecolor", s.fg_truecolor = T) : (s.bg = "ansi-truecolor", s.bg_truecolor = T) : b ? s.fg = T : s.bg = T;
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
}
|
|
392
|
-
return
|
|
396
|
+
return s.fg === null && s.bg === null && s.decorations.length === 0 || (a.fg = s.fg, a.bg = s.bg, a.fg_truecolor = s.fg_truecolor, a.bg_truecolor = s.bg_truecolor, a.decorations = s.decorations, a.decoration = s.decorations.slice(-1).pop() || null, a.was_processed = !0), a;
|
|
393
397
|
}
|
|
394
398
|
/**
|
|
395
399
|
* processChunk
|
|
@@ -406,207 +410,207 @@ function ne() {
|
|
|
406
410
|
* @param {Boolean} markup If false, the colors will not be parsed.
|
|
407
411
|
* @return {Object|String} The result (object if `json` is wanted back or string otherwise).
|
|
408
412
|
*/
|
|
409
|
-
processChunk(
|
|
410
|
-
|
|
411
|
-
let
|
|
412
|
-
if (
|
|
413
|
+
processChunk(t, e, h) {
|
|
414
|
+
e = e || {};
|
|
415
|
+
let r = this.processChunkJson(t, e, h), l = e.use_classes;
|
|
416
|
+
if (r.decorations = r.decorations.filter((i) => {
|
|
413
417
|
if (i === "reverse") {
|
|
414
|
-
|
|
415
|
-
let
|
|
416
|
-
|
|
417
|
-
let
|
|
418
|
-
return
|
|
418
|
+
r.fg || (r.fg = n[0][7][l ? "class" : "color"]), r.bg || (r.bg = n[0][0][l ? "class" : "color"]);
|
|
419
|
+
let b = r.fg;
|
|
420
|
+
r.fg = r.bg, r.bg = b;
|
|
421
|
+
let k = r.fg_truecolor;
|
|
422
|
+
return r.fg_truecolor = r.bg_truecolor, r.bg_truecolor = k, r.isInverted = !0, !1;
|
|
419
423
|
}
|
|
420
424
|
return !0;
|
|
421
|
-
}),
|
|
422
|
-
return
|
|
423
|
-
if (
|
|
425
|
+
}), e.json)
|
|
426
|
+
return r;
|
|
427
|
+
if (r.isEmpty())
|
|
424
428
|
return "";
|
|
425
|
-
if (!
|
|
426
|
-
return
|
|
427
|
-
let a = [],
|
|
428
|
-
let
|
|
429
|
-
for (
|
|
430
|
-
i.hasOwnProperty(
|
|
431
|
-
return
|
|
429
|
+
if (!r.was_processed)
|
|
430
|
+
return r.content;
|
|
431
|
+
let a = [], u = [], f = [], s = {}, v = (i) => {
|
|
432
|
+
let b = [], k;
|
|
433
|
+
for (k in i)
|
|
434
|
+
i.hasOwnProperty(k) && b.push("data-" + k + '="' + this.escapeForHtml(i[k]) + '"');
|
|
435
|
+
return b.length > 0 ? " " + b.join(" ") : "";
|
|
432
436
|
};
|
|
433
|
-
return
|
|
437
|
+
return r.isInverted && (s["ansi-is-inverted"] = "true"), r.fg && (l ? (a.push(r.fg + "-fg"), r.fg_truecolor !== null && (s["ansi-truecolor-fg"] = r.fg_truecolor, r.fg_truecolor = null)) : a.push("color:rgb(" + r.fg + ")")), r.bg && (l ? (a.push(r.bg + "-bg"), r.bg_truecolor !== null && (s["ansi-truecolor-bg"] = r.bg_truecolor, r.bg_truecolor = null)) : a.push("background-color:rgb(" + r.bg + ")")), r.decorations.forEach((i) => {
|
|
434
438
|
if (l) {
|
|
435
|
-
|
|
439
|
+
u.push("ansi-" + i);
|
|
436
440
|
return;
|
|
437
441
|
}
|
|
438
|
-
i === "bold" ?
|
|
439
|
-
}),
|
|
442
|
+
i === "bold" ? u.push("font-weight:bold") : i === "dim" ? u.push("opacity:0.5") : i === "italic" ? u.push("font-style:italic") : i === "hidden" ? u.push("visibility:hidden") : i === "strikethrough" ? f.push("line-through") : f.push(i);
|
|
443
|
+
}), f.length && u.push("text-decoration:" + f.join(" ")), l ? '<span class="' + a.concat(u).join(" ") + '"' + v(s) + ">" + r.content + "</span>" : '<span style="' + a.concat(u).join(";") + '"' + v(s) + ">" + r.content + "</span>";
|
|
440
444
|
}
|
|
441
|
-
removeDecoration(
|
|
442
|
-
const
|
|
443
|
-
|
|
445
|
+
removeDecoration(t) {
|
|
446
|
+
const e = this.decorations.indexOf(t);
|
|
447
|
+
e >= 0 && this.decorations.splice(e, 1);
|
|
444
448
|
}
|
|
445
449
|
}
|
|
446
|
-
return
|
|
450
|
+
return A = g, A;
|
|
447
451
|
}
|
|
448
|
-
var
|
|
449
|
-
const
|
|
450
|
-
var
|
|
451
|
-
function
|
|
452
|
-
if (
|
|
453
|
-
|
|
454
|
-
function
|
|
455
|
-
if (!
|
|
456
|
-
if (!/\r/.test(
|
|
457
|
-
for (
|
|
458
|
-
`); /\r./.test(
|
|
459
|
-
|
|
460
|
-
return
|
|
452
|
+
var ve = Se();
|
|
453
|
+
const Ce = /* @__PURE__ */ we(ve);
|
|
454
|
+
var x = { exports: {} }, M;
|
|
455
|
+
function Te() {
|
|
456
|
+
if (M) return x.exports;
|
|
457
|
+
M = 1;
|
|
458
|
+
function n(t) {
|
|
459
|
+
if (!t) return "";
|
|
460
|
+
if (!/\r/.test(t)) return t;
|
|
461
|
+
for (t = t.replace(/\r+\n/gm, `
|
|
462
|
+
`); /\r./.test(t); )
|
|
463
|
+
t = t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm, function(e, h, r) {
|
|
464
|
+
return r + h.slice(r.length);
|
|
461
465
|
});
|
|
462
|
-
return r;
|
|
463
|
-
}
|
|
464
|
-
function o(r) {
|
|
465
|
-
for (var t = 0, h = 0; h < r.length; h++)
|
|
466
|
-
r[t].length <= r[h].length && (t = h);
|
|
467
466
|
return t;
|
|
468
467
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
468
|
+
function c(t) {
|
|
469
|
+
for (var e = 0, h = 0; h < t.length; h++)
|
|
470
|
+
t[e].length <= t[h].length && (e = h);
|
|
471
|
+
return e;
|
|
472
|
+
}
|
|
473
|
+
function g(t) {
|
|
474
|
+
if (!/\r/.test(t)) return t;
|
|
475
|
+
for (var e = t.split("\r"), h = []; e.length > 0; ) {
|
|
476
|
+
var r = c(e);
|
|
477
|
+
h.push(e[r]), e = e.slice(r + 1);
|
|
474
478
|
}
|
|
475
479
|
return h.join("\r");
|
|
476
480
|
}
|
|
477
|
-
function
|
|
478
|
-
if (!
|
|
479
|
-
if (!/\r/.test(
|
|
480
|
-
if (!/\n/.test(
|
|
481
|
-
|
|
481
|
+
function y(t) {
|
|
482
|
+
if (!t) return "";
|
|
483
|
+
if (!/\r/.test(t)) return t;
|
|
484
|
+
if (!/\n/.test(t)) return g(t);
|
|
485
|
+
t = t.replace(/\r+\n/gm, `
|
|
482
486
|
`);
|
|
483
|
-
var
|
|
487
|
+
var e = t.lastIndexOf(`
|
|
484
488
|
`);
|
|
485
|
-
return
|
|
486
|
-
` + g(
|
|
489
|
+
return n(t.slice(0, e)) + `
|
|
490
|
+
` + g(t.slice(e + 1));
|
|
487
491
|
}
|
|
488
|
-
return
|
|
492
|
+
return x.exports = n, x.exports.escapeCarriageReturn = n, x.exports.escapeCarriageReturnSafe = y, x.exports;
|
|
489
493
|
}
|
|
490
|
-
var
|
|
491
|
-
function
|
|
492
|
-
return
|
|
494
|
+
var Oe = Te();
|
|
495
|
+
function xe(n, c) {
|
|
496
|
+
return n = Oe.escapeCarriageReturn(Ie(n)), Ce.ansiToJson(n, {
|
|
493
497
|
json: !0,
|
|
494
498
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
495
499
|
remove_empty: !0,
|
|
496
500
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
497
|
-
use_classes:
|
|
501
|
+
use_classes: c
|
|
498
502
|
});
|
|
499
503
|
}
|
|
500
|
-
function
|
|
501
|
-
const
|
|
502
|
-
return
|
|
504
|
+
function Ee(n) {
|
|
505
|
+
const c = [];
|
|
506
|
+
return n.bg && c.push(S[`${n.bg}-bg`]), n.fg && c.push(S[`${n.fg}-fg`]), n.decoration && c.push(S[`ansi-${n.decoration}`]), c.length === 0 ? null : c.join(" ");
|
|
503
507
|
}
|
|
504
|
-
function
|
|
505
|
-
const
|
|
506
|
-
switch (
|
|
508
|
+
function Le(n) {
|
|
509
|
+
const c = {};
|
|
510
|
+
switch (n.bg && (c.backgroundColor = `rgb(${n.bg})`), n.fg && (c.color = `rgb(${n.fg})`), n.decoration) {
|
|
507
511
|
case "bold":
|
|
508
|
-
|
|
512
|
+
c.fontWeight = "bold";
|
|
509
513
|
break;
|
|
510
514
|
case "dim":
|
|
511
|
-
|
|
515
|
+
c.opacity = "0.5";
|
|
512
516
|
break;
|
|
513
517
|
case "italic":
|
|
514
|
-
|
|
518
|
+
c.fontStyle = "italic";
|
|
515
519
|
break;
|
|
516
520
|
case "hidden":
|
|
517
|
-
|
|
521
|
+
c.visibility = "hidden";
|
|
518
522
|
break;
|
|
519
523
|
case "strikethrough":
|
|
520
|
-
|
|
524
|
+
c.textDecoration = "line-through";
|
|
521
525
|
break;
|
|
522
526
|
case "underline":
|
|
523
|
-
|
|
527
|
+
c.textDecoration = "underline";
|
|
524
528
|
break;
|
|
525
529
|
case "blink":
|
|
526
|
-
|
|
530
|
+
c.textDecoration = "blink";
|
|
527
531
|
break;
|
|
528
532
|
}
|
|
529
|
-
return
|
|
533
|
+
return c;
|
|
530
534
|
}
|
|
531
|
-
function
|
|
532
|
-
const
|
|
533
|
-
if (!
|
|
534
|
-
return
|
|
535
|
+
function Re(n, c, g, y) {
|
|
536
|
+
const t = c ? null : Le(g), e = c ? Ee(g) : null;
|
|
537
|
+
if (!n)
|
|
538
|
+
return R.createElement(
|
|
535
539
|
"pre",
|
|
536
|
-
{ style:
|
|
540
|
+
{ style: t, key: y, className: e },
|
|
537
541
|
g.content
|
|
538
542
|
);
|
|
539
|
-
const h = [],
|
|
543
|
+
const h = [], r = /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;
|
|
540
544
|
let l = 0, a;
|
|
541
|
-
for (; (a =
|
|
542
|
-
const [,
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
+
for (; (a = r.exec(g.content)) !== null; ) {
|
|
546
|
+
const [, u, f] = a, s = a.index + u.length;
|
|
547
|
+
s > l && h.push(g.content.substring(l, s));
|
|
548
|
+
const v = f.startsWith("www.") ? `http://${f}` : f;
|
|
545
549
|
h.push(
|
|
546
|
-
|
|
550
|
+
R.createElement(
|
|
547
551
|
"a",
|
|
548
552
|
{
|
|
549
553
|
key: l,
|
|
550
|
-
href:
|
|
554
|
+
href: v,
|
|
551
555
|
target: "_blank"
|
|
552
556
|
},
|
|
553
|
-
`${
|
|
557
|
+
`${f}`
|
|
554
558
|
)
|
|
555
|
-
), l =
|
|
559
|
+
), l = r.lastIndex;
|
|
556
560
|
}
|
|
557
|
-
return l < g.content.length && h.push(g.content.substring(l)),
|
|
561
|
+
return l < g.content.length && h.push(g.content.substring(l)), R.createElement("span", { style: t, key: y, className: e }, h);
|
|
558
562
|
}
|
|
559
|
-
function
|
|
560
|
-
const { className:
|
|
561
|
-
return
|
|
563
|
+
function U(n) {
|
|
564
|
+
const { className: c, useClasses: g, children: y, linkify: t } = n;
|
|
565
|
+
return R.createElement(
|
|
562
566
|
"code",
|
|
563
|
-
{ className:
|
|
564
|
-
|
|
565
|
-
|
|
567
|
+
{ className: c },
|
|
568
|
+
xe(y ?? "", g ?? !1).map(
|
|
569
|
+
Re.bind(null, t ?? !1, g ?? !1)
|
|
566
570
|
)
|
|
567
571
|
);
|
|
568
572
|
}
|
|
569
|
-
function
|
|
570
|
-
let
|
|
573
|
+
function Ie(n) {
|
|
574
|
+
let c = n;
|
|
571
575
|
do
|
|
572
|
-
|
|
573
|
-
while (
|
|
574
|
-
return
|
|
576
|
+
n = c, c = n.replace(/[^\n]\x08/gm, "");
|
|
577
|
+
while (c.length < n.length);
|
|
578
|
+
return n;
|
|
575
579
|
}
|
|
576
|
-
const
|
|
577
|
-
const g =
|
|
580
|
+
const j = ne(ie(({ text: n }, c) => {
|
|
581
|
+
const g = n?.split(`
|
|
578
582
|
`);
|
|
579
|
-
return /* @__PURE__ */
|
|
580
|
-
(
|
|
583
|
+
return /* @__PURE__ */ w("div", { ref: c, children: g?.map(
|
|
584
|
+
(y, t) => /* @__PURE__ */ w(U, { className: S.Output, useClasses: !0, children: y === "" ? " " : y }, t)
|
|
581
585
|
) });
|
|
582
|
-
});
|
|
583
|
-
function
|
|
584
|
-
const [h,
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
}, [
|
|
586
|
+
}));
|
|
587
|
+
function De({ value: n, prefix: c, onChange: g, onKeyUp: y, onKeyDown: t, inputRef: e }) {
|
|
588
|
+
const [h, r] = $(0), l = I(null);
|
|
589
|
+
le(() => {
|
|
590
|
+
const u = e.current;
|
|
591
|
+
u && l.current !== null ? (u.setSelectionRange(l.current, l.current), r(l.current), l.current = null) : u && u.selectionStart !== null && r(u.selectionStart);
|
|
592
|
+
}, [n, e]);
|
|
589
593
|
const a = () => {
|
|
590
|
-
const
|
|
591
|
-
|
|
594
|
+
const u = e.current?.selectionStart;
|
|
595
|
+
u != null && r(u);
|
|
592
596
|
};
|
|
593
|
-
return /* @__PURE__ */
|
|
594
|
-
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ D("span", { className: S.Input, children: [
|
|
598
|
+
c && /* @__PURE__ */ w(U, { className: S.Prefix, useClasses: !0, children: c }),
|
|
599
|
+
/* @__PURE__ */ D("span", { className: S["Input-container"], style: { "--cursor-offset": h }, children: [
|
|
600
|
+
/* @__PURE__ */ w("span", { "aria-hidden": "true", children: n }),
|
|
601
|
+
/* @__PURE__ */ w(
|
|
598
602
|
"input",
|
|
599
603
|
{
|
|
600
604
|
id: "input",
|
|
601
|
-
value:
|
|
605
|
+
value: n,
|
|
602
606
|
"aria-label": "Command input",
|
|
603
|
-
onChange: (
|
|
604
|
-
l.current =
|
|
607
|
+
onChange: (u) => {
|
|
608
|
+
l.current = u.target.selectionStart, g(u);
|
|
605
609
|
},
|
|
606
|
-
ref:
|
|
607
|
-
onKeyUp:
|
|
608
|
-
onKeyDown: (
|
|
609
|
-
|
|
610
|
+
ref: e,
|
|
611
|
+
onKeyUp: y,
|
|
612
|
+
onKeyDown: (u) => {
|
|
613
|
+
t?.(u), a();
|
|
610
614
|
},
|
|
611
615
|
onClick: a,
|
|
612
616
|
onSelect: a,
|
|
@@ -618,130 +622,160 @@ function he({ value: s, prefix: o, onChange: g, onKeyUp: d, onKeyDown: r, inputR
|
|
|
618
622
|
] })
|
|
619
623
|
] });
|
|
620
624
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
+
var Pe = {
|
|
626
|
+
prefix: "fas",
|
|
627
|
+
iconName: "stop",
|
|
628
|
+
icon: [448, 512, [9209], "f04d", "M64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32z"]
|
|
629
|
+
};
|
|
630
|
+
function Ae({ app: n, path: c, input: g, setTitle: y, close: t, active: e, focus: h, autoSubmit: r }) {
|
|
631
|
+
const l = I(null), a = I(null), u = I(oe.ZERO), { charSize: f, containerSize: s, sentinel: v } = G({ containerRef: l }), [i, b] = $(0), [k, d] = $(!1), [m, o] = Q({
|
|
632
|
+
app: n,
|
|
633
|
+
path: c,
|
|
625
634
|
input: g,
|
|
626
|
-
exit:
|
|
627
|
-
sizeRef:
|
|
635
|
+
exit: t,
|
|
636
|
+
sizeRef: u
|
|
628
637
|
});
|
|
629
|
-
|
|
630
|
-
d
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}, [
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
638
|
+
O(() => {
|
|
639
|
+
r && g && o.prompt && !k && (d(!0), window.confirm(`Do you want to run the following command?
|
|
640
|
+
|
|
641
|
+
${g}`) && (m.run(g), b((p) => p + 1)));
|
|
642
|
+
}, [r, g, k, o.prompt, m]), O(() => {
|
|
643
|
+
y?.(ae.strip(o.prompt).trim());
|
|
644
|
+
}, [o.prompt, y]), O(() => {
|
|
645
|
+
e && (o.stream ? l.current?.focus() : a.current?.focus());
|
|
646
|
+
}, [e, o.stream]), O(() => {
|
|
647
|
+
if (a.current && !o.stream) {
|
|
648
|
+
const p = o.line.length;
|
|
649
|
+
a.current.setSelectionRange(p, p);
|
|
637
650
|
}
|
|
638
|
-
}, [
|
|
639
|
-
const
|
|
640
|
-
|
|
651
|
+
}, [o.historyOffset]);
|
|
652
|
+
const T = () => {
|
|
653
|
+
l.current && (l.current.scrollTop = l.current.scrollHeight);
|
|
641
654
|
};
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}, [
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if ((f.ctrlKey || f.metaKey) && _ === "c" && !f.shiftKey) {
|
|
659
|
-
f.preventDefault(), n.interrupt();
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
if (!u.stream)
|
|
663
|
-
if (_ === "Tab")
|
|
664
|
-
f.preventDefault(), n.autoComplete();
|
|
665
|
-
else if (_ === "Enter") {
|
|
666
|
-
const w = f.target.value;
|
|
667
|
-
n.run(w), p((S) => S + 1);
|
|
668
|
-
} else _ === "ArrowUp" ? (f.preventDefault(), n.historySearch(1)) : _ === "ArrowDown" && (f.preventDefault(), n.historySearch(-1));
|
|
669
|
-
}, y = (f) => {
|
|
670
|
-
n.setLine(f.target.value);
|
|
671
|
-
}, b = () => {
|
|
672
|
-
if (u.isUsingAltScreen)
|
|
673
|
-
return u.ttyBuffer ? /* @__PURE__ */ k(A, { text: u.ttyBuffer }) : null;
|
|
674
|
-
let f = 0;
|
|
675
|
-
for (let _ = u.history.length - 1; _ >= 0; _--)
|
|
676
|
-
if (u.history[_].clear) {
|
|
677
|
-
f = _ + 1;
|
|
655
|
+
O(() => {
|
|
656
|
+
T();
|
|
657
|
+
}, [o.history.length, o.line, o.ttyBuffer]), O(() => {
|
|
658
|
+
u.current.set(s.x, s.y);
|
|
659
|
+
}, [s]);
|
|
660
|
+
const K = (p) => {
|
|
661
|
+
m.handleKeyDown(p), p.key === "Enter" && !o.stream && b((_) => _ + 1);
|
|
662
|
+
}, F = (p) => {
|
|
663
|
+
m.setLine(p.target.value);
|
|
664
|
+
}, z = P(() => {
|
|
665
|
+
if (o.isUsingAltScreen)
|
|
666
|
+
return o.ttyBuffer ? /* @__PURE__ */ w(j, { text: o.ttyBuffer }) : null;
|
|
667
|
+
let p = 0;
|
|
668
|
+
for (let _ = o.history.length - 1; _ >= 0; _--)
|
|
669
|
+
if ((o.history[_].flags & X.Clear) !== 0) {
|
|
670
|
+
p = _ + 1;
|
|
678
671
|
break;
|
|
679
672
|
}
|
|
680
|
-
return
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
673
|
+
return o.history.slice(p).map(
|
|
674
|
+
(_, C) => /* @__PURE__ */ w(j, { text: _.displayText }, C)
|
|
675
|
+
);
|
|
676
|
+
}, [o.history, o.isUsingAltScreen, o.ttyBuffer]), J = (p) => {
|
|
677
|
+
h?.(p), p.button === 2 && (p.preventDefault(), navigator.clipboard.readText().then((_) => {
|
|
678
|
+
if (o.isRawMode) {
|
|
679
|
+
for (const E of _)
|
|
680
|
+
m.handleKeyDown({
|
|
681
|
+
key: E,
|
|
682
|
+
ctrlKey: p.ctrlKey,
|
|
683
|
+
metaKey: p.metaKey,
|
|
684
|
+
shiftKey: p.shiftKey,
|
|
685
|
+
preventDefault: p.preventDefault.bind(p)
|
|
686
|
+
});
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
const C = a.current;
|
|
690
|
+
if (!C)
|
|
691
|
+
return;
|
|
692
|
+
const N = C.selectionStart ?? o.line.length, Z = C.selectionEnd ?? o.line.length;
|
|
693
|
+
m.setLine((E) => E.substring(0, N) + _ + E.substring(Z));
|
|
694
|
+
const B = N + _.length;
|
|
693
695
|
setTimeout(() => {
|
|
694
|
-
|
|
696
|
+
C.focus(), C.setSelectionRange(B, B);
|
|
695
697
|
}, 0);
|
|
696
698
|
}).catch((_) => {
|
|
697
699
|
console.error(_);
|
|
698
700
|
}));
|
|
699
|
-
},
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
-
|
|
701
|
+
}, q = (p) => {
|
|
702
|
+
p.preventDefault();
|
|
703
|
+
}, V = P(() => f.x === 0 || f.y === 0 ? {} : {
|
|
704
|
+
"--char-width": `${f.x}px`,
|
|
705
|
+
"--char-height": `${f.y}px`
|
|
706
|
+
}, [f]), W = P(() => !o.isRawMode || f.x === 0 || f.y === 0 ? {} : {
|
|
707
|
+
left: o.cursorPosition.x * f.x,
|
|
708
|
+
top: o.cursorPosition.y * f.y
|
|
709
|
+
}, [o.cursorPosition, o.isRawMode, f]);
|
|
710
|
+
return /* @__PURE__ */ D(
|
|
703
711
|
"div",
|
|
704
712
|
{
|
|
705
|
-
ref:
|
|
713
|
+
ref: l,
|
|
706
714
|
tabIndex: 0,
|
|
707
|
-
className:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
715
|
+
className: S.Terminal,
|
|
716
|
+
style: V,
|
|
717
|
+
onKeyDown: K,
|
|
718
|
+
onMouseDown: J,
|
|
719
|
+
onContextMenu: q,
|
|
720
|
+
onClick: (p) => {
|
|
721
|
+
window.getSelection()?.toString().length || (p.preventDefault(), o.stream ? l.current?.focus() : a.current?.focus());
|
|
713
722
|
},
|
|
714
723
|
children: [
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
724
|
+
v,
|
|
725
|
+
/* @__PURE__ */ D("div", { className: S.History, children: [
|
|
726
|
+
z,
|
|
727
|
+
o.isRawMode && /* @__PURE__ */ w("div", { className: S.VirtualCursor, style: W })
|
|
728
|
+
] }),
|
|
729
|
+
!o.isUsingAltScreen && !o.stream && /* @__PURE__ */ w(
|
|
730
|
+
De,
|
|
718
731
|
{
|
|
719
|
-
value:
|
|
720
|
-
prefix:
|
|
721
|
-
onChange:
|
|
722
|
-
inputRef:
|
|
732
|
+
value: o.line,
|
|
733
|
+
prefix: (o.ttyBuffer ?? "") + o.prompt,
|
|
734
|
+
onChange: F,
|
|
735
|
+
inputRef: a
|
|
723
736
|
},
|
|
724
|
-
|
|
725
|
-
)
|
|
737
|
+
i
|
|
738
|
+
),
|
|
739
|
+
!o.isUsingAltScreen && o.stream && o.ttyBuffer && /* @__PURE__ */ w(j, { text: o.ttyBuffer }),
|
|
740
|
+
o.stream && /* @__PURE__ */ w(
|
|
741
|
+
Y,
|
|
742
|
+
{
|
|
743
|
+
className: `${S.InterruptButton} ${ee.TextBold}`,
|
|
744
|
+
onClick: () => m.interrupt(),
|
|
745
|
+
title: "Interrupt (Ctrl+C)",
|
|
746
|
+
icon: Pe,
|
|
747
|
+
children: "Stop"
|
|
748
|
+
}
|
|
749
|
+
)
|
|
726
750
|
]
|
|
727
751
|
}
|
|
728
752
|
);
|
|
729
753
|
}
|
|
730
|
-
class
|
|
754
|
+
class je extends te {
|
|
731
755
|
constructor() {
|
|
732
|
-
super("Terminal", "terminal",
|
|
756
|
+
super("Terminal", "terminal", Ae), this.setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg"), this.setRole(re.APP_ROLES.terminal), this.setCategory("Utilities & tools"), this.addSkinOverride(ce, {
|
|
757
|
+
name: "Terminal",
|
|
758
|
+
iconUrl: L.assetUrl("/assets/skins/mac/apps/icons/terminal.svg")
|
|
759
|
+
}), this.addSkinOverride(ue, {
|
|
760
|
+
name: "MS-DOS Prompt",
|
|
761
|
+
iconUrl: L.assetUrl("/assets/skins/windows95/apps/icons/terminal.svg")
|
|
762
|
+
}), this.addSkinOverride(fe, {
|
|
763
|
+
iconUrl: L.assetUrl("/assets/skins/minimal/apps/icons/terminal.svg")
|
|
764
|
+
}), this.addSkinOverride(ge, {
|
|
765
|
+
iconUrl: L.assetUrl("/assets/skins/pixel/apps/icons/terminal.png")
|
|
766
|
+
});
|
|
733
767
|
}
|
|
734
|
-
addCommands(
|
|
735
|
-
return
|
|
768
|
+
addCommands(c) {
|
|
769
|
+
return c.forEach((g) => this.addCommand(g)), this;
|
|
736
770
|
}
|
|
737
|
-
addCommand(
|
|
738
|
-
return
|
|
771
|
+
addCommand(c) {
|
|
772
|
+
return se.builtins.push(c), this;
|
|
739
773
|
}
|
|
740
774
|
}
|
|
741
|
-
const
|
|
742
|
-
|
|
775
|
+
const $e = new je();
|
|
776
|
+
$e.setMetadata({ name: "@prozilla-os/terminal", version: "2.0.5", author: "Prozilla", website: "https://os.prozilla.dev/terminal" });
|
|
743
777
|
export {
|
|
744
|
-
|
|
745
|
-
|
|
778
|
+
je as TerminalApp,
|
|
779
|
+
$e as terminal
|
|
746
780
|
};
|
|
747
781
|
//# sourceMappingURL=main.js.map
|