Skip to content

Commit 506f86b

Browse files
committed
docs(vitepress): create docs initial
1 parent 4c35b02 commit 506f86b

File tree

13 files changed

+326
-8
lines changed

13 files changed

+326
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ dist-ssr
2525

2626
.gitconfig
2727

28+
# vitepress
29+
docs/.vitepress/cache
30+
docs/.vitepress/dist

docs/.vitepress/config.mts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import Unocss from 'unocss/vite'
2+
import { defineConfig } from 'vitepress'
3+
import { version } from '../../package.json'
4+
5+
export default defineConfig({
6+
title: 'FormKit-PrimeVue',
7+
description: 'Formkit PrimeVue Integration',
8+
base: '/formkit-primevue/',
9+
themeConfig: {
10+
footer: {
11+
message: 'Nuxt 3 PrimeVue Module',
12+
copyright: 'Copyright © 2023 SFXCode',
13+
},
14+
socialLinks: [
15+
{ icon: 'github', link: 'https://github.com/sfxcode/formkit-primevue' },
16+
],
17+
editLink: {
18+
pattern: 'https://github.com/sfxcode/formkit-primevue/edit/main/docs/:path',
19+
text: 'Edit this page on GitHub',
20+
},
21+
nav: nav(),
22+
search: {
23+
provider: 'local'
24+
},
25+
sidebar: {
26+
'/guide/': sidebarGuide(),
27+
'/config/': sidebarConfig(),
28+
},
29+
},
30+
markdown: {
31+
headers: {
32+
level: [0, 0],
33+
},
34+
},
35+
vite: {
36+
plugins: [
37+
Unocss({
38+
configFile: '../../unocss.config.ts',
39+
}),
40+
],
41+
},
42+
})
43+
44+
function nav() {
45+
return [
46+
{ text: 'Guide', link: '/guide/', activeMatch: '/guide/' },
47+
{
48+
text: 'External Docs',
49+
items: [
50+
{
51+
text: 'PrimeVue',
52+
link: 'https://www.primefaces.org/primevue',
53+
},
54+
{
55+
text: 'Formkit',
56+
link: 'https://formkit.com',
57+
},
58+
],
59+
},
60+
{
61+
text: version,
62+
items: [
63+
{
64+
text: 'Changelog',
65+
link: 'https://github.com/sfxcode/formkit-primevue/blob/main/CHANGELOG.md',
66+
},
67+
],
68+
},
69+
]
70+
}
71+
72+
function sidebarGuide() {
73+
return [
74+
{
75+
text: 'Introduction',
76+
collapsible: true,
77+
items: [
78+
{ text: 'What is this?', link: '/guide/' },
79+
{ text: 'Getting started', link: '/guide/getting-started' },
80+
],
81+
},
82+
{
83+
text: 'Guide',
84+
collapsible: true,
85+
items: [
86+
{ text: 'Usage', link: '/guide/usage' },
87+
{ text: 'PrimeVue Inputs', link: '/guide/inputs' },
88+
{ text: 'Sample Apps', link: '/guide/examples' },
89+
],
90+
},
91+
]
92+
}
93+
94+
function sidebarConfig() {
95+
return [
96+
{
97+
text: 'Config',
98+
items: [
99+
{ text: 'Introduction', link: '/config/' },
100+
],
101+
},
102+
]
103+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<script setup lang='ts'>
2+
</script>
3+
4+
<template>
5+
<div>
6+
<div class="mt-8 flex gap-2">
7+
<div class="i-mdi-information text-2xl mb-2 text-[color:var(--vp-c-brand)]"/>
8+
<div class="text-2xl">TODO</div>
9+
</div>
10+
<div class="">
11+
<span>More Info to come ...</span>
12+
</div>
13+
</div>
14+
</template>
15+
16+
<style scoped>
17+
18+
</style>

docs/.vitepress/theme/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
import type { App } from 'vue'
3+
import 'uno.css'
4+
import type { Theme } from 'vitepress'
5+
import Todo from './components/Todo.vue'
6+
7+
export default {
8+
...DefaultTheme,
9+
enhanceApp({ app }: { app: App }) {
10+
app.component('Todo', Todo)
11+
},
12+
} satisfies Theme

docs/guide/examples.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Usage Examples
2+
3+
::: info
4+
If you are using this package in your project, please let me know or create a PR for this site
5+
:::
6+
7+
## Vue
8+
9+
[Demo Application](https://formkit-primevue.netlify.app/)
10+
11+
[Vite PrimeVue Starter](https://github.com/sfxcode/vite-primevue-starter)
12+
13+
## Nuxt 3
14+
15+
[Nuxt 3 PrimeVue Starter](https://github.com/sfxcode/nuxt3-primevue-starter)
16+

docs/guide/getting-started.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Getting Started
2+
3+
## Installation steps
4+
5+
### Install depenendencies
6+
7+
```sh
8+
$ pnpm add -D @sfxcode/formkit-primevue
9+
```
10+
11+
### PrimeVue
12+
13+
Make sure all components of PrimeVue you want to use are enabled in your configuration.
14+
15+
### Formkit Config
16+
17+
Add a formkit.config.ts to your root dir and register primeInputs for FormKit.
18+
19+
Sample:
20+
21+
```ts
22+
// formkit.config.ts
23+
import type { DefaultConfigOptions } from '@formkit/vue'
24+
import { primeInputs } from '@sfxcode/formkit-primevue'
25+
26+
const config: DefaultConfigOptions = {
27+
inputs: primeInputs
28+
}
29+
30+
export default config
31+
```
32+

docs/guide/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Guide Overview
2+
3+
**formkit-primevue** combines the [PrimeVue](https://www.primefaces.org/primevue) component framework with the validation power of [Formkit](https://formkit.com/) in your Vue/Nuxt application.
4+
5+
6+
7+

docs/guide/inputs.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# PrimeVue Inputs
2+
3+
formkit-primevue tries to integrate as much PrimeVue inputs as possible.
4+
5+
::: warning
6+
Used inputs by FormKit must be imported global (default).
7+
8+
They are referenced in the startup phase, if FormKit is enabled.
9+
:::
10+
11+
12+
## Naming in FormKit
13+
Inputs are used in schema with **prime** as prefix and the **input name** as suffix.
14+
15+
E.g. InputMask -> primeInputMask
16+
17+
## Supported Inputs
18+
19+
- Calendar
20+
- Checkbox
21+
- Dropdown
22+
- Editor (HTML Editor)
23+
- InputMask
24+
- InputNumber
25+
- InputSwitch
26+
- InputText
27+
- InputTextarea
28+
- MultiSelect
29+
- Password
30+
- Ranking
31+
- Chips
32+
- Knob
33+
- ColorPicker
34+
- Listbox
35+
- ToggleButton
36+
- SelectButton
37+
- TriStateCheckbox
38+
- RadioButton
39+

docs/guide/usage.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Usage
2+
3+
formkit-primevue was designed for easy integration into FormKit schema.
4+
5+
## Formkit Schema
6+
7+
```ts
8+
9+
const schema
10+
= [
11+
{
12+
$formkit: 'primeInputMask',
13+
name: 'myInputMask',
14+
label: 'Input Mask',
15+
validation: 'required',
16+
validationVisibility: 'live',
17+
mask: '99-999999',
18+
placeholder: '99-999999',
19+
},
20+
{
21+
$formkit: 'primeInputMask',
22+
name: 'custom',
23+
label: 'Input Mask',
24+
mask: '(999) 999-9999',
25+
unmask: true,
26+
},
27+
]
28+
const data = { }
29+
```
30+
31+
```vue
32+
<template>
33+
<FormKit
34+
id="form"
35+
v-model="data"
36+
type="form"
37+
:submit-attrs="{
38+
inputClass: 'p-button p-component',
39+
}"
40+
@submit="submitHandler"
41+
>
42+
<FormKitSchema :schema="schema" :data="data" />
43+
</FormKit>
44+
</template>
45+
```

docs/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
layout: home
3+
4+
hero:
5+
name: FormKit PrimeVue
6+
text: Schema based Validation
7+
tagline: Use PrimeVue and FormKit Validation
8+
actions:
9+
- theme: brand
10+
text: Get Started
11+
link: /guide/getting-started
12+
- theme: alt
13+
text: Guide
14+
link: /guide/
15+
16+
features:
17+
- title: "Formkit-PrimeVue"
18+
details: PrimeVue support for the FormKit validation Framwork. PrimeVue inputs are prepared for seamless FormKit integration.
19+
- title: "PrimeVue"
20+
details: Next Generation Vue UI Component Library. Rich set of open source native components for Vue.
21+
- title: "FormKit"
22+
details: A Vue form building framework that simplifies form structure, generation, validation, theming, submission, error handling, and more.
23+
---
24+

0 commit comments

Comments
 (0)