Created ssr demo and moved csr to a sub-folder + rebuild

This commit is contained in:
euvl
2017-06-20 09:01:27 +01:00
parent b652b4342c
commit ff27ef2049
36 changed files with 7762 additions and 2 deletions

1
demo/client_side_rendering/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
dist

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue Modal Examples</title>
<meta name="description" content="Vue.js modal component. Simple, clean with no external dependencies."/>
<meta name="keywords" content="vue, vuejs, modal, dialog, box, modal box, dialog box, vue-modal vuejs-modal.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-80822945-4', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<div style="position: absolute; right: 0; top: 20px">
<iframe
src="https://ghbtns.com/github-btn.html?user=euvl&repo=vue-js-modal&type=star&count=true"
frameborder="0"
scrolling="0"
width="94px"
height="20px"></iframe>
</div>
<div id="app"></div>
<script src="/dist/build.js"></script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
{
"name": "demo",
"version": "1.0.0",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.0.0"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-latest": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"node-sass": "^4.5.0",
"sass-loader": "^5.0.1",
"vue-loader": "^11.1.4",
"vue-template-compiler": "^2.2.1",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0"
}
}

View File

@@ -0,0 +1,215 @@
<template>
<div id="app">
<demo-error-modal/>
<demo-login-modal/>
<demo-dog-profile-modal />
<demo-conditional-modal/>
<demo-focus-modal/>
<modal name="example-modal"
transition="nice-modal-fade"
:min-width="200"
:min-height="200"
:delay="100"
:adaptive="adaptive"
:resizable="resizable"
:draggable="draggable">
<div style="height: 100%; box-sizing: border-box; padding: 10px; font-size: 13px; overflow: auto">
Appropriately exploit professional infrastructures rather than unique growth strategies. Assertively build leveraged growth strategies vis-a-vis multimedia based vortals. Progressively simplify cross-platform value through interactive imperatives. Objectively
implement enabled web services after plug-and-play ROI. Distinctively impact inexpensive schemas before installed base imperatives. Holisticly benchmark pandemic process improvements without wireless experiences. Efficiently create worldwide partnerships
after tactical vortals. Uniquely productize enabled platforms vis-a-vis timely processes. Conveniently unleash standards compliant niches through highly efficient testing procedures. Rapidiously enable pandemic niche markets whereas viral markets.
Assertively simplify alternative partnerships and error-free e-commerce. Professionally formulate 24/365 internal or "organic" sources through equity invested mindshare. Globally redefine unique best practices for.
</div>
</modal>
<h2>Vue.js Modal
<a href="https://github.com/euvl/vue-js-modal/blob/master/README.md" target="readme">Readme</a>
<a href="https://github.com/euvl/vue-js-modal/issues" target="issues">Issues</a>
</h2>
<pre style="line-height: 1.5;">
npm install --save vue-js-modal
...
import vmodal from 'vue-js-modal'
Vue.use(vmodal)
</pre>
<modes-table />
<div style="margin-top: 20px; margin-bottom: 15px;">
<button @click="show(false, false, false)">Simple</button>
<button @click="show(true, false, false)">Resizable</button>
<button @click="show(false, true, false)">Adaptive</button>
<button @click="show(false, false, true)">Draggable</button>
<br>
<button class="green"
@click="$modal.show('dog-profile')">
Demo: Dog Profile photo
</button>
<button class="green"
@click="$modal.show('error-modal')">
Demo: Error handling
</button>
<button class="green"
@click="$modal.show('demo-login')">
Demo: Login
</button>
<!--
<button class="green"
@click="$modal.show('input-focus-modal')">
Demo: Focus Input
</button>
-->
<button :class="canBeShown ? 'green' : 'red'"
@click="conditionalShow">
Can <b v-if="!canBeShown">NOT</b> be shown
</button>
</div>
<props-table />
</div>
</template>
<script>
import ModesTable from './components/ModesTable.vue'
import PropsTable from './components/PropsTable.vue'
import DemoErrorModal from './components/DemoErrorModal.vue'
import DemoFocusModal from './components/InputFocusModal.vue'
import DemoLoginModal from './components/DemoLoginModal.vue'
import DemoDogProfileModal from './components/DogProfileModal.vue'
import DemoConditionalModal from './components/ConditionalModal.vue'
export default {
name: 'app',
components: {
ModesTable,
PropsTable,
DemoErrorModal,
DemoFocusModal,
DemoLoginModal,
DemoDogProfileModal,
DemoConditionalModal
},
data() {
return {
resizable: false,
adaptive: false,
draggable: false,
canBeShown: false
}
},
created () {
setInterval(() => {
this.canBeShown = !this.canBeShown
}, 5000)
},
methods: {
show(resizable, adaptive, draggable) {
this.resizable = resizable
this.adaptive = adaptive
this.draggable = draggable
/*
$nextTick is required because the data model with new
"resizable, adaptive, draggable" values is not updated yet.. eh
*/
this.$nextTick(() => {
this.$modal.show('example-modal')
})
},
conditionalShow () {
this.$modal.show('conditional-modal', { show: this.canBeShown })
}
},
}
</script>
<style lang="scss">
body {
margin: 0;
padding: 50px;
cursor: default;
box-sizing: border-box;
}
pre {
color: #595959;
background-color: #f3f3f3;
border: 1px solid #eee;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}
h1,
h2 {
font-weight: normal;
a {
font-size: 12px;
}
}
a {
color: inherit;
}
button {
outline: none;
background: white;
border: 0;
padding: 6px 18px;
cursor: pointer;
border-radius: 3px;
background: white;
color: #4db3ff;
border: 1px solid #4db3ff;
min-width: 90px;
margin-bottom: 2px;
margin-top: 4px;
&:hover {
color: #20a0ff;
border: 1px solid #20a0ff;
}
&.green {
$color: #50C9BA;
color: $color;
border: 1px solid $color;
&:hover {
color: mix($color, black, 95%);
border: 1px solid mix($color, black, 95%);
}
}
&.red {
$color: #F21368;
color: $color;
border: 1px solid $color;
&:hover {
color: mix($color, black, 95%);
border: 1px solid mix($color, black, 95%);
}
}
}
@media (max-width:600px) {
body {
padding: 10px;
}
}
</style>

View File

@@ -0,0 +1,24 @@
<template>
<modal name="conditional-modal"
:adaptive="true"
@before-open="beforeOpen">
<div style="padding:30px; text-align: center">
Hello!
</div>
</modal>
</template>
<script>
export default {
name: 'ConditionalModal',
methods: {
beforeOpen (event) {
console.log('Event:', event)
console.log('Params:', event.params)
if (event.params.show === false) {
event.stop()
}
},
}
}
</script>

View File

@@ -0,0 +1,90 @@
<template>
<modal name="error-modal"
:classes="['v--modal', 'error-modal', hasBugs && 'has-bugs']"
:pivot-y="0.2"
:width="400"
:height="300"
@before-open="beforeOpen"
@before-close="beforeClose">
<div class="error-modal-content">
<div class="bugs-label">bugs: {{bugCount}}</div>
<button @click="createBug">Create a bug</button>
<button @click="fixBug">Fix a bug</button>
<div style="padding: 10px;">
You will be able to close the window only if you have fixed all the bugs :)
</div>
<sub :style="{opacity: hasBugs ? 1 : 0}">
{{bugCount}} bugs to fix
</sub>
</div>
</modal>
</template>
<script>
export default {
name: 'DemoErrorModal',
data () {
return {
bugCount: 0,
message: '',
hasBugs: false
}
},
methods: {
createBug () {
this.bugCount++
},
fixBug () {
this.bugCount = Math.max(this.bugCount - 1, 0)
this.hasBugs = false
},
beforeOpen (event) {
this.bugCount = Math.round(Math.random() * 3) + 1
},
beforeClose (event) {
if (this.bugCount > 0) {
this.hasBugs = true
/*
Stopping close event execution
*/
event.stop()
}
}
}
}
</script>
<style lang="scss">
.error-modal {
transition: box-shadow 1s;
&.has-bugs {
box-shadow: 0 24px 80px -2px rgba(255, 0, 0, .6) !important;
}
}
.error-modal-content {
padding: 10px;
text-align: center;
.bugs-label {
text-transform: uppercase;
font-size: 60px;
font-weight: 300;
letter-spacing: 2px;
padding: 40px;
}
button {
width: 180px;
}
sub {
color: #EC625F;
transition: opacity 0.25s;
}
}
</style>

