diff --git a/dist/vue-clock.cjs.js b/dist/vue-clock.cjs.js index fa0b955..7b9fdc5 100644 --- a/dist/vue-clock.cjs.js +++ b/dist/vue-clock.cjs.js @@ -1,7 +1,7 @@ -"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,d,u,c,r,l,m){typeof c!="boolean"&&(l=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(u?(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,l(o)),o&&o._registeredComponents&&o._registeredComponents.add(u)},i._ssrRegister=a):t&&(a=c?function(o){t.call(this,m(o,this.$root.$options.shadowRoot))}:function(o){t.call(this,r(o))}),a)if(i.functional){const o=i.render;i.render=function(_,A){return a.call(A),o(_,A)}}else{const o=i.beforeCreate;i.beforeCreate=o?[].concat(o,a):[a]}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 d=t.source;if(t.map&&(d+=` +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),HEAD===void 0&&(HEAD=document.head||document.getElementsByTagName("head")[0]),HEAD.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(d),n.element.styleSheet.cssText=n.styles.filter(Boolean).join(` -`);else{const u=n.ids.size-1,c=document.createTextNode(d),r=n.element.childNodes;r[u]&&n.element.removeChild(r[u]),r.length?n.element.insertBefore(c,r[u]):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:` +/*# 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:` .clock[data-v-6294754c] { background: #fff; border: 0.3rem solid #fff; @@ -124,4 +124,4 @@ export default { left: 8px; } -`]},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);exports.default=__vue_component__; +`]},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 $; diff --git a/dist/vue-clock.esm.js b/dist/vue-clock.esm.js index 7b9fdc5..fa0b955 100644 --- a/dist/vue-clock.esm.js +++ b/dist/vue-clock.esm.js @@ -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+=` +"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,d,u,c,r,l,m){typeof c!="boolean"&&(l=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(u?(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,l(o)),o&&o._registeredComponents&&o._registeredComponents.add(u)},i._ssrRegister=a):t&&(a=c?function(o){t.call(this,m(o,this.$root.$options.shadowRoot))}:function(o){t.call(this,r(o))}),a)if(i.functional){const o=i.render;i.render=function(_,A){return a.call(A),o(_,A)}}else{const o=i.beforeCreate;i.beforeCreate=o?[].concat(o,a):[a]}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 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:` +/*# 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(d),n.element.styleSheet.cssText=n.styles.filter(Boolean).join(` +`);else{const u=n.ids.size-1,c=document.createTextNode(d),r=n.element.childNodes;r[u]&&n.element.removeChild(r[u]),r.length?n.element.insertBefore(c,r[u]):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; @@ -124,4 +124,4 @@ export default { left: 8px; } -`]},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);exports.default=__vue_component__; diff --git a/package.json b/package.json index 9337131..031d321 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,17 @@ "scripts": { "build": "rollup -c" }, - "keywords": ["vue", "vue-clock", "clock"], + "keywords": [ + "vue", + "vue-clock", + "clock" + ], "license": "MIT", "devDependencies": { "@rollup/plugin-commonjs": "^15.0.0", "@rollup/plugin-node-resolve": "^9.0.0", - "esbuild": "^0.6.27", - "rollup": "^2.26.5", + "esbuild": "^0.6.28", + "rollup": "^2.26.6", "rollup-plugin-esbuild": "^2.4.2", "rollup-plugin-vue": "^5.1.9", "vue-template-compiler": "^2.6.12" diff --git a/rollup.config.js b/rollup.config.js index c24a7a0..1a27585 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,6 +2,7 @@ import vue from 'rollup-plugin-vue'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import esbuild from 'rollup-plugin-esbuild'; +import pkg from './package.json'; const production = !process.env.ROLLUP_WATCH; @@ -12,18 +13,18 @@ export default [ input: 'src/index.js', output: { format: 'esm', - file: 'dist/vue-clock.esm.js', + file: pkg.main }, - plugins, + plugins }, { input: 'src/index.js', output: { exports: 'named', format: 'cjs', - file: 'dist/vue-clock.cjs.js', + file: pkg.module }, - plugins, + plugins }, { input: 'src/index.js', @@ -31,8 +32,8 @@ export default [ name: 'VueClock', exports: 'named', format: 'umd', - file: 'dist/vue-clock.umd.js', + file: pkg.browser }, - plugins, - }, + plugins + } ];