-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f02d322
Showing
25 changed files
with
6,108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
["es2015", { "modules": false }] | ||
], | ||
"plugins": [ | ||
"external-helpers", | ||
"transform-flow-strip-types", | ||
"transform-class-properties" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
extends: eslint-config-ktsn | ||
parser: babel-eslint | ||
plugins: | ||
- flowtype | ||
env: | ||
es6: true | ||
node: true | ||
parserOptions: | ||
ecmaVersion: 6 | ||
sourceType: module | ||
rules: | ||
flowtype/define-flow-type: 1 | ||
flowtype/use-flow-type: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ignore] | ||
.*/dist/ | ||
.*/node_modules/ | ||
|
||
[include] | ||
|
||
[libs] | ||
flow/ | ||
|
||
[options] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
before_script: | ||
- "export DISPLAY=:99.0" | ||
- "sh -e /etc/init.d/xvfb start" | ||
- sleep 3 # give xvfb some time to start | ||
script: | ||
- echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2017 katashin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Vue Modal | ||
|
||
Thin modal Vue component. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install --save vue-thin-modal | ||
# or | ||
$ yarn add vue-thin-modal | ||
``` | ||
|
||
## Usage | ||
|
||
1. Import `VueThinModal` and install it in Vue constructor. | ||
|
||
```js | ||
import Vue from 'vue' | ||
import VueThinModal from 'vue-thin-modal' | ||
|
||
Vue.use(VueThinModal) | ||
|
||
new Vue({ | ||
// ... | ||
}) | ||
``` | ||
|
||
2. (Optional) Import base CSS file for the modal wherever you want or you can define your own styles. | ||
|
||
```js | ||
import 'vue-thin-modal/dist/vue-thin-modal.css' | ||
``` | ||
|
||
3. Use `<modal>` component in your apps. You can see `this.$modal` in your components | ||
|
||
```vue | ||
<template> | ||
<div> | ||
<button type="button" @click="open">Open Modal</button> | ||
<modal name="example"> | ||
<div class="basic-modal"> | ||
<h1 class="title">Modal Title</h1> | ||
<button class="button" type="button" @click="close">Close Modal</button> | ||
</div> | ||
</modal> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
methods: { | ||
open () { | ||
this.$modal.push('example') | ||
}, | ||
close () { | ||
this.$modal.pop() | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
|
||
## References | ||
|
||
### `<modal>` component | ||
|
||
#### Props | ||
|
||
* `name` - String, required | ||
|
||
Required as the modal name. The `name` must be unique against every modal you would use. | ||
|
||
* `content-transition` - Object | ||
|
||
It is the same options as the props of Vue's `<transition>` component. You can customize the modal content transition by using this prop. If omitted a default transition will be used. | ||
* `backdrop-transition` - Object | ||
Same as `content-transition` except for the modal backdrop. | ||
### `this.$modal` mediator | ||
#### Properties | ||
* currentName | ||
Returns a modal name that appears currently. | ||
#### Methods | ||
* push(name: string): void | ||
Show the modal that cooresnponding with the `name`. | ||
* pop(): void | ||
Hide the modal that is appearing. | ||
* replace(name: string): void | ||
Hide the modal that is appearing and show a new modal. | ||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @flow | ||
|
||
declare module vue { | ||
declare var exports: any; | ||
} | ||
|
||
declare module vuex { | ||
declare var exports: any; | ||
} | ||
|
||
interface ActionContext<S> { | ||
state: S; | ||
getters: any; | ||
dispatch: (type: string, payload: any) => void; | ||
commit: (type: string, payload: any) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "vue-thin-modal", | ||
"version": "0.0.0", | ||
"author": "katashin", | ||
"description": "Simple modal Vue component", | ||
"keywords": [ | ||
"modal", | ||
"component", | ||
"Vue" | ||
], | ||
"license": "MIT", | ||
"main": "dist/vue-thin-modal.cjs.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"homepage": "https://github.com/ktsn/vue-thin-modal", | ||
"bugs": "https://github.com/ktsn/vue-thin-modal/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ktsn/vue-thin-modal.git" | ||
}, | ||
"scripts": { | ||
"prepublish": "npm run release", | ||
"clean": "rm -rf dist", | ||
"build": "cross-env NODE_ENV=production node scripts/build.js", | ||
"build:example": "webpack --config examples/webpack.config.js", | ||
"build:play": "vbuild --config play.config.js", | ||
"dev": "chokidar \"src/**/*\" --initial --silent -c \"npm run build\"", | ||
"dev:example": "webpack-dev-server --inline --hot --config examples/webpack.config.js", | ||
"play": "vbuild dev --config play.config.js", | ||
"flow": "flow check", | ||
"lint": "eslint --fix \"@(src|scripts)/**/*.js\"", | ||
"release": "run-s lint flow clean build" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-eslint": "^7.2.3", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"chokidar-cli": "^1.2.0", | ||
"cross-env": "^4.0.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-ktsn": "^1.0.0", | ||
"eslint-plugin-flowtype": "^2.32.1", | ||
"flow-bin": "^0.45.0", | ||
"npm-run-all": "^4.0.2", | ||
"rollup": "^0.41.6", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-plugin-replace": "^1.1.1", | ||
"rollup-plugin-uglify": "^1.0.2", | ||
"rollup-watch": "^3.2.2", | ||
"vbuild": "^7.1.0", | ||
"vue": "^2.3.2", | ||
"vue-play": "^3.2.1", | ||
"vue-template-compiler": "^2.3.2" | ||
}, | ||
"peerDependencies": { | ||
"vue": "^2.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
module.exports = { | ||
entry: { | ||
app: 'play/app.js', | ||
preview: 'play/preview.js' | ||
}, | ||
dist: 'dist-play', | ||
port: 5000, | ||
// compile Vue template | ||
templateCompiler: true, | ||
hmrEntry: ['preview'], | ||
// no code split for 3rd party libraries | ||
vendor: false, | ||
html: [{ | ||
chunks: ['app'], | ||
filename: 'index.html' | ||
}, { | ||
chunks: ['preview'], | ||
filename: 'preview.html' | ||
}], | ||
babel: { | ||
babelrc: false, | ||
cacheDirectory: true, | ||
presets: ['vue-app'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template> | ||
<div> | ||
<input type="radio" name="modal" value="foo" v-model="current">Show Foo Modal | ||
<input type="radio" name="modal" value="bar" v-model="current">Show Bar Modal | ||
<input type="radio" name="modal" value="long" v-model="current">Show Long Modal | ||
<modal name="foo"> | ||
<div class="basic-modal"> | ||
<h1 class="title">Foo</h1> | ||
<button class="button" type="button" @click="close">Close</button> | ||
</div> | ||
</modal> | ||
<modal name="bar"> | ||
<div class="basic-modal"> | ||
<h1 class="title">Bar</h1> | ||
<button class="button" @click="open('foo')">Open Foo</button> | ||
<button class="button" type="button" @click="close">Close</button> | ||
</div> | ||
</modal> | ||
<modal name="long"> | ||
<div class="basic-modal"> | ||
<h1 class="title">Long Content</h1> | ||
<p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p> | ||
<button class="button" @click="close">Close</button> | ||
</div> | ||
</modal> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
computed: { | ||
current: { | ||
get () { | ||
return this.$modal.currentName | ||
}, | ||
set (name) { | ||
this.open(name) | ||
} | ||
} | ||
}, | ||
methods: { | ||
open (name) { | ||
this.$modal.push(name) | ||
}, | ||
close () { | ||
this.$modal.pop() | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.basic-modal { | ||
margin: 30px auto; | ||
padding: 30px; | ||
width: 800px; | ||
} | ||
.basic-modal.modal-content-leave-active { | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
} | ||
.title { | ||
margin: 0; | ||
font-weight: normal; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// ./play/app.js | ||
import app from 'vue-play/app' | ||
|
||
// bootstrap app | ||
app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { play } from 'vue-play' | ||
|
||
import Vue from 'vue' | ||
import VueModal from '../' | ||
import '../dist/vue-modal.css' | ||
|
||
import Simple from './Simple.vue' | ||
|
||
Vue.use(VueModal) | ||
|
||
play('Vue Modal') | ||
.add('Simple', Simple) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable import/no-unassigned-import */ | ||
|
||
// ./play/preview.js | ||
import './' // which is ./play/index.js | ||
import preview from 'vue-play/preview' | ||
|
||
// actually render the scenarios in preview page | ||
// when the preview page is ready | ||
// it will tell the app interface what scenarios we have | ||
preview() |
Oops, something went wrong.