@zeit-ui/vue
Version:
A popular UI framework for Vue
2 lines • 8.33 kB
JavaScript
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["grid"]=e():t["grid"]=e()})("undefined"!==typeof self?self:this,(function(){return 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}return 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="fb15")}({"236b":function(t,e,n){},"5d63":function(t,e,n){"use strict";var r=n("236b"),o=n.n(r);o.a},"7ce0":function(t,e,n){},ba8f:function(t,e,n){"use strict";var r=n("7ce0"),o=n.n(r);o.a},f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(r){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fb15:function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"enums",(function(){return u})),n.d(r,"isMac",(function(){return s}));var o,i={};(n.r(i),n.d(i,"warning",(function(){return f})),n.d(i,"error",(function(){return p})),"undefined"!==typeof window)&&(n("f6fd"),(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=o[1]));var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.classes,style:t.styles},[t._t("default")],2)},c=[],u=function(t){return function(e){return!!Array.isArray(t)&&!!t.find((function(t){return t===e}))}},s=function(){if("undefined"===typeof window||!window.navigator)return!1;var t=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(t)},l=function(t){var e=t.getBoundingClientRect(),n=window.getComputedStyle(t),r=n.width,o=n.height,i=function(t,e){if(!t)return 0;var n=t.includes("px")?+t.split("px")[0]:t.includes("%")?+t.split("%")[0]*e*.01:t;return Number.isNaN(+n)?0:+n};return{width:i("".concat(r),e.width),height:i("".concat(o),e.height)}},f=function(t){console.warn(t)},p=function(t){console.error(t)},d=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"expand"},on:{enter:t.enter,"after-enter":t.afterEnter,leave:t.leave}},[t._t("default")],2)},y=[],m={name:"zi-transition-expand",methods:{enter:function(t){var e=l(t),n=e.width;t.style.width="".concat(n,"px"),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";var r=l(t),o=r.height;t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,l(t);var i=setTimeout((function(){t.style.height="".concat(o,"px"),clearTimeout(i)}),0)},afterEnter:function(t){t.style.height="auto"},leave:function(t){var e=l(t),n=e.height;t.style.height="".concat(n,"px"),l(t);var r=setTimeout((function(){t.style.height=0,clearTimeout(r)}),0)},afterLeave:function(t){t.style.height=null}}},g=m;n("ba8f");function h(t,e,n,r,o,i,a,c){var u,s="function"===typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),a?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},s._ssrRegister=u):o&&(u=c?function(){o.call(this,this.$root.$options.shadowRoot)}:o),u)if(s.functional){s._injectStyles=u;var l=s.render;s.render=function(t,e){return u.call(e),l(t,e)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,u):[u]}return{exports:t,options:s}}var v=h(g,d,y,!1,null,null,null),b=(v.exports,new Map,{alignContent:["flex-start","flex-end","stretch","space-between","space-around"],alignItems:["flex-start","flex-end","center","stretch","baseline"],justifyContent:["flex-start","flex-end","center","space-between","space-around","space-evenly"],flexWrap:["nowrap","wrap","wrap-reverse"],flexDirection:["row","row-reverse","column","column-reverse"]});function w(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function x(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?w(Object(n),!0).forEach((function(e){j(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(t){return P(t)||C(t)||S(t)||_()}function _(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(t,e){if(t){if("string"===typeof t)return $(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(t,e):void 0}}function C(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function P(t){if(Array.isArray(t))return $(t)}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var E=["xs","sm","md","lg","xl"],T={name:"zi-grid",props:{container:Boolean,spacing:Number,alignContent:{type:String,default:"stretch",validator:r.enums(b.alignContent)},alignItems:{type:String,default:"stretch",validator:r.enums(b.alignItems)},justify:{type:String,default:"flex-start",validator:r.enums(b.justifyContent)},direction:{type:String,default:"row",validator:r.enums(b.flexDirection)},wrap:{type:String,default:"wrap",validator:r.enums(b.flexWrap)},lg:{type:[Number,Boolean],default:!1},xl:{type:[Number,Boolean],default:!1},md:{type:[Number,Boolean],default:!1},xs:{type:[Number,Boolean],default:!1},sm:{type:[Number,Boolean],default:!1}},computed:{CssFlexProps:function(){var t=this.$props,e=t.justify,n=t.alignItems,r=t.alignContent,o=t.direction,i=t.wrap;return{"justify-content":e,"align-content":r,"flex-direction":o,"flex-wrap":i,"align-items":n}},containerWidth:function(){var t=this,e=function(){return{"max-width":"calc(100% + 8px * ".concat(t.spacing,")"),margin:"-".concat(4*t.spacing,"px")}};return this.container?e():(this.spacing&&i.error("[Grid Error] The prop [spacing] must be used on [container] mode"),{})},classes:function(){var t=this,e=E.map((function(e){return 0===t[e]?"".concat(e,"-hidden"):t[e]&&"".concat(e)}));return this.container?["grid-container"].concat(O(e)):["grid"].concat(O(e))},styles:function(){var t=this,e=function(){return x({"--zeit-grid-spacing":"".concat(4*t.spacing,"px")},t.CssFlexProps)};return[this.containerWidth,this.container?e():{}].concat(this.getItemLayout())}},methods:{getItemLayout:function(){var t=this;return E.map((function(e){var n="number"===typeof t.$props[e];if(!t.$props[e])return{};if(n){var r,o=100/24*t.$props[e];return r={},j(r,"--zeit-".concat(e,"-width"),o>100?"100%":o<0?"0":"".concat(o,"%")),j(r,"--zeit-".concat(e,"-grow"),0),j(r,"--zeit-".concat(e,"-basis"),o>100?"100%":o<0?"0":"".concat(o,"%")),r}return j({},"--zeit-".concat(e,"-grow"),1)}))}}},N=T,A=(n("5d63"),h(N,a,c,!1,null,"43bc75e2",null)),I=A.exports;I.install=function(t){t.component(I.name,I)};var B=I;e["default"]=B}})["default"]}));
//# sourceMappingURL=grid.umd.min.js.map