()
| 100 | this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._terminal.scrollLines(0 === t3 ? -1 : 1), this._rowElements[0 === t3 ? 1 : this._rowElements.length - 2].focus(), e3.preventDefault(), e3.stopImmediatePropagation(); |
| 101 | } |
| 102 | _handleSelectionChange() { |
| 103 | var _a; |
| 104 | if (0 === this._rowElements.length) return; |
| 105 | const e3 = document.getSelection(); |
| 106 | if (!e3) return; |
| 107 | if (e3.isCollapsed) return void (this._rowContainer.contains(e3.anchorNode) && this._terminal.clearSelection()); |
| 108 | if (!e3.anchorNode || !e3.focusNode) return void console.error("anchorNode and/or focusNode are null"); |
| 109 | let t3 = { node: e3.anchorNode, offset: e3.anchorOffset }, i3 = { node: e3.focusNode, offset: e3.focusOffset }; |
| 110 | if ((t3.node.compareDocumentPosition(i3.node) & Node.DOCUMENT_POSITION_PRECEDING || t3.node === i3.node && t3.offset > i3.offset) && ([t3, i3] = [i3, t3]), t3.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING) && (t3 = { node: this._rowElements[0].childNodes[0], offset: 0 }), !this._rowContainer.contains(t3.node)) return; |
| 111 | const s3 = this._rowElements.slice(-1)[0]; |
| 112 | if (i3.node.compareDocumentPosition(s3) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING) && (i3 = { node: s3, offset: ((_a = s3.textContent) == null ? void 0 : _a.length) ?? 0 }), !this._rowContainer.contains(i3.node)) return; |
| 113 | const r2 = ({ node: e4, offset: t4 }) => { |
| 114 | const i4 = e4 instanceof Text ? e4.parentNode : e4; |
| 115 | let s4 = parseInt(i4 == null ? void 0 : i4.getAttribute("aria-posinset"), 10) - 1; |
| 116 | if (isNaN(s4)) return console.warn("row is invalid. Race condition?"), null; |
| 117 | const r3 = this._rowColumns.get(i4); |
| 118 | if (!r3) return console.warn("columns is null. Race condition?"), null; |
| 119 | let n3 = t4 < r3.length ? r3[t4] : r3.slice(-1)[0] + 1; |
| 120 | return n3 >= this._terminal.cols && (++s4, n3 = 0), { row: s4, column: n3 }; |
| 121 | }, n2 = r2(t3), o2 = r2(i3); |
| 122 | if (n2 && o2) { |
| 123 | if (n2.row > o2.row || n2.row === o2.row && n2.column >= o2.column) throw new Error("invalid range"); |
| 124 | this._terminal.select(n2.column, n2.row, (o2.row - n2.row) * this._terminal.cols - n2.column + o2.column); |
| 125 | } |
| 126 | } |
| 127 | _handleResize(e3) { |
| 128 | this._rowElements[this._rowElements.length - 1].removeEventListener("focus", this._bottomBoundaryFocusListener); |
| 129 | for (let e4 = this._rowContainer.children.length; e4 < this._terminal.rows; e4++) this._rowElements[e4] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[e4]); |
no test coverage detected