Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Earlier bindings #3

Merged
merged 2 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# Terminal
## Welcome to `@digital-alchemy/terminal`!

- [Extended docs](https://docs.digital-alchemy.app)
- [Discord](https://discord.gg/JkZ35Gv97Y)

## Overview

This library contains custom tooling for building type safe terminal applications.
It has custom widgets for basic prompts such as string / number / date, as well as more complex widgets like menus & object builders

## Extra Features

- enums for font awesome icons
- automatic screen management
- easy keyboard bindings & management
- compatibility with external editors like vim/nano for setting values

## Notes

> This library is a curious mix of experimental & undocumented and extremely feature rich
>
> Will provide support on Discord as needed if things seem interesting - Zoe
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@digital-alchemy/terminal",
"repository": "https://github.com/Digital-Alchemy-TS/terminal",
"homepage": "https://docs.digital-alchemy.app",
"version": "24.7.1",
"version": "24.7.2",
"scripts": {
"build": "tsc",
"test": "./scripts/test.sh",
Expand All @@ -25,7 +25,6 @@
},
"license": "MIT",
"dependencies": {
"@digital-alchemy/core": "^24.6.6",
"chalk": "^5.3.0",
"chrono-node": "^2.7.5",
"dayjs": "^1.11.10",
Expand All @@ -35,7 +34,11 @@
"fuzzysort": "^2.0.4",
"mute-stream": "^1.0.0"
},
"peerDependencies": {
"@digital-alchemy/core": "*"
},
"devDependencies": {
"@digital-alchemy/core": "^24.7.2",
"@cspell/eslint-plugin": "^8.7.0",
"@types/figlet": "^1.5.8",
"@types/jest": "^29.5.12",
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/keyboard-manager.extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function KeyboardManager({ terminal, lifecycle }: TServiceParams) {
const { chalk } = terminal.internals;
let activeKeymaps: Map<unknown, TTYComponentKeymap> = new Map();

lifecycle.onReady(() => {
lifecycle.onPreInit(() => {
const rl = terminal.screen.rl;
rl.input.on("keypress", (value, key = {}) => {
keyPressHandler({ key, value });
Expand Down
4 changes: 3 additions & 1 deletion src/extensions/text-rendering.extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ function sliceRange({
};
}

const EXTRA_EARLY = 100;

export function TextRendering({
terminal,
config,
Expand All @@ -240,7 +242,7 @@ export function TextRendering({
).split("_");
open = OPEN;
close = CLOSE;
});
}, EXTRA_EARLY);

function fuzzyHighlight<T>(
keys: MatchKeys[],
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,9 @@ __metadata:
languageName: node
linkType: hard

"@digital-alchemy/core@npm:^24.6.6":
version: 24.6.6
resolution: "@digital-alchemy/core@npm:24.6.6"
"@digital-alchemy/core@npm:^24.7.2":
version: 24.7.2
resolution: "@digital-alchemy/core@npm:24.7.2"
dependencies:
chalk: "npm:^5.3.0"
dayjs: "npm:^1.11.11"
Expand All @@ -935,7 +935,7 @@ __metadata:
dependenciesMeta:
redis:
optional: true
checksum: 10/e8b4ed60ebb6170403450da8e1d1c5e285c04a3223c6c7aff5b5c6da05774d029087303fa356b7194912ff8f4626bcb7126f024d535217e9c3b14c57a141fd09
checksum: 10/d45c39883df79ed85e1245bce833db9147d8749282e985ab0258e77989e2cf1dd6ebe62a6f8e2018ba1c5d9890b60bf03515a4d8f0b220229185a4790cbde9db
languageName: node
linkType: hard

Expand All @@ -944,7 +944,7 @@ __metadata:
resolution: "@digital-alchemy/terminal@workspace:."
dependencies:
"@cspell/eslint-plugin": "npm:^8.7.0"
"@digital-alchemy/core": "npm:^24.6.6"
"@digital-alchemy/core": "npm:^24.7.2"
"@types/figlet": "npm:^1.5.8"
"@types/jest": "npm:^29.5.12"
"@types/js-yaml": "npm:^4.0.9"
Expand Down
Loading