@prozilla-os/terminal 2.0.5 → 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/dist/main.js CHANGED
@@ -1,20 +1,20 @@
1
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 Z, useShell as G, HistoryFlags as Q, Button as X, utilStyles as Y, App as ee, AppsConfig as te, ExecutableResolver as re } from "@prozilla-os/core";
3
- import { jsx as k, jsxs as I } from "react/jsx-runtime";
4
- import * as L from "react";
5
- import { memo as se, forwardRef as ne, useState as j, useRef as O, useLayoutEffect as ie, useEffect as E, useMemo as D } from "react";
6
- import { Vector2 as le, Ansi as oe } from "@prozilla-os/shared";
7
- import { faStop as ae } from "@fortawesome/free-solid-svg-icons";
8
- const ce = "_Terminal_1y9ey_1", ue = "_VirtualCursor_1y9ey_29", fe = "_blink_1y9ey_1", ge = "_History_1y9ey_44", he = "_Prefix_1y9ey_48", pe = "_Input_1y9ey_54", ye = "_Output_1y9ey_54", _e = "_InterruptButton_1y9ey_120", C = {
9
- Terminal: ce,
10
- VirtualCursor: ue,
11
- blink: fe,
12
- History: ge,
13
- Prefix: he,
14
- Input: pe,
15
- Output: ye,
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
16
  "Input-container": "_Input-container_1y9ey_69",
17
- InterruptButton: _e,
17
+ InterruptButton: ke,
18
18
  "ansi-black-fg": "_ansi-black-fg_1y9ey_148",
19
19
  "ansi-red-fg": "_ansi-red-fg_1y9ey_149",
20
20
  "ansi-green-fg": "_ansi-green-fg_1y9ey_150",
@@ -41,13 +41,13 @@ const ce = "_Terminal_1y9ey_1", ue = "_VirtualCursor_1y9ey_29", fe = "_blink_1y9
41
41
  "ansi-white-bg": "_ansi-white-bg_1y9ey_173",
42
42
  "ansi-dim": "_ansi-dim_1y9ey_175"
43
43
  };
