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e,SAAU,CAAC,IAAX,CAAgB,SAAhB;AAChB,SAJD;AAKD;;AAED,YAAM,aAAa,GAAG,SAAS,CAAC,IAAV,CAAe,SAAS,IAAI,SAAS,CAAC,UAAV,CAAqB,MAArB,CAA5B,CAAtB;AAEA,MAAA,SAAS,CAAC,IAAV,CAAe;AACb;AACA,QAAA,GAAG,EAAE,CAAC,aAAD,IAAkB,CAAC,KAAK,CAAC,IAFjB;AAGb,SAAC,OAAO,KAAK,CAAC,IAAI,EAAlB,GAAuB,KAAK,CAAC,IAHhB;AAIb,SAAC,UAAU,KAAK,CAAC,MAAM,EAAvB,GAA4B,KAAK,CAAC,MAJrB;AAKb,SAAC,SAAS,KAAK,CAAC,KAAK,EAArB,GAA0B,KAAK,CAAC,KALnB;AAMb,SAAC,cAAc,KAAK,CAAC,SAAS,EAA9B,GAAmC,KAAK,CAAC;AAN5B,OAAf;AASA,MAAA,KAAK,CAAC,GAAN,CAAU,QAAV,EAAoB,SAApB;AACD;;AAED,WAAO,CAAC,CAAC,KAAK,CAAC,GAAP,EAAY,SAAS,CAAC,IAAD,EAAO;AAAE,MAAA,KAAK,EAAE;AAAT,KAAP,CAArB,EAAmD,QAAnD,CAAR;AACD;;AAhEuB,CAAX,CAAf","sourcesContent":["import './VGrid.sass'\n\nimport Vue, { VNode, PropOptions } from 'vue'\nimport mergeData from '../../util/mergeData'\nimport { upperFirst } from '../../util/helpers'\n\n// no xs\nconst breakpoints = ['sm', 'md', 'lg', 'xl']\n\nconst breakpointProps = (() => {\n return breakpoints.reduce((props, val) => {\n props[val] = {\n type: [Boolean, String, Number],\n default: false,\n }\n return props\n }, {} as Dictionary<PropOptions>)\n})()\n\nconst offsetProps = (() => {\n return breakpoints.reduce((props, val) => {\n props['offset' + upperFirst(val)] = {\n type: [String, Number],\n default: null,\n }\n return props\n }, {} as Dictionary<PropOptions>)\n})()\n\nconst orderProps = (() => {\n return breakpoints.reduce((props, val) => {\n props['order' + upperFirst(val)] = {\n type: [String, Number],\n default: null,\n }\n return props\n }, {} as Dictionary<PropOptions>)\n})()\n\nconst propMap = {\n col: Object.keys(breakpointProps),\n offset: Object.keys(offsetProps),\n order: Object.keys(orderProps),\n}\n\nfunction breakpointClass (type: keyof typeof propMap, prop: string, val: boolean | string | number) {\n let className = type\n if (val == null || val === false) {\n return undefined\n }\n if (prop) {\n const breakpoint = prop.replace(type, '')\n className += `-${breakpoint}`\n }\n // Handling the boolean style prop when accepting [Boolean, String, Number]\n // means Vue will not convert <v-col sm></v-col> to sm: true for us.\n // Since the default is false, an empty string indicates the prop's presence.\n if (type === 'col' && (val === '' || val === true)) {\n // .col-md\n return className.toLowerCase()\n }\n // .order-md-6\n className += `-${val}`\n return className.toLowerCase()\n}\n\nconst cache = new Map<string, any[]>()\n\nexport default Vue.extend({\n name: 'v-col',\n functional: true,\n props: {\n cols: {\n type: [Boolean, String, Number],\n default: false,\n },\n ...breakpointProps,\n offset: {\n type: [String, Number],\n default: null,\n },\n ...offsetProps,\n order: {\n type: [String, Number],\n default: null,\n },\n ...orderProps,\n alignSelf: {\n type: String,\n default: null,\n validator: (str: any) => ['auto', 'start', 'end', 'center', 'baseline', 'stretch'].includes(str),\n },\n tag: {\n type: String,\n default: 'div',\n },\n },\n render (h, { props, data, children, parent }): VNode {\n // Super-fast memoization based on props, 5x faster than JSON.stringify\n let cacheKey = ''\n for (const prop in props) {\n cacheKey += String((props as any)[prop])\n }\n let classList = cache.get(cacheKey)\n\n if (!classList) {\n classList = []\n // Loop through `col`, `offset`, `order` breakpoint props\n let type: keyof typeof propMap\n for (type in propMap) {\n propMap[type].forEach(prop => {\n const value: string | number | boolean = (props as any)[prop]\n const className = breakpointClass(type, prop, value)\n if (className) classList!.push(className)\n })\n }\n\n const hasColClasses = classList.some(className => className.startsWith('col-'))\n\n classList.push({\n // Default to .col if no other col-{bp}-* classes generated nor `cols` specified.\n col: !hasColClasses || !props.cols,\n [`col-${props.cols}`]: props.cols,\n [`offset-${props.offset}`]: props.offset,\n [`order-${props.order}`]: props.order,\n [`align-self-${props.alignSelf}`]: props.alignSelf,\n })\n\n cache.set(cacheKey, classList)\n }\n\n return h(props.tag, mergeData(data, { class: classList }), children)\n },\n})\n"],"sourceRoot":"","file":"VCol.js"} |