Skip to content

Commit bd148a1

Browse files
committed
chore(docs): Upgrade to Vuepress 2
1 parent 0db4873 commit bd148a1

File tree

17 files changed

+543
-91
lines changed

17 files changed

+543
-91
lines changed

docs/.vuepress/client.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// import { getDirname, path } from '@vuepress/utils'
2+
// import { searchPlugin } from '@vuepress/plugin-search'
3+
import VeeValidate from 'vee-validate'
4+
import Cleave from 'cleave.js'
5+
import * as lang from '../../dist/locale/index.esm'
6+
import Datepicker from '../../dist/vue-datepicker.esm'
7+
import AppendToBody from './components/Datepicker/AppendToBody.vue'
8+
import OpenDate from './components/Datepicker/OpenDate.vue'
9+
import Rtl from './components/Datepicker/Rtl.vue'
10+
import UseUtc from './components/Datepicker/UseUtc.vue'
11+
import VModel from './components/Datepicker/VModel.vue'
12+
import YearPickerRange from './components/Datepicker/YearPickerRange.vue'
13+
import Disabled from './components/Disabled.vue'
14+
import Highlighted from './components/Highlighted.vue'
15+
import Formatting from './components/Formatting.vue'
16+
import Language from './components/Language.vue'
17+
import Typeable from './components/Typeable.vue'
18+
import { defineClientConfig } from '@vuepress/client'
19+
// import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
20+
21+
// export default ({ Vue }) => {
22+
// const config = {
23+
// aria: true,
24+
// classNames: {},
25+
// classes: true,
26+
// delay: 0,
27+
// dictionary: null,
28+
// errorBagName: 'errors', // change if property conflicts
29+
// events: 'input|blur',
30+
// fieldsBagName: 'fields',
31+
// i18n: null, // the vue-i18n plugin instance
32+
// i18nRootKey: 'validations', // the key under which nested validation messages will be located
33+
// inject: true,
34+
// locale: 'en',
35+
// validity: false,
36+
// useConstraintAttrs: true,
37+
// }
38+
//
39+
// Vue.use(VeeValidate, config)
40+
// Vue.component('Datepicker', Datepicker)
41+
// Vue.prototype.$datepickerLocals = lang
42+
//
43+
// Vue.directive('cleave', {
44+
// inserted(el, binding) {
45+
// // if the bound element is not an input field search for one
46+
// // this is for cases where the input is inside a wrapper
47+
// if (el.tagName !== 'INPUT') {
48+
// el = el.querySelector('input')
49+
// }
50+
// // only apply cleave if it is an input field and the options are set
51+
// if (
52+
// el.tagName === 'INPUT' &&
53+
// Object.keys(binding.value).length !== 0 &&
54+
// binding.value.constructor === Object
55+
// ) {
56+
// new Cleave(el, binding.value)
57+
// }
58+
// },
59+
// })
60+
// }
61+
62+
// const __dirname = getDirname(import.meta.url)
63+
64+
const config = {
65+
aria: true,
66+
classNames: {},
67+
classes: true,
68+
delay: 0,
69+
dictionary: null,
70+
errorBagName: 'errors', // change if property conflicts
71+
events: 'input|blur',
72+
fieldsBagName: 'fields',
73+
i18n: null, // the vue-i18n plugin instance
74+
i18nRootKey: 'validations', // the key under which nested validation messages will be located
75+
inject: true,
76+
locale: 'en',
77+
validity: false,
78+
useConstraintAttrs: true,
79+
}
80+
81+
export default defineClientConfig({
82+
// plugins: [
83+
// searchPlugin({}),
84+
// registerComponentsPlugin({
85+
// componentsDir: path.resolve(__dirname, './components'),
86+
// }),
87+
// ],
88+
89+
// enhance({ app, router, siteData }) {},
90+
91+
enhance({ app }) {
92+
app.component('Datepicker', Datepicker)
93+
app.component('Datepicker-AppendToBody', AppendToBody)
94+
app.component('Datepicker-OpenDate', OpenDate)
95+
app.component('Datepicker-Rtl', Rtl)
96+
app.component('Datepicker-UseUtc', UseUtc)
97+
app.component('Datepicker-VModel', VModel)
98+
app.component('Datepicker-YearPickerRange', YearPickerRange)
99+
app.component('Disabled', Disabled)
100+
app.component('Highlighted', Highlighted)
101+
app.component('Formatting', Formatting)
102+
app.component('Language', Language)
103+
app.component('Typeable', Typeable)
104+
app.component('VeeValidate', VeeValidate)
105+
106+
// app.use(VeeValidate, config)
107+
app.config.globalProperties.$datepickerLocals = lang
108+
app.directive('cleave', {
109+
inserted(el, binding) {
110+
// If the bound element is not an input field, search for one.
111+
// This is for cases where the input is inside a wrapper
112+
if (el.tagName !== 'INPUT') {
113+
el = el.querySelector('input')
114+
}
115+
// Only apply Cleave if it is an input field and the options are set
116+
if (
117+
el.tagName === 'INPUT' &&
118+
Object.keys(binding.value).length !== 0 &&
119+
binding.value.constructor === Object
120+
) {
121+
new Cleave(el, binding.value)
122+
}
123+
},
124+
})
125+
},
126+
setup() {},
127+
rootComponents: [],
128+
})