View File

@@ -0,0 +1,228 @@
<template>
<modal name="demo-login" transition="pop-out" :width="modalWidth" :height="400">
<div class="box">
<div class="box-part" id="bp-left">
<div class="partition" id="partition-register">
<div class="partition-title">CREATE ACCOUNT</div>
<div class="partition-form">
<form autocomplete="false">
<div class="autocomplete-fix">
<input type="password">
</div>
<input id="n-email" type="text" placeholder="Email">
<input id="n-username" type="text" placeholder="Username">
<input id="n-password2" type="password" placeholder="Password">
</form>
<div style="margin-top: 42px">
</div>
<div class="button-set">
<button id="goto-signin-btn">Sign In</button>
<button id="register-btn">Register</button>
</div>
<button class="large-btn github-btn">connect with <span>github</span></button>
<button class="large-btn facebook-btn">connect with <span>facebook</span></button>
</div>
</div>
</div>
<div class="box-part" id="bp-right">
<div class="box-messages">
</div>
</div>
</div>
</modal>
</template>
<script>
const MODAL_WIDTH = 656
export default {
name: 'DemoLoginModal',
data () {
return {
modalWidth: MODAL_WIDTH
}
},
created () {
this.modalWidth = window.innerWidth < MODAL_WIDTH
? MODAL_WIDTH / 2
: MODAL_WIDTH
}
}
</script>
<style lang="scss">
$background_color: #404142;
$github_color: #DBA226;
$facebook_color: #3880FF;
.box {
background: white;
overflow: hidden;
width: 656px;
height: 400px;
border-radius: 2px;
box-sizing: border-box;
box-shadow: 0 0 40px black;
color: #8b8c8d;
font-size: 0;
.box-part {
display: inline-block;
position: relative;
vertical-align: top;
box-sizing: border-box;
height: 100%;
width: 50%;
&#bp-right {
background: url("/static/panorama.jpg") no-repeat top left;
border-left: 1px solid #eee;
}
}
.box-messages {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
.box-error-message {
position: relative;
overflow: hidden;
box-sizing: border-box;
height: 0;
line-height: 32px;
padding: 0 12px;
text-align: center;
width: 100%;
font-size: 11px;
color: white;
background: #F38181;
}
.partition {
width: 100%;
height: 100%;
.partition-title {
box-sizing: border-box;
padding: 30px;
width: 100%;
text-align: center;
letter-spacing: 1px;
font-size: 20px;
font-weight: 300;
}
.partition-form {
padding: 0 20px;
box-sizing: border-box;
}
}
input[type=password],
input[type=text] {
display: block;
box-sizing: border-box;
margin-bottom: 4px;
width: 100%;
font-size: 12px;
line-height: 2;
border: 0;
border-bottom: 1px solid #DDDEDF;
padding: 4px 8px;
font-family: inherit;
transition: 0.5s all;
outline: none;
}
button {
background: white;
border-radius: 4px;
box-sizing: border-box;
padding: 10px;
letter-spacing: 1px;
font-family: "Open Sans", sans-serif;
font-weight: 400;
min-width: 140px;
margin-top: 8px;
color: #8b8c8d;
cursor: pointer;
border: 1px solid #DDDEDF;
text-transform: uppercase;
transition: 0.1s all;
font-size: 10px;
outline: none;
&:hover {
border-color: mix(#DDDEDF, black, 90%);
color: mix(#8b8c8d, black, 80%);
}
}
.large-btn {
width: 100%;
background: white;
span {
font-weight: 600;
}
&:hover {
color: white !important;
}
}
.button-set {
margin-bottom: 8px;
}
#register-btn,
#signin-btn {
margin-left: 8px;
}
.facebook-btn {
border-color: $facebook_color;
color: $facebook_color;
&:hover {
border-color: $facebook_color;
background: $facebook_color;
}
}
.github-btn {
border-color: $github_color;
color: $github_color;
&:hover {
border-color: $github_color;
background: $github_color;
}
}
.autocomplete-fix {
position: absolute;
visibility: hidden;
overflow: hidden;
opacity: 0;
width: 0;
height: 0;
left: 0;
top: 0;
}
}
.pop-out-enter-active,
.pop-out-leave-active {
transition: all 0.5s;
}
.pop-out-enter,
.pop-out-leave-active {
opacity: 0;
transform: translateY(24px);
}
</style>

View File

@@ -0,0 +1,55 @@
<template>
<modal name="dog-profile"
classes="cute-dog-profile-photo"
transition="scale"
:height="260"
:width="260"
@opened="opened">
<div slot="top-right" class="ct-top-right">
HIDE THE DOGGY
</div>
<img src="/static/cute_dog.gif" />
</modal>
</template>
<script>
export default {
name: 'InputFocusModal',
methods: {
opened (event) {
}
}
}
</script>
<style lang="scss">
.cute-dog-profile-photo {
background-color: transparent;
border-radius: 100%;
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.65);
img {
width: 260px;
height: 260px;
}
}
.ct-top-right {
cursor: pointer;
padding-top: 20px;
padding-right: 30px;
font-weight: 600;
color: white;
text-shadow: 0 0px 20px black;
}
.scale-enter-active,
.scale-leave-active {
transition: all 0.5s;
}
.scale-enter,
.scale-leave-active {
opacity: 0;
transform: scale(0.3) translateY(24px);
}
</style>

