├── .gitignore ├── config.js ├── README.md ├── src ├── components │ ├── SelectAllDirective.js │ ├── Highlight.js │ ├── shortener.js │ ├── compiler.js │ ├── MenuToggler.vue │ ├── CodeMirror.js │ ├── SplitPane.vue │ └── GithubRibbon.vue ├── index.js ├── app.js ├── samples.js ├── index.html └── style.css ├── webpack.config.js ├── package.json ├── yarn.lock └── docs ├── client.fe1e06d6.css ├── client.f0b8de34.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /vue-web-compiler/ 3 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | html: { 3 | template: __dirname + '/src/index.html' 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Browser based Vue.js compiler 2 | 3 | https://vuejs-tips.github.io/compiler/ 4 | 5 | 6 | Type html on the left and see the resulting javascript on the right 7 | -------------------------------------------------------------------------------- /src/components/SelectAllDirective.js: -------------------------------------------------------------------------------- 1 | export default function (el) { 2 | ['focus', 'mouseup', 'keyup'].map(type => { 3 | el.addEventListener(type, evt => { 4 | evt.target.select() 5 | evt.preventDefault() 6 | }) 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | // Throw error message as Exception, so I can catch Vue compilation errors 2 | console.error = function (msg) {throw msg} 3 | 4 | // Vue.config.devtools = true 5 | // Vue.config.debug = true 6 | 7 | import './app' 8 | import './style.css' 9 | 10 | import Clipboard from 'clipboard/dist/clipboard' 11 | new Clipboard('.copy') 12 | -------------------------------------------------------------------------------- /src/components/Highlight.js: -------------------------------------------------------------------------------- 1 | export default { 2 | template: '
', 3 | props: ['code'], 4 | mounted () { 5 | this.refresh() 6 | }, 7 | watch: { 8 | code () { 9 | this.refresh() 10 | } 11 | }, 12 | methods: { 13 | refresh () { 14 | var codeTag = this.$el.querySelector('code') 15 | codeTag.innerHTML = this.code 16 | hljs.highlightBlock(codeTag) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/components/shortener.js: -------------------------------------------------------------------------------- 1 | // Safari 10 and mobile devices doesn't support fetch: http://caniuse.com/#search=fetch 2 | export default function shortener(url) { 3 | return fetch('https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyA20hdW0mgN9sdnfdMvKF0S63-QxwfazAU', { 4 | method:'POST', 5 | body: `{"longUrl": "${url}"}`, 6 | mode: 'cors', 7 | headers: {'Content-Type': 'application/json'} 8 | }) 9 | .then(response => response.json()) 10 | .then(json => json.id) 11 | } 12 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require.main.require('webpack') 2 | const HtmlWebpackPlugin = require.main.require('html-webpack-plugin') 3 | const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin') 4 | 5 | module.exports = { 6 | devtool: false, 7 | output: { 8 | publicPath: '' // same path as online version 9 | }, 10 | plugins: [ 11 | new webpack.DefinePlugin({ 12 | 'process.env.VERSION': JSON.stringify(require('./package.json').version) 13 | }), 14 | new HtmlWebpackPlugin({ 15 | template: './src/index.html', 16 | inlineSource: '.(js|css)$' // embed all javascript and css inline 17 | }), 18 | new HtmlWebpackInlineSourcePlugin() 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/components/compiler.js: -------------------------------------------------------------------------------- 1 | export default function compile (code) { 2 | code = code.replace(/\s*\n+\s*/g, ' ') // collapse whitespaces 3 | code = code.replace(/>\s+/g, '>').replace(/\s+ (https://medium.com/vuejs-tips)", 7 | "license": "MIT", 8 | "keywords": [ 9 | "vue", 10 | "compiler", 11 | "template", 12 | "playground" 13 | ], 14 | "scripts": { 15 | "start": "vue build src/index.js --config config.js", 16 | "compile": "yarn build -- --disable-compress", 17 | "build": "vue build src/index.js --config config.js --webpack webpack.config.js --dist ./docs/ --prod", 18 | "deploy": "npm version minor; yarn build", 19 | "serve": "open 'http://localhost:3000/'; serve ./docs/", 20 | "upgrade:check": "ncu", 21 | "upgrade:apply": "ncu -a" 22 | }, 23 | "devDependencies": { 24 | "html-webpack-inline-source-plugin": "^0.0.8" 25 | }, 26 | "dependencies": { 27 | "clipboard": "^1.6.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/components/MenuToggler.vue: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /src/components/CodeMirror.js: -------------------------------------------------------------------------------- 1 | export default { 2 | template: '
', 3 | props: ['value'], 4 | mounted () { 5 | // convert textarea to syntax highlight editor http://codemirror.net/ 6 | var editor = CodeMirror(this.$el, { 7 | value: this.value, 8 | mode: "text/html", // https://github.com/codemirror/CodeMirror/blob/5.24.0/mode/xml/index.html#L41 9 | theme: 'material', // https://codemirror.net/demo/theme.html#material 10 | tabSize: 2 // http://codemirror.net/doc/manual.html#config 11 | }) 12 | 13 | // fix cursor position after google font family has loaded 14 | // https://github.com/codemirror/CodeMirror/issues/3764#issuecomment-171560662 15 | window.addEventListener('load', function () { 16 | editor.getWrapperElement().style.fontSize = '16px' 17 | editor.refresh() 18 | }) 19 | 20 | editor.on('change', cm => this.$emit('input', cm.getValue())) 21 | this.editor = editor 22 | }, 23 | watch: { 24 | value (val) { 25 | if (val === this.editor.getValue()) return // changed from inside 26 | this.editor.setValue(val) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/components/SplitPane.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 45 | 46 | 76 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | clipboard@^1.6.1: 6 | version "1.6.1" 7 | resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-1.6.1.tgz#65c5b654812466b0faab82dc6ba0f1d2f8e4be53" 8 | dependencies: 9 | good-listener "^1.2.0" 10 | select "^1.1.2" 11 | tiny-emitter "^1.0.0" 12 | 13 | delegate@^3.1.2: 14 | version "3.1.2" 15 | resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.1.2.tgz#1e1bc6f5cadda6cb6cbf7e6d05d0bcdd5712aebe" 16 | 17 | escape-string-regexp@^1.0.5: 18 | version "1.0.5" 19 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 20 | 21 | good-listener@^1.2.0: 22 | version "1.2.2" 23 | resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" 24 | dependencies: 25 | delegate "^3.1.2" 26 | 27 | html-webpack-inline-source-plugin@^0.0.8: 28 | version "0.0.8" 29 | resolved "https://registry.yarnpkg.com/html-webpack-inline-source-plugin/-/html-webpack-inline-source-plugin-0.0.8.tgz#245c0f33e14e017c224d61dbdb74ac58536596c2" 30 | dependencies: 31 | escape-string-regexp "^1.0.5" 32 | slash "^1.0.0" 33 | source-map-url "^0.4.0" 34 | 35 | select@^1.1.2: 36 | version "1.1.2" 37 | resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" 38 | 39 | slash@^1.0.0: 40 | version "1.0.0" 41 | resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" 42 | 43 | source-map-url@^0.4.0: 44 | version "0.4.0" 45 | resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" 46 | 47 | tiny-emitter@^1.0.0: 48 | version "1.1.0" 49 | resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-1.1.0.tgz#ab405a21ffed814a76c19739648093d70654fecb" 50 | -------------------------------------------------------------------------------- /src/components/GithubRibbon.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 53 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | import samples from './samples' 2 | import CodeMirror from './components/CodeMirror' 3 | import Highlight from './components/Highlight' 4 | import compile from './components/compiler' 5 | import shortener from './components/shortener' 6 | import GithubRibbon from './components/GithubRibbon.vue' 7 | import MenuToggler from './components/MenuToggler.vue' 8 | import SplitPane from './components/SplitPane.vue' 9 | 10 | var urlParam = decodeURI(location.hash.substr(1)) 11 | var input = urlParam ? samples[urlParam] || atob(urlParam) : localStorage.getItem('input') || '
' 12 | 13 | new Vue({ 14 | el: '#app', 15 | components: {CodeMirror, Highlight, GithubRibbon, MenuToggler, SplitPane}, 16 | 17 | data: { 18 | input: input, // restore after refresh 19 | filter: '', 20 | error: '', 21 | code: '', 22 | vueVersion: Vue.version, 23 | version: process.env.VERSION, 24 | samples, 25 | showMenu: !!samples[urlParam], 26 | selectedMenu: urlParam, 27 | shortUrl: '' 28 | }, 29 | 30 | computed: { 31 | filteredSamples () { 32 | if (this.filter === '') { 33 | return this.samples 34 | } else { 35 | var samples = {} 36 | for (let label in this.samples) { 37 | var code = this.samples[label].toLowerCase() 38 | if (code.match(this.filter.toLowerCase()) || label.toLowerCase().match(this.filter.toLowerCase())) { 39 | samples[label] = code 40 | } 41 | } 42 | return samples 43 | } 44 | }, 45 | 46 | compiled () { 47 | try { 48 | this.code = compile(this.input) 49 | this.error = '' // clear error if compiled 50 | localStorage.setItem('input', this.input) // keep code changes after refresh 51 | } catch (e) { 52 | this.error = e.toString() 53 | } 54 | 55 | return this.code 56 | }, 57 | 58 | url () { 59 | return location.protocol + '//' + location.host + location.pathname 60 | }, 61 | 62 | shareUrl () { 63 | return this.url + '#' + btoa(this.input) 64 | } 65 | }, 66 | 67 | methods: { 68 | select (label) { 69 | this.input = samples[label] 70 | this.selectedMenu = label 71 | }, 72 | 73 | share () { 74 | this.shortUrl = this.shareUrl 75 | shortener(this.shareUrl).then(url => this.shortUrl = url) 76 | } 77 | }, 78 | }) 79 | -------------------------------------------------------------------------------- /src/samples.js: -------------------------------------------------------------------------------- 1 | export default { 2 | 'custom': '', 3 | 'sync': '', 4 | 'v-model': '', 5 | 'v-model_input': '', 6 | 'v-model_textarea': `\n`, 7 | 'v-model_checkbox': '', 8 | 'v-model_radio': '', 9 | 'v-model_select': '', 10 | 'v-model.trim': '', 11 | 'v-model.lazy': '', 12 | 'v-model.number': '', 13 | 'v-on': '', 14 | 'v-on-event': '', 15 | 'v-on.prevent': '', 16 | 'v-on.native': '', 17 | 'v-on_filter': `\n`, 18 | 'v-bind_filter': '', 19 | 'v-bind': '', 20 | 'v-pre': ``, 21 | 'v-cloak': `
`, 22 | 'v-once': `
`, 23 | 'v-text': ``, 24 | 'v-html': `
`, 25 | 'v-show': 'logout', 26 | 'v-if': 'logout', 27 | 'v-else': ` 31 | `, 32 | 33 | 'v-else-if': `
34 | A 35 |
36 |
37 | B 38 |
39 |
40 | C 41 |
42 |
43 | Not A/B/C 44 |
`, 45 | 46 | 'v-for': ` 51 | `, 52 | 53 | 'slot': `
54 | 55 | content 56 | 57 | 58 | copyright 59 | 60 |
`, 61 | 62 | 'slot-scoped': `
63 | 64 | 68 | 69 |
`, 70 | 71 | 'inline-template': ` 72 |
73 | content 74 |
75 |
`, 76 | 77 | 'component-is': `` 78 | } 79 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 |
25 | Vue.js {{vueVersion}} 26 |
27 | 28 |
29 | 41 | 42 |
43 | 44 |
{{error}}
45 |
46 | 47 |
48 | 49 |
50 |
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/style.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | } 4 | *, 5 | *::before, 6 | *::after { 7 | box-sizing: inherit; 8 | } 9 | html, body { 10 | margin: 0; 11 | } 12 | header { 13 | padding: 0 10px; 14 | display: flex; 15 | align-items: center; 16 | justify-content: space-between; 17 | height: 30px; 18 | background-color: #333; 19 | color: white; 20 | } 21 | header > * { 22 | } 23 | .fb-column { 24 | display: flex; 25 | flex-direction: column; 26 | align-items: stretch; 27 | } 28 | .fb-row { 29 | display: flex; 30 | flex-direction: row; 31 | align-items: stretch; 32 | } 33 | .fb-grow { 34 | display: flex; 35 | flex-grow: 1; 36 | width: 100%; 37 | flex-direction: column; 38 | } 39 | #code { 40 | flex-grow: 1; 41 | display: flex; 42 | flex-direction: column; 43 | cursor: text; 44 | flex-basis: 100%; 45 | } 46 | .CodeMirror { 47 | flex-grow: 1; 48 | } 49 | pre { 50 | margin: 0; 51 | 52 | } 53 | 54 | html, body, pre, code, #app, .fb-row, .fb-grow { 55 | height: 100%; 56 | } 57 | 58 | #output { 59 | cursor: default; 60 | flex-grow: 1; 61 | background-color: #282c34; 62 | } 63 | 64 | #error { 65 | position: absolute; 66 | bottom: 0; 67 | color: white; 68 | background-color: red; 69 | padding: 5px; 70 | } 71 | 72 | #error, textarea, code, .CodeMirror { 73 | font-family: 'Source Code Pro', monospace; 74 | font-size: 16px; 75 | } 76 | ol, 77 | ul { 78 | list-style: none; 79 | margin: 0; 80 | padding: 0; 81 | } 82 | nav.menu { 83 | background-color: #fafafa; 84 | width: 150px; 85 | min-width: 150px; 86 | max-width: 150px; 87 | margin-left: -150px; 88 | transition: margin-left 0.5s cubic-bezier(0.77,0.2,0.05,1.0); 89 | overflow-y: auto; 90 | padding-bottom: 20px; 91 | } 92 | 93 | nav.menu li { 94 | padding: 5px; 95 | border-bottom: 1px solid #ddd; 96 | } 97 | 98 | nav.menu a { 99 | text-decoration: none; 100 | color: #444; 101 | display: block; 102 | } 103 | 104 | nav.menu li:hover { 105 | background-color: #ccc; 106 | } 107 | 108 | nav.menu li.active { 109 | background-color: #efe; 110 | font-weight: bold; 111 | } 112 | 113 | nav.menu.showing { 114 | margin-left: 0; 115 | } 116 | [v-cloak] { 117 | display: none; 118 | } 119 | 120 | #version { 121 | margin-right: 70px; 122 | } 123 | 124 | #share { 125 | color: #ccc; 126 | text-decoration: none; 127 | } 128 | 129 | #share:hover { 130 | color: white; 131 | } 132 | 133 | input { 134 | outline: none; 135 | border-radius: 6px; 136 | border: 1px solid silver; 137 | height: 25px; 138 | line-height: 25px; 139 | font-size: 0.7em; 140 | display: block; 141 | width: 100%; 142 | padding: 4px; 143 | } 144 | /* hamburger svg menu */ 145 | 146 | .svg-menu-toggle:hover { 147 | fill: #fff; 148 | } 149 | 150 | .svg-menu-toggle { 151 | fill: #ccc; 152 | pointer-events: all; 153 | cursor: pointer; 154 | } 155 | .svg-menu-toggle .bar { 156 | -webkit-transform: rotate(0) translateY(0) translateX(0); 157 | transform: rotate(0) translateY(0) translateX(0); 158 | opacity: 1; 159 | -webkit-transform-origin: 20px 10px; 160 | transform-origin: 20px 10px; 161 | -webkit-transition: -webkit-transform 0.4s ease-in-out, opacity 0.2s ease-in-out; 162 | transition: transform 0.4s ease-in-out, opacity 0.2s ease-in-out; 163 | } 164 | .svg-menu-toggle .bar:nth-of-type(1) { 165 | -webkit-transform-origin: 20px 10px; 166 | transform-origin: 20px 10px; 167 | } 168 | .svg-menu-toggle .bar:nth-of-type(3) { 169 | -webkit-transform-origin: 20px 20px; 170 | transform-origin: 20px 20px; 171 | } 172 | 173 | .active .svg-menu-toggle .bar:nth-of-type(1) { 174 | -webkit-transform: rotate(-45deg) translateY(0) translateX(0); 175 | transform: rotate(-45deg) translateY(0) translateX(0); 176 | } 177 | .active .svg-menu-toggle .bar:nth-of-type(2) { 178 | opacity: 0; 179 | } 180 | .active .svg-menu-toggle .bar:nth-of-type(3) { 181 | -webkit-transform: rotate(45deg) translateY(0em) translateX(0em); 182 | transform: rotate(45deg) translateY(0em) translateX(0em); 183 | } 184 | 185 | .inline-svg { 186 | width: 30px; 187 | } 188 | -------------------------------------------------------------------------------- /docs/client.fe1e06d6.css: -------------------------------------------------------------------------------- 1 | .github-corner[data-v-01d82cf6]{z-index:1}.github-corner:hover .octo-arm[data-v-01d82cf6]{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}@-webkit-keyframes octocat-wave{0%,to{-webkit-transform:rotate(0);transform:rotate(0)}20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{-webkit-transform:rotate(0);transform:rotate(0)}20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm[data-v-01d82cf6]{-webkit-animation:none;animation:none}.github-corner .octo-arm[data-v-01d82cf6]{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}.split-pane[data-v-233982e6]{display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;width:100%}.split-pane.dragging[data-v-233982e6]{cursor:ew-resize}.left[data-v-233982e6],.right[data-v-233982e6]{position:relative;width:100%}.left[data-v-233982e6]{border-right:1px solid #333}.dragger[data-v-233982e6]{position:absolute;z-index:99;top:0;bottom:0;right:-5px;width:10px;cursor:ew-resize}html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}body,html{margin:0}header{padding:0 10px;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;height:30px;background-color:#333;color:#fff}.fb-column{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.fb-column,.fb-row{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-ms-flex-align:stretch;align-items:stretch}.fb-row{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row}.fb-grow{width:100%}#code,.fb-grow{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}#code{cursor:text;-webkit-flex-basis:100%;-ms-flex-preferred-size:100%;flex-basis:100%}.CodeMirror{-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}pre{margin:0}#app,.fb-grow,.fb-row,body,code,html,pre{height:100%}#output{cursor:default;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;background-color:#282c34}#error{position:absolute;bottom:0;color:#fff;background-color:red;padding:5px}#error,.CodeMirror,code,textarea{font-family:Source Code Pro,monospace;font-size:16px}ol,ul{list-style:none;margin:0;padding:0}nav.menu{background-color:#fafafa;width:150px;min-width:150px;max-width:150px;margin-left:-150px;transition:margin-left .5s cubic-bezier(.77,.2,.05,1);overflow-y:auto;padding-bottom:20px}nav.menu li{padding:5px;border-bottom:1px solid #ddd}nav.menu a{text-decoration:none;color:#444;display:block}nav.menu li:hover{background-color:#ccc}nav.menu li.active{background-color:#efe;font-weight:700}nav.menu.showing{margin-left:0}[v-cloak]{display:none}#version{margin-right:70px}#share{color:#ccc;text-decoration:none}#share:hover{color:#fff}input{outline:none;border-radius:6px;border:1px solid silver;height:25px;line-height:25px;font-size:.7em;display:block;width:100%;padding:4px}.svg-menu-toggle:hover{fill:#fff}.svg-menu-toggle{fill:#ccc;pointer-events:all;cursor:pointer}.svg-menu-toggle .bar{-webkit-transform:rotate(0) translateY(0) translateX(0);-ms-transform:rotate(0) translateY(0) translateX(0);transform:rotate(0) translateY(0) translateX(0);opacity:1;transform-origin:20px 10px;transition:opacity .2s ease-in-out,-webkit-transform .4s ease-in-out;transition:transform .4s ease-in-out,opacity .2s ease-in-out;transition:transform .4s ease-in-out,opacity .2s ease-in-out,-webkit-transform .4s ease-in-out}.svg-menu-toggle .bar,.svg-menu-toggle .bar:first-of-type{-webkit-transform-origin:20px 10px;-ms-transform-origin:20px 10px}.svg-menu-toggle .bar:first-of-type{transform-origin:20px 10px}.svg-menu-toggle .bar:nth-of-type(3){-webkit-transform-origin:20px 20px;-ms-transform-origin:20px 20px;transform-origin:20px 20px}.active .svg-menu-toggle .bar:first-of-type{-webkit-transform:rotate(-45deg) translateY(0) translateX(0);-ms-transform:rotate(-45deg) translateY(0) translateX(0);transform:rotate(-45deg) translateY(0) translateX(0)}.active .svg-menu-toggle .bar:nth-of-type(2){opacity:0}.active .svg-menu-toggle .bar:nth-of-type(3){-webkit-transform:rotate(45deg) translateY(0) translateX(0);-ms-transform:rotate(45deg) translateY(0) translateX(0);transform:rotate(45deg) translateY(0) translateX(0)}.inline-svg{width:30px} -------------------------------------------------------------------------------- /docs/client.f0b8de34.js: -------------------------------------------------------------------------------- 1 | (function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=19)})([function(t,e){t.exports=function(t,e,n,o){var i,r=t=t||{},a=typeof t.default;"object"!==a&&"function"!==a||(i=t,r=t.default);var s="function"==typeof r?r.options:r;if(e&&(s.render=e.render,s.staticRenderFns=e.staticRenderFns),n&&(s._scopeId=n),o){var l=s.computed||(s.computed={});Object.keys(o).forEach(function(t){var e=o[t];l[t]=function(){return e}})}return{esModule:i,exports:r,options:s}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=(n(3),n(9)),i=(n.n(o),n(18)),r=n.n(i);console.error=function(t){throw t},new r.a(".copy")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={data:function(){return{split:50,dragging:!1}},methods:{dragStart:function(t){this.dragging=!0,this.startX=t.pageX,this.startSplit=this.split},dragMove:function(t){if(this.dragging){var e=t.pageX-this.startX,n=this.$el.offsetWidth;this.split=this.startSplit+~~(e/n*100)}},dragEnd:function(){this.dragging=!1}}}},function(t,e,n){"use strict";var o=n(8),i=n(4),r=n(5),a=n(6),s=n(7),l=n(12),c=n.n(l),u=n(13),f=n.n(u),d=n(14),p=n.n(d),h=decodeURI(location.hash.substr(1)),v=h?o.a[h]||atob(h):localStorage.getItem("input")||"
";new Vue({el:"#app",components:{CodeMirror:i.a,Highlight:r.a,GithubRibbon:c.a,MenuToggler:f.a,SplitPane:p.a},data:{input:v,filter:"",error:"",code:"",vueVersion:Vue.version,version:"0.5.0",samples:o.a,showMenu:!!o.a[h],selectedMenu:h,shortUrl:""},computed:{filteredSamples:function(){if(""===this.filter)return this.samples;var t={};for(var e in this.samples){var n=this.samples[e].toLowerCase();(n.match(this.filter.toLowerCase())||e.toLowerCase().match(this.filter.toLowerCase()))&&(t[e]=n)}return t},compiled:function(){try{this.code=n.i(a.a)(this.input),this.error="",localStorage.setItem("input",this.input)}catch(t){this.error=t.toString()}return this.code},url:function(){return location.protocol+"//"+location.host+location.pathname},shareUrl:function(){return this.url+"#"+btoa(this.input)}},methods:{select:function(t){this.input=o.a[t],this.selectedMenu=t},share:function(){var t=this;this.shortUrl=this.shareUrl,n.i(s.a)(this.shareUrl).then(function(e){return t.shortUrl=e})}}})},function(t,e,n){"use strict";e.a={template:"
",props:["value"],mounted:function(){var t=this,e=CodeMirror(this.$el,{value:this.value,mode:"text/html",theme:"material",tabSize:2});window.addEventListener("load",function(){e.getWrapperElement().style.fontSize="16px",e.refresh()}),e.on("change",function(e){return t.$emit("input",e.getValue())}),this.editor=e},watch:{value:function(t){t!==this.editor.getValue()&&this.editor.setValue(t)}}}},function(t,e,n){"use strict";e.a={template:'
',props:["code"],mounted:function(){this.refresh()},watch:{code:function(){this.refresh()}},methods:{refresh:function(){var t=this.$el.querySelector("code");t.innerHTML=this.code,hljs.highlightBlock(t)}}}},function(t,e,n){"use strict";function o(t){return t=t.replace(/\s*\n+\s*/g," "),t=t.replace(/>\s+/g,">").replace(/\s+",sync:'',"v-model":'',"v-model_input":'',"v-model_textarea":'\n',"v-model_checkbox":'',"v-model_radio":'',"v-model_select":'',"v-model.trim":'',"v-model.lazy":'',"v-model.number":'',"v-on":'',"v-on-event":'',"v-on.prevent":'',"v-on.native":'',"v-on_filter":'\n',"v-bind_filter":'',"v-bind":'',"v-pre":"","v-cloak":"
","v-once":"
","v-text":'',"v-html":'
',"v-show":'logout',"v-if":'logout',"v-else":'\n',"v-else-if":"
\n A\n
\n
\n B\n
\n
\n C\n
\n
\n Not A/B/C\n
","v-for":'\n',slot:'
\n \n content\n \n \n copyright\n \n
',"slot-scoped":'
\n \n \n \n
',"inline-template":"\n
\n content\n
\n
","component-is":''}},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){n(10);var o=n(0)(null,n(15),"data-v-01d82cf6",null);t.exports=o.exports},function(t,e,n){var o=n(0)(null,n(16),null,null);t.exports=o.exports},function(t,e,n){n(11);var o=n(0)(n(2),n(17),"data-v-233982e6",null);t.exports=o.exports},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a",{staticClass:"github-corner",attrs:{href:"https://github.com/vuejs-tips/compiler","aria-label":"View source on Github"}},[n("svg",{staticStyle:{fill:"#333333",color:"#fff",position:"absolute",top:"0",border:"0",right:"0"},attrs:{width:"80",height:"80",viewBox:"0 0 250 250","aria-hidden":"true"}},[n("path",{attrs:{d:"M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"}}),t._v(" "),n("path",{staticClass:"octo-arm",staticStyle:{"transform-origin":"130px 106px"},attrs:{d:"M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2",fill:"currentColor"}}),t._v(" "),n("path",{staticClass:"octo-body",attrs:{d:"M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z",fill:"currentColor"}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("svg",{staticClass:"inline-svg",attrs:{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"24px",height:"30px",viewBox:"0 0 24 30","enable-background":"new 0 0 32 22.5","xml:space":"preserve"}},[n("g",{staticClass:"svg-menu-toggle"},[n("path",{staticClass:"bar",attrs:{d:"M20.945,8.75c0,0.69-0.5,1.25-1.117,1.25H3.141c-0.617,0-1.118-0.56-1.118-1.25l0,0c0-0.69,0.5-1.25,1.118-1.25h16.688C20.445,7.5,20.945,8.06,20.945,8.75L20.945,8.75z"}}),t._v(" "),n("path",{staticClass:"bar",attrs:{d:"M20.923,15c0,0.689-0.501,1.25-1.118,1.25H3.118C2.5,16.25,2,15.689,2,15l0,0c0-0.689,0.5-1.25,1.118-1.25 h16.687C20.422,13.75,20.923,14.311,20.923,15L20.923,15z"}}),t._v(" "),n("path",{staticClass:"bar",attrs:{d:"M20.969,21.25c0,0.689-0.5,1.25-1.117,1.25H3.164c-0.617,0-1.118-0.561-1.118-1.25l0,0c0-0.689,0.5-1.25,1.118-1.25h16.688C20.469,20,20.969,20.561,20.969,21.25L20.969,21.25z"}}),t._v(" "),n("rect",{attrs:{width:"24",height:"30",fill:"none"}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"split-pane",class:{dragging:t.dragging},on:{mousemove:t.dragMove,mouseup:t.dragEnd,mouseleave:t.dragEnd}},[n("div",{staticClass:"left",style:{width:t.split+"%"}},[t._t("left"),t._v(" "),n("div",{staticClass:"dragger",on:{mousedown:t.dragStart}})],2),t._v(" "),n("div",{staticClass:"right",style:{width:100-t.split+"%"}},[t._t("right")],2)])},staticRenderFns:[]}},function(t,e,n){var o,o;(function(e){t.exports=e()})(function(){var t;return function t(e,n,i){function r(s,l){if(!n[s]){if(!e[s]){var c="function"==typeof o&&o;if(!l&&c)return o(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return r(n?n:t)},f,f.exports,t,e,n,i)}return n[s].exports}for(var a="function"==typeof o&&o,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,o.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,o.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":i(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=a})},{select:5}],8:[function(e,n,o){(function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}})(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var c=i(e),u=i(n),f=i(o),d=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,f.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(e),target:this.target(e),text:this.text(e),trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return l("action",t)}},{key:"defaultTarget",value:function(t){var e=l("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return l("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)})},function(t,e,n){t.exports=n(1)}]); -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 |
25 | Vue.js {{vueVersion}} 26 |
27 | 28 |
29 | 41 | 42 |
43 | 44 |
{{error}}
45 |
46 | 47 |
48 | 49 |
50 |
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 70 | 71 | 72 | --------------------------------------------------------------------------------