Skip to content

Commit

Permalink
Update SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
dangvanthanh committed Aug 28, 2020
1 parent cd1dd2f commit 589774d
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 147 deletions.
10 changes: 5 additions & 5 deletions dist/vue-clock.cjs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const _=1e3,f=12;function k(e){return e>=12?"PM":"AM"}function p(e){return(parseInt(e,10)>=10?"":"0")+e}var b={data(){return{hours:0,minutes:0,seconds:0,hourtime:""}},mounted(){this.$options.timer=window.setTimeout(this.updateDateTime,_)},beforeDestroy(){window.clearTimeout(this.$options.timer)},methods:{updateDateTime(){const e=new Date();this.hours=e.getHours(),this.minutes=p(e.getMinutes()),this.seconds=p(e.getSeconds()),this.hourtime=k(this.hours),this.hours=this.hours%f||f,this.$options.timer=window.setTimeout(this.updateDateTime,_)}}};function E(e,t,s,n,d,l,c,r,A,v){typeof c!="boolean"&&(A=r,r=c,c=!1);const i=typeof s=="function"?s.options:s;e&&e.render&&(i.render=e.render,i.staticRenderFns=e.staticRenderFns,i._compiled=!0,d&&(i.functional=!0)),n&&(i._scopeId=n);let a;if(l?(a=function(o){o=o||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!o&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(o=__VUE_SSR_CONTEXT__),t&&t.call(this,A(o)),o&&o._registeredComponents&&o._registeredComponents.add(l)},i._ssrRegister=a):t&&(a=c?function(o){t.call(this,v(o,this.$root.$options.shadowRoot))}:function(o){t.call(this,r(o))}),a)if(i.functional){const o=i.render;i.render=function(g,m){return a.call(m),o(g,m)}}else{const o=i.beforeCreate;i.beforeCreate=o?[].concat(o,a):[a]}return s}const y=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function w(e){return(t,s)=>T(t,s)}let u;const h={};function T(e,t){const s=y?t.media||"default":e,n=h[s]||(h[s]={ids:new Set(),styles:[]});if(!n.ids.has(e)){n.ids.add(e);let d=t.source;if(t.map&&(d+=`
/*# sourceURL=`+t.map.sources[0]+" */",d+=`
/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",t.media&&n.element.setAttribute("media",t.media),u===void 0&&(u=document.head||document.getElementsByTagName("head")[0]),u.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(d),n.element.styleSheet.cssText=n.styles.filter(Boolean).join(`
`);else{const l=n.ids.size-1,c=document.createTextNode(d),r=n.element.childNodes;r[l]&&n.element.removeChild(r[l]),r.length?n.element.insertBefore(c,r[l]):n.element.appendChild(c)}}}const x=b;var C=function(){var e=this,t=e.$createElement,s=e._self._c||t;return e.hourtime!=""?s("div",{staticClass:"clock"},[s("div",{staticClass:"clock__hours"},[s("span",{staticClass:"clock__hourtime",domProps:{textContent:e._s(e.hourtime)}}),e._v(" "),s("span",{domProps:{textContent:e._s(e.hours)}})]),e._v(" "),s("div",{staticClass:"clock__minutes",domProps:{textContent:e._s(e.minutes)}}),e._v(" "),s("div",{staticClass:"clock__seconds",domProps:{textContent:e._s(e.seconds)}})]):e._e()},S=[];C._withStripped=!0;const R=function(e){if(!e)return;e("data-v-6294754c_0",{source:`
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const SECOND=1e3,HOUR=12;function getHourTime(e){return e>=12?"PM":"AM"}function getZeroPad(e){return(parseInt(e,10)>=10?"":"0")+e}var script={data(){return{hours:0,minutes:0,seconds:0,hourtime:""}},mounted(){this.$options.timer=window.setTimeout(this.updateDateTime,SECOND)},beforeDestroy(){window.clearTimeout(this.$options.timer)},methods:{updateDateTime(){const e=new Date();this.hours=e.getHours(),this.minutes=getZeroPad(e.getMinutes()),this.seconds=getZeroPad(e.getSeconds()),this.hourtime=getHourTime(this.hours),this.hours=this.hours%HOUR||HOUR,this.$options.timer=window.setTimeout(this.updateDateTime,SECOND)}}};function normalizeComponent(e,t,s,n,a,l,c,r,u,m){typeof c!="boolean"&&(u=r,r=c,c=!1);const i=typeof s=="function"?s.options:s;e&&e.render&&(i.render=e.render,i.staticRenderFns=e.staticRenderFns,i._compiled=!0,a&&(i.functional=!0)),n&&(i._scopeId=n);let d;if(l?(d=function(o){o=o||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!o&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(o=__VUE_SSR_CONTEXT__),t&&t.call(this,u(o)),o&&o._registeredComponents&&o._registeredComponents.add(l)},i._ssrRegister=d):t&&(d=c?function(o){t.call(this,m(o,this.$root.$options.shadowRoot))}:function(o){t.call(this,r(o))}),d)if(i.functional){const o=i.render;i.render=function(f,A){return d.call(A),o(f,A)}}else{const o=i.beforeCreate;i.beforeCreate=o?[].concat(o,d):[d]}return s}const isOldIE=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function createInjector(e){return(t,s)=>addStyle(t,s)}let HEAD;const styles={};function addStyle(e,t){const s=isOldIE?t.media||"default":e,n=styles[s]||(styles[s]={ids:new Set(),styles:[]});if(!n.ids.has(e)){n.ids.add(e);let a=t.source;if(t.map&&(a+=`
/*# sourceURL=`+t.map.sources[0]+" */",a+=`
/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",t.media&&n.element.setAttribute("media",t.media),HEAD===void 0&&(HEAD=document.head||document.getElementsByTagName("head")[0]),HEAD.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(a),n.element.styleSheet.cssText=n.styles.filter(Boolean).join(`
`);else{const l=n.ids.size-1,c=document.createTextNode(a),r=n.element.childNodes;r[l]&&n.element.removeChild(r[l]),r.length?n.element.insertBefore(c,r[l]):n.element.appendChild(c)}}}const __vue_script__=script;var __vue_render__=function(){var e=this,t=e.$createElement,s=e._self._c||t;return e.hourtime!=""?s("div",{staticClass:"clock"},[s("div",{staticClass:"clock__hours"},[s("span",{staticClass:"clock__hourtime",domProps:{textContent:e._s(e.hourtime)}}),e._v(" "),s("span",{domProps:{textContent:e._s(e.hours)}})]),e._v(" "),s("div",{staticClass:"clock__minutes",domProps:{textContent:e._s(e.minutes)}}),e._v(" "),s("div",{staticClass:"clock__seconds",domProps:{textContent:e._s(e.seconds)}})]):e._e()},__vue_staticRenderFns__=[];__vue_render__._withStripped=!0;const __vue_inject_styles__=function(e){if(!e)return;e("data-v-6294754c_0",{source:`
.clock[data-v-6294754c] {
background: #fff;
border: 0.3rem solid #fff;
Expand Down Expand Up @@ -124,4 +124,4 @@ export default {
left: 8px;
}
</style>
`]},media:void 0})},D="data-v-6294754c",B=void 0,N=!1,$=E({render:C,staticRenderFns:S},R,x,D,N,B,!1,w,void 0,void 0);export default $;
`]},media:void 0})},__vue_scope_id__="data-v-6294754c",__vue_module_identifier__=void 0,__vue_is_functional_template__=!1,__vue_component__=normalizeComponent({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,!1,createInjector,void 0,void 0);function install(e){if(install.installed)return;install.installed=!0,e.component("VueClock",__vue_component__)}const plugin={install};let globalVue=null;typeof window!="undefined"?globalVue=window.Vue:typeof global!="undefined"&&(globalVue=global.Vue),globalVue&&globalVue.use(plugin),exports.default=__vue_component__,exports.install=install;
37 changes: 37 additions & 0 deletions dist/vue-clock.esm.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

.clock[data-v-6294754c] {
background: #fff;
border: 0.3rem solid #fff;
border-radius: 0.5rem;
display: inline-block;
margin-bottom: 1em;
}
.clock__hours[data-v-6294754c],
.clock__minutes[data-v-6294754c],
.clock__seconds[data-v-6294754c] {
background: linear-gradient(to bottom, #26303b 50%, #2c3540 50%);
display: inline-block;
color: #fff;
font-family: 'Nunito', sans-serif;
font-size: 3rem;
font-weight: 300;
padding: 0.5rem 1rem;
text-align: center;
position: relative;
}
.clock__hours[data-v-6294754c] {
border-right: 0.15rem solid #fff;
border-radius: 0.5rem 0 0 0.5rem;
}
.clock__minutes[data-v-6294754c] {
border-right: 0.15rem solid #fff;
}
.clock__seconds[data-v-6294754c] {
border-radius: 0 0.5rem 0.5rem 0;
}
.clock__hourtime[data-v-6294754c] {
font-size: 1rem;
position: absolute;
top: 2px;
left: 8px;
}
128 changes: 1 addition & 127 deletions dist/vue-clock.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 589774d

Please sign in to comment.