44
- function de(n) {
44
+ function we(n) {
45
45
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
46
46
  }
47
- var P, N;
48
- function me() {
49
- if (N) return P;
50
- N = 1;
47
+ var A, H;
48
+ function Se() {
49
+ if (H) return A;
50
+ H = 1;
51
51
  const n = [
52
52
  [
53
53
  { color: "0, 0, 0", class: "ansi-black" },
@@ -373,20 +373,20 @@ function me() {
373
373
  else if (i === 38 || i === 48) {
374
374
  let b = i === 38;
375
375
  if (f.length >= 1) {
376
- let w = f.shift();
377
- if (w === "5" && f.length >= 1) {
378
- let _ = parseInt(f.shift());
379
- if (_ >= 0 && _ <= 255)
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
380
  if (!r)
381
- this.PALETTE_COLORS || s.setupPalette(), b ? s.fg = this.PALETTE_COLORS[_] : s.bg = this.PALETTE_COLORS[_];
381
+ this.PALETTE_COLORS || s.setupPalette(), b ? s.fg = this.PALETTE_COLORS[d] : s.bg = this.PALETTE_COLORS[d];
382
382
  else {
383
- let d = _ >= 16 ? "ansi-palette-" + _ : n[_ > 7 ? 1 : 0][_ % 8].class;
384
- b ? s.fg = d : s.bg = d;
383
+ let m = d >= 16 ? "ansi-palette-" + d : n[d > 7 ? 1 : 0][d % 8].class;
384
+ b ? s.fg = m : s.bg = m;
385
385
  }
386
- } else if (w === "2" && f.length >= 3) {
387
- let _ = parseInt(f.shift()), d = parseInt(f.shift()), o = parseInt(f.shift());
388
- if (_ >= 0 && _ <= 255 && d >= 0 && d <= 255 && o >= 0 && o <= 255) {
389
- let T = _ + ", " + d + ", " + o;
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
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;
391
391
  }
392
392
  }
@@ -418,8 +418,8 @@ function me() {
418
418
  r.fg || (r.fg = n[0][7][l ? "class" : "color"]), r.bg || (r.bg = n[0][0][l ? "class" : "color"]);
419
419
  let b = r.fg;
420
420
  r.fg = r.bg, r.bg = b;
421
- let w = r.fg_truecolor;
422
- return r.fg_truecolor = r.bg_truecolor, r.bg_truecolor = w, r.isInverted = !0, !1;
421
+ let k = r.fg_truecolor;
422
+ return r.fg_truecolor = r.bg_truecolor, r.bg_truecolor = k, r.isInverted = !0, !1;
423
423
  }
424
424
  return !0;
425
425
  }), e.json)
@@ -429,9 +429,9 @@ function me() {
429
429
  if (!r.was_processed)
430
430
  return r.content;
431
431
  let a = [], u = [], f = [], s = {}, v = (i) => {
432
- let b = [], w;
433
- for (w in i)
434
- i.hasOwnProperty(w) && b.push("data-" + w + '="' + this.escapeForHtml(i[w]) + '"');
432
+ let b = [], k;
433
+ for (k in i)
434
+ i.hasOwnProperty(k) && b.push("data-" + k + '="' + this.escapeForHtml(i[k]) + '"');
435
435
  return b.length > 0 ? " " + b.join(" ") : "";
436
436
  };
437
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) => {
@@ -447,14 +447,14 @@ function me() {
447
447
  e >= 0 && this.decorations.splice(e, 1);
448
448
  }
449
449
  }
450
- return P = g, P;
450
+ return A = g, A;
451
451
  }
452
- var be = me();
453
- const we = /* @__PURE__ */ de(be);
454
- var x = { exports: {} }, H;
455
- function ke() {
456
- if (H) return x.exports;
457
- H = 1;
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
458
  function n(t) {
459
459
  if (!t) return "";
460
460
  if (!/\r/.test(t)) return t;
@@ -491,9 +491,9 @@ function ke() {
491
491
  }
492
492
  return x.exports = n, x.exports.escapeCarriageReturn = n, x.exports.escapeCarriageReturnSafe = y, x.exports;
493
493
  }
494
- var Ce = ke();
495
- function ve(n, c) {
496
- return n = Ce.escapeCarriageReturn(xe(n)), we.ansiToJson(n, {
494
+ var Oe = Te();
495
+ function xe(n, c) {
496
+ return n = Oe.escapeCarriageReturn(Ie(n)), Ce.ansiToJson(n, {
497
497
  json: !0,
498
498
  // eslint-disable-next-line @typescript-eslint/naming-convention
499
499
  remove_empty: !0,
@@ -501,11 +501,11 @@ function ve(n, c) {
501
501
  use_classes: c
502
502
  });
503
503
  }
504
- function Se(n) {
504
+ function Ee(n) {
505
505
  const c = [];
506
- return n.bg && c.push(C[`${n.bg}-bg`]), n.fg && c.push(C[`${n.fg}-fg`]), n.decoration && c.push(C[`ansi-${n.decoration}`]), c.length === 0 ? null : c.join(" ");
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(" ");
507
507
  }
508
- function Te(n) {
508
+ function Le(n) {
509
509
  const c = {};
510
510
  switch (n.bg && (c.backgroundColor = `rgb(${n.bg})`), n.fg && (c.color = `rgb(${n.fg})`), n.decoration) {
511
511
  case "bold":
@@ -532,10 +532,10 @@ function Te(n) {
532
532
  }
533
533
  return c;
534
534
  }
535
- function Ee(n, c, g, y) {
536
- const t = c ? null : Te(g), e = c ? Se(g) : null;
535
+ function Re(n, c, g, y) {
536
+ const t = c ? null : Le(g), e = c ? Ee(g) : null;
537
537
  if (!n)
538
- return L.createElement(
538
+ return R.createElement(
539
539
  "pre",
540
540
  { style: t, key: y, className: e },
541
541
  g.content
@@ -547,7 +547,7 @@ function Ee(n, c, g, y) {
547
547
  s > l && h.push(g.content.substring(l, s));
548
548
  const v = f.startsWith("www.") ? `http://${f}` : f;
549
549
  h.push(
550
- L.createElement(
550
+ R.createElement(
551
551
  "a",
552
552
  {
553
553
  key: l,
@@ -558,35 +558,35 @@ function Ee(n, c, g, y) {
558
558
  )
559
559
  ), l = r.lastIndex;
560
560
  }
561
- return l < g.content.length && h.push(g.content.substring(l)), L.createElement("span", { style: t, key: y, className: e }, h);
561
+ return l < g.content.length && h.push(g.content.substring(l)), R.createElement("span", { style: t, key: y, className: e }, h);
562
562
  }
563
- function K(n) {
563
+ function U(n) {
564
564
  const { className: c, useClasses: g, children: y, linkify: t } = n;
565
- return L.createElement(
565
+ return R.createElement(
566
566
  "code",
567
567
  { className: c },
568
- ve(y ?? "", g ?? !1).map(
569
- Ee.bind(null, t ?? !1, g ?? !1)
568
+ xe(y ?? "", g ?? !1).map(
569
+ Re.bind(null, t ?? !1, g ?? !1)
570
570
  )
571
571
  );
572
572
  }
573
- function xe(n) {
573
+ function Ie(n) {
574
574
  let c = n;
575
575
  do
576
576
  n = c, c = n.replace(/[^\n]\x08/gm, "");
577
577
  while (c.length < n.length);
578
578
  return n;
579
579
  }
580
- const A = se(ne(({ text: n }, c) => {
580
+ const j = ne(ie(({ text: n }, c) => {
581
581
  const g = n?.split(`
582
582
  `);
583
- return /* @__PURE__ */ k("div", { ref: c, children: g?.map(
584
- (y, t) => /* @__PURE__ */ k(K, { className: C.Output, useClasses: !0, children: y === "" ? " " : y }, t)
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)
585
585
  ) });
586
586
  }));
587
- function Re({ value: n, prefix: c, onChange: g, onKeyUp: y, onKeyDown: t, inputRef: e }) {
588
- const [h, r] = j(0), l = O(null);
589
- ie(() => {
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
590
  const u = e.current;
591
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
592
  }, [n, e]);
@@ -594,11 +594,11 @@ function Re({ value: n, prefix: c, onChange: g, onKeyUp: y, onKeyDown: t, inputR
594
594
  const u = e.current?.selectionStart;
595
595
  u != null && r(u);
596
596
  };
597
- return /* @__PURE__ */ I("span", { className: C.Input, children: [
598
- c && /* @__PURE__ */ k(K, { className: C.Prefix, useClasses: !0, children: c }),
599
- /* @__PURE__ */ I("span", { className: C["Input-container"], style: { "--cursor-offset": h }, children: [
600
- /* @__PURE__ */ k("span", { "aria-hidden": "true", children: n }),
601
- /* @__PURE__ */ k(
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(
602
602
  "input",
603
603
  {
604
604
  id: "input",
@@ -622,23 +622,28 @@ function Re({ value: n, prefix: c, onChange: g, onKeyUp: y, onKeyDown: t, inputR
622
622
  ] })
623
623
  ] });
624
624
  }
625
- function Le({ app: n, path: c, input: g, setTitle: y, close: t, active: e, focus: h, autoSubmit: r }) {
626
- const l = O(null), a = O(null), u = O(le.ZERO), { charSize: f, containerSize: s, sentinel: v } = Z({ containerRef: l }), [i, b] = j(0), [w, _] = j(!1), [d, o] = G({
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({
627
632
  app: n,
628
633
  path: c,
629
634
  input: g,
630
635
  exit: t,
631
636
  sizeRef: u
632
637
  });
633
- E(() => {
634
- r && g && o.prompt && !w && (_(!0), window.confirm(`Do you want to run the following command?
638
+ O(() => {
639
+ r && g && o.prompt && !k && (d(!0), window.confirm(`Do you want to run the following command?
635
640
 
636
- ${g}`) && (d.run(g), b((p) => p + 1)));
637
- }, [r, g, w, o.prompt, d]), E(() => {
638
- y?.(oe.strip(o.prompt).trim());
639
- }, [o.prompt, y]), E(() => {
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(() => {
640
645
  e && (o.stream ? l.current?.focus() : a.current?.focus());
641
- }, [e, o.stream]), E(() => {
646
+ }, [e, o.stream]), O(() => {
642
647
  if (a.current && !o.stream) {
643
648
  const p = o.line.length;
644
649
  a.current.setSelectionRange(p, p);
@@ -647,33 +652,33 @@ ${g}`) && (d.run(g), b((p) => p + 1)));
647
652
  const T = () => {
648
653
  l.current && (l.current.scrollTop = l.current.scrollHeight);
649
654
  };
650
- E(() => {
655
+ O(() => {
651
656
  T();
652
- }, [o.history.length, o.line, o.ttyBuffer]), E(() => {
657
+ }, [o.history.length, o.line, o.ttyBuffer]), O(() => {
653
658
  u.current.set(s.x, s.y);
654
659
  }, [s]);
655
- const F = (p) => {
656
- d.handleKeyDown(p), p.key === "Enter" && !o.stream && b((m) => m + 1);
657
- }, M = (p) => {
658
- d.setLine(p.target.value);
659
- }, z = D(() => {
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(() => {
660
665
  if (o.isUsingAltScreen)
661
- return o.ttyBuffer ? /* @__PURE__ */ k(A, { text: o.ttyBuffer }) : null;
666
+ return o.ttyBuffer ? /* @__PURE__ */ w(j, { text: o.ttyBuffer }) : null;
662
667
  let p = 0;
663
- for (let m = o.history.length - 1; m >= 0; m--)
664
- if ((o.history[m].flags & Q.Clear) !== 0) {
665
- p = m + 1;
668
+ for (let _ = o.history.length - 1; _ >= 0; _--)
669
+ if ((o.history[_].flags & X.Clear) !== 0) {
670
+ p = _ + 1;
666
671
  break;
667
672
  }
668
673
  return o.history.slice(p).map(
669
- (m, S) => /* @__PURE__ */ k(A, { text: m.displayText }, S)
674
+ (_, C) => /* @__PURE__ */ w(j, { text: _.displayText }, C)
670
675
  );
671
676
  }, [o.history, o.isUsingAltScreen, o.ttyBuffer]), J = (p) => {
672
- h?.(p), p.button === 2 && (p.preventDefault(), navigator.clipboard.readText().then((m) => {
677
+ h?.(p), p.button === 2 && (p.preventDefault(), navigator.clipboard.readText().then((_) => {
673
678
  if (o.isRawMode) {
674
- for (const R of m)
675
- d.handleKeyDown({
676
- key: R,
679
+ for (const E of _)
680
+ m.handleKeyDown({
681
+ key: E,
677
682
  ctrlKey: p.ctrlKey,
678
683
  metaKey: p.metaKey,
679
684
  shiftKey: p.shiftKey,
@@ -681,64 +686,64 @@ ${g}`) && (d.run(g), b((p) => p + 1)));
681
686
  });
682
687
  return;
683
688
  }
684
- const S = a.current;
685
- if (!S)
689
+ const C = a.current;
690
+ if (!C)
686
691
  return;
687
- const $ = S.selectionStart ?? o.line.length, W = S.selectionEnd ?? o.line.length;
688
- d.setLine((R) => R.substring(0, $) + m + R.substring(W));
689
- const B = $ + m.length;
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;
690
695
  setTimeout(() => {
691
- S.focus(), S.setSelectionRange(B, B);
696
+ C.focus(), C.setSelectionRange(B, B);
692
697
  }, 0);
693
- }).catch((m) => {
694
- console.error(m);
698
+ }).catch((_) => {
699
+ console.error(_);
695
700
  }));
696
- }, U = (p) => {
701
+ }, q = (p) => {
697
702
  p.preventDefault();
698
- }, q = D(() => f.x === 0 || f.y === 0 ? {} : {
703
+ }, V = P(() => f.x === 0 || f.y === 0 ? {} : {
699
704
  "--char-width": `${f.x}px`,
700
705
  "--char-height": `${f.y}px`
701
- }, [f]), V = D(() => !o.isRawMode || f.x === 0 || f.y === 0 ? {} : {
706
+ }, [f]), W = P(() => !o.isRawMode || f.x === 0 || f.y === 0 ? {} : {
702
707
  left: o.cursorPosition.x * f.x,
703
708
  top: o.cursorPosition.y * f.y
704
709
  }, [o.cursorPosition, o.isRawMode, f]);
705
- return /* @__PURE__ */ I(
710
+ return /* @__PURE__ */ D(
706
711
  "div",
707
712
  {
708
713
  ref: l,
709
714
  tabIndex: 0,
710
- className: C.Terminal,
711
- style: q,
712
- onKeyDown: F,
715
+ className: S.Terminal,
716
+ style: V,
717
+ onKeyDown: K,
713
718
  onMouseDown: J,
714
- onContextMenu: U,
719
+ onContextMenu: q,
715
720
  onClick: (p) => {
716
721
  window.getSelection()?.toString().length || (p.preventDefault(), o.stream ? l.current?.focus() : a.current?.focus());
717
722
  },
718
723
  children: [
719
724
  v,
720
- /* @__PURE__ */ I("div", { className: C.History, children: [
725
+ /* @__PURE__ */ D("div", { className: S.History, children: [
721
726
  z,
722
- o.isRawMode && /* @__PURE__ */ k("div", { className: C.VirtualCursor, style: V })
727
+ o.isRawMode && /* @__PURE__ */ w("div", { className: S.VirtualCursor, style: W })
723
728
  ] }),
724
- !o.isUsingAltScreen && !o.stream && /* @__PURE__ */ k(
725
- Re,
729
+ !o.isUsingAltScreen && !o.stream && /* @__PURE__ */ w(
730
+ De,
726
731
  {
727
732
  value: o.line,
728
733
  prefix: (o.ttyBuffer ?? "") + o.prompt,
729
- onChange: M,
734
+ onChange: F,
730
735
  inputRef: a
731
736
  },
732
737
  i
733
738
  ),
734
- !o.isUsingAltScreen && o.stream && o.ttyBuffer && /* @__PURE__ */ k(A, { text: o.ttyBuffer }),
735
- o.stream && /* @__PURE__ */ k(
736
- X,
739
+ !o.isUsingAltScreen && o.stream && o.ttyBuffer && /* @__PURE__ */ w(j, { text: o.ttyBuffer }),
740
+ o.stream && /* @__PURE__ */ w(
741
+ Y,
737
742
  {
738
- className: `${C.InterruptButton} ${Y.TextBold}`,
739
- onClick: () => d.interrupt(),
743
+ className: `${S.InterruptButton} ${ee.TextBold}`,
744
+ onClick: () => m.interrupt(),
740
745
  title: "Interrupt (Ctrl+C)",
741
- icon: ae,
746
+ icon: Pe,
742
747
  children: "Stop"
743
748
  }
744
749
  )
@@ -746,21 +751,31 @@ ${g}`) && (d.run(g), b((p) => p + 1)));
746
751
  }
747
752
  );
748
753
  }
749
- class Oe extends ee {
754
+ class je extends te {
750
755
  constructor() {
751
- super("Terminal", "terminal", Le), this.setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg"), this.setRole(te.APP_ROLES.terminal), this.setCategory("Utilities & tools");
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
+ });
752
767
  }
753
768
  addCommands(c) {
754
769
  return c.forEach((g) => this.addCommand(g)), this;
755
770
  }
756
771
  addCommand(c) {
757
- return re.builtins.push(c), this;
772
+ return se.builtins.push(c), this;
758
773
  }
759
774
  }
760
- const Ie = new Oe();
761
- Ie.setMetadata({ name: "@prozilla-os/terminal", version: "2.0.1", author: "Prozilla", website: "https://os.prozilla.dev/terminal" });
775
+ const $e = new je();
776
+ $e.setMetadata({ name: "@prozilla-os/terminal", version: "2.0.5", author: "Prozilla", website: "https://os.prozilla.dev/terminal" });
762
777
  export {
763
- Oe as TerminalApp,
764
- Ie as terminal
778
+ je as TerminalApp,
779
+ $e as terminal
765
780
  };
766
781
  //# sourceMappingURL=main.js.map