Skip to content

Commit

Permalink
merge with devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Dec 27, 2021
2 parents 9134a67 + 65b50e5 commit 7e522c3
Show file tree
Hide file tree
Showing 16 changed files with 532 additions and 288 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 2.31.0
### Breaking
* remove undocumented `echo_command` (that was used by old `echo_newline` extension)
### Features
* scroll to bottom for each line in multiline typing animation
* allow to use `--glow: 1` with default animation
* new API `terminal::enter` same as echo_command but supports animation
* add global option `execAnimationDelay` default - 100
* make execAnimation work only with execHash [#723](https://github.com/jcubic/jquery.terminal/issues/723)
### Bugfix
* fix prompt that return string or promise (in animation and set_prompt) [#724](https://github.com/jcubic/jquery.terminal/issues/724)
* fix formatting in typing animation [#721](https://github.com/jcubic/jquery.terminal/issues/721)
* fix formatting colors and `--glow` [#725](https://github.com/jcubic/jquery.terminal/issues/725)
* fix record stop command being recorded [#719](https://github.com/jcubic/jquery.terminal/issues/719)

## 2.30.2
### Bugfix
* fix animated exec array with sync commands [#722](https://github.com/jcubic/jquery.terminal/issues/722)
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
__ / / // / // / _ / _/ // / / / _ / _/ / / \/ / _ \/ /
/ / / // / // / ___/ // // / / / ___/ // / / / / /\ / // / /__
\___/____ \\__/____/_/ \__ / /_/____/_//_/_/_/_/_/ \/\__\_\___/
\/ /____/ version 2.30.2
\/ /____/ version DEV
```

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

[![npm](https://img.shields.io/badge/npm-2.30.2-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-2.30.2-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&a3d8f5c3567979aca210315cafaca955)](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&f89d5d7e8a915c7f958e2407b66acf15)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![Paid Support](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down Expand Up @@ -92,7 +92,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.30.2](https://jcubic.github.io/jquery.terminal/?ver=2.30.2)
* [https://jcubic.github.io/jquery.terminal/?ver=DEV](https://jcubic.github.io/jquery.terminal/?ver=DEV)

And development version using:

Expand All @@ -110,20 +110,20 @@ Include jQuery library, you can use cdn from https://jquery.com/download/

```

Then include js/jquery.terminal-2.30.2.min.js and css/jquery.terminal-2.30.2.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.30.2/js/jquery.terminal.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.30.2/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.30.2/js/jquery.terminal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.30.2/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
93 changes: 89 additions & 4 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2995,16 +2995,41 @@ describe('sub plugins', function() {
describe('Terminal plugin', function() {
describe('jQuery Terminal options', function() {
describe('prompt', function() {
it('should have default prompt', function() {
var term = $('<div/>').terminal($.noop);
expect(term.get_prompt()).toEqual('> ');
});
it('should set prompt', function() {
var prompt = '>>> ';
var term = $('<div/>').terminal($.noop, {
prompt: prompt
});
expect(term.get_prompt()).toEqual(prompt);
});
it('should have default prompt', function() {
var term = $('<div/>').terminal($.noop);
expect(term.get_prompt()).toEqual('> ');
it('should render function that return string', () => {
var term = $('<div/>').terminal($.noop, {
prompt: function() {
return '>>>'
}
});
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
});
it('should render funtion that return promise', async () => {
var term = $('<div/>').terminal($.noop, {
prompt: function() {
return Promise.resolve('>>>');
}
});
await delay(10);
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
});
it('should render funtion that call callback', () => {
var term = $('<div/>').terminal($.noop, {
prompt: function(fn) {
fn('>>>');
}
});
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
});
});
describe('history', function() {
Expand Down Expand Up @@ -4971,7 +4996,8 @@ describe('Terminal plugin', function() {
});
it('should animate exec array with sync commands #722', async function() {
await term.exec(['echo HELLO', 'echo WORLD', 'echo !'], {
typing: 10
typing: true,
delay: 0
});
expect(term.get_output().split('\n')).toEqual([
'> echo HELLO',
Expand All @@ -4982,6 +5008,37 @@ describe('Terminal plugin', function() {
'!'
]);
});
it('should handle exec animation when using prompt that return string #724', async () => {
var term = $('<div/>').terminal({
echo: function(arg) {
this.echo(arg);
}
}, {
greetings: false,
prompt: function() {
return '>>> '
}
});
async function test() {
await term.exec(['echo HELLO', 'echo WORLD', 'echo !'], {
typing: true,
delay: 0
});
expect(term.get_output().split('\n')).toEqual([
'>>> echo HELLO',
'HELLO',
'>>> echo WORLD',
'WORLD',
'>>> echo !',
'!'
]);
}
await test();
term.clear().set_prompt(function() {
return Promise.resolve('>>> ');
});
await test();
});
});

describe('exec', function() {
Expand Down Expand Up @@ -5733,6 +5790,34 @@ describe('Terminal plugin', function() {
expect(last_line.text()).toEqual('Lorem');
});
});
describe('set_prompt', function() {
var term;
beforeEach(() => {
term = $('<div/>').terminal();
});
function get_prompt() {
return term.find('.cmd-prompt').text();
}
it('should render prompt when using function that returns promise', async function() {
term.set_prompt(function() {
return Promise.resolve('>>>');
});
await delay(10);
expect(get_prompt()).toEqual('>>>');
});
it('should render prompt when using function that return string', function() {
term.set_prompt(function() {
return '>>>';
});
expect(get_prompt()).toEqual('>>>');
});
it('should render prompt when using function that use callback', function() {
term.set_prompt(function(fn) {
fn('>>>');
});
expect(get_prompt()).toEqual('>>>');
});
});
describe('echo', function() {
var numChars = 100;
var numRows = 25;
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.

24 changes: 19 additions & 5 deletions css/jquery.terminal-2.30.2.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.30.2
* \/ /____/ version DEV
* http://terminal.jcubic.pl
*
* This file is part of jQuery Terminal.
*
* Copyright (c) 2011-2021 Jakub Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* Date: Thu, 23 Dec 2021 14:52:27 +0000
* Date: Fri, 24 Dec 2021 21:53:37 +0000
*/

.terminal .terminal-output .format, .cmd .format,
Expand Down Expand Up @@ -136,9 +136,15 @@ body.full-screen-terminal .terminal {
.cmd a[href]:not(.terminal-inverted),
.terminal .terminal-output > :not(.raw) a[href]:not(.terminal-inverted) {
--color: var(--link-color, #3377FF);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal .terminal-output > :not(.raw) a[href].terminal-inverted {
background: var(--color, #ccc);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--background, #000);
}
.terminal .terminal-output > :not(.raw) a[href]:hover, .cmd a[href]:hover {
background-color: #3377FF;
Expand Down Expand Up @@ -365,6 +371,8 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
Expand All @@ -379,6 +387,8 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
Expand All @@ -392,11 +402,15 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
color: inherit;
color: var(--original-background, var(--original-color, #aaa));
-webkit-box-shadow: none;
box-shadow: none;
}
}
/* GLOW ANIMATION */
Expand Down Expand Up @@ -708,9 +722,6 @@ terminal .terminal-output > div {
/* padding added as margin to .cmd to fix FireFox bug see: https://stackoverflow.com/q/29986977/387194 */
.terminal {
padding-bottom: 0;
/* conditionals in CSS ref: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal .terminal-output > :not(.raw) .error,
.terminal .terminal-output > :not(.raw) .error * {
Expand All @@ -736,6 +747,9 @@ terminal .terminal-output > div {
.cmd div {
color: var(--color, #aaa);
background-color: var(--background, #000);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal span[style*="--length"] {
/*
Expand Down
6 changes: 3 additions & 3 deletions css/jquery.terminal-2.30.2.min.css

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions css/jquery.terminal-src.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ body.full-screen-terminal .terminal {
.cmd a[href]:not(.terminal-inverted),
.terminal .terminal-output > :not(.raw) a[href]:not(.terminal-inverted) {
--color: var(--link-color, #3377FF);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal .terminal-output > :not(.raw) a[href].terminal-inverted {
background: var(--color, #ccc);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--background, #000);
}
.terminal .terminal-output > :not(.raw) a[href]:hover, .cmd a[href]:hover {
background-color: #3377FF;
Expand Down Expand Up @@ -365,6 +371,8 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
Expand All @@ -379,6 +387,8 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
Expand All @@ -392,11 +402,15 @@ terminal .terminal-output > div {
background-color: var(--original-color, #aaa);
color: #000;
color: var(--background, #000);
-webkit-box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
box-shadow: 0 0 calc(var(--glow) * 3px) var(--color, #aaa);
}
50.1%, 100% {
background-color: inherit;
color: inherit;
color: var(--original-background, var(--original-color, #aaa));
-webkit-box-shadow: none;
box-shadow: none;
}
}
/* GLOW ANIMATION */
Expand Down Expand Up @@ -708,9 +722,6 @@ terminal .terminal-output > div {
/* padding added as margin to .cmd to fix FireFox bug see: https://stackoverflow.com/q/29986977/387194 */
.terminal {
padding-bottom: 0;
/* conditionals in CSS ref: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal .terminal-output > :not(.raw) .error,
.terminal .terminal-output > :not(.raw) .error * {
Expand All @@ -736,6 +747,9 @@ terminal .terminal-output > div {
.cmd div {
color: var(--color, #aaa);
background-color: var(--background, #000);
/* conditionals: https://www.kizu.ru/conditions-for-css-variables/ */
/* --glow: 0; */
text-shadow: 0 0 calc(var(--glow) * 5px) var(--color, #ccc);
}
.terminal span[style*="--length"] {
/*
Expand Down
Loading

0 comments on commit 7e522c3

Please sign in to comment.