@rlabs-inc/create-tui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/create.ts +6 -21
- package/src/index.ts +1 -1
package/package.json
CHANGED
package/src/commands/create.ts
CHANGED
|
@@ -242,9 +242,6 @@ main().catch(console.error)
|
|
|
242
242
|
`
|
|
243
243
|
|
|
244
244
|
const APP_TUI = `<script lang="ts">
|
|
245
|
-
/**
|
|
246
|
-
* Root Application Component
|
|
247
|
-
*/
|
|
248
245
|
import Counter from './components/Counter.tui'
|
|
249
246
|
</script>
|
|
250
247
|
|
|
@@ -257,31 +254,19 @@ const APP_TUI = `<script lang="ts">
|
|
|
257
254
|
gap={2}
|
|
258
255
|
>
|
|
259
256
|
<text variant="accent">Welcome to TUI Framework</text>
|
|
260
|
-
<Counter
|
|
257
|
+
<Counter />
|
|
261
258
|
<text variant="muted">Press Q to quit</text>
|
|
262
259
|
</box>
|
|
263
260
|
`
|
|
264
261
|
|
|
265
262
|
const COUNTER_TUI = `<script lang="ts">
|
|
266
|
-
/**
|
|
267
|
-
* Counter Component
|
|
268
|
-
*
|
|
269
|
-
* A simple reactive counter to demonstrate TUI Framework basics.
|
|
270
|
-
*/
|
|
271
263
|
import { keyboard } from '@rlabs-inc/tui'
|
|
272
264
|
|
|
273
|
-
|
|
265
|
+
const count = signal(0)
|
|
274
266
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
keyboard.onKey((event) => {
|
|
279
|
-
if (event.key === 'ArrowUp' || event.key === '+') {
|
|
280
|
-
count.value++
|
|
281
|
-
}
|
|
282
|
-
if (event.key === 'ArrowDown' || event.key === '-') {
|
|
283
|
-
count.value--
|
|
284
|
-
}
|
|
267
|
+
keyboard.onKey((e) => {
|
|
268
|
+
if (e.key === '+' || e.key === 'ArrowUp') count.value++
|
|
269
|
+
if (e.key === '-' || e.key === 'ArrowDown') count.value--
|
|
285
270
|
})
|
|
286
271
|
</script>
|
|
287
272
|
|
|
@@ -293,6 +278,6 @@ const COUNTER_TUI = `<script lang="ts">
|
|
|
293
278
|
gap={1}
|
|
294
279
|
>
|
|
295
280
|
<text>Count: {count}</text>
|
|
296
|
-
<text variant="muted"
|
|
281
|
+
<text variant="muted">+/- to change</text>
|
|
297
282
|
</box>
|
|
298
283
|
`
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { parseArgs } from 'util'
|
|
|
12
12
|
import { c, symbols } from './utils/colors'
|
|
13
13
|
import { create } from './commands/create'
|
|
14
14
|
|
|
15
|
-
const VERSION = '0.1.
|
|
15
|
+
const VERSION = '0.1.2'
|
|
16
16
|
|
|
17
17
|
const HELP = `
|
|
18
18
|
${c.bold('@rlabs-inc/create-tui')} ${c.muted(`v${VERSION}`)}
|