Skip to content

Commit

Permalink
merge with devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Oct 8, 2024
2 parents 8e81962 + 412fe76 commit 64e15aa
Show file tree
Hide file tree
Showing 18 changed files with 522 additions and 321 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 2.44.0
### Features
* new API `terminal::animation()` and `terminal::delay()` [#683](https://github.com/jcubic/jquery.terminal/issues/683)
* add images in less now have `terminal-less` class
* add `execHistory` main option and `history` option to `terminal::exec()` [#745](https://github.com/jcubic/jquery.terminal/issues/745)
* add helper `$.terminal.remove_formatter`
* escape xml in `$.terminal.escape_formatting` when xml formatter is used [#973](https://github.com/jcubic/jquery.terminal/issues/973)
### Bugfix
* fix number of rows when using different `--size` [#969](https://github.com/jcubic/jquery.terminal/issues/969)
* fix hidden cursor when using command that change `--size` [#968](https://github.com/jcubic/jquery.terminal/issues/968)
* fix command prop in `export_view()` when in command [#967](https://github.com/jcubic/jquery.terminal/issues/967)
* fix processing images in less [#970](https://github.com/jcubic/jquery.terminal/issues/970)
* fix passing alt and class for image in less
* fix width of images in less when image is bigger than the terminal
* fix line-height of the lines to render less image slices properly
* fix flashing of old prompt after prompt animation [#976](https://github.com/jcubic/jquery.terminal/issues/976)

## 2.43.2
### Bugfix
* fix scroll to bottom when using `terminal::import_view`

## 2.43.1
### Bugfix
* fix height when not using `--rows` [#962](https://github.com/jcubic/jquery.terminal/issues/962)
Expand Down
24 changes: 6 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,26 @@ UPDATE_CONTRIBUTORS=0

.PHONY: coverage test coveralls lint.src eslint skipped_tests jsonlint publish lint tscheck publish-guthub emoji

ALL: Makefile .$(VERSION) terminal.jquery.json bower.json package.json assets/ascii_art.svg js/jquery.terminal-$(VERSION).js js/jquery.terminal.js js/jquery.terminal-$(VERSION).min.js js/jquery.terminal.min.js js/jquery.terminal.min.js.map css/jquery.terminal-$(VERSION).css css/jquery.terminal-$(VERSION).min.css css/jquery.terminal.min.css css/jquery.terminal.min.css.map css/jquery.terminal.css README.md import.html js/terminal.widget.js css/emoji.css update-contributors
ALL: Makefile .$(VERSION) terminal.jquery.json bower.json package.json assets/ascii_art.svg js/jquery.terminal.js js/jquery.terminal.min.js js/jquery.terminal.min.js.map css/jquery.terminal.min.css css/jquery.terminal.min.css.map css/jquery.terminal.css README.md import.html js/terminal.widget.js css/emoji.css update-contributors

bower.json: templates/bower.in .$(VERSION)
$(SED) -e "s/{{VER}}/$(VERSION)/g" templates/bower.in > bower.json

package.json: .$(VERSION)
$(SED) -i 's/"version": "[^"]\+"/"version": "$(VERSION)"/' package.json

js/jquery.terminal-$(VERSION).js: js/jquery.terminal-src.js .$(VERSION)
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal-$(VERSION).js || $(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{DATE}}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal-$(VERSION).js
js/jquery.terminal.js: js/jquery.terminal-src.js .$(VERSION)
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal.js || $(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{DATE}}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal.js

js/jquery.terminal.js: js/jquery.terminal-$(VERSION).js
$(CP) js/jquery.terminal-$(VERSION).js js/jquery.terminal.js

js/jquery.terminal-$(VERSION).min.js: js/jquery.terminal.min.js
$(CP) js/jquery.terminal.min.js js/jquery.terminal-$(VERSION).min.js

js/jquery.terminal.min.js js/jquery.terminal.min.js.map: js/jquery.terminal-$(VERSION).js
js/jquery.terminal.min.js js/jquery.terminal.min.js.map: js/jquery.terminal.js
$(CD) js && $(UGLIFY) -o jquery.terminal.min.js --comments --mangle --source-map "includeSources,url='jquery.terminal.min.js.map'" -- jquery.terminal.js && $(ECHO) >> jquery.terminal.min.js

css/jquery.terminal-$(VERSION).css: css/jquery.terminal-src.css .$(VERSION)
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal-$(VERSION).css || $(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{DATE}}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal-$(VERSION).css

css/jquery.terminal.css: css/jquery.terminal-$(VERSION).css .$(VERSION)
$(CP) css/jquery.terminal-$(VERSION).css css/jquery.terminal.css
css/jquery.terminal.css: css/jquery.terminal-src.css .$(VERSION)
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal.css || $(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{DATE}}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal.css

css/jquery.terminal.min.css css/jquery.terminal.min.css.map: css/jquery.terminal.css
$(CSSNANO) css/jquery.terminal.css css/jquery.terminal.min.css

css/jquery.terminal-$(VERSION).min.css: css/jquery.terminal.min.css
$(CP) css/jquery.terminal.min.css css/jquery.terminal-$(VERSION).min.css

README.md: templates/README.in .$(VERSION) __tests__/terminal.spec.js
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e \
"s/{{BRANCH}}/$(BRANCH_SAFE)/g" -e "s/{{CHECKSUM}}/$(SPEC_CHECKSUM)/" \
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<h1 align="center">
<img src="https://github.com/jcubic/jquery.terminal/blob/master/assets/ascii_art.svg?raw=true&ver=2.43.1"
<img src="https://github.com/jcubic/jquery.terminal/blob/devel/assets/ascii_art.svg?raw=true&ver=DEV"
alt="ASCII Art that represent text jQuery Terminal - JavaScript Library for Web Based Terminal Emulators" />
</h1>

[JavaScript Library for Web Based Terminal Emulators](https://terminal.jcubic.pl)

[![npm](https://img.shields.io/badge/npm-2.43.1-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-2.43.1-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=master&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=master&cd09bc55e55c92b2e6b07bb29830ae68)](https://coveralls.io/github/jcubic/jquery.terminal?branch=master)
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&0f20bf6eaa4edcca15f83f8bbf243c1e)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down Expand Up @@ -87,7 +87,7 @@ You can test current version at this URL:

or if it doesn't use latest version (because of jsDelivr cache) you can force it with this URL:

* [https://jcubic.github.io/jquery.terminal/?ver=2.43.1](https://jcubic.github.io/jquery.terminal/?ver=2.43.1)
* [https://jcubic.github.io/jquery.terminal/?ver=DEV](https://jcubic.github.io/jquery.terminal/?ver=DEV)

And development version using:

Expand All @@ -106,20 +106,20 @@ or use jsDelivr:

```

Then include js/jquery.terminal-2.43.1.min.js and css/jquery.terminal-2.43.1.min.css
Then include js/jquery.terminal-DEV.min.js and css/jquery.terminal-DEV.min.css

You can grab the files from CDN:

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.43.1/js/jquery.terminal.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.43.1/css/jquery.terminal.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/js/jquery.terminal.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/css/jquery.terminal.min.css" rel="stylesheet"/>
```

or

```html
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.43.1/js/jquery.terminal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.43.1/css/jquery.terminal.min.css"/>
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/js/jquery.terminal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/css/jquery.terminal.min.css"/>
```

If you always want latest version, you can get it from [unpkg](https://unpkg.com/) without specifying version,
Expand Down Expand Up @@ -401,7 +401,7 @@ You can request paid support, you can find details at [support.jcubic.pl](https:

### Star History

[![Star History Chart](https://api.star-history.com/svg?repos=jcubic/jquery.terminal&type=Date&branch=master)](https://star-history.com/#jcubic/jquery.terminal&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=jcubic/jquery.terminal&type=Date&branch=devel)](https://star-history.com/#jcubic/jquery.terminal&Date)

### License

Expand Down
86 changes: 43 additions & 43 deletions __tests__/__snapshots__/terminal.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -561,49 +561,49 @@ exports[`Terminal utils $.terminal.from_ansi should render Denis Richie ANSI art
exports[`Terminal utils $.terminal.less should split image 1`] = `
"xxx
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
[[@;;;terminal-less;data:image/jpg,<BLOB>] ]
xxx
~
Expand Down
56 changes: 44 additions & 12 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,28 @@ window.Image = class Image {
}
}
};
window.HTMLCanvasElement.prototype.getContext = function () {

const context = {
putImageData: function(data, x, y) {
},
getImageData: function(x, y, w, h) {
return [1,1,1];
},
drawImage: function(image, x1, y1, iw, ih, out_x, out_y, out_w, out_h) {
}
};

global.OffscreenCanvas = function(width, height) {
return {
putImageData: function(data, x, y) {
},
getImageData: function(x, y, w, h) {
return [1,1,1];
},
drawImage: function(image, x1, y1, iw, ih, out_x, out_y, out_w, out_h) {
}
height,
width,
getContext: () => context,
convertToBlob: () => Promise.resolve('<BLOB>')
};
};
window.HTMLCanvasElement.prototype.toBlob = function(fn) {
fn('<BLOB>');
};

window.HTMLCanvasElement.prototype.getContext = () => context;
window.HTMLCanvasElement.prototype.toBlob = (fn) => fn('<BLOB>');
global.URL = window.URL = {
createObjectURL: function(blob) {
return 'data:image/jpg,' + blob;
Expand Down Expand Up @@ -482,6 +490,10 @@ describe('Terminal utils', function() {
Object.keys($.terminal.xml_formatter).forEach(key => {
keys[key] = $.terminal.xml_formatter[key];
});
var formatters = $.terminal.defaults.formatters;
if (!formatters.includes($.terminal.xml_formatter)) {
$.terminal.new_formatter($.terminal.xml_formatter);
}
term = $('<div/>').terminal({}, {greetings: false});
});
afterEach(() => {
Expand Down Expand Up @@ -579,6 +591,13 @@ describe('Terminal utils', function() {
term.echo(input);
expect(term.find('.terminal-output').html()).toMatchSnapshot();
});
it('should escape xml tags', () => {
expect($.terminal.escape_formatting('<white>hello</white>')).toEqual('&lt;white&gt;hello&lt;/white&gt;');
});
it('should not escape xml tags', () => {
$.terminal.remove_formatter($.terminal.xml_formatter);
expect($.terminal.escape_formatting('<white>hello</white>')).toEqual('<white>hello</white>');
});
});
describe('$.terminal.from_ansi', function() {
var ansi_string = '\x1b[38;5;12mHello\x1b[2;31;46mFoo\x1b[1;3;4;32;45mB[[sb;;]a]r\x1b[0m\x1b[7mBaz\x1b[0;48;2;255;255;0;38;2;0;100;0mQuux\x1b[m';
Expand Down Expand Up @@ -2209,6 +2228,7 @@ describe('Terminal utils', function() {
numRows: rows
});
term.css('width', 800);
term.find('.terminal-output').css('width', 800);
term.focus();
});
function key(ord, key) {
Expand Down Expand Up @@ -5525,7 +5545,9 @@ describe('Terminal plugin', function() {
}
};
spy(interpreter, 'foo');
term = $('<div/>').appendTo('body').terminal(interpreter);
term = $('<div/>').appendTo('body').terminal(interpreter, {
name: '__exec__'
});
term.focus();
});
afterEach(function() {
Expand Down Expand Up @@ -5748,6 +5770,16 @@ describe('Terminal plugin', function() {
}, 800);
});
});
it('should not save command in history', () => {
term.clear();
term.focus().exec('echo hello');
expect(term.history().data()).toEqual([]);
});
it('should save command in history', () => {
term.clear();
term.focus().exec('echo hello', { history: true });
expect(term.history().data()).toEqual(['echo hello']);
});
});
describe('autologin', function() {
var token = 'TOKEN';
Expand Down
2 changes: 1 addition & 1 deletion css/emoji.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 20 additions & 18 deletions css/jquery.terminal-src.css
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,9 @@ terminal .terminal-output > div {
}
.terminal .terminal-output > :not(.raw) > div,
.cmd div,
.terminal,
.terminal.external div {
line-height: var(--terminal-line, 1em);
line-height: round(var(--terminal-line, 1em));
}
.terminal [data-text], .cmd [data-text] {
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
Expand Down Expand Up @@ -950,33 +951,34 @@ terminal .terminal-output > div {
* overwrite css variables that don't work with selection in Edge
*/
@property --color {
syntax: '<color>';
inherits: true;
initial-value: rgba(170, 170, 170, 0.99);
syntax: '<color>';
inherits: true;
initial-value: rgba(170, 170, 170, 0.99);
}
@property --background {
syntax: '<color>';
inherits: true;
initial-value: #000;
syntax: '<color>';
inherits: true;
initial-value: #000;
}
@property --link-color {
syntax: '<color>';
inherits: true;
initial-value: #3377FF;
syntax: '<color>';
inherits: true;
initial-value: #3377FF;
}
@property --size {
syntax: '<number>';
inherits: true;
initial-value: 1;
syntax: '<number>';
inherits: true;
initial-value: 1;
}
@property --padding {
syntax: '<number>';
inherits: true;
initial-value: 10;
syntax: '<number>';
inherits: true;
initial-value: 10;
}
@property --rows {
syntax: '<number>';
inherits: true;
syntax: '<number> | auto';
inherits: true;
initial-value: auto;
}
@supports (-ms-ime-align:auto) {
.terminal h1::selection,
Expand Down
Loading

0 comments on commit 64e15aa

Please sign in to comment.