Swap Hack font with @azurity/pure-nerd-font which provides more icons than Hack

This commit is contained in:
Ni Rui
2022-09-18 20:20:33 +08:00
parent 7a5dc076ff
commit 57816f731f
5 changed files with 70 additions and 55 deletions

View File

@@ -17,8 +17,20 @@ Major dependencies includes:
Packaged by [Christian Hoffmeister](https://github.com/choffmeister/roboto-fontface-bower), Licensed under Apache 2.0 Packaged by [Christian Hoffmeister](https://github.com/choffmeister/roboto-fontface-bower), Licensed under Apache 2.0
- [iconv-lite](https://github.com/ashtuchkin/iconv-lite), Licensed under MIT license - [iconv-lite](https://github.com/ashtuchkin/iconv-lite), Licensed under MIT license
- [buffer](https://github.com/feross/buffer), Licensed under MIT license - [buffer](https://github.com/feross/buffer), Licensed under MIT license
- [Hack font](https://github.com/source-foundry/Hack), [View license](https://github.com/source-foundry/Hack/blob/master/LICENSE.md)
- [fontfaceobserver](https://github.com/bramstein/fontfaceobserver), [View license](https://github.com/bramstein/fontfaceobserver/blob/master/LICENSE) - [fontfaceobserver](https://github.com/bramstein/fontfaceobserver), [View license](https://github.com/bramstein/fontfaceobserver/blob/master/LICENSE)
- [Nerd Font](https://www.nerdfonts.com/), packaged by [@azurity/pure-nerd-font](http://github.com/azurity/pure-nerd-font)
includes icons from following fonts:
- [Powerline Extra Symbols](https://github.com/ryanoasis/powerline-extra-symbols), Licensed under MIT license
- [Font Awesome](https://github.com/FortAwesome/Font-Awesome), [View license](https://github.com/FortAwesome/Font-Awesome/blob/6.x/LICENSE.txt)
- [Font Awesome Extension](https://github.com/AndreLZGava/font-awesome-extension), Licensed under MIT license
- [Material Design Icons](https://github.com/Templarian/MaterialDesign), [View license](https://github.com/Templarian/MaterialDesign/blob/master/LICENSE)
- [Weather Icons](https://github.com/erikflowers/weather-icons), Licensed under SIL OFL 1.1
- [Devicons](https://github.com/vorillaz/devicons), Licensed under MIT license
- [Octicons](https://github.com/primer/octicons), Licensed under MIT license
- [Codicons](https://github.com/microsoft/vscode-codicons), Licensed under MIT License
- [Font Logos (Formerly Font Linux)](https://github.com/Lukas-W/font-logos), Licensed under Unlicense license
- [Pomicons](https://github.com/gabrielelana/pomicons), Licensed under OFL-1.1 license
- ... and more, see [full list](https://github.com/ryanoasis/nerd-fonts/tree/master/src/glyphs)
## For back-end application ## For back-end application

26
package-lock.json generated
View File

@@ -9,6 +9,7 @@
"version": "0.0.0", "version": "0.0.0",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"devDependencies": { "devDependencies": {
"@azurity/pure-nerd-font": "^1.0.0",
"@babel/core": "^7.19.0", "@babel/core": "^7.19.0",
"@babel/eslint-parser": "^7.18.9", "@babel/eslint-parser": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.10", "@babel/plugin-transform-runtime": "^7.18.10",
@@ -29,7 +30,6 @@
"eslint-webpack-plugin": "^3.2.0", "eslint-webpack-plugin": "^3.2.0",
"favicons": "^7.0.0", "favicons": "^7.0.0",
"fontfaceobserver": "^2.3.0", "fontfaceobserver": "^2.3.0",
"hack-font": "^3.3.0",
"html-loader": "^4.1.0", "html-loader": "^4.1.0",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",
@@ -71,6 +71,12 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/@azurity/pure-nerd-font": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azurity/pure-nerd-font/-/pure-nerd-font-1.0.0.tgz",
"integrity": "sha512-cwgO277jMoNa5Xjn6mozYFZiOS7T9VSCZp5YmvHRnnpfn625sLJYWwtRN4HZlXQCd/qBWfNtf7xwtxa9JHUYLQ==",
"dev": true
},
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
"version": "7.18.6", "version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
@@ -5904,12 +5910,6 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"dev": true "dev": true
}, },
"node_modules/hack-font": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/hack-font/-/hack-font-3.3.0.tgz",
"integrity": "sha512-RohrcAr3UaKiIoxDlOytCjObcUAucfFc6V5fKu6gBrvmvTfIXeBqZwR0Q5kb9qpbluThJWt326LClLKIGiFyug==",
"dev": true
},
"node_modules/has": { "node_modules/has": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@@ -11437,6 +11437,12 @@
"@jridgewell/trace-mapping": "^0.3.9" "@jridgewell/trace-mapping": "^0.3.9"
} }
}, },
"@azurity/pure-nerd-font": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azurity/pure-nerd-font/-/pure-nerd-font-1.0.0.tgz",
"integrity": "sha512-cwgO277jMoNa5Xjn6mozYFZiOS7T9VSCZp5YmvHRnnpfn625sLJYWwtRN4HZlXQCd/qBWfNtf7xwtxa9JHUYLQ==",
"dev": true
},
"@babel/code-frame": { "@babel/code-frame": {
"version": "7.18.6", "version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
@@ -15761,12 +15767,6 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"dev": true "dev": true
}, },
"hack-font": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/hack-font/-/hack-font-3.3.0.tgz",
"integrity": "sha512-RohrcAr3UaKiIoxDlOytCjObcUAucfFc6V5fKu6gBrvmvTfIXeBqZwR0Q5kb9qpbluThJWt326LClLKIGiFyug==",
"dev": true
},
"has": { "has": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",

View File

@@ -4,6 +4,7 @@
"description": "Sshwifty Web Front-end Project", "description": "Sshwifty Web Front-end Project",
"main": "", "main": "",
"devDependencies": { "devDependencies": {
"@azurity/pure-nerd-font": "1.0.0",
"@babel/core": "^7.19.0", "@babel/core": "^7.19.0",
"@babel/eslint-parser": "^7.18.9", "@babel/eslint-parser": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.10", "@babel/plugin-transform-runtime": "^7.18.10",
@@ -24,7 +25,6 @@
"eslint-webpack-plugin": "^3.2.0", "eslint-webpack-plugin": "^3.2.0",
"favicons": "^7.0.0", "favicons": "^7.0.0",
"fontfaceobserver": "^2.3.0", "fontfaceobserver": "^2.3.0",
"hack-font": "^3.3.0",
"html-loader": "^4.1.0", "html-loader": "^4.1.0",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",

View File

@@ -20,18 +20,19 @@
@charset "utf-8"; @charset "utf-8";
@import "~hack-font/build/web/hack.css"; @import "~hack-font/build/web/hack.css";
@import "~@azurity/pure-nerd-font/pure-nerd-font.css";
#connector-resource-preload-control-console { #connector-resource-preload-control-console {
font-family: Hack; font-family: PureNerdFont;
} }
#connector-resource-preload-control-console::after { #connector-resource-preload-control-console::after {
content: " "; content: " ";
font-family: Hack; font-family: PureNerdFont;
font-weight: bold; font-weight: bold;
} }
#connector-resource-preload-control-console::before { #connector-resource-preload-control-console::before {
content: " "; content: " ";
font-family: Hack; font-family: PureNerdFont;
font-style: italic; font-style: italic;
} }

View File

@@ -117,7 +117,7 @@ import { consoleScreenKeys } from "./screen_console_keys.js";
import "./screen_console.css"; import "./screen_console.css";
import "xterm/css/xterm.css"; import "xterm/css/xterm.css";
const termTypeFace = "Hack"; const termTypeFace = "PureNerdFont";
const termFallbackTypeFace = "monospace"; const termFallbackTypeFace = "monospace";
const termTypeFaceLoadTimeout = 3000; const termTypeFaceLoadTimeout = 3000;
const termTypeFaceLoadError = const termTypeFaceLoadError =
@@ -200,46 +200,48 @@ class Term {
} }
}); });
this.term.attachCustomKeyEventHandler(async (ev) => { // It seems Xtermjs now handles copy paste by itself, following code is no
if (this.closed) { // longer useful
return true; // this.term.attachCustomKeyEventHandler(async (ev) => {
} // if (this.closed) {
// return true;
// }
if ( // if (
ev.type == "keyup" && // ev.type == "keyup" &&
((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) || // ((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) ||
(ev.key === "Insert" && ev.shiftKey)) // (ev.key === "Insert" && ev.shiftKey))
) { // ) {
try { // try {
let text = await window.navigator.clipboard.readText(); // let text = await window.navigator.clipboard.readText();
this.writeEchoStr(text); // this.writeEchoStr(text);
} catch (e) { // } catch (e) {
alert( // alert(
"Unable to paste: " + // "Unable to paste: " +
e + // e +
". Please try again without using the Control+Shift+V / " + // ". Please try again without using the Control+Shift+V / " +
"Shift+Insert hot key" // "Shift+Insert hot key"
); // );
} // }
return false; // return false;
} // }
if ( // if (
ev.type == "keyup" && // ev.type == "keyup" &&
((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) || // ((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) ||
(ev.key === "Insert" && ev.ctrlKey)) // (ev.key === "Insert" && ev.ctrlKey))
) { // ) {
try { // try {
window.navigator.clipboard.writeText(this.term.getSelection()); // window.navigator.clipboard.writeText(this.term.getSelection());
} catch (e) { // } catch (e) {
alert("Unable to copy: " + e); // alert("Unable to copy: " + e);
} // }
return false; // return false;
} // }
return true; // return true;
}); // });
let resizeDelay = null, let resizeDelay = null,
oldRows = 0, oldRows = 0,