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,CAAC,IAAD,EAAO,IAAP,EAAa,KAAb,CAAjC;AACA,gBAAI,SAAJ,EAAe,SAAU,CAAC,IAAX,CAAgB,SAAhB;AAChB,WAJD;AAKD;;AAED,QAAA,SAAS,CAAC,IAAV;AACE,wBAAc,KAAK,CAAC,SADtB;AAEE,wBAAc,KAAK,CAAC;AAFtB,4DAGY,KAAK,CAAC,KAHlB,GAG4B,KAAK,CAAC,KAHlC,sDAIc,KAAK,CAAC,OAJpB,GAIgC,KAAK,CAAC,OAJtC,4DAKoB,KAAK,CAAC,YAL1B,GAK2C,KAAK,CAAC,YALjD;AAQA,QAAA,KAAK,CAAC,GAAN,CAAU,QAAV,EAAoB,SAApB;AApBc;AAqBf;;AAED,WAAO,CAAC,CACN,KAAK,CAAC,GADA,EAEN,wBAAU,IAAV,EAAgB;AACd,MAAA,WAAW,EAAE,KADC;AAEd,MAAA,KAAK,EAAE;AAFO,KAAhB,CAFM,EAMN,QANM,CAAR;AAQD;AApEuB,CAAX,C","sourcesContent":["import './VGrid.sass'\n\nimport Vue, { 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 ALIGNMENT = ['start', 'end', 'center']\n\nfunction makeProps (prefix: string, def: () => PropOptions) {\n return breakpoints.reduce((props, val) => {\n props[prefix + upperFirst(val)] = def()\n return props\n }, {} as Dictionary<PropOptions>)\n}\n\nconst alignValidator = (str: any) => [...ALIGNMENT, 'baseline', 'stretch'].includes(str)\nconst alignProps = makeProps('align', () => ({\n type: String,\n default: null,\n validator: alignValidator,\n}))\n\nconst justifyValidator = (str: any) => [...ALIGNMENT, 'space-between', 'space-around'].includes(str)\nconst justifyProps = makeProps('justify', () => ({\n type: String,\n default: null,\n validator: justifyValidator,\n}))\n\nconst alignContentValidator = (str: any) => [...ALIGNMENT, 'space-between', 'space-around', 'stretch'].includes(str)\nconst alignContentProps = makeProps('alignContent', () => ({\n type: String,\n default: null,\n validator: alignContentValidator,\n}))\n\nconst propMap = {\n align: Object.keys(alignProps),\n justify: Object.keys(justifyProps),\n alignContent: Object.keys(alignContentProps),\n}\n\nconst classMap = {\n align: 'align',\n justify: 'justify',\n alignContent: 'align-content',\n}\n\nfunction breakpointClass (type: keyof typeof propMap, prop: string, val: string) {\n let className = classMap[type]\n if (val == null) {\n return undefined\n }\n if (prop) {\n // alignSm -> Sm\n const breakpoint = prop.replace(type, '')\n className += `-${breakpoint}`\n }\n // .align-items-sm-center\n className += `-${val}`\n return className.toLowerCase()\n}\n\nconst cache = new Map<string, any[]>()\n\nexport default Vue.extend({\n name: 'v-row',\n functional: true,\n props: {\n tag: {\n type: String,\n default: 'div',\n },\n dense: Boolean,\n noGutters: Boolean,\n align: {\n type: String,\n default: null,\n validator: alignValidator,\n },\n ...alignProps,\n justify: {\n type: String,\n default: null,\n validator: justifyValidator,\n },\n ...justifyProps,\n alignContent: {\n type: String,\n default: null,\n validator: alignContentValidator,\n },\n ...alignContentProps,\n },\n render (h, { props, data, children }) {\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 `align`, `justify`, `alignContent` breakpoint props\n let type: keyof typeof propMap\n for (type in propMap) {\n propMap[type].forEach(prop => {\n const value: string = (props as any)[prop]\n const className = breakpointClass(type, prop, value)\n if (className) classList!.push(className)\n })\n }\n\n classList.push({\n 'no-gutters': props.noGutters,\n 'row--dense': props.dense,\n [`align-${props.align}`]: props.align,\n [`justify-${props.justify}`]: props.justify,\n [`align-content-${props.alignContent}`]: props.alignContent,\n })\n\n cache.set(cacheKey, classList)\n }\n\n return h(\n props.tag,\n mergeData(data, {\n staticClass: 'row',\n class: classList,\n }),\n children\n )\n },\n})\n"],"sourceRoot":"","file":"VRow.js"} |