New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xterm-addon-serialize

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xterm-addon-serialize - npm Package Compare versions

Comparing version 0.7.0-beta.1 to 0.7.0-beta.2

2

lib/xterm-addon-serialize.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SerializeAddon=e():t.SerializeAddon=e()}(this,(function(){return(()=>{"use strict";var t={};return{44:function(t,e){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function o(t,e){return t.getBgColorMode()===e.getBgColorMode()&&t.getBgColor()===e.getBgColor()}Object.defineProperty(e,"__esModule",{value:!0}),e.SerializeAddon=void 0;var s=function(t){function e(e,r){var i=t.call(this,e)||this;return i._terminal=r,i._rowIndex=0,i._allRows=new Array,i._allRowSeparators=new Array,i._currentRow="",i._nullCellCount=0,i._cursorStyle=i._buffer.getNullCell(),i._cursorStyleRow=0,i._cursorStyleCol=0,i._backgroundCell=i._buffer.getNullCell(),i._firstRow=0,i._lastCursorRow=0,i._lastCursorCol=0,i._lastContentCursorRow=0,i._lastContentCursorCol=0,i._thisRowLastChar=i._buffer.getNullCell(),i._thisRowLastSecondChar=i._buffer.getNullCell(),i._nextRowFirstChar=i._buffer.getNullCell(),i}return i(e,t),e.prototype._beforeSerialize=function(t,e,r){this._allRows=new Array(t),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e},e.prototype._rowEnd=function(t,e){var r;this._nullCellCount>0&&!o(this._cursorStyle,this._backgroundCell)&&(this._currentRow+="["+this._nullCellCount+"X");var i="";if(!e){t-this._firstRow>=this._terminal.rows&&(null===(r=this._buffer.getLine(this._cursorStyleRow))||void 0===r||r.getCell(this._cursorStyleCol,this._backgroundCell));var s=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(l.isWrapped){i="";var n=s.getCell(s.length-1,this._thisRowLastChar),u=s.getCell(s.length-2,this._thisRowLastSecondChar),a=l.getCell(0,this._nextRowFirstChar),h=a.getWidth()>1,_=!1;(a.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((n.getChars()||0===n.getWidth())&&o(n,a)&&(_=!0),h&&(u.getChars()||0===u.getWidth())&&o(n,a)&&o(u,a)&&(_=!0)),_||(i="-".repeat(this._nullCellCount+1),i+="",this._nullCellCount>0&&(i+="",i+="["+(s.length-this._nullCellCount)+"C",i+="["+this._nullCellCount+"X",i+="["+(s.length-this._nullCellCount)+"D",i+=""),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}else i="\r\n",this._lastCursorRow=t+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=i,this._currentRow="",this._nullCellCount=0},e.prototype._diffStyle=function(t,e){var r,i,s=[],l=(i=e,!((r=t).getFgColorMode()===i.getFgColorMode()&&r.getFgColor()===i.getFgColor())),n=!o(t,e),u=!function(t,e){return t.isInverse()===e.isInverse()&&t.isBold()===e.isBold()&&t.isUnderline()===e.isUnderline()&&t.isBlink()===e.isBlink()&&t.isInvisible()===e.isInvisible()&&t.isItalic()===e.isItalic()&&t.isDim()===e.isDim()}(t,e);if(l||n||u)if(t.isAttributeDefault())e.isAttributeDefault()||s.push(0);else{if(l){var a=t.getFgColor();t.isFgRGB()?s.push(38,2,a>>>16&255,a>>>8&255,255&a):t.isFgPalette()?a>=16?s.push(38,5,a):s.push(8&a?90+(7&a):30+(7&a)):s.push(39)}n&&(a=t.getBgColor(),t.isBgRGB()?s.push(48,2,a>>>16&255,a>>>8&255,255&a):t.isBgPalette()?a>=16?s.push(48,5,a):s.push(8&a?100+(7&a):40+(7&a)):s.push(49)),u&&(t.isInverse()!==e.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==e.isBold()&&s.push(t.isBold()?1:22),t.isUnderline()!==e.isUnderline()&&s.push(t.isUnderline()?4:24),t.isBlink()!==e.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==e.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==e.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==e.isDim()&&s.push(t.isDim()?2:22))}return s},e.prototype._nextCell=function(t,e,r,i){if(0!==t.getWidth()){var s=""===t.getChars(),l=this._diffStyle(t,this._cursorStyle);if(s?!o(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+="["+l.join(";")+"m";var n=this._buffer.getLine(r);void 0!==n&&(n.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}s?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}},e.prototype._serializeString=function(){var t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);for(var e="",r=0;r<t;r++)e+=this._allRows[r],r+1<t&&(e+=this._allRowSeparators[r]);var i,o=this._buffer.baseY+this._buffer.cursorY,s=this._buffer.cursorX;return(o!==this._lastCursorRow||s!==this._lastCursorCol)&&((i=o-this._lastCursorRow)>0?e+="["+i+"B":i<0&&(e+="["+-i+"A"),function(t){t>0?e+="["+t+"C":t<0&&(e+="["+-t+"D")}(s-this._lastCursorCol)),e},e}(function(){function t(t){this._buffer=t}return t.prototype.serialize=function(t,e){var r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r;this._beforeSerialize(e-t,t,e);for(var s=t;s<e;s++){var l=this._buffer.getLine(s);if(l)for(var n=0;n<l.length;n++){var u=l.getCell(n,o===r?i:r);u?(this._nextCell(u,o,s,n),o=u):console.warn("Can't get cell at row="+s+", col="+n)}this._rowEnd(s,s===e-1)}return this._afterSerialize(),this._serializeString()},t.prototype._nextCell=function(t,e,r,i){},t.prototype._rowEnd=function(t,e){},t.prototype._beforeSerialize=function(t,e,r){},t.prototype._afterSerialize=function(){},t.prototype._serializeString=function(){return""},t}()),l=function(){function t(){}return t.prototype.activate=function(t){this._terminal=t},t.prototype._serializeBuffer=function(t,e,r){var i,o,l=e.length,n=new s(e,t),u=void 0===r?l:(i=r+t.rows,0,o=l,Math.max(0,Math.min(i,o)));return n.serialize(l-u,l)},t.prototype._serializeModes=function(t){var e="",r=t.modes;if(r.applicationCursorKeysMode&&(e+="[?1h"),r.applicationKeypadMode&&(e+="[?66h"),r.bracketedPasteMode&&(e+="[?2004h"),r.insertMode&&(e+=""),r.originMode&&(e+="[?6h"),r.reverseWraparoundMode&&(e+="[?45h"),r.sendFocusMode&&(e+="[?1004h"),!1===r.wraparoundMode&&(e+="[?7l"),"none"!==r.mouseTrackingMode)switch(r.mouseTrackingMode){case"x10":e+="[?9h";break;case"vt200":e+="[?1000h";break;case"drag":e+="[?1002h";break;case"any":e+="[?1003h"}return e},t.prototype.serialize=function(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var e=this._serializeBuffer(this._terminal,this._terminal.buffer.normal,null==t?void 0:t.scrollback);return(null==t?void 0:t.excludeAltBuffer)||"alternate"===this._terminal.buffer.active.type&&(e+="[?1049h"+this._serializeBuffer(this._terminal,this._terminal.buffer.alternate,void 0)),(null==t?void 0:t.excludeModes)||(e+=this._serializeModes(this._terminal)),e},t.prototype.dispose=function(){},t}();e.SerializeAddon=l}}[44](0,t),t})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SerializeAddon=e():t.SerializeAddon=e()}(this,(function(){return(()=>{"use strict";var t={};return{44:function(t,e){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function o(t,e){return t.getBgColorMode()===e.getBgColorMode()&&t.getBgColor()===e.getBgColor()}Object.defineProperty(e,"__esModule",{value:!0}),e.SerializeAddon=void 0;var s=function(t){function e(e,r){var i=t.call(this,e)||this;return i._terminal=r,i._rowIndex=0,i._allRows=new Array,i._allRowSeparators=new Array,i._currentRow="",i._nullCellCount=0,i._cursorStyle=i._buffer.getNullCell(),i._cursorStyleRow=0,i._cursorStyleCol=0,i._backgroundCell=i._buffer.getNullCell(),i._firstRow=0,i._lastCursorRow=0,i._lastCursorCol=0,i._lastContentCursorRow=0,i._lastContentCursorCol=0,i._thisRowLastChar=i._buffer.getNullCell(),i._thisRowLastSecondChar=i._buffer.getNullCell(),i._nextRowFirstChar=i._buffer.getNullCell(),i}return i(e,t),e.prototype._beforeSerialize=function(t,e,r){this._allRows=new Array(t),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e},e.prototype._rowEnd=function(t,e){var r;this._nullCellCount>0&&!o(this._cursorStyle,this._backgroundCell)&&(this._currentRow+="["+this._nullCellCount+"X");var i="";if(!e){t-this._firstRow>=this._terminal.rows&&(null===(r=this._buffer.getLine(this._cursorStyleRow))||void 0===r||r.getCell(this._cursorStyleCol,this._backgroundCell));var s=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(l.isWrapped){i="";var n=s.getCell(s.length-1,this._thisRowLastChar),u=s.getCell(s.length-2,this._thisRowLastSecondChar),h=l.getCell(0,this._nextRowFirstChar),a=h.getWidth()>1,_=!1;(h.getChars()&&a?this._nullCellCount<=1:this._nullCellCount<=0)&&((n.getChars()||0===n.getWidth())&&o(n,h)&&(_=!0),a&&(u.getChars()||0===u.getWidth())&&o(n,h)&&o(u,h)&&(_=!0)),_||(i="-".repeat(this._nullCellCount+1),i+="",this._nullCellCount>0&&(i+="",i+="["+(s.length-this._nullCellCount)+"C",i+="["+this._nullCellCount+"X",i+="["+(s.length-this._nullCellCount)+"D",i+=""),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}else i="\r\n",this._lastCursorRow=t+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=i,this._currentRow="",this._nullCellCount=0},e.prototype._diffStyle=function(t,e){var r,i,s=[],l=(i=e,!((r=t).getFgColorMode()===i.getFgColorMode()&&r.getFgColor()===i.getFgColor())),n=!o(t,e),u=!function(t,e){return t.isInverse()===e.isInverse()&&t.isBold()===e.isBold()&&t.isUnderline()===e.isUnderline()&&t.isBlink()===e.isBlink()&&t.isInvisible()===e.isInvisible()&&t.isItalic()===e.isItalic()&&t.isDim()===e.isDim()&&t.isStrikethrough()===e.isStrikethrough()}(t,e);if(l||n||u)if(t.isAttributeDefault())e.isAttributeDefault()||s.push(0);else{if(l){var h=t.getFgColor();t.isFgRGB()?s.push(38,2,h>>>16&255,h>>>8&255,255&h):t.isFgPalette()?h>=16?s.push(38,5,h):s.push(8&h?90+(7&h):30+(7&h)):s.push(39)}n&&(h=t.getBgColor(),t.isBgRGB()?s.push(48,2,h>>>16&255,h>>>8&255,255&h):t.isBgPalette()?h>=16?s.push(48,5,h):s.push(8&h?100+(7&h):40+(7&h)):s.push(49)),u&&(t.isInverse()!==e.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==e.isBold()&&s.push(t.isBold()?1:22),t.isUnderline()!==e.isUnderline()&&s.push(t.isUnderline()?4:24),t.isBlink()!==e.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==e.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==e.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==e.isDim()&&s.push(t.isDim()?2:22),t.isStrikethrough()!==e.isStrikethrough()&&s.push(t.isStrikethrough()?9:29))}return s},e.prototype._nextCell=function(t,e,r,i){if(0!==t.getWidth()){var s=""===t.getChars(),l=this._diffStyle(t,this._cursorStyle);if(s?!o(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+="["+l.join(";")+"m";var n=this._buffer.getLine(r);void 0!==n&&(n.getCell(i,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=i)}s?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(o(this._cursorStyle,this._backgroundCell)||(this._currentRow+="["+this._nullCellCount+"X"),this._currentRow+="["+this._nullCellCount+"C",this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}},e.prototype._serializeString=function(){var t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);for(var e="",r=0;r<t;r++)e+=this._allRows[r],r+1<t&&(e+=this._allRowSeparators[r]);var i,o=this._buffer.baseY+this._buffer.cursorY,s=this._buffer.cursorX;return(o!==this._lastCursorRow||s!==this._lastCursorCol)&&((i=o-this._lastCursorRow)>0?e+="["+i+"B":i<0&&(e+="["+-i+"A"),function(t){t>0?e+="["+t+"C":t<0&&(e+="["+-t+"D")}(s-this._lastCursorCol)),e},e}(function(){function t(t){this._buffer=t}return t.prototype.serialize=function(t,e){var r=this._buffer.getNullCell(),i=this._buffer.getNullCell(),o=r;this._beforeSerialize(e-t,t,e);for(var s=t;s<e;s++){var l=this._buffer.getLine(s);if(l)for(var n=0;n<l.length;n++){var u=l.getCell(n,o===r?i:r);u?(this._nextCell(u,o,s,n),o=u):console.warn("Can't get cell at row="+s+", col="+n)}this._rowEnd(s,s===e-1)}return this._afterSerialize(),this._serializeString()},t.prototype._nextCell=function(t,e,r,i){},t.prototype._rowEnd=function(t,e){},t.prototype._beforeSerialize=function(t,e,r){},t.prototype._afterSerialize=function(){},t.prototype._serializeString=function(){return""},t}()),l=function(){function t(){}return t.prototype.activate=function(t){this._terminal=t},t.prototype._serializeBuffer=function(t,e,r){var i,o,l=e.length,n=new s(e,t),u=void 0===r?l:(i=r+t.rows,0,o=l,Math.max(0,Math.min(i,o)));return n.serialize(l-u,l)},t.prototype._serializeModes=function(t){var e="",r=t.modes;if(r.applicationCursorKeysMode&&(e+="[?1h"),r.applicationKeypadMode&&(e+="[?66h"),r.bracketedPasteMode&&(e+="[?2004h"),r.insertMode&&(e+=""),r.originMode&&(e+="[?6h"),r.reverseWraparoundMode&&(e+="[?45h"),r.sendFocusMode&&(e+="[?1004h"),!1===r.wraparoundMode&&(e+="[?7l"),"none"!==r.mouseTrackingMode)switch(r.mouseTrackingMode){case"x10":e+="[?9h";break;case"vt200":e+="[?1000h";break;case"drag":e+="[?1002h";break;case"any":e+="[?1003h"}return e},t.prototype.serialize=function(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");var e=this._serializeBuffer(this._terminal,this._terminal.buffer.normal,null==t?void 0:t.scrollback);return(null==t?void 0:t.excludeAltBuffer)||"alternate"===this._terminal.buffer.active.type&&(e+="[?1049h"+this._serializeBuffer(this._terminal,this._terminal.buffer.alternate,void 0)),(null==t?void 0:t.excludeModes)||(e+=this._serializeModes(this._terminal)),e},t.prototype.dispose=function(){},t}();e.SerializeAddon=l}}[44](0,t),t})()}));
//# sourceMappingURL=xterm-addon-serialize.js.map

@@ -63,3 +63,4 @@ "use strict";

&& cell1.isItalic() === cell2.isItalic()
&& cell1.isDim() === cell2.isDim();
&& cell1.isDim() === cell2.isDim()
&& cell1.isStrikethrough() === cell2.isStrikethrough();
}

@@ -257,2 +258,5 @@ class StringSerializeHandler extends BaseSerializeHandler {

}
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) {
sgrSeq.push(cell.isStrikethrough() ? 9 : 29);
}
}

@@ -259,0 +263,0 @@ }

@@ -71,3 +71,4 @@ "use strict";

&& cell1.isItalic() === cell2.isItalic()
&& cell1.isDim() === cell2.isDim();
&& cell1.isDim() === cell2.isDim()
&& cell1.isStrikethrough() === cell2.isStrikethrough();
}

@@ -231,2 +232,5 @@ var StringSerializeHandler = (function (_super) {

}
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) {
sgrSeq.push(cell.isStrikethrough() ? 9 : 29);
}
}

@@ -233,0 +237,0 @@ }

{
"name": "xterm-addon-serialize",
"version": "0.7.0-beta.1",
"version": "0.7.0-beta.2",
"author": {

@@ -5,0 +5,0 @@ "name": "The xterm.js authors",

@@ -75,3 +75,4 @@ /**

&& cell1.isItalic() === cell2.isItalic()
&& cell1.isDim() === cell2.isDim();
&& cell1.isDim() === cell2.isDim()
&& cell1.isStrikethrough() === cell2.isStrikethrough();
}

@@ -164,3 +165,3 @@

nextRowFirstChar.getChars() &&
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
) {

@@ -264,2 +265,3 @@ if (

if (cell.isDim() !== oldCell.isDim()) { sgrSeq.push(cell.isDim() ? 2 : 22); }
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) { sgrSeq.push(cell.isStrikethrough() ? 9 : 29); }
}

@@ -266,0 +268,0 @@ }

@@ -27,2 +27,6 @@ /**

* incomplete frames.
*
* It's recommended that you write the serialized data into a terminal of the same size in which
* it originated from and then resize it after if needed.
*
* @param options Custom options to allow control over what gets serialized.

@@ -29,0 +33,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc