Skip to content

Commit 44fa718

Browse files
committed
refactor: add better playground
1 parent dd9ed3f commit 44fa718

30 files changed

+215
-297
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"devDependencies": {
2323
"@types/node": "^16.11.29",
2424
"@vitejs/plugin-vue": "^2.3.1",
25+
"@vue/compiler-sfc": "^3.2.33",
26+
"@vue/runtime-core": "^3.2.33",
2527
"c8": "^7.11.2",
2628
"chalk": "^5.0.1",
2729
"conventional-changelog-cli": "^2.2.2",
@@ -35,6 +37,7 @@
3537
"tsup": "^5.12.6",
3638
"typescript": "^4.6.3",
3739
"unplugin-auto-import": "^0.7.1",
40+
"unplugin-vue-components": "^0.19.5",
3841
"vite": "^2.9.6",
3942
"vitest": "^0.10.0",
4043
"vue": "^3.2.33",

packages/cli/vite.config.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite'
2-
import VueTermui from 'vite-plugin-vue-termui'
3-
import Inspect from 'vite-plugin-inspect'
2+
// use dev version directly
3+
import VueTermui from '../vite-plugin-vue-termui/src'
44
import { resolve } from 'path'
55

66
export default defineConfig({
@@ -9,11 +9,9 @@ export default defineConfig({
99
},
1010
resolve: {
1111
alias: {
12+
// Use development version instead of dist
1213
'vue-termui': resolve('../core/src/index.ts'),
1314
},
1415
},
15-
plugins: [
16-
VueTermui(),
17-
// Inspect()
18-
],
16+
plugins: [VueTermui()],
1917
})

packages/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"@types/slice-ansi": "^5.0.0",
6262
"@types/wrap-ansi": "^8.0.1",
6363
"@types/ws": "^8.5.3",
64-
"@vue/runtime-core": "^3.2.33",
6564
"ws": "^8.5.0"
6665
},
6766
"engines": {

packages/core/src/app/createApp.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ import {
1313
} from '../injectionSymbols'
1414
import { createLog } from '../renderer/LogUpdate'
1515
import { baseCreateApp } from '../renderer'
16-
import { RootProps, TuiApp, TuiAppOptions } from './types'
16+
import type { RootProps, TuiApp, TuiAppOptions } from './types'
1717
import {
1818
isRawModeSupported,
1919
RESTORE_SCREEN_BUFFER,
2020
SAVE_SCREEN_BUFFER,
2121
} from '../input/inputSequences'
2222
import { createFocusManager, FocusManagerSymbol } from '../focus/FocusManager'
23-
24-
const noop = () => {}
23+
import { noop } from '../utils'
2524

2625
export function createApp(
2726
rootComponent: Component,
2827
{
29-
// TODO: move this options to mount
3028
stdout = process.stdout,
3129
stdin = process.stdin,
3230
stderr = process.stderr,

packages/core/src/components/App.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const TuiApp = defineComponent({
3030
required: true,
3131
},
3232

33-
// TODO: remove and useStdout() ?
33+
// we need this as a prop instead of useStdout because we need to define the write function here based on the last final render output
3434
stdout: {
3535
type: Object as PropType<NodeJS.WriteStream>,
3636
required: true,

packages/core/src/components/Link.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {
2-
defineComponent,
3-
FunctionalComponent,
4-
h,
5-
toRef,
6-
} from '@vue/runtime-core'
1+
import { defineComponent, h, toRef } from '@vue/runtime-core'
72
import { TuiTextTransform } from './TextTransform'
83
import terminalLink from 'terminal-link'
9-
import { TuiText } from './Text'
104
import { useFocus } from '../focus/Focusable'
115

126
// export const TuiLink: FunctionalComponent<{

packages/core/src/components/TextTransform.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import chalk, { ForegroundColor } from 'chalk'
2-
import {
3-
PropType,
4-
h,
5-
inject,
6-
defineComponent,
7-
onUpdated,
8-
FunctionalComponent,
9-
} from '@vue/runtime-core'
2+
import { h, inject, FunctionalComponent } from '@vue/runtime-core'
103
import { scheduleUpdateSymbol } from '../injectionSymbols'
114
import type { OutputTransformer } from '../renderer/Output'
125
import { defaultStyle, TuiTextProps } from './Text'

packages/core/src/focus/FocusManager.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ import {
88
} from '@vue/runtime-core'
99
import { nextSibling, previousSibling } from '../renderer/nodeOpts'
1010
import { DOMElement, DOMNode, isDOMElement } from '../renderer/dom'
11-
import {
12-
checkCurrentInstance,
13-
getElementFromInstance,
14-
noop,
15-
getVnodeFromInstance,
16-
} from '../utils'
11+
import { checkCurrentInstance, getElementFromInstance, noop } from '../utils'
1712
import { Focusable, FocusId } from './types'
1813

1914
export interface FocusManager {
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["johnsoncodehk.volar"]
3+
}

0 commit comments

Comments
 (0)