source: trip-planner-front/node_modules/autoprefixer/lib/hacks/display-flex.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 2.4 KB
Line 
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 flexSpec = require('./flex-spec');
10
11var OldValue = require('../old-value');
12
13var Value = require('../value');
14
15var DisplayFlex = /*#__PURE__*/function (_Value) {
16 _inheritsLoose(DisplayFlex, _Value);
17
18 function DisplayFlex(name, prefixes) {
19 var _this;
20
21 _this = _Value.call(this, name, prefixes) || this;
22
23 if (name === 'display-flex') {
24 _this.name = 'flex';
25 }
26
27 return _this;
28 }
29 /**
30 * Faster check for flex value
31 */
32
33
34 var _proto = DisplayFlex.prototype;
35
36 _proto.check = function check(decl) {
37 return decl.prop === 'display' && decl.value === this.name;
38 }
39 /**
40 * Return value by spec
41 */
42 ;
43
44 _proto.prefixed = function prefixed(prefix) {
45 var spec, value;
46
47 var _flexSpec = flexSpec(prefix);
48
49 spec = _flexSpec[0];
50 prefix = _flexSpec[1];
51
52 if (spec === 2009) {
53 if (this.name === 'flex') {
54 value = 'box';
55 } else {
56 value = 'inline-box';
57 }
58 } else if (spec === 2012) {
59 if (this.name === 'flex') {
60 value = 'flexbox';
61 } else {
62 value = 'inline-flexbox';
63 }
64 } else if (spec === 'final') {
65 value = this.name;
66 }
67
68 return prefix + value;
69 }
70 /**
71 * Add prefix to value depend on flebox spec version
72 */
73 ;
74
75 _proto.replace = function replace(string, prefix) {
76 return this.prefixed(prefix);
77 }
78 /**
79 * Change value for old specs
80 */
81 ;
82
83 _proto.old = function old(prefix) {
84 var prefixed = this.prefixed(prefix);
85 if (!prefixed) return undefined;
86 return new OldValue(this.name, prefixed);
87 };
88
89 return DisplayFlex;
90}(Value);
91
92_defineProperty(DisplayFlex, "names", ['display-flex', 'inline-flex']);
93
94module.exports = DisplayFlex;
Note: See TracBrowser for help on using the repository browser.