@wsxjs/wsx-press 0.0.18
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/dist/client.cjs +1 -0
- package/dist/client.js +1256 -0
- package/dist/index-ChO3PMD5.js +461 -0
- package/dist/index-uNJnOC7n.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +8 -0
- package/dist/node.cjs +47 -0
- package/dist/node.js +1708 -0
- package/package.json +90 -0
- package/src/client/components/DocLayout.css +49 -0
- package/src/client/components/DocLayout.wsx +92 -0
- package/src/client/components/DocPage.css +56 -0
- package/src/client/components/DocPage.wsx +480 -0
- package/src/client/components/DocSearch.css +113 -0
- package/src/client/components/DocSearch.wsx +328 -0
- package/src/client/components/DocSidebar.css +97 -0
- package/src/client/components/DocSidebar.wsx +173 -0
- package/src/client/components/DocTOC.css +105 -0
- package/src/client/components/DocTOC.wsx +262 -0
- package/src/client/index.ts +32 -0
- package/src/client/styles/code.css +242 -0
- package/src/client/styles/index.css +12 -0
- package/src/client/styles/reset.css +116 -0
- package/src/client/styles/theme.css +171 -0
- package/src/client/styles/typography.css +239 -0
- package/src/index.ts +26 -0
- package/src/node/index.ts +16 -0
- package/src/node/metadata.ts +113 -0
- package/src/node/plugin.ts +223 -0
- package/src/node/search.ts +53 -0
- package/src/node/toc.ts +148 -0
- package/src/node/typedoc.ts +96 -0
- package/src/types/wsx.d.ts +11 -0
- package/src/types.test.ts +118 -0
- package/src/types.ts +150 -0
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wsxjs/wsx-press",
|
|
3
|
+
"version": "0.0.18",
|
|
4
|
+
"description": "A VitePress-like documentation system built with WSXJS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"import": "./dist/client.js",
|
|
15
|
+
"require": "./dist/client.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./node": {
|
|
18
|
+
"import": "./dist/node.js",
|
|
19
|
+
"require": "./dist/node.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"src",
|
|
25
|
+
"!**/__tests__",
|
|
26
|
+
"!**/test"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"fuse.js": "^7.0.0",
|
|
30
|
+
"marked": "^12.0.0",
|
|
31
|
+
"@wsxjs/wsx-core": "0.0.18",
|
|
32
|
+
"@wsxjs/wsx-logger": "0.0.18",
|
|
33
|
+
"@wsxjs/wsx-router": "0.0.18",
|
|
34
|
+
"@wsxjs/wsx-marked-components": "0.0.18"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/fs-extra": "^11.0.4",
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.37.0",
|
|
41
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
42
|
+
"eslint": "^9.31.0",
|
|
43
|
+
"fs-extra": "^11.2.0",
|
|
44
|
+
"glob": "^11.0.0",
|
|
45
|
+
"memfs": "^4.0.0",
|
|
46
|
+
"typedoc": "^0.26.0",
|
|
47
|
+
"typedoc-plugin-markdown": "^4.0.0",
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"vite": "^5.4.19",
|
|
50
|
+
"vitest": "^2.0.0",
|
|
51
|
+
"@wsxjs/eslint-plugin-wsx": "0.0.18",
|
|
52
|
+
"@wsxjs/wsx-vite-plugin": "0.0.18"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"typedoc": "^0.26.0",
|
|
56
|
+
"typedoc-plugin-markdown": "^4.0.0"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"wsx",
|
|
60
|
+
"web-components",
|
|
61
|
+
"documentation",
|
|
62
|
+
"docs",
|
|
63
|
+
"markdown",
|
|
64
|
+
"typedoc",
|
|
65
|
+
"typescript",
|
|
66
|
+
"vite"
|
|
67
|
+
],
|
|
68
|
+
"author": "WSXJS Team",
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"repository": {
|
|
71
|
+
"type": "git",
|
|
72
|
+
"url": "https://github.com/wsxjs/wsxjs.git",
|
|
73
|
+
"directory": "packages/wsx-press"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "vite build",
|
|
80
|
+
"build:dev": "NODE_ENV=development vite build",
|
|
81
|
+
"dev": "NODE_ENV=development vite build --watch",
|
|
82
|
+
"clean": "rm -rf dist",
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"lint": "eslint .",
|
|
85
|
+
"lint:fix": "eslint . --fix",
|
|
86
|
+
"test": "vitest --run",
|
|
87
|
+
"test:watch": "vitest",
|
|
88
|
+
"test:coverage": "vitest --run --coverage"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
wsx-doc-layout {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
width: 100%;
|
|
5
|
+
min-height: calc(100vh - var(--nav-height, 70px));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.doc-layout {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: 1600px;
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
gap: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.doc-layout-sidebar {
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
/* Sidebar 宽度由 wsx-doc-sidebar 组件控制 */
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.doc-layout-main {
|
|
23
|
+
flex: 1;
|
|
24
|
+
min-width: 0; /* 允许 flex 子元素收缩 */
|
|
25
|
+
padding: var(--doc-layout-main-padding-y, 1.5rem) var(--doc-layout-main-padding-x, 2rem);
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.doc-layout-toc {
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
/* TOC 宽度由 wsx-doc-toc 组件控制 */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 响应式设计 */
|
|
35
|
+
@media (max-width: 1280px) {
|
|
36
|
+
.doc-layout-toc {
|
|
37
|
+
display: none; /* 隐藏 TOC */
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@media (max-width: 1024px) {
|
|
42
|
+
.doc-layout-sidebar {
|
|
43
|
+
display: none; /* 隐藏侧边栏 */
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.doc-layout-main {
|
|
47
|
+
padding: var(--doc-layout-main-padding-y, 1.5rem);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxImportSource @wsxjs/wsx-core
|
|
3
|
+
* DocLayout Component
|
|
4
|
+
*
|
|
5
|
+
* Complete documentation layout with sidebar, main content, and TOC.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { LightComponent, autoRegister } from "@wsxjs/wsx-core";
|
|
9
|
+
import styles from "./DocLayout.css?inline";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* DocLayout Component
|
|
13
|
+
*
|
|
14
|
+
* Provides a complete documentation layout with:
|
|
15
|
+
* - Sidebar navigation (DocSidebar)
|
|
16
|
+
* - Main content area (DocPage)
|
|
17
|
+
* - Table of Contents (DocTOC)
|
|
18
|
+
*/
|
|
19
|
+
@autoRegister({ tagName: "wsx-doc-layout" })
|
|
20
|
+
export default class DocLayout extends LightComponent {
|
|
21
|
+
private sidebarInstance: HTMLElement | null = null;
|
|
22
|
+
private docPageInstance: HTMLElement | null = null;
|
|
23
|
+
private tocInstance: HTMLElement | null = null;
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
super({
|
|
27
|
+
styles,
|
|
28
|
+
styleName: "wsx-doc-layout",
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected onConnected() {
|
|
33
|
+
// 在连接后创建子组件实例
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
if (this.connected) {
|
|
36
|
+
// 创建侧边栏
|
|
37
|
+
const sidebarContainer = this.querySelector(".doc-layout-sidebar");
|
|
38
|
+
if (sidebarContainer && !this.sidebarInstance) {
|
|
39
|
+
this.sidebarInstance = document.createElement("wsx-doc-sidebar");
|
|
40
|
+
sidebarContainer.appendChild(this.sidebarInstance);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 创建主内容区
|
|
44
|
+
const mainContainer = this.querySelector(".doc-layout-main");
|
|
45
|
+
if (mainContainer && !this.docPageInstance) {
|
|
46
|
+
this.docPageInstance = document.createElement("wsx-doc-page");
|
|
47
|
+
mainContainer.appendChild(this.docPageInstance);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 创建 TOC
|
|
51
|
+
const tocContainer = this.querySelector(".doc-layout-toc");
|
|
52
|
+
if (tocContainer && !this.tocInstance) {
|
|
53
|
+
this.tocInstance = document.createElement("wsx-doc-toc");
|
|
54
|
+
tocContainer.appendChild(this.tocInstance);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected onDisconnected() {
|
|
61
|
+
// 清理所有子组件实例
|
|
62
|
+
if (this.sidebarInstance) {
|
|
63
|
+
this.sidebarInstance.remove();
|
|
64
|
+
this.sidebarInstance = null;
|
|
65
|
+
}
|
|
66
|
+
if (this.docPageInstance) {
|
|
67
|
+
this.docPageInstance.remove();
|
|
68
|
+
this.docPageInstance = null;
|
|
69
|
+
}
|
|
70
|
+
if (this.tocInstance) {
|
|
71
|
+
this.tocInstance.remove();
|
|
72
|
+
this.tocInstance = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
render() {
|
|
77
|
+
return (
|
|
78
|
+
<div class="doc-layout">
|
|
79
|
+
<aside class="doc-layout-sidebar">
|
|
80
|
+
{/* DocSidebar 实例将在这里动态创建 */}
|
|
81
|
+
</aside>
|
|
82
|
+
<main class="doc-layout-main">
|
|
83
|
+
{/* DocPage 实例将在这里动态创建 */}
|
|
84
|
+
</main>
|
|
85
|
+
<aside class="doc-layout-toc">
|
|
86
|
+
{/* DocTOC 实例将在这里动态创建 */}
|
|
87
|
+
</aside>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.wsx-doc-page {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
min-height: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.doc-page {
|
|
8
|
+
flex: 1;
|
|
9
|
+
padding: var(--doc-page-padding-y, 1rem) var(--doc-page-padding-x, 2rem);
|
|
10
|
+
max-width: 1200px;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.doc-loading,
|
|
16
|
+
.doc-empty {
|
|
17
|
+
text-align: center;
|
|
18
|
+
padding: 3rem;
|
|
19
|
+
color: var(--wsx-press-text-secondary, #666);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.doc-error {
|
|
23
|
+
padding: 2rem;
|
|
24
|
+
background: var(--wsx-press-error-bg, #fee);
|
|
25
|
+
border: 1px solid var(--wsx-press-error-border, #fcc);
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
color: var(--wsx-press-error-text, #c33);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.doc-error h2 {
|
|
31
|
+
margin-top: 0;
|
|
32
|
+
color: var(--wsx-press-error-title, #a00);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.doc-header {
|
|
36
|
+
margin-bottom: 2rem;
|
|
37
|
+
padding-bottom: 1rem;
|
|
38
|
+
border-bottom: 1px solid var(--wsx-press-border, #ddd);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.doc-title {
|
|
42
|
+
margin: 0 0 0.5rem 0;
|
|
43
|
+
font-size: 2rem;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
color: var(--wsx-press-text-primary, #333);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.doc-description {
|
|
49
|
+
margin: 0;
|
|
50
|
+
color: var(--wsx-press-text-secondary, #666);
|
|
51
|
+
font-size: 1.1rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.doc-content {
|
|
55
|
+
line-height: 1.6;
|
|
56
|
+
}
|