docs/.vuepress/components/Cleave.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</template>
1313

1414
<script>
15-
// export component
1615
export default {
1716
name: 'Cleave',
1817
data() {

docs/.vuepress/components/Disabled.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
return true
5353
}
5454
// disable first half of the month when it is a multiple of 2
55-
if (month % 2 !== 0 && day < 15) {
55+
if (month % 2 !== 0 && day &lt; 15) {
5656
return true
5757
}
5858
}

docs/.vuepress/components/Formatting.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</template>
2121

2222
<script>
23-
import Format from '../../../docs/.vuepress/components/Formats'
23+
import Format from '../components/Formats.vue'
2424
import { format, parse } from 'date-fns'
2525
2626
export default {

docs/.vuepress/components/Typeable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</template>
1818

1919
<script>
20-
import Format from '../../../docs/.vuepress/components/Formats'
20+
import Format from '../components/Formats.vue'
2121
2222
export default {
2323
name: 'Typeable',

docs/.vuepress/components/VeeValidate.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
</template>
1818

1919
<script>
20-
// export component
2120
export default {
2221
name: 'VeeValidate',
2322
data() {

docs/.vuepress/components/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../../dist/Datepicker.css';
1+
@import '../../../dist/vue-datepicker.css';
22

33
.example input,
44
.example select {

docs/.vuepress/config.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const sidebar = require('./sidebar')
2-
const nav = require('./nav')
3-
const pkg = require('../../package')
1+
import { defineUserConfig, defaultTheme } from 'vuepress'
2+
import sidebar from './sidebar'
3+
import navbar from './navbar'
4+
import pkg from '../../package'
45

5-
module.exports = {
6+
export default defineUserConfig({
67
title: pkg.name,
78
description: pkg.description,
89
base: '/vue-datepicker/',
9-
evergreen: true,
1010
displayAllHeaders: true,
1111
sidebarDepth: 3,
1212
head: [
@@ -18,11 +18,11 @@ module.exports = {
1818
},
1919
],
2020
],
21-
themeConfig: {
21+
theme: defaultTheme({
2222
sidebar,
23-
nav,
23+
navbar,
2424
repo: pkg.homepage,
2525
// if your docs are not at the root of the repo:
2626
docsDir: 'docs',
27-
},
28-
}
27+
}),
28+
})

docs/.vuepress/enhanceApp.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

docs/.vuepress/nav.js renamed to docs/.vuepress/navbar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const pkg = require('../../package')
1+
import pkg from '../../package'
22

3-
module.exports = [
3+
export default [
44
{
55
text: 'Guide',
66
link: '/guide/',

0 commit comments

Comments
 (0)