@andrew_l/vue-stdout 0.0.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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/index.d.ts +608 -0
- package/dist/index.mjs +1584 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Andrew L. <andrew.io.dev@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Vue Stdout Toolkit <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
 <!-- omit in toc -->
|
|
4
|
+
 <!-- omit in toc -->
|
|
5
|
+
 <!-- omit in toc -->
|
|
6
|
+
|
|
7
|
+
A custom Vue.js renderer for outputting content directly to the terminal (stdout), combining the flexibility of Vue with the power of console-based rendering.
|
|
8
|
+
|
|
9
|
+
[Documentation](https://men232.github.io/toolkit/reference/@andrew_l/vue-stdout/)
|
|
10
|
+
|
|
11
|
+
<!-- install placeholder -->
|
|
12
|
+
|
|
13
|
+
## โจ Features
|
|
14
|
+
|
|
15
|
+
- **Terminal Flex Layout:** Built with Yoga Layout for flexible box-based terminal layouts.
|
|
16
|
+
- **Base Components:** Simplifies rendering common elements like boxes, text, and progress bars.
|
|
17
|
+
- **TypeScript Ready:** Full TypeScript support for enhanced developer experience.
|
|
18
|
+
- **Lightweight:** Minimal bundle size to ensure fast and efficient runtime performance.
|
|
19
|
+
|
|
20
|
+
## ๐ Usage Example
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import { noop } from '@andrew_l/toolkit';
|
|
24
|
+
import {
|
|
25
|
+
createApp,
|
|
26
|
+
createContainer,
|
|
27
|
+
ProgressBar,
|
|
28
|
+
Box,
|
|
29
|
+
} from '@andrew_l/vue-stdout';
|
|
30
|
+
|
|
31
|
+
// Required for development mode
|
|
32
|
+
// https://github.com/privatenumber/tsx/issues/678
|
|
33
|
+
import '@andrew_l/vue-stdout/runtime';
|
|
34
|
+
|
|
35
|
+
const Main = defineComponent(() => {
|
|
36
|
+
const progress = ref(0);
|
|
37
|
+
|
|
38
|
+
const timer = setInterval(() => {
|
|
39
|
+
progress.value++;
|
|
40
|
+
}, 100);
|
|
41
|
+
|
|
42
|
+
onBeforeUnmount(() => clearInterval(timer));
|
|
43
|
+
|
|
44
|
+
return () => (
|
|
45
|
+
<Box borderStyle="round">
|
|
46
|
+
<Text>
|
|
47
|
+
<Text>Hello From</Text>
|
|
48
|
+
<Text color="green">
|
|
49
|
+
{' '}
|
|
50
|
+
Vue {(progress.value / 4) % 2 !== 0 ? '๐คฏ' : ''}
|
|
51
|
+
</Text>
|
|
52
|
+
</Text>
|
|
53
|
+
|
|
54
|
+
<ProgressBar
|
|
55
|
+
variant="round"
|
|
56
|
+
showPercent
|
|
57
|
+
color={progress.value >= 100 ? 'cyan' : 'green'}
|
|
58
|
+
value={progress.value}
|
|
59
|
+
/>
|
|
60
|
+
</Box>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const app = createApp(Main);
|
|
65
|
+
app.config.warnHandler = noop; // Suppress warnings
|
|
66
|
+
app.mount(createContainer());
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Output
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
|
|
73
|
+
โHello From Vue ๐คฏ โ
|
|
74
|
+
โโญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎโ
|
|
75
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 100%โโ
|
|
76
|
+
โโฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏโ
|
|
77
|
+
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## ๐ค Why Use This Package?
|
|
81
|
+
|
|
82
|
+
1. **Optimized for Terminal:** Ideal for CLI applications, interactive tools, and dashboards.
|
|
83
|
+
2. **Vue Ecosystem:** Leverages Vueโs declarative and reactive system for building rich console interfaces.
|
|
84
|
+
3. **Flexibility with Components:** Provides reusable components like Box, Text, and ProgressBar for structured layouts.
|
|
85
|
+
4. **TypeScript Support:** Offers type definitions for better IDE support and error checking.
|