source: trip-planner-front/node_modules/autoprefixer/lib/hacks/grid-template.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.7 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 Declaration = require('../declaration');
10
11var _require = require('./grid-utils'),
12 parseTemplate = _require.parseTemplate,
13 warnMissedAreas = _require.warnMissedAreas,
14 getGridGap = _require.getGridGap,
15 warnGridGap = _require.warnGridGap,
16 inheritGridGap = _require.inheritGridGap;
17
18var GridTemplate = /*#__PURE__*/function (_Declaration) {
19 _inheritsLoose(GridTemplate, _Declaration);
20
21 function GridTemplate() {
22 return _Declaration.apply(this, arguments) || this;
23 }
24
25 var _proto = GridTemplate.prototype;
26
27 /**
28 * Translate grid-template to separate -ms- prefixed properties
29 */
30 _proto.insert = function insert(decl, prefix, prefixes, result) {
31 if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
32
33 if (decl.parent.some(function (i) {
34 return i.prop === '-ms-grid-rows';
35 })) {
36 return undefined;
37 }
38
39 var gap = getGridGap(decl);
40 /**
41 * we must insert inherited gap values in some cases:
42 * if we are inside media query && if we have no grid-gap value
43 */
44
45 var inheritedGap = inheritGridGap(decl, gap);
46
47 var _parseTemplate = parseTemplate({
48 decl: decl,
49 gap: inheritedGap || gap
50 }),
51 rows = _parseTemplate.rows,
52 columns = _parseTemplate.columns,
53 areas = _parseTemplate.areas;
54
55 var hasAreas = Object.keys(areas).length > 0;
56 var hasRows = Boolean(rows);
57 var hasColumns = Boolean(columns);
58 warnGridGap({
59 gap: gap,
60 hasColumns: hasColumns,
61 decl: decl,
62 result: result
63 });
64 warnMissedAreas(areas, decl, result);
65
66 if (hasRows && hasColumns || hasAreas) {
67 decl.cloneBefore({
68 prop: '-ms-grid-rows',
69 value: rows,
70 raws: {}
71 });
72 }
73
74 if (hasColumns) {
75 decl.cloneBefore({
76 prop: '-ms-grid-columns',
77 value: columns,
78 raws: {}
79 });
80 }
81
82 return decl;
83 };
84
85 return GridTemplate;
86}(Declaration);
87
88_defineProperty(GridTemplate, "names", ['grid-template']);
89
90module.exports = GridTemplate;
Note: See TracBrowser for help on using the repository browser.