UNPKG

9.58 kBSource Map (JSON)View Raw
1{"version":3,"file":"angular-flex-layout-_private-utils.mjs","sources":["../../../../projects/libs/flex-layout/_private-utils/auto-prefixer.ts","../../../../projects/libs/flex-layout/_private-utils/layout-validator.ts","../../../../projects/libs/flex-layout/_private-utils/object-extend.ts","../../../../projects/libs/flex-layout/_private-utils/index.ts","../../../../projects/libs/flex-layout/_private-utils/angular-flex-layout-_private-utils.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * Applies CSS prefixes to appropriate style keys.\n *\n * Note: `-ms-`, `-moz` and `-webkit-box` are no longer supported. e.g.\n * {\n * display: -webkit-flex; NEW - Safari 6.1+. iOS 7.1+, BB10\n * display: flex; NEW, Spec - Firefox, Chrome, Opera\n * // display: -webkit-box; OLD - iOS 6-, Safari 3.1-6, BB7\n * // display: -ms-flexbox; TWEENER - IE 10\n * // display: -moz-flexbox; OLD - Firefox\n * }\n */\nexport function applyCssPrefixes(target: {[key: string]: any | null}) {\n for (let key in target) {\n let value = target[key] ?? '';\n\n switch (key) {\n case 'display':\n if (value === 'flex') {\n target['display'] = [\n '-webkit-flex',\n 'flex'\n ];\n } else if (value === 'inline-flex') {\n target['display'] = [\n '-webkit-inline-flex',\n 'inline-flex'\n ];\n } else {\n target['display'] = value;\n }\n break;\n\n case 'align-items':\n case 'align-self':\n case 'align-content':\n case 'flex':\n case 'flex-basis':\n case 'flex-flow':\n case 'flex-grow':\n case 'flex-shrink':\n case 'flex-wrap':\n case 'justify-content':\n target['-webkit-' + key] = value;\n break;\n\n case 'flex-direction':\n target['-webkit-flex-direction'] = value;\n target['flex-direction'] = value;\n break;\n\n case 'order':\n target['order'] = target['-webkit-' + key] = isNaN(+value) ? '0' : value;\n break;\n }\n }\n return target;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport const INLINE = 'inline';\nexport const LAYOUT_VALUES = ['row', 'column', 'row-reverse', 'column-reverse'];\n\n/**\n * Validate the direction|'direction wrap' value and then update the host's inline flexbox styles\n */\nexport function buildLayoutCSS(value: string) {\n let [direction, wrap, isInline] = validateValue(value);\n return buildCSS(direction, wrap, isInline);\n}\n\n/**\n * Validate the value to be one of the acceptable value options\n * Use default fallback of 'row'\n */\nexport function validateValue(value: string): [string, string, boolean] {\n value = value?.toLowerCase() ?? '';\n let [direction, wrap, inline] = value.split(' ');\n\n // First value must be the `flex-direction`\n if (!LAYOUT_VALUES.find(x => x === direction)) {\n direction = LAYOUT_VALUES[0];\n }\n\n if (wrap === INLINE) {\n wrap = (inline !== INLINE) ? inline : '';\n inline = INLINE;\n }\n\n return [direction, validateWrapValue(wrap), !!inline];\n}\n\n/**\n * Determine if the validated, flex-direction value specifies\n * a horizontal/row flow.\n */\nexport function isFlowHorizontal(value: string): boolean {\n let [flow, ] = validateValue(value);\n return flow.indexOf('row') > -1;\n}\n\n/**\n * Convert layout-wrap='<value>' to expected flex-wrap style\n */\nexport function validateWrapValue(value: string) {\n if (!!value) {\n switch (value.toLowerCase()) {\n case 'reverse':\n case 'wrap-reverse':\n case 'reverse-wrap':\n value = 'wrap-reverse';\n break;\n\n case 'no':\n case 'none':\n case 'nowrap':\n value = 'nowrap';\n break;\n\n // All other values fallback to 'wrap'\n default:\n value = 'wrap';\n break;\n }\n }\n return value;\n}\n\n/**\n * Build the CSS that should be assigned to the element instance\n * BUG:\n * 1) min-height on a column flex container won’t apply to its flex item children in IE 10-11.\n * Use height instead if possible; height : <xxx>vh;\n *\n * This way any padding or border specified on the child elements are\n * laid out and drawn inside that element's specified width and height.\n */\nfunction buildCSS(direction: string, wrap: string | null = null, inline = false) {\n return {\n display: inline ? 'inline-flex' : 'flex',\n 'box-sizing': 'border-box',\n 'flex-direction': direction,\n 'flex-wrap': wrap || null,\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * Extends an object with the *enumerable* and *own* properties of one or more source objects,\n * similar to Object.assign.\n *\n * @param dest The object which will have properties copied to it.\n * @param sources The source objects from which properties will be copied.\n */\nexport function extendObject(dest: any, ...sources: any[]): any {\n if (dest == null) {\n throw TypeError('Cannot convert undefined or null to object');\n }\n\n for (let source of sources) {\n if (source != null) {\n for (let key in source) {\n if (source.hasOwnProperty(key)) {\n dest[key] = source[key];\n }\n }\n }\n }\n\n return dest;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './auto-prefixer';\nexport * from './layout-validator';\nexport * from './object-extend';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;;;;;AAMG;AACH;;;;;;;;;;;AAWG;AACG,SAAU,gBAAgB,CAAC,MAAmC,EAAA;AAClE,IAAA,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;QACtB,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AAE9B,QAAA,QAAQ,GAAG;AACT,YAAA,KAAK,SAAS;gBACZ,IAAI,KAAK,KAAK,MAAM,EAAE;oBACpB,MAAM,CAAC,SAAS,CAAC,GAAG;wBAClB,cAAc;wBACd,MAAM;qBACP,CAAC;AACH,iBAAA;qBAAM,IAAI,KAAK,KAAK,aAAa,EAAE;oBAClC,MAAM,CAAC,SAAS,CAAC,GAAG;wBAClB,qBAAqB;wBACrB,aAAa;qBACd,CAAC;AACH,iBAAA;AAAM,qBAAA;AACL,oBAAA,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;AAC3B,iBAAA;gBACD,MAAM;AAER,YAAA,KAAK,aAAa,CAAC;AACnB,YAAA,KAAK,YAAY,CAAC;AAClB,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