Skip to content

Commit 799e39b

Browse files
committed
docs: quick start
1 parent eb60c3c commit 799e39b

File tree

7 files changed

+174
-4
lines changed

7 files changed

+174
-4
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Ignore all files in the dist directory
2+
dist
3+
4+
**/.vitepress/dist
5+
6+
**/cache
7+
8+
# Ignore all files in the modules directory
9+
10+
node_modules
11+
12+
# Ignore all files in the .idea directory
13+
14+
.idea
15+
16+
# Ignore all files in the .vscode directory
17+
18+
.vscode
19+
20+

docs/.vitepress/config.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineConfig({
88
lastUpdated: true,
99
themeConfig: {
1010
logo: "/logo.svg",
11-
11+
1212
editLink: {
1313
pattern: "https://github.com/jwcjs/docs/edit/main/docs/:path",
1414
text: "在 GitHub 上编辑此页",
@@ -18,6 +18,38 @@ export default defineConfig({
1818
{ text: 'Guide', link: '/guide/' },
1919
],
2020

21+
sidebar: {
22+
'/': [
23+
{
24+
text: 'Getting Started', items: [{
25+
text: 'Introduction',
26+
link: '/guide/what-is-jwc',
27+
}, {
28+
text: 'Quick Start',
29+
link: '/guide/quick-start',
30+
}]
31+
},
32+
{
33+
text: 'Components', items: [{
34+
text: 'Defining',
35+
link: '/guide/defining',
36+
}, {
37+
text: 'Rendering',
38+
link: '/guide/rendering',
39+
}, {
40+
text: 'Reactivity',
41+
link: '/guide/reactivity',
42+
}, {
43+
text: 'Styles',
44+
link: '/guide/styles',
45+
}, {
46+
text: 'Lifecycle',
47+
link: '/guide/lifecycle',
48+
},],
49+
},
50+
]
51+
},
52+
2153
footer: {
2254
message: 'Made with ❤️ by Wibus and AkaraChen',
2355
copyright: 'Copyright © 2022-PRESENT Jwc.js',

docs/.vitepress/theme/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import './styles/main.css'
2+
import Theme from 'vitepress/theme'
3+
4+
export default {
5+
...Theme,
6+
}

docs/.vitepress/theme/styles/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:root {
2+
--vp-c-bg-alt: var(--vp-c-bg) !important;
3+
}
4+
5+
/* 缓慢变暗 */
6+
body {
7+
transition: color .5s,background-color .5s;
8+
}

docs/guide/quick-start.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Quick Start
2+
3+
## Create a new Jwc project
4+
5+
You can use npm, yarn or pnpm to install jwcjs. We recommend using pnpm, it is faster and more efficient.
6+
7+
You can install it with the following command:
8+
9+
::: code-group
10+
11+
```bash [npm]
12+
npm install jwcjs
13+
```
14+
15+
```bash [yarn]
16+
yarn add jwcjs
17+
```
18+
19+
```bash [pnpm]
20+
pnpm add jwcjs
21+
```
22+
:::
23+
24+
These commands will install jwcjs. You can use Vite, Rollup, Webpack, or any other build tool to build your project.
25+
26+
### Create a new project
27+
28+
::: danger SORRY
29+
We have not yet published the package to npm, so you can only install it from github. And CLI is not yet available, so you can only use it in the project directory.
30+
:::
31+
32+
Once the project is created, follow the instructions to install dependencies and start the dev server:
33+
34+
::: code-group
35+
36+
```bash [npm]
37+
cd <project-name>
38+
npm install
39+
npm run dev
40+
```
41+
42+
```bash [yarn]
43+
cd <project-name>
44+
yarn
45+
yarn dev
46+
```
47+
48+
```bash [pnpm]
49+
cd <project-name>
50+
pnpm install
51+
pnpm dev
52+
```
53+
:::
54+
55+
You should now have your Jwc project running! When you are ready to deploy, use the build command:
56+
57+
::: code-group
58+
59+
```bash [npm]
60+
npm run build
61+
```
62+
63+
```bash [yarn]
64+
yarn build
65+
```
66+
67+
```bash [pnpm]
68+
pnpm build
69+
```
70+
:::
71+
72+
This will create a js file in the dist directory. You can use it in your project like this:
73+
74+
```html
75+
<script src="/dist/index.js"></script>
76+
77+
<app-element cound="1" ></app-element>
78+
```

docs/guide/what-is-jwc.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# What is Jwc?
2+
3+
Jwc is a JavaScript framework for using JSX to write web components on the web. It builds on the [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) standard and provides a simple function-based API for writing components.
4+
5+
::: warning
6+
JWC is currently in `alpha`. The API is not stable and may change at any time.
7+
:::
8+
9+
The goal of JWC is to provide a simple, lightweight, and performant way to write web components. It is not a full framework like React or Vue. It is not a library like LitElement or Stencil. It is a framework for writing web components.
10+
11+
## Why Jwc?
12+
13+
Jwc supports the following features:
14+
15+
- Function-based API
16+
- JSX
17+
- TypeScript
18+
- Web Components
19+
20+
If you are looking for a way to build web components, Jwc is a great choice. You just need some basic knowledge of JavaScript and JSX. You don't need to learn a new templating language.
21+
22+
## Why Web Components?
23+
24+
Web Components are a set of standards that allow you to write custom HTML elements. They are a native browser feature that is supported by all modern browsers. They are the future of the web.
25+
26+
Web Components are a great way to write reusable components. They are a standard that is not tied to any framework. They can be used in any framework or without a framework at all.

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ hero:
1111
actions:
1212
- theme: brand
1313
text: Get Started
14-
link: /guide/what-is-vitepress
14+
link: /guide/what-is-jwc
1515
- theme: alt
1616
text: View on GitHub
17-
link: https://github.com/vuejs/vitepress
17+
link: https://github.com/jwcjs/core
1818

1919
features:
2020
- title: Web Components
@@ -30,6 +30,6 @@ features:
3030
<style>
3131
:root {
3232
--vp-home-hero-image-background-image: linear-gradient( -45deg, #000 50%, #000 50% );
33-
--vp-home-hero-image-filter: blur(50px);
33+
--vp-home-hero-image-filter: blur(60px);
3434
}
3535
</style>

0 commit comments

Comments
 (0)