From 6193634a337b38e335a7ff5ead9ca5c18c3413df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 13 Sep 2017 00:38:59 +0200 Subject: [PATCH 1/3] split build script for easier use with phpstorm file watchers --- _build_assets.sh | 16 ++++++++++++++++ _build_common.sh | 3 +++ _build_css.sh | 7 +++++++ _build_html.sh | 6 ++++++ _build_js.sh | 22 +++++++++++++++++++++ build.sh | 50 ++++++------------------------------------------ 6 files changed, 60 insertions(+), 44 deletions(-) create mode 100755 _build_assets.sh create mode 100755 _build_common.sh create mode 100755 _build_css.sh create mode 100755 _build_html.sh create mode 100755 _build_js.sh diff --git a/_build_assets.sh b/_build_assets.sh new file mode 100755 index 0000000..2056499 --- /dev/null +++ b/_build_assets.sh @@ -0,0 +1,16 @@ +#!/bin/bash +source "_build_common.sh" + +echo 'Copying resources...' + +cp -r img out/img +cp favicon.ico out/ + +if [[ $ESP_PROD ]]; then + echo 'Cleaning junk files...' + find out/ -name "*.orig" -delete + find out/ -name "*.xcf" -delete + find out/ -name "*~" -delete + find out/ -name "*.bak" -delete + find out/ -name "*.map" -delete +fi diff --git a/_build_common.sh b/_build_common.sh new file mode 100755 index 0000000..833611b --- /dev/null +++ b/_build_common.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +export FRONT_END_HASH=$(git rev-parse --short HEAD) diff --git a/_build_css.sh b/_build_css.sh new file mode 100755 index 0000000..1cfa157 --- /dev/null +++ b/_build_css.sh @@ -0,0 +1,7 @@ +#!/bin/bash +source "_build_common.sh" + +echo 'Building CSS...' + +mkdir -p out/css +npm run sass -- --output-style compressed sass/app.scss "out/css/app.$FRONT_END_HASH.css" diff --git a/_build_html.sh b/_build_html.sh new file mode 100755 index 0000000..a4f869d --- /dev/null +++ b/_build_html.sh @@ -0,0 +1,6 @@ +#!/bin/bash +source "_build_common.sh" + +echo 'Building HTML...' + +php ./compile_html.php diff --git a/_build_js.sh b/_build_js.sh new file mode 100755 index 0000000..dc5c65b --- /dev/null +++ b/_build_js.sh @@ -0,0 +1,22 @@ +#!/bin/bash +source "_build_common.sh" + +mkdir -p out/js +echo 'Generating lang.js...' +php ./dump_js_lang.php + +echo 'Processing JS...' +npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" --source-maps js/lib \ + js/lib/chibi.js \ + js/lib/keymaster.js \ + js/lib/polyfills.js \ + js/utils.js \ + js/modal.js \ + js/notif.js \ + js/appcommon.js \ + js/lang.js \ + js/wifi.js \ + js/term_* \ + js/debug_screen.js \ + js/soft_keyboard.js \ + js/term.js diff --git a/build.sh b/build.sh index 7f10082..75ac53f 100755 --- a/build.sh +++ b/build.sh @@ -2,51 +2,13 @@ cd $(dirname $0) -FRONT_END_HASH=$(git rev-parse --short HEAD) +source "_build_common.sh" -rm -r out/* -mkdir out/js -mkdir out/css +rm -fr out/* -echo 'Generating lang.js...' -php ./dump_js_lang.php - -echo 'Packing JS...' -npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" --source-maps js/lib \ - js/lib/chibi.js \ - js/lib/keymaster.js \ - js/lib/polyfills.js \ - js/utils.js \ - js/modal.js \ - js/notif.js \ - js/appcommon.js \ - js/lang.js \ - js/wifi.js \ - js/term_* \ - js/debug_screen.js \ - js/soft_keyboard.js \ - js/term.js - -echo 'Building CSS...' - -npm run sass -- --output-style compressed sass/app.scss "out/css/app.$FRONT_END_HASH.css" - -echo 'Building HTML...' - -php ./compile_html.php - -echo 'Copying resources...' - -cp -r img out/img -cp favicon.ico out/ - -if [[ $ESP_PROD ]]; then - echo 'Cleaning junk files...' - find out/ -name "*.orig" -delete - find out/ -name "*.xcf" -delete - find out/ -name "*~" -delete - find out/ -name "*.bak" -delete - find out/ -name "*.map" -delete -fi +./_build_css.sh +./_build_js.sh +./_build_html.sh +./_build_assets.sh echo 'ESPTerm front-end ready' From e23191e7042fe3d0cd824dc90ea35a1b964ce1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 13 Sep 2017 00:39:19 +0200 Subject: [PATCH 2/3] add print stylesheet --- sass/_print_override.scss | 115 ++++++++++++++++++++++++++++++++++++++ sass/app.scss | 2 + 2 files changed, 117 insertions(+) create mode 100644 sass/_print_override.scss diff --git a/sass/_print_override.scss b/sass/_print_override.scss new file mode 100644 index 0000000..cb8bf86 --- /dev/null +++ b/sass/_print_override.scss @@ -0,0 +1,115 @@ +@media print { + .Row.buttons, nav { + display: none !important; + } + .Row.buttons .button { + display: none !important; + } + + h1, h2, h3 { + // chrome ignores those :( + break-after: avoid-page!important; + page-break-after: avoid!important; + font-family: sans-serif; + } + + html, body { + background: white; + color: black; + font-family: serif; + //font-size: 12pt; + line-height: 1.3em; + } + + label, p { + color: black !important; + text-shadow: none !important; + } + + .Box { + box-shadow: none; + } + + input, select, button { + background: white !important; + color: black !important; + border: 1px solid black !important; + } + + a { + color: #004eff !important; + } + + a[href^="http://"]::after, + a[href^="https://"]::after { + content: attr(href); + padding-left: .8ex; + text-decoration: underline !important; + } + p a { + word-wrap: break-word; + } + + .Row.checkbox .box { + border-color: black; + border-radius: 3px; + background: white; + color: black; + } + + .button { + background: white; border: 1px solid black; + text-shadow: none !important; + color: black; + box-shadow: none; + text-decoration: underline !important; + } + + [class^="icn-"], [class*=" icn-"] { + &::before { + display: none; + } + } + + .Box .Row { + display: block !important; + } + + .Box.fold h2::after { + display: none; + } + + #outer { + display: block; + overflow: auto; + width: unset; + height: unset; + position: static; + } + + html, body { + overflow: auto !important; + width: unset; height: unset; + } + + .Box { + padding: 0; border: 0 none; + } + + .charset div span:nth-child(1), + .charset div span:nth-child(2) { + color: #666; + } + + .page-help code { + background: rgba(0, 215, 255, 0.31); + } + + [noprint] { + display: none !important; + } + + #content tbody th { + color: black !important; + } +} diff --git a/sass/app.scss b/sass/app.scss index 6177e38..554a541 100755 --- a/sass/app.scss +++ b/sass/app.scss @@ -55,3 +55,5 @@ $screen-stack: "DejaVu Sans Mono", "Liberation Mono", "Inconsolata", "Menlo", mo @include media($tablet-max) { .mq-normal-min { display: none !important; } } + +@import "print_override"; From da738838e53dac79968885974a4bf8ef195aabf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 13 Sep 2017 00:39:36 +0200 Subject: [PATCH 3/3] updated help page --- pages/about.php | 2 +- pages/help.php | 7 ++- pages/help/cmd_cursor.php | 18 ++++++++ pages/help/cmd_screen.php | 7 +++ pages/help/cmd_system.php | 81 +++++++++++++++++++++++++++++----- pages/help/screen_behavior.php | 15 ++++++- pages/help/sgr_colors.php | 26 ++++++++--- pages/help/sgr_styles.php | 18 ++++++-- sass/layout/_base.scss | 4 ++ sass/pages/_about.scss | 5 +++ 10 files changed, 162 insertions(+), 21 deletions(-) diff --git a/pages/about.php b/pages/about.php index b6ea8dd..6e7d4c5 100644 --- a/pages/about.php +++ b/pages/about.php @@ -2,7 +2,7 @@

