brsh 3.1.2 → 3.1.4

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.
@@ -1038,7 +1038,7 @@ var E = e?.default ?? e, D = class {
1038
1038
  ].includes(r)) throw Error("cursor value must be one of: 'none', 'block', 'blink'");
1039
1039
  if (!["none", "type"].includes(a)) throw Error("outputAnimation value must be one of: 'none', 'type'");
1040
1040
  if (!Number.isInteger(o) || o < 1 || o > 20) throw Error("animateSpeed value must be between 1 and 20");
1041
- if (this._exitFn = s, this._cursor = r, this._outputAnimation = a, this._animateSpeed = o, this._lineWrap = l, this._el = t, this._dataListeners = [], this._resizeListeners = [], this._titleListeners = [], this._mouseButtonDown = null, this._typeQueue = "", this._typeTimer = null, this._isHandlingInput = !1, this._suppressAnimationUntil = 0, this.screen = new i(d, p, { maxScrollback: h }), this.parser = new m(this.screen, {
1041
+ if (this._exitFn = s, this._cursor = r, this._outputAnimation = a, this._animateSpeed = o, this._lineWrap = l, this._el = t, this._dataListeners = [], this._resizeListeners = [], this._titleListeners = [], this._mouseButtonDown = null, this._mobileInputElement = null, this._onMobileInputClick = null, this._typeQueue = "", this._typeTimer = null, this._isHandlingInput = !1, this._suppressAnimationUntil = 0, this.screen = new i(d, p, { maxScrollback: h }), this.parser = new m(this.screen, {
1042
1042
  urlWhitelist: f,
1043
1043
  onResponse: (e) => this._emitInput(e),
1044
1044
  onTitle: (e) => {
@@ -1393,9 +1393,9 @@ var E = e?.default ?? e, D = class {
1393
1393
  _mobileInput() {
1394
1394
  if (typeof document > "u" || !this._el) return;
1395
1395
  let e = document.createElement("input");
1396
- e.type = "text", e.style.position = "absolute", e.style.left = "-9999999px", this._el.appendChild(e), this._mobileInputBuffer = "", this._el.addEventListener("click", () => {
1397
- typeof e.focus == "function" && e.focus();
1398
- }), e.addEventListener("keypress", (t) => {
1396
+ e.type = "text", e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.width = "0", e.style.height = "0", e.style.opacity = "0", e.style.pointerEvents = "none", e.style.zIndex = "-1", e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", "-1"), this._el.appendChild(e), this._mobileInputElement = e, this._mobileInputBuffer = "", this._onMobileInputClick = (t) => {
1397
+ t && t.target && t.target.tagName === "A" || typeof e.focus == "function" && e.focus({ preventScroll: !0 });
1398
+ }, this._el.addEventListener("click", this._onMobileInputClick), e.addEventListener("keypress", (t) => {
1399
1399
  t.key === "Enter" && (e.value = "", this._mobileInputBuffer = e.value);
1400
1400
  }), e.addEventListener("keyup", (t) => {
1401
1401
  if (t.key === "Unidentified") {
@@ -1419,7 +1419,7 @@ var E = e?.default ?? e, D = class {
1419
1419
  (n !== this._lastCols || r !== this._lastRows) && this.resize(n, r);
1420
1420
  }
1421
1421
  destroy() {
1422
- this._typeTimer !== null && (clearInterval(this._typeTimer), this._typeTimer = null), typeof window < "u" && window.removeEventListener && (this._onKeyDown && window.removeEventListener("keydown", this._onKeyDown), this._onPaste && window.removeEventListener("paste", this._onPaste)), this._dataListeners = [], this._resizeListeners = [], this._titleListeners = [];
1422
+ this._typeTimer !== null && (clearInterval(this._typeTimer), this._typeTimer = null), typeof window < "u" && window.removeEventListener && (this._onKeyDown && window.removeEventListener("keydown", this._onKeyDown), this._onPaste && window.removeEventListener("paste", this._onPaste)), this._mobileInputElement &&= (this._onMobileInputClick && this._el && typeof this._el.removeEventListener == "function" && this._el.removeEventListener("click", this._onMobileInputClick), this._mobileInputElement.parentNode ? this._mobileInputElement.parentNode.removeChild(this._mobileInputElement) : typeof this._mobileInputElement.remove == "function" && this._mobileInputElement.remove(), null), this._dataListeners = [], this._resizeListeners = [], this._titleListeners = [];
1423
1423
  }
1424
1424
  };
1425
1425
  O.Terminal = O, O.spawnPty = T, typeof globalThis < "u" && (globalThis.Terminal = O);