From e95b8a606d9a572fb6af5f5589f4f400a2fa9404 Mon Sep 17 00:00:00 2001 From: sheychen Date: Wed, 17 Apr 2019 12:08:30 +0200 Subject: [PATCH] using event bus --- compiler/dist/mastodon/main.js | 2 +- compiler/dist/nextcloud-news/main.js | 2 +- compiler/dist/openweathermap/main.js | 4 +- compiler/src/core/baseService.vue | 10 +- compiler/src/core/input/baseSetting.vue | 2 +- compiler/src/core/serviceEmiter.vue | 23 ++++ compiler/src/core/serviceHeader.vue | 5 +- compiler/src/core/tools.js | 23 ---- compiler/src/mastodon/account.vue | 2 +- compiler/src/mastodon/client.vue | 6 +- compiler/src/mastodon/main.vue | 18 +-- compiler/src/mastodon/status.vue | 6 +- compiler/src/mastodon/tools.js | 18 +-- compiler/src/nextcloud-news/main.vue | 10 +- compiler/src/openweathermap/main.vue | 20 ++-- index.html | 5 +- main.css | 12 +- main.css.map | 2 +- main.js | 147 +++++++++++++----------- main.sass | 9 +- 20 files changed, 179 insertions(+), 147 deletions(-) create mode 100644 compiler/src/core/serviceEmiter.vue delete mode 100644 compiler/src/core/tools.js diff --git a/compiler/dist/mastodon/main.js b/compiler/dist/mastodon/main.js index ecf754b..188c330 100644 --- a/compiler/dist/mastodon/main.js +++ b/compiler/dist/mastodon/main.js @@ -1 +1 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=81)}([function(t,e,n){var r=n(19)("wks"),o=n(13),i=n(1).Symbol,s="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=s&&i[t]||(s?i:o)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){t.exports=!n(3)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(5),o=n(36),i=n(17),s=Object.defineProperty;e.f=n(2)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(8);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(4),o=n(18);t.exports=n(2)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(1),o=n(7),i=n(6),s=n(13)("src"),a=n(49),u=(""+a).split("toString");n(12).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var c="function"==typeof n;c&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(c&&(i(n,s)||o(n,s,t[e]?""+t[e]:u.join(String(e)))),t===r?t[e]=n:a?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[s]||a.call(this)})},function(t,e,n){var r=n(52),o=n(16);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(1),o=n(12),i=n(7),s=n(9),a=n(38),u=function(t,e,n){var c,l,f,p,v=t&u.F,h=t&u.G,d=t&u.S,y=t&u.P,g=t&u.B,m=h?r:d?r[e]||(r[e]={}):(r[e]||{}).prototype,_=h?o:o[e]||(o[e]={}),b=_.prototype||(_.prototype={});for(c in h&&(n=e),n)f=((l=!v&&m&&void 0!==m[c])?m:n)[c],p=g&&l?a(f,r):y&&"function"==typeof f?a(Function.call,f):f,m&&s(m,c,f,t&u.U),_[c]!=f&&i(_,c,p),y&&b[c]!=f&&(b[c]=f)};r.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(42),o=n(26);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(8);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(12),o=n(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(20)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!1},function(t,e,n){"use strict";var r=n(1),o=n(6),i=n(15),s=n(65),a=n(17),u=n(3),c=n(29).f,l=n(30).f,f=n(4).f,p=n(67).trim,v=r.Number,h=v,d=v.prototype,y="Number"==i(n(28)(d)),g="trim"in String.prototype,m=function(t){var e=a(t,!1);if("string"==typeof e&&e.length>2){var n,r,o,i=(e=g?e.trim():p(e,3)).charCodeAt(0);if(43===i||45===i){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===i){switch(e.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+e}for(var s,u=e.slice(2),c=0,l=u.length;co)return NaN;return parseInt(u,r)}}return+e};if(!v(" 0o1")||!v("0b1")||v("+0x1")){v=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof v&&(y?u(function(){d.valueOf.call(n)}):"Number"!=i(n))?s(new h(m(e)),n,v):m(e)};for(var _,b=n(2)?c(h):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;b.length>x;x++)o(h,_=b[x])&&!o(v,_)&&f(v,_,l(h,_));v.prototype=d,d.constructor=v,n(9)(r,"Number",v)}},function(t,e,n){"use strict";var r=n(1),o=n(6),i=n(2),s=n(11),a=n(9),u=n(50).KEY,c=n(3),l=n(19),f=n(23),p=n(13),v=n(0),h=n(40),d=n(41),y=n(51),g=n(55),m=n(5),_=n(8),b=n(10),x=n(17),w=n(18),S=n(28),k=n(58),O=n(30),C=n(4),E=n(14),M=O.f,j=C.f,P=k.f,N=r.Symbol,T=r.JSON,A=T&&T.stringify,I=v("_hidden"),R=v("toPrimitive"),L={}.propertyIsEnumerable,K=l("symbol-registry"),D=l("symbols"),F=l("op-symbols"),$=Object.prototype,B="function"==typeof N,V=r.QObject,G=!V||!V.prototype||!V.prototype.findChild,H=i&&c(function(){return 7!=S(j({},"a",{get:function(){return j(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=M($,e);r&&delete $[e],j(t,e,n),r&&t!==$&&j($,e,r)}:j,U=function(t){var e=D[t]=S(N.prototype);return e._k=t,e},z=B&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},J=function(t,e,n){return t===$&&J(F,e,n),m(t),e=x(e,!0),m(n),o(D,e)?(n.enumerable?(o(t,I)&&t[I][e]&&(t[I][e]=!1),n=S(n,{enumerable:w(0,!1)})):(o(t,I)||j(t,I,w(1,{})),t[I][e]=!0),H(t,e,n)):j(t,e,n)},W=function(t,e){m(t);for(var n,r=y(e=b(e)),o=0,i=r.length;i>o;)J(t,n=r[o++],e[n]);return t},X=function(t){var e=L.call(this,t=x(t,!0));return!(this===$&&o(D,t)&&!o(F,t))&&(!(e||!o(this,t)||!o(D,t)||o(this,I)&&this[I][t])||e)},Y=function(t,e){if(t=b(t),e=x(e,!0),t!==$||!o(D,e)||o(F,e)){var n=M(t,e);return!n||!o(D,e)||o(t,I)&&t[I][e]||(n.enumerable=!0),n}},q=function(t){for(var e,n=P(b(t)),r=[],i=0;n.length>i;)o(D,e=n[i++])||e==I||e==u||r.push(e);return r},Q=function(t){for(var e,n=t===$,r=P(n?F:b(t)),i=[],s=0;r.length>s;)!o(D,e=r[s++])||n&&!o($,e)||i.push(D[e]);return i};B||(a((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===$&&e.call(F,n),o(this,I)&&o(this[I],t)&&(this[I][t]=!1),H(this,t,w(1,n))};return i&&G&&H($,t,{configurable:!0,set:e}),U(t)}).prototype,"toString",function(){return this._k}),O.f=Y,C.f=J,n(29).f=k.f=q,n(27).f=X,n(44).f=Q,i&&!n(20)&&a($,"propertyIsEnumerable",X,!0),h.f=function(t){return U(v(t))}),s(s.G+s.W+s.F*!B,{Symbol:N});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)v(Z[tt++]);for(var et=E(v.store),nt=0;et.length>nt;)d(et[nt++]);s(s.S+s.F*!B,"Symbol",{for:function(t){return o(K,t+="")?K[t]:K[t]=N(t)},keyFor:function(t){if(!z(t))throw TypeError(t+" is not a symbol!");for(var e in K)if(K[e]===t)return e},useSetter:function(){G=!0},useSimple:function(){G=!1}}),s(s.S+s.F*!B,"Object",{create:function(t,e){return void 0===e?S(t):W(S(t),e)},defineProperty:J,defineProperties:W,getOwnPropertyDescriptor:Y,getOwnPropertyNames:q,getOwnPropertySymbols:Q}),T&&s(s.S+s.F*(!B||c(function(){var t=N();return"[null]"!=A([t])||"{}"!=A({a:t})||"{}"!=A(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e=r[1],(_(e)||void 0!==t)&&!z(t))return g(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!z(e))return e}),r[1]=e,A.apply(T,r)}}),N.prototype[R]||n(7)(N.prototype,R,N.prototype.valueOf),f(N,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){var r=n(4).f,o=n(6),i=n(0)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(19)("keys"),o=n(13);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(5),o=n(56),i=n(26),s=n(25)("IE_PROTO"),a=function(){},u=function(){var t,e=n(37)("iframe"),r=i.length;for(e.style.display="none",n(57).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write(" diff --git a/compiler/src/core/input/baseSetting.vue b/compiler/src/core/input/baseSetting.vue index 716ab0c..660f1c9 100644 --- a/compiler/src/core/input/baseSetting.vue +++ b/compiler/src/core/input/baseSetting.vue @@ -6,7 +6,7 @@ export default { }, methods: { sendChange(value) { - this.$emit('change', { name: this.id, value: value }) + this.$emit('change', { key: this.id, value: value }) } } } diff --git a/compiler/src/core/serviceEmiter.vue b/compiler/src/core/serviceEmiter.vue new file mode 100644 index 0000000..829071e --- /dev/null +++ b/compiler/src/core/serviceEmiter.vue @@ -0,0 +1,23 @@ + diff --git a/compiler/src/core/serviceHeader.vue b/compiler/src/core/serviceHeader.vue index 953c9fa..f8ca442 100644 --- a/compiler/src/core/serviceHeader.vue +++ b/compiler/src/core/serviceHeader.vue @@ -17,9 +17,12 @@ export default { data() { return { showSettings: false } }, + props: { + emit: Function + }, methods: { onMove(type, direction) { - this.$emit('move', { type: type, direction: direction }) + this.emit('move', { type: type, direction: direction }) }, } } diff --git a/compiler/src/core/tools.js b/compiler/src/core/tools.js deleted file mode 100644 index 92a65b5..0000000 --- a/compiler/src/core/tools.js +++ /dev/null @@ -1,23 +0,0 @@ -export const emitErrorMixin = { - methods: { - emitError(err) { - this.$emit('error', err.toString()) - } - } -} - -export const handleOptionsMixin = { - methods: { - saveOptions(options) { - this.$emit('save', options) - }, - setOption(name, value) { - const options = {...this.$props} - options[name] = value - this.saveOptions(options) - }, - setOptionCouple(couple) { - this.setOption(couple.name, couple.value) - } - } -} \ No newline at end of file diff --git a/compiler/src/mastodon/account.vue b/compiler/src/mastodon/account.vue index de0c695..aa3838b 100644 --- a/compiler/src/mastodon/account.vue +++ b/compiler/src/mastodon/account.vue @@ -9,6 +9,7 @@ a.account(target="_blank" :href="account.url") import { parseEmojisMixin } from './tools' export default { + mixins: [ parseEmojisMixin ], props: { account: Object, showMedia: { @@ -16,7 +17,6 @@ export default { default: true } }, - mixins: [ parseEmojisMixin ], methods: { avatarStyle(avatar) { return { diff --git a/compiler/src/mastodon/client.vue b/compiler/src/mastodon/client.vue index dd18c17..cb7803c 100644 --- a/compiler/src/mastodon/client.vue +++ b/compiler/src/mastodon/client.vue @@ -19,12 +19,14 @@