View File

@@ -0,0 +1,30 @@
<template>
<modal name="input-focus-modal"
:height="150"
:adaptive="true"
@opened="opened">
<div style="padding: 30px; text-align: center">
<input class="huge-font" type="text" placeholder="email" ref="email">
</div>
</modal>
</template>
<script>
export default {
name: 'InputFocusModal',
methods: {
opened (event) {
console.log(this.$refs.email)
// this.$refs.email.focus();
}
}
}
</script>
<style>
input.huge-font {
font-size: 70px;
font-weight: 100;
text-align: center;
min-width: auto;
width: 100%;
}
</style>

View File

@@ -0,0 +1,33 @@
<template>
<table>
<tr>
<td style="width: 20%">Modes:</td>
<td></td>
</tr>
<tr>
<td><b>Simple</b></td>
<td>Yet another boring modal :)</td>
</tr>
<tr>
<td><b>Adaptive</b></td>
<td>Tries to adjust to the page size</td>
</tr>
<tr>
<td><b>Resizable</b></td>
<td>
Has a small arrow on the bottom-right corner (customizable) that you can drag to change the size of the modal
</td>
</tr>
<tr>
<td><b>Draggable</b></td>
<td>
Allows to drag modal on the screen
</td>
</tr>
</table>
</template>
<script>
export default {
name: 'ModesTable'
}
</script>

