This commit is contained in:
1 parent
b9655a5ab1
commit
e292824161
122 files changed
+90002
-69
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import{r as fe,j as Re}from"./react-vendor-jWT2yUdV.js";import{a as Fe,c as We}from"./index-DiaaLdUu.js";var be={exports:{}},Me;function $e(){return Me||(Me=1,(function(de,ve){(function(ae,J){de.exports=J()})(self,(()=>(()=>{var ae={903:(B,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseRenderLayer=void 0;const d=a(274),_=a(627),n=a(237),c=a(860),f=a(374),m=a(296),o=a(345),e=a(859),r=a(399),t=a(855);class i extends e.Disposable{get canvas(){return this._canvas}get cacheCanvas(){var l;return(l=this._charAtlas)==null?void 0:l.pages[0].canvas}constructor(l,g,u,p,C,b,y,w,k,D){super(),this._terminal=l,this._container=g,this._alpha=C,this._themeService=b,this._bufferService=y,this._optionsService=w,this._decorationService=k,this._coreBrowserService=D,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._selectionModel=(0,m.createSelectionRenderModel)(),this._bitmapGenerator=[],this._charAtlasDisposable=this.register(new e.MutableDisposable),this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._cellColorResolver=new d.CellColorResolver(this._terminal,this._optionsService,this._selectionModel,this._decorationService,this._coreBrowserService,this._themeService),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${u}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._refreshCharAtlas(this._themeService.colors),this.register(this._themeService.onChangeColors((P=>{this._refreshCharAtlas(P),this.reset(),this.handleSelectionChanged(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}))),this.register((0,e.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,f.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(){}handleFocus(){}handleCursorMove(){}handleGridChanged(l,g){}handleSelectionChanged(l,g,u=!1){this._selectionModel.update(this._terminal._core,l,g,u)}_setTransparency(l){if(l===this._alpha)return;const g=this._canvas;this._alpha=l,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,g),this._refreshCharAtlas(this._themeService.colors),this.handleGridChanged(0,this._bufferService.rows-1)}_refreshCharAtlas(l){if(!(this._deviceCharWidth<=0&&this._deviceCharHeight<=0)){this._charAtlas=(0,_.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,l,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlasDisposable.value=(0,o.forwardEvent)(this._charAtlas.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),this._charAtlas.warmUp();for(let g=0;g<this._charAtlas.pages.length;g++)this._bitmapGenerator[g]=new h(this._charAtlas.pages[g].canvas)}}resize(l){this._deviceCellWidth=l.device.cell.width,this._deviceCellHeight=l.device.cell.height,this._deviceCharWidth=l.device.char.width,this._deviceCharHeight=l.device.char.height,this._deviceCharLeft=l.device.char.left,this._deviceCharTop=l.device.char.top,this._canvas.width=l.device.canvas.width,this._canvas.height=l.device.canvas.height,this._canvas.style.width=`${l.css.canvas.width}px`,this._canvas.style.height=`${l.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(this._themeService.colors)}clearTextureAtlas(){var l;(l=this._charAtlas)==null||l.clearTexture()}_fillCells(l,g,u,p){this._ctx.fillRect(l*this._deviceCellWidth,g*this._deviceCellHeight,u*this._deviceCellWidth,p*this._deviceCellHeight)}_fillMiddleLineAtCells(l,g,u=1){const p=Math.ceil(.5*this._deviceCellHeight);this._ctx.fillRect(l*this._deviceCellWidth,(g+1)*this._deviceCellHeight-p-this._coreBrowserService.dpr,u*this._deviceCellWidth,this._coreBrowserService.dpr)}_fillBottomLineAtCells(l,g,u=1,p=0){this._ctx.fillRect(l*this._deviceCellWidth,(g+1)*this._deviceCellHeight+p-this._coreBrowserService.dpr-1,u*this._deviceCellWidth,this._coreBrowserService.dpr)}_curlyUnderlineAtCell(l,g,u=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const p=this._coreBrowserService.dpr;this._ctx.lineWidth=p;for(let C=0;C<u;C++){const b=(l+C)*this._deviceCellWidth,y=(l+C+.5)*this._deviceCellWidth,w=(l+C+1)*this._deviceCellWidth,k=(g+1)*this._deviceCellHeight-p-1,D=k-p,P=k+p;this._ctx.moveTo(b,k),this._ctx.bezierCurveTo(b,D,y,D,y,k),this._ctx.bezierCurveTo(y,P,w,P,w,k)}this._ctx.stroke(),this._ctx.restore()}_dottedUnderlineAtCell(l,g,u=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const p=this._coreBrowserService.dpr;this._ctx.lineWidth=p,this._ctx.setLineDash([2*p,p]);const C=l*this._deviceCellWidth,b=(g+1)*this._deviceCellHeight-p-1;this._ctx.moveTo(C,b);for(let y=0;y<Line truncated
|
||||
`)))),this.register(this._terminal.onA11yTab((l=>this._handleTab(l)))),this.register(this._terminal.onKey((l=>this._handleKey(l.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,e.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(t){for(let i=0;i<t;i++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
|
||||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,i){this._liveRegionDebouncer.refresh(t,i,this._terminal.rows)}_renderRows(t,i){const h=this._terminal.buffer,v=h.lines.length.toString();for(let l=t;l<=i;l++){const g=h.lines.get(h.ydisp+l),u=[],p=(g==null?void 0:g.translateToString(!0,void 0,void 0,u))||"",C=(h.ydisp+l+1).toString(),b=this._rowElements[l];b&&(p.length===0?(b.innerText=" ",this._rowColumns.set(b,[0,1])):(b.textContent=p,this._rowColumns.set(b,u)),b.setAttribute("aria-posinset",C),b.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,i){const h=t.target,v=this._rowElements[i===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||t.relatedTarget!==v)return;let l,g;if(i===0?(l=h,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(l=this._rowElements.shift(),g=h,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const t=document.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:t.anchorNode,offset:t.anchorOffset},h={node:t.focusNode,offset:t.focusOffset};if((i.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===h.node&&i.offset>h.offset)&&([i,h]=[h,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;const v=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:v,offset:((p=v.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(h.node))return;const l=({node:C,offset:b})=>{const y=C instanceof Text?C.parentNode:C;let w=parseInt(y==null?void 0:y.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;const k=this._rowColumns.get(y);if(!k)return console.warn("columns is null. Race condition?"),null;let D=b<k.length?k[b]:k.slice(-1)[0]+1;return D>=this._terminal.cols&&(++w,D=0),{row:w,column:D}},g=l(i),u=l(h);if(g&&u){if(g.row>u.row||g.row===u.row&&g.column>=u.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(u.row-g.row)*this._terminal.cols-g.column+u.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=r=d([_(1,o.IInstantiationService),_(2,m.ICoreBrowserService),_(3,m.IRenderService)],r)},3614:(B,s)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function d(
Line truncated
|
||||
|
||||
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=f=d([_(0,c.IBufferService),_(1,c.IOptionsService),_(2,c.IOscLinkService)],f)},6193:(B,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(a,d){this._renderCallback=a,this._coreBrowserService=d,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,d,_){this._rowCount=_,a=a!==void 0?a:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,d),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(B,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const d=a(3614),_=a(3656),n=a(3551),c=a(9042),f=a(3730),m=a(1680),o=a(3107),e=a(5744),r=a(2950),t=a(1296),i=a(428),h=a(4269),v=a(5114),l=a(8934),g=a(3230),u=a(9312),p=a(4725),C=a(6731),b=a(8055),y=a(8969),w=a(8460),k=a(844),D=a(6114),P=a(8437),T=a(2584),A=a(7399),S=a(5941),x=a(9074),E=a(2585),R=a(5435),I=a(4567),F=a(779);class N extends y.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(M={}){super(M),this.browser=D,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new k.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(E.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(F.LinkProviderService),this._instantiationService.setService(p.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((L,H)=>this.refresh(L,H)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((L=>this._reportWindowsOptions(L)))),this.register(this._inputHandler.onColor((L=>this._handleColorEvent(L)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((L=>this._afterResize(L.cols,L.rows)))),this.register((0,k.toDisposable)((()=>{var L,H;this._customKeyEventHandler=void 0,(H=(L=this.element)==null?void 0:L.parentNode)==null||H.removeChild(this.element)})))}_handleColorEvent(M){if(this._themeService)for(const L of M){let H,O="";switch(L.index){case 256:H="foreground",O="10";break;case 257:H="background",O="11";b
Line truncated
|
||||
`:`
|
||||
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),r.isLinux&&u&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(u){const p=this._getMouseBufferCoords(u),C=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return!!(C&&b&&p)&&this._areCoordsInSelection(p,C,b)}isCellInSelection(u,p){const C=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return!(!C||!b)&&this._areCoordsInSelection([u,p],C,b)}_areCoordsInSelection(u,p,C){return u[1]>p[1]&&u[1]<C[1]||p[1]===C[1]&&u[1]===p[1]&&u[0]>=p[0]&&u[0]<C[0]||p[1]<C[1]&&u[1]===C[1]&&u[0]<C[0]||p[1]<C[1]&&u[1]===p[1]&&u[0]>=p[0]}_selectWordAtCursor(u,p){var y,w;const C=(w=(y=this._linkifier.currentLink)==null?void 0:y.link)==null?void 0:w.range;if(C)return this._model.selectionStart=[C.start.x-1,C.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(C,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const b=this._getMouseBufferCoords(u);return!!b&&(this._selectWordAt(b,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,p){this._model.clearSelection(),u=Math.max(u,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const p=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(u){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const C=this._renderService.dimensions.css.canvas.height;return p>=0&&p<=C?0:(p>C&&(p-=C),p=Math.min(Math.max(p,-50),50),p/=50,p/Math.abs(p)+Math.round(14*p))}shouldForceSelection(u){return r.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const p=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);p&&p.length!==this._model.selectionStart[0]&&p.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const p=this._getMouseBufferCoords(u);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(u){return u.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const p=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._buff
Line truncated
|
||||
`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""})(a||(s.C0=a={})),(function(n){n.PAD="",n.HOP="",n.BPH="",n.NBH="",n.IND="",n.NEL="
",n.SSA="",n.ESA="",n.HTS="",n.HTJ="",n.VTS="",n.PLD="",n.PLU="",n.RI="",n.SS2="",n.SS3="",n.DCS="",n.PU1="",n.PU2="",n.STS="",n.CCH="",n.MW="",n.SPA="",n.EPA="",n.SOS="",n.SGCI="",n.SCI="",n.CSI="",n.ST="",n.OSC="",n.PM="",n.APC=""})(d||(s.C1=d={})),(function(n){n.ST=`${a.ESC}\\`})(_||(s.C1_ESCAPED=_={}))},7399:(B,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const d=a(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};s.evaluateKeyboardEvent=function(n,c,f,m){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=c?d.C0.ESC+"OA":d.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=c?d.C0.ESC+"OD":d.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=c?d.C0.ESC+"OC":d.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=c?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":d.C0.DEL,n.altKey&&(o.key=d.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=d.C0.ESC+"[Z";break}o.key=d.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,o.cancel=!0;break;case 27:o.key=d.C0.ESC,n.altKey&&(o.key=d.C0.ESC+d.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=d.C0.ESC+"[1;"+(e+1)+"D",o.key===d.C0.ESC+"[1;3D"&&(o.key=d.C0.ESC+(f?"b":"[1;5D"))):o.key=c?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=d.C0.ESC+"[1;"+(e+1)+"C",o.key===d.C0.ESC+"[1;3C"&&(o.key=d.C0.ESC+(f?"f":"[1;5C"))):o.key=c?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=d.C0.ESC+"[1;"+(e+1)+"A",f||o.key!==d.C0.ESC+"[1;3A"||(o.key=d.C0.ESC+"[1;5A")):o.key=c?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=d.C0.ESC+"[1;"+(e+1)+"B",f||o.key!==d.C0.ESC+"[1;3B"||(o.key=d.C0.ESC+"[1;5B")):o.key=c?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=d.C0.ESC+"[2~");break;case 46:o.key=e?d.C0.ESC+"[3;"+(e+1)+"~":d.C0.ESC+"[3~";break;case 36:o.key=e?d.C0.ESC+"[1;"+(e+1)+"H":c?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:o.key=e?d.C0.ESC+"[1;"+(e+1)+"F":c?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=d.C0.ESC+"[5;"+(e+1)+"~":o.key=d.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=d.C0.ESC+"[6;"+(e+1)+"~":o.key=d.C0.ESC+"[6~";break;case 112:o.key=e?d.C0.ESC+"[1;"+(e+1)+"P":d.C0.ESC+"OP";break;case 113:o.key=e?d.C0.ESC+"[1;"+(e+1)+"Q":d.C0.ESC+"OQ";break;case 114:o.key=e?d.C0.ESC+"[1;"+(e+1)+"R":d.C0.ESC+"OR";break;case 115:o.key=e?d.C0.ESC+"[1;"+(e+1)+"S":d.C0.ESC+"OS";break;case 116:o.key=e?d.C0.ESC+"[15;"+(e+1)+"~":d.C0.ESC+"[15~";break;case 117:o.key=e?d.C0.ESC+"[17;"+(e+1)+"~":d.C0.ESC+"[17~";break;case 118:o.key=e?d.C0.ESC+"[18;"+(e+1)+"~":d.C0.ESC+"[18~";break;case 119:o.key=e?d.C0.ESC+"[19;"+(e+1)+"~":d.C0.ESC+"[19~";break;case 120:o.key=e?d.C0.ESC+"[20;"+(e+1)+"~":d.C0.ESC+"[20~";break;case 121:o.key=e?d.C0.ESC+"[21;"+(e+1)+"~":d.C0.ESC+"[21~";break;case 122:o.key=e?d.C0.ESC+"[23;"+(e+1)+"~":d.C0.ESC+"[23~";break;case 123:o.key=e?d.C0.ESC+"[24;"+(e+1)+"~":d.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(f&&!m||!n.altKey||n.metaKey)!f||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=d.C0.US),n.key==="@"&&(o.key=d.C0.NUL)):n.keyCode===65&&(o.type=1);else{const r=_[n.keyCode],t=r==null?void 0:r[n.shiftKey?1:0];if(t)o.key=d.C0.ESC+t;else if(n.keyCode>=65&&n.keyCode<=90){const i=n.ctrlKey?n.keyCode-64:n.keyCode+32;let h=String.fromCharCode(i);n.shiftKey&&(h=h.toUpperCase()),o.key=d.C0.ESC+h}else if(n.keyCode===32)o.key=d.C0.ESC+(n.ctrlKey?d.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let i=n.code.slice(3,4);n.shiftKey||(i=i.toLowerCase()),o.key=d.C0.ESC+i,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=d.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=d.C0.DEL:n.keyCode===219?o.key=d.C0.ESC:n.keyCode===220?o.key=d.C0.FS:n.keyCode===221&&(o.key=d.C0.GS)}return o}},482:(B,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55Line truncated
|
||||
`,t)}paste(r){this._core.paste(r)}refresh(r,t){this._verifyIntegers(r,t),this._core.refresh(r,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return s}_verifyIntegers(...r){for(const t of r)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const t of r)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}B.Terminal=o})(),oe})()))})(Le)),Le.exports}var Ge=Ke();const Je=fe.forwardRef((de,ve)=>{const ae=fe.useRef(null),J=fe.useRef(null),{className:Z,onInput:oe,onKey:B,onResize:s,...a}=de,{theme:d}=Fe();return fe.useEffect(()=>{const _=window.innerWidth;let n=16;_<400?n=4:_<600?n=5:_<900?n=6:_<1280&&(n=12);const c=new Ge.Terminal({allowTransparency:!0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "JetBrains Mono", monospace',cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!1,fontSize:n,lineHeight:1.2});J.current=c;const f=new ze.FitAddon;c.loadAddon(new qe.WebLinksAddon((o,e)=>{(o.ctrlKey||o.metaKey)&&window.open(e,"_blank")})),c.loadAddon(f),c.open(ae.current),c.loadAddon(new Ue.CanvasAddon),c.onData(o=>{oe&&oe(o)}),c.onKey(o=>{B&&B(o.key,o.domEvent)});const m=new ResizeObserver(()=>{f.fit();const o=c.cols,e=c.rows;s&&s(o,e)});return document.fonts.ready.then(()=>{f.fit(),m.observe(ae.current)}),()=>{m.disconnect(),setTimeout(()=>{c.dispose()},0)}},[]),fe.useEffect(()=>{if(J.current){d==="dark"?J.current.options.theme={background:"#00000000",black:"#ffffff",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightCyan:"#29b8db",brightWhite:"#e5e5e5",foreground:"#cccccc",selectionBackground:"#3a3d41",cursor:"#ffffff"}:J.current.options.theme={background:"#00000000",black:"#1b1b22",red:"#f07178",green:"#7fd88f",yellow:"#ffcb6b",blue:"#82aaff",magenta:"#c792ea",cyan:"#89ddff",white:"#d0d0d6",brightBlack:"#7a7a86",brightRed:"#ff8b92",brightGreen:"#a5e8b4",brightYellow:"#ffe0a3",brightBlue:"#a8c4ff",brightMagenta:"#e2b9ff",brightCyan:"#b5ecff",brightWhite:"#f5f5fa",foreground:"#d0d0d6",selectionBackground:"rgba(255,127,172,0.35)",cursor:"#ff7fac"};try{J.current.refresh(0,J.current.rows-1)}catch{}}},[d]),fe.useImperativeHandle(ve,()=>({write:(..._)=>{var n;return(n=J.current)==null?void 0:n.write(..._)},writeAsync:async _=>new Promise(n=>{var c;(c=J.current)==null||c.write(_,n)}),writeln:(..._)=>{var n;return(n=J.current)==null?void 0:n.writeln(..._)},writelnAsync:async _=>new Promise(n=>{var c;(c=J.current)==null||c.writeln(_,n)}),clear:()=>{var _;(_=J.current)==null||_.clear()},terminalRef:J}),[]),Re.jsx("div",{className:We("p-2.5 rounded-2xl border w-full h-full overflow-hidden backdrop-blur-sm transition-colors",d==="dark"?"bg-[#0d0d11] border-white/10":"bg-[#16161c] border-black/20",Z),...a,children:Re.jsx("div",{style:{width:"100%",height:"100%"},ref:ae})})});export{Je as X};
|
||||
Reference in new issue
Block a user