Skip to content

Commit 2a9e287

Browse files
committed
chore: update
2 parents bb390d5 + 42f6383 commit 2a9e287

File tree

17 files changed

+200
-19
lines changed

17 files changed

+200
-19
lines changed

netlify.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[build.environment]
22
NODE_VERSION = "16"
3-
NPM_FLAGS = "--version" # prevent Netlify npm install
43

54
[build]
6-
command = "npx pnpm@7 i --store=node_modules/.pnpm-store && npx pnpm@7 run -w docs:build"
5+
command = "pnpm run -w docs:build"
76
ignore = "./scripts/docs-check.sh"
87
publish = "packages/docs/.vitepress/dist"

packages/cli/CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
## [0.0.16](https://github.com/vue-terminal/vue-termui/compare/@vue-termui/[email protected]...@vue-termui/[email protected]) (2022-10-21)
2+
3+
### Bug Fixes
4+
5+
- ci ([#12](https://github.com/vue-terminal/vue-termui/issues/12)) ([3c1d009](https://github.com/vue-terminal/vue-termui/commit/3c1d009a929cac0c786b0e31fd103824971489d1))
6+
- clear screen when swapScreens is true ([5ef1f9e](https://github.com/vue-terminal/vue-termui/commit/5ef1f9eebced1b1bbda919639bec0d451fc96aa3))
7+
- **focus:** correct traversal order ([5ce6381](https://github.com/vue-terminal/vue-termui/commit/5ce6381b1eb773685c187456d1cdcc44f281910e))
8+
9+
### Code Refactoring
10+
11+
- rewrite useStdout() ([7cfba52](https://github.com/vue-terminal/vue-termui/commit/7cfba5296a7728e2a5920ed85a41504c14f9c14c))
12+
13+
### Features
14+
15+
- allow passing auto import options ([7ab9a00](https://github.com/vue-terminal/vue-termui/commit/7ab9a001a61156264a480014ab8ccd734988b3b9))
16+
- allow swapping screens for fullscreen apps ([71e0cdc](https://github.com/vue-terminal/vue-termui/commit/71e0cdcc161a7c5531e36da9b6441d2e26bff895))
17+
- **box:** add basic title ([e5b488d](https://github.com/vue-terminal/vue-termui/commit/e5b488d6e7e18853e4ff5f2e9fa96742c87fcfd3))
18+
- improve debug log ([98a4e50](https://github.com/vue-terminal/vue-termui/commit/98a4e50dc7ed1d24f1537cb44dc582cb5e07b651))
19+
- useTitle ([a8b14ce](https://github.com/vue-terminal/vue-termui/commit/a8b14ce0c8b7aa3e31f1f963a650d672de261ef1))
20+
21+
### BREAKING CHANGES
22+
23+
- now it returns an object with `stdout` and a `write`
24+
method. `stdout` is just the stdout being used by the app while `write`
25+
lets you write to the output without messing up with the current output.
26+
Useful for debugging.
27+
28+
## [0.0.15](https://github.com/vue-terminal/vue-termui/compare/@vue-termui/[email protected]...@vue-termui/[email protected]) (2022-10-21)
29+
30+
### Bug Fixes
31+
32+
- ci ([#12](https://github.com/vue-terminal/vue-termui/issues/12)) ([3c1d009](https://github.com/vue-terminal/vue-termui/commit/3c1d009a929cac0c786b0e31fd103824971489d1))
33+
- clear screen when swapScreens is true ([5ef1f9e](https://github.com/vue-terminal/vue-termui/commit/5ef1f9eebced1b1bbda919639bec0d451fc96aa3))
34+
- **focus:** correct traversal order ([5ce6381](https://github.com/vue-terminal/vue-termui/commit/5ce6381b1eb773685c187456d1cdcc44f281910e))
35+
36+
### Code Refactoring
37+
38+
- rewrite useStdout() ([7cfba52](https://github.com/vue-terminal/vue-termui/commit/7cfba5296a7728e2a5920ed85a41504c14f9c14c))
39+
40+
### Features
41+
42+
- allow passing auto import options ([7ab9a00](https://github.com/vue-terminal/vue-termui/commit/7ab9a001a61156264a480014ab8ccd734988b3b9))
43+
- allow swapping screens for fullscreen apps ([71e0cdc](https://github.com/vue-terminal/vue-termui/commit/71e0cdcc161a7c5531e36da9b6441d2e26bff895))
44+
- **box:** add basic title ([e5b488d](https://github.com/vue-terminal/vue-termui/commit/e5b488d6e7e18853e4ff5f2e9fa96742c87fcfd3))
45+
- improve debug log ([98a4e50](https://github.com/vue-terminal/vue-termui/commit/98a4e50dc7ed1d24f1537cb44dc582cb5e07b651))
46+
- useTitle ([a8b14ce](https://github.com/vue-terminal/vue-termui/commit/a8b14ce0c8b7aa3e31f1f963a650d672de261ef1))
47+
48+
### BREAKING CHANGES
49+
50+
- now it returns an object with `stdout` and a `write`
51+
method. `stdout` is just the stdout being used by the app while `write`
52+
lets you write to the output without messing up with the current output.
53+
Useful for debugging.
54+
155
## [0.0.14](https://github.com/vue-terminal/vue-termui/compare/@vue-termui/[email protected]...@vue-termui/[email protected]) (2022-03-21)
256

357
### Bug Fixes

packages/cli/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"access": "public"
66
},
77
"type": "module",
8-
"version": "0.0.14",
8+
"version": "0.0.16",
99
"scripts": {
1010
"stub": "unbuild --stub",
1111
"build": "tsup",
@@ -27,6 +27,8 @@
2727
},
2828
"files": [
2929
"dist/**/*.js",
30+
"dist/**/*.mjs",
31+
"dist/**/*.cjs",
3032
"dist/**/*.d.ts",
3133
"vtui.mjs"
3234
],
@@ -60,8 +62,8 @@
6062
},
6163
"peerDependencies": {
6264
"vite": "^3.1.3",
63-
"vite-plugin-vue-termui": ">=0.0.8",
64-
"vue-termui": ">=0.0.10"
65+
"vite-plugin-vue-termui": ">=0.0.10",
66+
"vue-termui": ">=0.0.13"
6567
},
6668
"devDependencies": {
6769
"@types/ws": "^8.5.3",

packages/core/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [0.0.13](https://github.com/vue-terminal/vue-termui/compare/[email protected]@0.0.13) (2022-10-21)
2+
3+
### Bug Fixes
4+
5+
- CI ([#3](https://github.com/vue-terminal/vue-termui/issues/3)) ([6e1d106](https://github.com/vue-terminal/vue-termui/commit/6e1d1065bb20e3828c907d70f77ac9d21f42d664))
6+
- **focus:** correct traversal order ([5ce6381](https://github.com/vue-terminal/vue-termui/commit/5ce6381b1eb773685c187456d1cdcc44f281910e))
7+
- should update when mount/unmount text component ([#8](https://github.com/vue-terminal/vue-termui/issues/8)) ([7fb8efc](https://github.com/vue-terminal/vue-termui/commit/7fb8efc566786375e58123b368bcdedf24534444))
8+
9+
### Features
10+
11+
- allow passing auto import options ([7ab9a00](https://github.com/vue-terminal/vue-termui/commit/7ab9a001a61156264a480014ab8ccd734988b3b9))
12+
- improve debug log ([98a4e50](https://github.com/vue-terminal/vue-termui/commit/98a4e50dc7ed1d24f1537cb44dc582cb5e07b651))
13+
114
## [0.0.12](https://github.com/vue-terminal/vue-termui/compare/[email protected]@0.0.12) (2022-03-26)
215

316
### Bug Fixes

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-termui",
3-
"version": "0.0.12",
3+
"version": "0.0.13",
44
"private": false,
55
"type": "module",
66
"types": "./dist/src",
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import {
2+
defineComponent,
3+
h,
4+
inject,
5+
onMounted,
6+
onUpdated,
7+
onUnmounted,
8+
computed,
9+
} from '@vue/runtime-core'
10+
import type { PropType } from '@vue/runtime-core'
11+
import { colorize } from '../renderer/textColor'
12+
import type { ForegroundColorProp } from '../renderer/textColor'
13+
import { scheduleUpdateSymbol } from '../injectionSymbols'
14+
15+
const FIGURES = {
16+
basic: '█',
17+
shade: '▓',
18+
} as const
19+
20+
type FigureType = keyof typeof FIGURES
21+
22+
export const TuiProgressBar = defineComponent({
23+
name: 'TuiProgressBar',
24+
25+
props: {
26+
color: {
27+
required: false,
28+
default: 'blue',
29+
type: String as PropType<ForegroundColorProp>,
30+
},
31+
bgColor: {
32+
required: false,
33+
default: 'white',
34+
type: String as PropType<ForegroundColorProp>,
35+
},
36+
width: {
37+
required: false,
38+
default: 25,
39+
type: Number,
40+
},
41+
value: {
42+
required: true,
43+
type: Number,
44+
},
45+
type: {
46+
required: false,
47+
type: String as PropType<FigureType>,
48+
default: 'basic',
49+
},
50+
},
51+
52+
setup(props) {
53+
const scheduleUpdate = inject(scheduleUpdateSymbol)!
54+
55+
onMounted(scheduleUpdate)
56+
57+
onUpdated(scheduleUpdate)
58+
59+
onUnmounted(scheduleUpdate)
60+
61+
const content = computed(() => {
62+
const type = FIGURES[props.type]
63+
const w = Math.floor(props.value * (props.width / 100))
64+
const bg = colorize(type, props.bgColor, 'foreground')
65+
const fg = colorize(type, props.color, 'foreground')
66+
return fg.repeat(w) + bg.repeat(props.width - w)
67+
})
68+
69+
return () => {
70+
return h('tui:text', content.value)
71+
}
72+
},
73+
})

packages/core/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export { TuiNewline } from './Newline'
44
export { TuiApp } from './App'
55
export { TuiBox } from './Box'
66
export { TuiInput } from './Input'
7+
export { TuiProgressBar } from './ProgressBar'
78

89
export { TuiLink } from './Link'
910
// export { default as TuiInput } from './Input.vue'

packages/core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
TuiLink,
99
TuiTextTransform,
1010
TuiInput,
11+
TuiProgressBar,
1112
} from './components'
1213

1314
export { render } from './renderer'

packages/core/src/renderer/textColor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import chalk from 'chalk'
2-
2+
import type { ForegroundColor } from 'chalk'
33
type ColorType = 'foreground' | 'background'
4+
import type { LiteralUnion } from '../utils'
5+
6+
export type ForegroundColorProp = LiteralUnion<ForegroundColor, string>
47

58
const RGB_LIKE_REGEX = /^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/
69
const ANSI_REGEX = /^(ansi|ansi256)\(\s?(\d+)\s?\)$/

packages/create-vue-termui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [0.0.11](https://github.com/vue-terminal/vue-termui/compare/[email protected]@0.0.11) (2022-10-21)
2+
3+
### Bug Fixes
4+
5+
- ci ([#12](https://github.com/vue-terminal/vue-termui/issues/12)) ([3c1d009](https://github.com/vue-terminal/vue-termui/commit/3c1d009a929cac0c786b0e31fd103824971489d1))
6+
17
## [0.0.10](https://github.com/vue-terminal/vue-termui/compare/[email protected]@0.0.10) (2022-03-21)
28

39
### Bug Fixes

0 commit comments

Comments
 (0)