source: trip-planner-front/node_modules/autoprefixer/lib/hacks/flex.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[6a3a178]1"use strict";
2
3function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
4
5function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
6
7function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
9var list = require('postcss').list;
10
11var flexSpec = require('./flex-spec');
12
13var Declaration = require('../declaration');
14
15var Flex = /*#__PURE__*/function (_Declaration) {
16 _inheritsLoose(Flex, _Declaration);
17
18 function Flex() {
19 return _Declaration.apply(this, arguments) || this;
20 }
21
22 var _proto = Flex.prototype;
23
24 /**
25 * Change property name for 2009 spec
26 */
27 _proto.prefixed = function prefixed(prop, prefix) {
28 var spec;
29
30 var _flexSpec = flexSpec(prefix);
31
32 spec = _flexSpec[0];
33 prefix = _flexSpec[1];
34
35 if (spec === 2009) {
36 return prefix + 'box-flex';
37 }
38
39 return _Declaration.prototype.prefixed.call(this, prop, prefix);
40 }
41 /**
42 * Return property name by final spec
43 */
44 ;
45
46 _proto.normalize = function normalize() {
47 return 'flex';
48 }
49 /**
50 * Spec 2009 supports only first argument
51 * Spec 2012 disallows unitless basis
52 */
53 ;
54
55 _proto.set = function set(decl, prefix) {
56 var spec = flexSpec(prefix)[0];
57
58 if (spec === 2009) {
59 decl.value = list.space(decl.value)[0];
60 decl.value = Flex.oldValues[decl.value] || decl.value;
61 return _Declaration.prototype.set.call(this, decl, prefix);
62 }
63
64 if (spec === 2012) {
65 var components = list.space(decl.value);
66
67 if (components.length === 3 && components[2] === '0') {
68 decl.value = components.slice(0, 2).concat('0px').join(' ');
69 }
70 }
71
72 return _Declaration.prototype.set.call(this, decl, prefix);
73 };
74
75 return Flex;
76}(Declaration);
77
78_defineProperty(Flex, "names", ['flex', 'box-flex']);
79
80_defineProperty(Flex, "oldValues", {
81 auto: '1',
82 none: '0'
83});
84
85module.exports = Flex;
Note: See TracBrowser for help on using the repository browser.