ESP8266 Remote Terminal

- +

© Ondřej Hruška, 2016-2017 diff --git a/pages/help.php b/pages/help.php index 575d4d5..12bbb45 100644 --- a/pages/help.php +++ b/pages/help.php @@ -1,5 +1,10 @@

- Expand all | Collapse all +
Expand all | Collapse all
+ +
+ Note: This list of commands is not exhaustive. \\ + There's a more detailed and technical + document available online.
diff --git a/pages/help/cmd_cursor.php b/pages/help/cmd_cursor.php index 4dd0d13..9ede2f2 100644 --- a/pages/help/cmd_cursor.php +++ b/pages/help/cmd_cursor.php @@ -184,6 +184,15 @@ Enable (`h`) or disable (`l`) cursor auto-wrap and screen auto-scroll + + + + \e[?12h \\ + \e[?12l + + + Toggle cursor blinking (`h` on, `l` off) + @@ -193,6 +202,15 @@ Show (`h`) or hide (`l`) the cursor + + + + \e[?45h \\ + \e[?45l + + + Enable (`h`) or disable (`l`) reverse wrap-around (when using "move left" or backspace) + diff --git a/pages/help/cmd_screen.php b/pages/help/cmd_screen.php index 948b8a8..d19c0b3 100644 --- a/pages/help/cmd_screen.php +++ b/pages/help/cmd_screen.php @@ -34,6 +34,13 @@ Erase _n_ characters in line. + + + `\e[nb` + + Repeat last printed characters _n_ times (moving cursor and using the current style). + + diff --git a/pages/help/cmd_system.php b/pages/help/cmd_system.php index 18a76de..f7b19f0 100644 --- a/pages/help/cmd_system.php +++ b/pages/help/cmd_system.php @@ -18,6 +18,10 @@ The screen size, title and button labels remain unchanged. + + `\e[8;r;ct` + Set screen size to _r_ rows and _c_ columns (this is a command borrowed from Xterm) + `\e[5n` @@ -33,6 +37,15 @@ spontaneous restarts which require a full screen repaint. + + `\e[n q` + + Set cursor style: eg. `\e[3 q` (the space is part of the command!). + 0~-~block~(blink), 1~-~default, 2~-~block~(steady), 3~-~underline~(blink), + 4~-~underline~(steady), 5~-~I-bar~(blink), 6~-~I-bar~(steady). The default style (number 1) + can be configured in Terminal Settings + + `\e]0;t\a` Set screen title to _t_ (this is a standard OSC command) @@ -40,23 +53,48 @@ - \e]80+n;t\a + \e]8x;t\a - Set label for button _n_ = 1-5 (code 81-85) to _t_ - e.g.`\e]81;Yes\a` + Set label for button 1-5 (code 81-85) to _t_ - e.g.`\e]81;Yes\a` sets the first button text to "Yes". - \e]90+n;m\a + \e]9x;m\a + + + + Set message for button 1-5 (code 91-95) to _m_ - e.g.`\e]94;*\a` + sets the 3rd button to send "*" when pressed. The message can be up to + 10 bytes long. + + + + + + \e]9;t\a + + + + Show a notification with text _t_. This will be either a desktop notification + or a pop-up balloon. + + + + + + \e[?ns \\ + \e[?nr - Set message for button _n_ = 1-5 (code 91-95) to _m_ - e.g.`\e]94;iv\a` - sets the 3rd button to send string "iv" when pressed. + Save (`s`) and restore (`r`) any option set using `CSI ? n h`. + This is used by some applications to back up the original state before + making changes. @@ -67,7 +105,7 @@ - Show (`h`) or hide (`l`) action buttons (the blue buttons under the screen). + Show (`h`) or hide (`l`) the action buttons (the blue buttons under the screen). @@ -81,6 +119,33 @@ Show (`h`) or hide (`l`) menu/help links under the screen. + + + + \e[?2004h \\ + \e[?2004l + + + + Enable (`h`) or disable (`l`) Bracketed Paste mode. + This mode makes any text sent using the Upload Tool be preceded by `\e[200\~` + and terminated by `\e[201\~`. This is useful for distinguishing keyboard input + from uploads. + + + + + + \e[?1049h \\ + \e[?1049l + + + + Switch to (`h`) or from (`l`) an alternate screen. + ESPTerm can't implement this fully, so the original screen content is not saved, + but it will remember the cursor, screen size, terminal title, button labels and messages. + + @@ -93,10 +158,6 @@ SRM is the opposite of Local Echo, meaning `\e[12h` disables and `\e[12l` enables Local Echo. - - `\e[8;r;ct` - Set screen size to _r_ rows and _c_ columns (this is a command borrowed from Xterm) - diff --git a/pages/help/screen_behavior.php b/pages/help/screen_behavior.php index 68e3641..96fbd8d 100644 --- a/pages/help/screen_behavior.php +++ b/pages/help/screen_behavior.php @@ -3,7 +3,8 @@

- The initial screen size, title text and button labels can be configured in Terminal Settings. + The initial screen size, title text and button labels can be configured + in Terminal Settings.

@@ -13,5 +14,17 @@ repaint. If you experience issues (broken image due to dropped bytes), try adjusting those config options. It may also be useful to try different baud rates.

+ +

UTF-8 support

+ +

+ ESPTerm supports all UTF-8 characters, but to reduce the screen buffer RAM size, + only a small amount of unique multi-byte characters can be used at the same time + (up to 160, depending on compile flags). Unique multi-byte characters are stored in a + look-up table and are removed when they are no longer used on the screen. In + rare cases it can happen that a character stays in the table after no longer + being used (this can be noticed when the table fills up and new characters + are not shown correctly). This is fixed by clearing the screen (`\e[2J` or `\ec`). +

diff --git a/pages/help/sgr_colors.php b/pages/help/sgr_colors.php index 85a1047..b9a0e55 100644 --- a/pages/help/sgr_colors.php +++ b/pages/help/sgr_colors.php @@ -1,16 +1,18 @@ -
+

Commands: Color SGR

- Colors are set using SGR commands (like `\e[10;20;30m`). The following tables list the SGR codes to use. - Selected colors are used for any new text entered, as well as for empty space when using line and screen clearing commands. - The configured default colors can be restored using SGR 39 for foreground and SGR 49 for background. + Colors are set using SGR commands (like `\e[30;47m`). The following tables list the SGR + codes to use. Selected colors are used for any new text entered, as well as for empty + space when using clearing commands (except screen reset `\ec`, which first clears all + style attriutes. The configured default colors can be restored using `SGR 39` for + foreground and `SGR 49` for background.

- The actual color representation depends on a color theme which + The actual color representation of the basic 16 colors depends on a color theme which can be selected in Terminal Settings.

@@ -61,5 +63,19 @@ 106 107
+ +

256-color palette

+ +

+ ESPTerm supports in total 256 standard colors. The dark and bright basic colors are + numbered 0-7 and 8-15. To use colors higher than 15 (or 0-15 using this simpler numbering), + send `CSI 38 ; 5 ; n m`, where `n` is the color to set. Use 48 for background colors. +

+ +

+ For a fererence of all 256 shades please refer to + jonasjacek.github.io/colors + or look it up elsewhere. +

diff --git a/pages/help/sgr_styles.php b/pages/help/sgr_styles.php index a1e5237..bfa788a 100644 --- a/pages/help/sgr_styles.php +++ b/pages/help/sgr_styles.php @@ -3,7 +3,7 @@

- All text attributes are set using SGR commands like `\e[10;20;30m`, with up to 10 numbers separated by semicolons. + All text attributes are set using SGR commands like `\e[1;4m`, with up to 10 numbers separated by semicolons. To restore all attributes to their default states, use SGR 0: `\e[0m` or `\e[m`.

@@ -16,11 +16,23 @@ Faint222 Italic323 Underlined424 - Blink525 - Inverse727 Striked929 + Overline5355 + Blink525 + Inverse727 𝔉𝔯𝔞𝔨𝔱𝔲𝔯2023 + Conceal1828 +

1Conceal turns all characters invisible.

+ + diff --git a/sass/layout/_base.scss b/sass/layout/_base.scss index bac9829..2ad5c8b 100755 --- a/sass/layout/_base.scss +++ b/sass/layout/_base.scss @@ -26,6 +26,10 @@ a:hover { display: none !important; } +.invisible { + visibility: hidden !important; +} + [onclick] { cursor: pointer; } diff --git a/sass/pages/_about.scss b/sass/pages/_about.scss index 072d2f5..70d8e7a 100644 --- a/sass/pages/_about.scss +++ b/sass/pages/_about.scss @@ -126,3 +126,8 @@ } } } + +.smallpad { + display: block; + padding-bottom: 5px; +}