Skip to content

Commit 4b2502e

Browse files
committed
Initial commit
0 parents  commit 4b2502e

File tree

12 files changed

+11998
-0
lines changed

12 files changed

+11998
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.vue]
15+
indent_size = 4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
/.idea
3+
/.vscode
4+
package-lock.json
5+
npm-debug.log
6+
yarn-error.log

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
/.idea
3+
/.vscode
4+
package-lock.json
5+
npm-debug.log
6+
yarn-error.log

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2018, Ivan Rey De Cardo
2+
3+
Permission to use, copy, modify, and/or distribute this software for any
4+
purpose with or without fee is hereby granted, provided that the above
5+
copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13+
PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# vue-pikaday
2+
3+
A [Pikaday](https://github.com/dbushell/Pikaday/) wrapper for [Vue.js 2](https://vuejs.org/).
4+
5+
### Installation
6+
7+
```
8+
npm install --save @idecardo/vue-pikaday
9+
```
10+
11+
### Usage
12+
13+
```javascript
14+
import Pikaday from '@idecardo/vue-pikaday'
15+
16+
// Import your preferred pikaday style/theme.
17+
import 'pikaday/css/pikaday.css'
18+
19+
export default {
20+
components: {
21+
Pikaday,
22+
},
23+
24+
data: () => ({
25+
date: '2018-10-05',
26+
27+
settings: {
28+
firstDay: 3,
29+
},
30+
}),
31+
}
32+
```
33+
34+
#### Basic
35+
36+
```html
37+
<pikaday v-model="date"></pikaday>
38+
```
39+
40+
#### Settings
41+
42+
```html
43+
<pikaday v-model="date" :settings="settings"></pikaday>
44+
```
45+
46+
#### Theme
47+
48+
```scss
49+
// You can also import your preferred style/theme in your main SASS file or your component's <style lang="scss"/> section.
50+
51+
@import "~pikaday/scss/pikaday.scss";
52+
```

build/index.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Import vue component
2+
import component from '../src/main.vue';
3+
4+
// install function executed by Vue.use()
5+
export function install(Vue) {
6+
if (install.installed) return;
7+
install.installed = true;
8+
Vue.component('Pikaday', component);
9+
}
10+
11+
// Create module definition for Vue.use()
12+
const plugin = {
13+
install,
14+
};
15+
16+
// To auto-install when vue is found
17+
let GlobalVue = null;
18+
if (typeof window !== 'undefined') {
19+
GlobalVue = window.Vue;
20+
} else if (typeof global !== 'undefined') {
21+
GlobalVue = global.Vue;
22+
}
23+
if (GlobalVue) {
24+
GlobalVue.use(plugin);
25+
}
26+
27+
// To allow use as module (npm/webpack/etc.) export component
28+
export default component;

build/rollup.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import babel from 'rollup-plugin-babel';
2+
import commonjs from 'rollup-plugin-commonjs';
3+
import minimist from 'minimist';
4+
import resolve from 'rollup-plugin-node-resolve';
5+
import uglify from 'rollup-plugin-uglify-es';
6+
import vue from 'rollup-plugin-vue';
7+
8+
const argv = minimist(process.argv.slice(2));
9+
10+
const config = {
11+
input: 'build/index.js',
12+
output: {
13+
name: 'Pikaday',
14+
exports: 'named',
15+
},
16+
plugins: [
17+
vue({
18+
css: true,
19+
compileTemplate: true,
20+
}),
21+
babel({
22+
exclude: 'node_modules/**',
23+
externalHelpersWhitelist: ['objectSpread'],
24+
plugins: ['transform-object-rest-spread'],
25+
presets: [['env', { modules: false }]],
26+
}),
27+
resolve(),
28+
commonjs(),
29+
],
30+
};
31+
32+
// Only minify browser (iife) version
33+
if (argv.format === 'iife') {
34+
config.plugins.push(uglify());
35+
}
36+
37+
export default config;

0 commit comments

Comments
 (0)