View File

@@ -0,0 +1,103 @@
<template>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr v-for="(prop, name) in props">
<td>
{{name}}
</td>
<td>
<template v-if="Array.isArray(prop.type)">
{{prop.type.map(v => v.name).join(' / ')}}
</template>
<template v-else>
<span>{{prop.type.name}}</span>
</template>
</td>
<td>
{{prop.default}}
</td>
</tr>
</tbody>
</table>
</template>
<script>
export default {
name: 'PropsTable',
data () {
return {
props: {
name: {
required: true,
type: String,
},
delay: {
type: Number,
default: 0,
},
resizable: {
type: Boolean,
default: false
},
adaptive: {
type: Boolean,
default: false
},
draggable: {
type: Boolean,
default: false
},
transition: {
type: String,
},
classes: {
type: [String, Array],
default: 'v--modal',
},
width: {
type: Number,
default: 600
},
height: {
type: Number,
default: 300
},
minWidth: {
type: Number,
default: 0
},
minHeight: {
type: Number,
default: 0
},
pivotX: {
type: Number,
default: 0.5
},
pivotY: {
type: Number,
default: 0.5
}
}
}
}
}
</script>
<style lang="scss">
table.props {
width: 100%;
text-align: left;
border-collapse: collapse;
td, th {
border: 1px solid #eee;
padding: 4px 8px;
}
}
</style>

View File

@@ -0,0 +1,10 @@
import Vue from 'vue'
import App from './App.vue'
import VueJsModal from 'plugin'
Vue.use(VueJsModal)
new Vue({
el: '#app',
render: h => h(App)
})

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -0,0 +1,72 @@
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
'plugin': path.resolve(__dirname, "../../dist/index.js")
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}