├── .babelrc
├── .gitignore
├── LICENSE.md
├── README.md
├── build
├── build.js
├── build.rollup.js
├── check-versions.js
├── code-loader.js
├── dev-client.js
├── dev-server.js
├── example_loader.js
├── inject-loader.js
├── rollup.config.js
├── utils.js
├── vue-loader.conf.js
├── webpack.base.conf.js
├── webpack.dev.conf.js
└── webpack.prod.conf.js
├── config
├── dev.env.js
├── index.js
└── prod.env.js
├── dist
├── vue-universal-modal.css
├── vue-universal-modal.js
├── vue-universal-modal.js.map
├── vue-universal-modal.min.css
└── vue-universal-modal.min.js
├── docs
├── index.html
└── static
│ ├── avatars
│ ├── 1.png
│ ├── 2.png
│ ├── 3.jpg
│ ├── 4.jpg
│ └── 5.jpg
│ ├── css
│ ├── app.95846c59d07da10696a8bc676fddd16a.css
│ └── app.95846c59d07da10696a8bc676fddd16a.css.map
│ ├── images
│ ├── 1.jpg
│ ├── 10.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── 6.jpg
│ ├── 7.jpg
│ ├── 8.jpg
│ ├── 9.jpg
│ └── wide
│ │ ├── 1.png
│ │ ├── 2.jpg
│ │ ├── 3.png
│ │ ├── 4.jpg
│ │ ├── 5.jpg
│ │ ├── 6.jpg
│ │ └── 7.png
│ ├── img
│ └── 1.e289a36.png
│ ├── js
│ ├── app.3ea48f7cca359e904af7.js
│ ├── app.3ea48f7cca359e904af7.js.map
│ ├── manifest.426f53d0521bbe6e946b.js
│ ├── manifest.426f53d0521bbe6e946b.js.map
│ ├── vendor.de6a133fd23cae40d923.js
│ └── vendor.de6a133fd23cae40d923.js.map
│ └── logo.png
├── es
├── close-icon.js
├── index.js
├── modal-wrapper.js
├── modal.js
└── utils
│ └── bus.js
├── lib
├── close-icon.js
├── index.js
├── modal-wrapper.js
├── modal.js
└── utils
│ └── bus.js
├── package-lock.json
├── package.json
├── rollup.config.js
└── src
├── close-icon.js
├── index.js
├── modal-wrapper.js
├── modal.js
├── style.scss
└── utils
└── bus.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["es2015", {
4 | "targets": {
5 | "browsers": ["last 2 versions", "safari >= 7"]
6 | },
7 | "modules": false
8 | }]
9 | ],
10 | "plugins": [
11 | "syntax-dynamic-import"
12 | ],
13 | "env": {
14 | "development": {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | demo/
4 | npm-debug.log
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 - vuNemesis
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #vue-universal-modal
2 |
--------------------------------------------------------------------------------
/build/build.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | var ora = require('ora')
6 | var rm = require('rimraf')
7 | var path = require('path')
8 | var chalk = require('chalk')
9 | var webpack = require('webpack')
10 | var config = require('../config')
11 | var webpackConfig = require('./webpack.prod.conf')
12 |
13 | var spinner = ora('building for production...')
14 | spinner.start()
15 |
16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17 | if (err) throw err
18 | webpack(webpackConfig, function (err, stats) {
19 | spinner.stop()
20 | if (err) throw err
21 | process.stdout.write(stats.toString({
22 | colors: true,
23 | modules: false,
24 | children: false,
25 | chunks: false,
26 | chunkModules: false
27 | }) + '\n\n')
28 |
29 | console.log(chalk.cyan(' Build complete.\n'))
30 | console.log(chalk.yellow(
31 | ' Tip: built files are meant to be served over an HTTP server.\n' +
32 | ' Opening index.html over file:// won\'t work.\n'
33 | ))
34 | })
35 | })
36 |
--------------------------------------------------------------------------------
/build/build.rollup.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs')
2 | var path = require('path')
3 | var chalk = require('chalk')
4 | var rollup = require('rollup')
5 | var babel = require('rollup-plugin-babel')
6 | var uglify = require('rollup-plugin-uglify')
7 | // var minify = require('uglify-es').minify;
8 |
9 | var version = process.env.VERSION || require('../package.json').version
10 | var author = process.env.VERSION || require('../package.json').author
11 | var license = process.env.VERSION || require('../package.json').license
12 |
13 | var banner =
14 | '/**\n' +
15 | ' * Vue-universal-slider v' + version + '\n' +
16 | ' * (c) ' + new Date().getFullYear() + ' ' + author + '\n' +
17 | ' * @license ' + license + '\n' +
18 | ' */\n'
19 |
20 | rollup.rollup({
21 | entry: path.resolve(__dirname, '..', 'src/index.js'),
22 | plugins: [
23 | babel(),
24 | uglify()
25 | ]
26 | })
27 | .then(bundle => {
28 | return write(path.resolve(__dirname, '../dist/vue-universal-slider.js'), bundle.generate({
29 | format: 'umd',
30 | moduleName: 'vue-universal-slider'
31 | }).code)
32 | })
33 | .then(() => {
34 | console.log(chalk.green('\nAwesome! Vue-universal-slider v' + version + ' builded.\n'))
35 | })
36 | .catch(console.log)
37 |
38 | function getSize (code) {
39 | return (code.length / 1024).toFixed(2) + 'kb'
40 | }
41 |
42 | function write (dest, code) {
43 | return new Promise(function (resolve, reject) {
44 | code = banner + code
45 | fs.writeFile(dest, code, function (err) {
46 | if (err) return reject(err)
47 | console.log(chalk.blue(dest) + ' ' + getSize(code))
48 | resolve()
49 | })
50 | })
51 | }
52 |
--------------------------------------------------------------------------------
/build/check-versions.js:
--------------------------------------------------------------------------------
1 | var chalk = require('chalk')
2 | var semver = require('semver')
3 | var packageConfig = require('../package.json')
4 | var shell = require('shelljs')
5 | function exec (cmd) {
6 | return require('child_process').execSync(cmd).toString().trim()
7 | }
8 |
9 | var versionRequirements = [
10 | {
11 | name: 'node',
12 | currentVersion: semver.clean(process.version),
13 | versionRequirement: packageConfig.engines.node
14 | },
15 | ]
16 |
17 | if (shell.which('npm')) {
18 | versionRequirements.push({
19 | name: 'npm',
20 | currentVersion: exec('npm --version'),
21 | versionRequirement: packageConfig.engines.npm
22 | })
23 | }
24 |
25 | module.exports = function () {
26 | var warnings = []
27 | for (var i = 0; i < versionRequirements.length; i++) {
28 | var mod = versionRequirements[i]
29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30 | warnings.push(mod.name + ': ' +
31 | chalk.red(mod.currentVersion) + ' should be ' +
32 | chalk.green(mod.versionRequirement)
33 | )
34 | }
35 | }
36 |
37 | if (warnings.length) {
38 | console.log('')
39 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
40 | console.log()
41 | for (var i = 0; i < warnings.length; i++) {
42 | var warning = warnings[i]
43 | console.log(' ' + warning)
44 | }
45 | console.log()
46 | process.exit(1)
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/build/code-loader.js:
--------------------------------------------------------------------------------
1 | const compiler = require("vue-template-compiler");
2 | const _ = require('lodash');
3 |
4 | module.exports = function (source, map) {
5 | var callback = this.async();
6 | this.loadModule(`!raw-loader!${this.resourcePath}`, (err, sourceParent, sourceMap, module) => {
7 | const raw = eval(sourceParent)
8 | const example = parseSource(raw, source)
9 | callback(null, 'module.exports = function(Component) {Component.options.__example = ' + JSON.stringify(example).trim() + '}', map)
10 | })
11 | // this.callback(null, 'module.exports = function(Component) {if(!Component.options.__examples) Component.options.__examples = []; Component.options.__examples.push(' +
12 | // JSON.stringify(source).trim() +
13 | // ')}', map)
14 | }
15 |
16 | // module.exports.pitch = function(remainingRequest, precedingRequest, data) {
17 |
18 | // };
19 |
20 | function parseSource(source, sourceExample) {
21 | const blocks = compiler.parseComponent(source, { pad: "space" })
22 | const template = blocks.template ? _.trim(blocks.template.content) : ''
23 | const script = blocks.script ? _.trim(blocks.script.content) : ''
24 | let info = {}
25 | let key
26 | const blocksExample = compiler.parseComponent(sourceExample, { pad: "space" })
27 | if(blocksExample.customBlocks.length) {
28 | blocksExample.customBlocks.forEach(block => {
29 | info[block.type] = _.trim(block.content)
30 | })
31 | key = info.title ? _.camelCase(info.title) : ''
32 | }
33 | return {
34 | key,
35 | template,
36 | script,
37 | info
38 | }
39 | }
--------------------------------------------------------------------------------
/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | var config = require('../config')
4 | if (!process.env.NODE_ENV) {
5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6 | }
7 |
8 | var opn = require('opn')
9 | var path = require('path')
10 | var express = require('express')
11 | var webpack = require('webpack')
12 | var proxyMiddleware = require('http-proxy-middleware')
13 | var webpackConfig = require('./webpack.dev.conf')
14 |
15 | // default port where dev server listens for incoming traffic
16 | var port = process.env.PORT || config.dev.port
17 | // automatically open browser, if not set will be false
18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser
19 | // Define HTTP proxies to your custom API backend
20 | // https://github.com/chimurai/http-proxy-middleware
21 | var proxyTable = config.dev.proxyTable
22 |
23 | var app = express()
24 | var compiler = webpack(webpackConfig)
25 |
26 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
27 | publicPath: webpackConfig.output.publicPath,
28 | quiet: true
29 | })
30 |
31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, {
32 | log: () => {}
33 | })
34 | // force page reload when html-webpack-plugin template changes
35 | compiler.plugin('compilation', function (compilation) {
36 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
37 | hotMiddleware.publish({ action: 'reload' })
38 | cb()
39 | })
40 | })
41 |
42 | // proxy api requests
43 | Object.keys(proxyTable).forEach(function (context) {
44 | var options = proxyTable[context]
45 | if (typeof options === 'string') {
46 | options = { target: options }
47 | }
48 | app.use(proxyMiddleware(options.filter || context, options))
49 | })
50 |
51 | // handle fallback for HTML5 history API
52 | app.use(require('connect-history-api-fallback')())
53 |
54 | // serve webpack bundle output
55 | app.use(devMiddleware)
56 |
57 | // enable hot-reload and state-preserving
58 | // compilation error display
59 | app.use(hotMiddleware)
60 |
61 | // serve pure static assets
62 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
63 | app.use(staticPath, express.static('./demo/static'))
64 |
65 | var uri = 'http://localhost:' + port
66 |
67 | var _resolve
68 | var readyPromise = new Promise(resolve => {
69 | _resolve = resolve
70 | })
71 |
72 | console.log('> Starting dev server...')
73 | devMiddleware.waitUntilValid(() => {
74 | console.log('> Listening at ' + uri + '\n')
75 | // when env is testing, don't need open it
76 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
77 | opn(uri)
78 | }
79 | _resolve()
80 | })
81 |
82 | var server = app.listen(port)
83 |
84 | module.exports = {
85 | ready: readyPromise,
86 | close: () => {
87 | server.close()
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/build/example_loader.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var fs = require('fs-extended');
3 | const _ = require('lodash');
4 | const Babel = require('babel-standalone');
5 | const compiler = require("vue-template-compiler");
6 |
7 | module.exports = function loader(source, map) {
8 | let ex = []
9 | let props = {}
10 | const blocks = compiler.parseComponent(source, { pad: "space" })
11 |
12 | if(blocks.script && blocks.script.content) {
13 | const { code } = Babel.transform(
14 | blocks.script.content, { presets: ["es2015"] },
15 | );
16 | props = eval(`const exports = {};${code}`); // eslint-disable-line
17 | }
18 |
19 | if(blocks.customBlocks.length) {
20 | const examples = blocks.customBlocks.filter(block => block.type ==='example')
21 | if(examples.length) {
22 | examples.forEach((example, index) => {
23 | let title, description, script, template, key, code, data, info
24 | const blocksExample = compiler.parseComponent(example.content, { pad: "space" })
25 | if(blocksExample.customBlocks.length) {
26 | title = blocksExample.customBlocks.find(block => block.type ==='title')
27 | description = blocksExample.customBlocks.find(block => block.type ==='description')
28 | info = blocksExample.customBlocks.find(block => block.type ==='info')
29 |
30 | script = blocksExample.script
31 | template = blocksExample.template
32 |
33 | key = title ? _.camelCase(title.content) : ''
34 | title = title ? _.trim(title.content) : ''
35 | description = description ? _.trim(description.content) : ''
36 | script = script ? _.trim(script.content) : ''
37 | template = template ? _.trim(template.content) : ''
38 | code = '\n' + template + '\n\n\n