@kawapress/plugin-code-group 0.0.1 → 0.2.0
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/README.md +17 -5
- package/README.zh-CN.md +17 -5
- package/package.json +2 -2
- package/src/code-group.css +90 -0
- package/src/runtime-plugin.ts +1 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
|
-
<a href="https://www.npmjs.com/package/kawapress"><img src="https://img.shields.io/npm/v/kawapress
|
|
19
|
+
<a href="https://www.npmjs.com/package/kawapress"><img src="https://img.shields.io/npm/v/kawapress?label=npm&color=42b883" alt="npm version"></a>
|
|
20
20
|
<a href="https://github.com/ShenQingchuan/kawapress/actions/workflows/deploy-pages.yml"><img src="https://github.com/ShenQingchuan/kawapress/actions/workflows/deploy-pages.yml/badge.svg" alt="documentation build"></a>
|
|
21
21
|
<a href="https://github.com/ShenQingchuan/kawapress/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ShenQingchuan/kawapress" alt="MIT license"></a>
|
|
22
22
|
<img src="https://img.shields.io/badge/Node.js-%E2%89%A522.12-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22.12 or newer">
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
<a href="https://github.com/ShenQingchuan/kawapress/blob/main/README.zh-CN.md">简体中文</a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
> KawaPress is in beta. It is ready for testing and early projects, but APIs may change before 0.1.0. Please pin the version when adopting it today.
|
|
31
|
+
If you run into any problems while using KawaPress, please [open an issue](https://github.com/ShenQingchuan/kawapress/issues). Your feedback helps shape the project during its early development.
|
|
33
32
|
|
|
34
33
|
## Why KawaPress?
|
|
35
34
|
|
|
@@ -47,6 +46,18 @@ KawaPress is an independent project. It is not a VitePress fork or a drop-in rep
|
|
|
47
46
|
|
|
48
47
|
You need [Node.js](https://nodejs.org/) 22.12 or newer.
|
|
49
48
|
|
|
49
|
+
Create a new site with the scaffolder:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm create kawapress@latest my-kawapress-site
|
|
53
|
+
cd my-kawapress-site
|
|
54
|
+
npm run dev
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`pnpm create kawapress my-kawapress-site` and `yarn create kawapress my-kawapress-site` do the same thing. The scaffolder asks for a site title and a default language, and can install dependencies for you.
|
|
58
|
+
|
|
59
|
+
If you would rather see every file from the start, set the site up by hand:
|
|
60
|
+
|
|
50
61
|
```sh
|
|
51
62
|
mkdir my-kawapress-site
|
|
52
63
|
cd my-kawapress-site
|
|
@@ -115,7 +126,7 @@ KawaPress keeps extension boundaries explicit:
|
|
|
115
126
|
- a **Runtime Plugin** extends the real Vue App and Vue Router in both SSR and the browser;
|
|
116
127
|
- a **Preset** combines configuration and plugins into a ready-to-use experience such as nagi.
|
|
117
128
|
|
|
118
|
-
A logical plugin is installed once and can provide both generator and runtime behavior. Learn more in the [Plugin System guide](https://shenqingchuan.github.io/kawapress/en/
|
|
129
|
+
A logical plugin is installed once and can provide both generator and runtime behavior. Learn more in the [Plugin System guide](https://shenqingchuan.github.io/kawapress/en/plugins/plugin-system).
|
|
119
130
|
|
|
120
131
|
## Documentation
|
|
121
132
|
|
|
@@ -123,7 +134,8 @@ A logical plugin is installed once and can provide both generator and runtime be
|
|
|
123
134
|
- [What is KawaPress?](https://shenqingchuan.github.io/kawapress/en/guide/what-is-kawapress)
|
|
124
135
|
- [Markdown Extensions](https://shenqingchuan.github.io/kawapress/en/guide/markdown-extensions)
|
|
125
136
|
- [Internationalization](https://shenqingchuan.github.io/kawapress/en/guide/internationalization)
|
|
126
|
-
- [Plugin System](https://shenqingchuan.github.io/kawapress/en/
|
|
137
|
+
- [Plugin System](https://shenqingchuan.github.io/kawapress/en/plugins/plugin-system)
|
|
138
|
+
- [Official Plugins](https://shenqingchuan.github.io/kawapress/en/plugins/overview)
|
|
127
139
|
- [Theme Customization](https://shenqingchuan.github.io/kawapress/en/guide/theme-customization)
|
|
128
140
|
|
|
129
141
|
## Contributing
|
package/README.zh-CN.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
|
-
<a href="https://www.npmjs.com/package/kawapress"><img src="https://img.shields.io/npm/v/kawapress
|
|
19
|
+
<a href="https://www.npmjs.com/package/kawapress"><img src="https://img.shields.io/npm/v/kawapress?label=npm&color=42b883" alt="npm 版本"></a>
|
|
20
20
|
<a href="https://github.com/ShenQingchuan/kawapress/actions/workflows/deploy-pages.yml"><img src="https://github.com/ShenQingchuan/kawapress/actions/workflows/deploy-pages.yml/badge.svg" alt="文档构建状态"></a>
|
|
21
21
|
<a href="https://github.com/ShenQingchuan/kawapress/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ShenQingchuan/kawapress" alt="MIT 许可"></a>
|
|
22
22
|
<img src="https://img.shields.io/badge/Node.js-%E2%89%A522.12-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22.12 或更高版本">
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
<a href="https://github.com/ShenQingchuan/kawapress/blob/main/README.md">English</a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
> KawaPress 目前处于 beta 阶段,适合试用和早期项目。0.1.0 之前,公开 API 仍可能调整;现阶段使用时请固定具体版本。
|
|
31
|
+
使用 KawaPress 时遇到任何问题,欢迎到 [提交 Issue](https://github.com/ShenQingchuan/kawapress/issues) 反馈,一起参与本项目的早期建设。
|
|
33
32
|
|
|
34
33
|
## 为什么选择 KawaPress?
|
|
35
34
|
|
|
@@ -47,6 +46,18 @@ KawaPress 是一个独立项目,不是 VitePress 的分支或配置兼容层
|
|
|
47
46
|
|
|
48
47
|
请先准备 [Node.js](https://nodejs.org/) 22.12 或更高版本。
|
|
49
48
|
|
|
49
|
+
用脚手架创建新站点:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm create kawapress@latest my-kawapress-site
|
|
53
|
+
cd my-kawapress-site
|
|
54
|
+
npm run dev
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`pnpm create kawapress my-kawapress-site` 和 `yarn create kawapress my-kawapress-site` 的作用完全一样。脚手架会询问站点标题和默认语言,也可以顺便帮你安装依赖。
|
|
58
|
+
|
|
59
|
+
如果你更想从零看清每个文件,可以手动创建:
|
|
60
|
+
|
|
50
61
|
```sh
|
|
51
62
|
mkdir my-kawapress-site
|
|
52
63
|
cd my-kawapress-site
|
|
@@ -115,7 +126,7 @@ KawaPress 把扩展边界分得很清楚:
|
|
|
115
126
|
- **Runtime Plugin** 在 SSR 和浏览器中扩展真实的 Vue App 与 Vue Router;
|
|
116
127
|
- **Preset** 把配置和一组插件组合成可以直接使用的产品体验,例如 nagi。
|
|
117
128
|
|
|
118
|
-
一个逻辑插件只需要安装一次,同时可以提供生成侧和运行侧能力。更多内容请查看[插件体系](https://shenqingchuan.github.io/kawapress/
|
|
129
|
+
一个逻辑插件只需要安装一次,同时可以提供生成侧和运行侧能力。更多内容请查看[插件体系](https://shenqingchuan.github.io/kawapress/plugins/plugin-system)。
|
|
119
130
|
|
|
120
131
|
## 文档
|
|
121
132
|
|
|
@@ -123,7 +134,8 @@ KawaPress 把扩展边界分得很清楚:
|
|
|
123
134
|
- [KawaPress 是什么?](https://shenqingchuan.github.io/kawapress/guide/what-is-kawapress)
|
|
124
135
|
- [Markdown 语法扩展](https://shenqingchuan.github.io/kawapress/guide/markdown-extensions)
|
|
125
136
|
- [国际化](https://shenqingchuan.github.io/kawapress/guide/internationalization)
|
|
126
|
-
- [插件体系](https://shenqingchuan.github.io/kawapress/
|
|
137
|
+
- [插件体系](https://shenqingchuan.github.io/kawapress/plugins/plugin-system)
|
|
138
|
+
- [官方插件总览](https://shenqingchuan.github.io/kawapress/plugins/overview)
|
|
127
139
|
- [主题定制](https://shenqingchuan.github.io/kawapress/guide/theme-customization)
|
|
128
140
|
|
|
129
141
|
## 参与贡献
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kawapress/plugin-code-group",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "Accessible code group tabs for KawaPress",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://shenqingchuan.github.io/kawapress/",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"vue": "^3.5.41",
|
|
41
|
-
"kawapress": "0.0
|
|
41
|
+
"kawapress": "0.2.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@mdit/plugin-container": "^1.0.2"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@layer kawa.plugin {
|
|
2
|
+
.kawa-code-group {
|
|
3
|
+
margin: 1rem 0;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
background: var(--kawa-c-bg-soft);
|
|
6
|
+
border: 1px solid var(--kawa-c-divider);
|
|
7
|
+
border-radius: var(--kawa-radius);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.kawa-code-group__tabs {
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 1rem;
|
|
13
|
+
padding: 0 1rem;
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
overflow-y: hidden;
|
|
16
|
+
border-bottom: 1px solid var(--kawa-c-divider);
|
|
17
|
+
overscroll-behavior-inline: contain;
|
|
18
|
+
/* The tab strip scrolls by touch or trackpad; a native bar would double the border. */
|
|
19
|
+
scrollbar-width: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.kawa-code-group__tabs::-webkit-scrollbar {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.kawa-code-group__tab {
|
|
27
|
+
position: relative;
|
|
28
|
+
flex: none;
|
|
29
|
+
padding: 0.75rem 0.25rem 0.625rem;
|
|
30
|
+
color: var(--kawa-c-text-2);
|
|
31
|
+
font-size: 0.8125rem;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
line-height: 1.5;
|
|
34
|
+
transition: color 180ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.kawa-code-group__tab::after {
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
height: 2px;
|
|
43
|
+
background: var(--kawa-c-brand);
|
|
44
|
+
content: '';
|
|
45
|
+
opacity: 0;
|
|
46
|
+
transform: scaleX(0.6);
|
|
47
|
+
transition:
|
|
48
|
+
opacity 180ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
49
|
+
transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kawa-code-group__tab:hover,
|
|
53
|
+
.kawa-code-group__tab[aria-selected='true'] {
|
|
54
|
+
color: var(--kawa-c-text-1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kawa-code-group__tab[aria-selected='true']::after {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
transform: scaleX(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.kawa-code-group__tab:focus-visible {
|
|
63
|
+
outline: 2px solid var(--kawa-c-brand);
|
|
64
|
+
outline-offset: -2px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.kawa-code-group__panel[hidden] {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* The group already draws the frame, so the code block inside drops its own. */
|
|
72
|
+
.kawa-code-group__panel > .kawa-code-block {
|
|
73
|
+
width: 100%;
|
|
74
|
+
margin: 0;
|
|
75
|
+
border: 0;
|
|
76
|
+
border-radius: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* The tab strip already names the language. */
|
|
80
|
+
.kawa-code-group__panel .kawa-code-block__language {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (prefers-reduced-motion: reduce) {
|
|
85
|
+
.kawa-code-group__tab,
|
|
86
|
+
.kawa-code-group__tab::after {
|
|
87
|
+
transition: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|