source: trip-planner-front/node_modules/autoprefixer/lib/hacks/align-self.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 2.3 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 Declaration = require('../declaration');
12
13var AlignSelf = /*#__PURE__*/function (_Declaration) {
14 _inheritsLoose(AlignSelf, _Declaration);
15
16 function AlignSelf() {
17 return _Declaration.apply(this, arguments) || this;
18 }
19
20 var _proto = AlignSelf.prototype;
21
22 _proto.check = function check(decl) {
23 return decl.parent && !decl.parent.some(function (i) {
24 return i.prop && i.prop.startsWith('grid-');
25 });
26 }
27 /**
28 * Change property name for 2012 specs
29 */
30 ;
31
32 _proto.prefixed = function prefixed(prop, prefix) {
33 var spec;
34
35 var _flexSpec = flexSpec(prefix);
36
37 spec = _flexSpec[0];
38 prefix = _flexSpec[1];
39
40 if (spec === 2012) {
41 return prefix + 'flex-item-align';
42 }
43
44 return _Declaration.prototype.prefixed.call(this, prop, prefix);
45 }
46 /**
47 * Return property name by final spec
48 */
49 ;
50
51 _proto.normalize = function normalize() {
52 return 'align-self';
53 }
54 /**
55 * Change value for 2012 spec and ignore prefix for 2009
56 */
57 ;
58
59 _proto.set = function set(decl, prefix) {
60 var spec = flexSpec(prefix)[0];
61
62 if (spec === 2012) {
63 decl.value = AlignSelf.oldValues[decl.value] || decl.value;
64 return _Declaration.prototype.set.call(this, decl, prefix);
65 }
66
67 if (spec === 'final') {
68 return _Declaration.prototype.set.call(this, decl, prefix);
69 }
70
71 return undefined;
72 };
73
74 return AlignSelf;
75}(Declaration);
76
77_defineProperty(AlignSelf, "names", ['align-self', 'flex-item-align']);
78
79_defineProperty(AlignSelf, "oldValues", {
80 'flex-end': 'end',
81 'flex-start': 'start'
82});
83
84module.exports = AlignSelf;
Note: See TracBrowser for help on using the repository browser.