Skip to content

Commit 5bd1018

Browse files
authored
feat(ui): added asciinema player component (nolebase#173)
Signed-off-by: Neko Ayaka <[email protected]>
1 parent 3607e9f commit 5bd1018

File tree

12 files changed

+1777
-7
lines changed

12 files changed

+1777
-7
lines changed

.vscode/settings.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"cSpell.words": [
33
"antfu",
4+
"asciicast",
5+
"asciinema",
46
"Astro",
57
"Attributify",
68
"blurhash",
79
"cijiugechu",
810
"colorette",
911
"datetime",
1012
"easytag",
13+
"ElMassimo",
1114
"emittypes",
1215
"evanw",
1316
"frontmatter",
@@ -17,20 +20,19 @@
1720
"mkdist",
1821
"napi",
1922
"Nisekoi5",
23+
"nodir",
2024
"nolebase",
2125
"Nólëbase",
2226
"quotepath",
2327
"Rehype",
2428
"resvg",
2529
"shikijs",
2630
"thumbhash",
31+
"thumbhashes",
2732
"Twoslash",
2833
"unconfig",
2934
"uncrypto",
30-
"unlazy",
31-
"ElMassimo",
32-
"nodir",
33-
"thumbhashes"
35+
"unlazy"
3436
],
3537
"editor.formatOnSave": false,
3638
"editor.codeActionsOnSave": {

docs/.vitepress/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
166166
{
167167
text: 'Animations',
168168
items: [
169+
{ text: 'Asciinema player', link: '/pages/en/ui/asciinema-player/' },
169170
{ text: 'Rive Canvas (Lazy Teleport)', link: '/pages/en/ui/lazy-teleport-rive-canvas/' },
170171
],
171172
},
@@ -323,6 +324,7 @@ export const sidebars: Record<string, DefaultTheme.Sidebar> = {
323324
{
324325
text: '动画',
325326
items: [
327+
{ text: 'Asciinema 播放器', link: '/pages/en/ui/asciinema-player/' },
326328
{ text: 'Rive Canvas(懒 Teleport)', link: '/pages/zh-CN/ui/lazy-teleport-rive-canvas/' },
327329
],
328330
},
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script setup>
2+
import { NuAsciinemaPlayer } from '@nolebase/ui'
3+
</script>
4+
5+
# Asciinema Player
6+
7+
<NuAsciinemaPlayer
8+
src="/asciinema/test-nyancat.cast"
9+
:preload="true"
10+
:cols="400"
11+
:rows="40"
12+
:auto-play="true"
13+
:controls="true"
14+
:terminal-font-size="'12px'"
15+
:loop="true"
16+
/>
17+
18+
```vue
19+
<script setup>
20+
import { NuAsciinemaPlayer } from '@nolebase/ui'
21+
</script>
22+
23+
<template>
24+
<NuAsciinemaPlayer
25+
src="/asciinema/test-nyancat.cast"
26+
:preload="true"
27+
:cols="400"
28+
:rows="40"
29+
:auto-play="true"
30+
:controls="true"
31+
:terminal-font-size="'12px'"
32+
:loop="true"
33+
/>
34+
</template>
35+
```
36+
37+
## Acknowledgements
38+
39+
- [NARKOZ/go-nyancat: Nyancat in your terminal](https://github.com/NARKOZ/go-nyancat)
40+
- [klange/nyancat: Nyancat in your terminal, rendered through ANSI escape sequences. This is the source for the Debian package `nyancat`.](https://github.com/klange/nyancat)
41+
- [休息一下,看看彩虹貓囉! Take a break at the Linux command line with Nyan Cat - HackMD](https://hackmd.io/@brlin/SkJi-KlWV/https%3A%2F%2Fhackmd.io%2FG1PDyxHYRjyE8UYewYePvQ?type=book)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script setup>
2+
import { NuAsciinemaPlayer } from '@nolebase/ui'
3+
</script>
4+
5+
# Asciinema 播放器
6+
7+
<NuAsciinemaPlayer
8+
src="/asciinema/test-nyancat.cast"
9+
:preload="true"
10+
:cols="400"
11+
:rows="40"
12+
:auto-play="true"
13+
:controls="true"
14+
:terminal-font-size="'12px'"
15+
:loop="true"
16+
/>
17+
18+
```vue
19+
<script setup>
20+
import { NuAsciinemaPlayer } from '@nolebase/ui'
21+
</script>
22+
23+
<template>
24+
<NuAsciinemaPlayer
25+
src="/asciinema/test-nyancat.cast"
26+
:preload="true"
27+
:cols="400"
28+
:rows="40"
29+
:auto-play="true"
30+
:controls="true"
31+
:terminal-font-size="'12px'"
32+
:loop="true"
33+
/>
34+
</template>
35+
```
36+
37+
## 致谢
38+
39+
- [NARKOZ/go-nyancat: Nyancat in your terminal](https://github.com/NARKOZ/go-nyancat)
40+
- [klange/nyancat: Nyancat in your terminal, rendered through ANSI escape sequences. This is the source for the Debian package `nyancat`.](https://github.com/klange/nyancat)
41+
- [休息一下,看看彩虹貓囉! Take a break at the Linux command line with Nyan Cat - HackMD](https://hackmd.io/@brlin/SkJi-KlWV/https%3A%2F%2Fhackmd.io%2FG1PDyxHYRjyE8UYewYePvQ?type=book)

docs/public/asciinema/test-nyancat.cast

+1,116
Large diffs are not rendered by default.

docs/vite.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default defineConfig({
3232
'**/*.mov',
3333
'**/*.mp4',
3434
'**/*.riv',
35+
'**/*.cast',
3536
],
3637
optimizeDeps: {
3738
exclude: [

packages/ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
},
7777
"dependencies": {
7878
"@rive-app/canvas": "^2.11.1",
79+
"asciinema-player": "^3.7.1",
7980
"less": "^4.2.0"
8081
},
8182
"devDependencies": {

0 commit comments

Comments
 (0)