nav tabs on admin dashboard
This commit is contained in:
192
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
192
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
@@ -1,137 +1,103 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
function _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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
||||
function _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; }
|
||||
|
||||
var Declaration = require('../declaration');
|
||||
|
||||
var DOTS = /^\.+$/;
|
||||
var _require = require('./grid-utils'),
|
||||
parseGridAreas = _require.parseGridAreas,
|
||||
warnMissedAreas = _require.warnMissedAreas,
|
||||
prefixTrackProp = _require.prefixTrackProp,
|
||||
prefixTrackValue = _require.prefixTrackValue,
|
||||
getGridGap = _require.getGridGap,
|
||||
warnGridGap = _require.warnGridGap,
|
||||
inheritGridGap = _require.inheritGridGap;
|
||||
|
||||
function track(start, end) {
|
||||
return { start: start, end: end, span: end - start };
|
||||
function getGridRows(tpl) {
|
||||
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
|
||||
}
|
||||
|
||||
function getRows(tpl) {
|
||||
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
|
||||
}
|
||||
var GridTemplateAreas =
|
||||
/*#__PURE__*/
|
||||
function (_Declaration) {
|
||||
_inheritsLoose(GridTemplateAreas, _Declaration);
|
||||
|
||||
function getColumns(line) {
|
||||
return line.trim().split(/\s+/g);
|
||||
}
|
||||
function GridTemplateAreas() {
|
||||
return _Declaration.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
function parseGridAreas(tpl) {
|
||||
return getRows(tpl).reduce(function (areas, line, rowIndex) {
|
||||
if (line.trim() === '') return areas;
|
||||
getColumns(line).forEach(function (area, columnIndex) {
|
||||
if (DOTS.test(area)) return;
|
||||
if (typeof areas[area] === 'undefined') {
|
||||
areas[area] = {
|
||||
column: track(columnIndex + 1, columnIndex + 2),
|
||||
row: track(rowIndex + 1, rowIndex + 2)
|
||||
};
|
||||
} else {
|
||||
var _areas$area = areas[area],
|
||||
column = _areas$area.column,
|
||||
row = _areas$area.row;
|
||||
var _proto = GridTemplateAreas.prototype;
|
||||
|
||||
/**
|
||||
* Translate grid-template-areas to separate -ms- prefixed properties
|
||||
*/
|
||||
_proto.insert = function insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
||||
var hasColumns = false;
|
||||
var hasRows = false;
|
||||
var parent = decl.parent;
|
||||
var gap = getGridGap(decl);
|
||||
gap = inheritGridGap(decl, gap) || gap; // remove already prefixed rows
|
||||
// to prevent doubling prefixes
|
||||
|
||||
column.start = Math.min(column.start, columnIndex + 1);
|
||||
column.end = Math.max(column.end, columnIndex + 2);
|
||||
column.span = column.end - column.start;
|
||||
parent.walkDecls(/-ms-grid-rows/, function (i) {
|
||||
return i.remove();
|
||||
}); // add empty tracks to rows
|
||||
|
||||
row.start = Math.min(row.start, rowIndex + 1);
|
||||
row.end = Math.max(row.end, rowIndex + 2);
|
||||
row.span = row.end - row.start;
|
||||
}
|
||||
parent.walkDecls(/grid-template-(rows|columns)/, function (trackDecl) {
|
||||
if (trackDecl.prop === 'grid-template-rows') {
|
||||
hasRows = true;
|
||||
var prop = trackDecl.prop,
|
||||
value = trackDecl.value;
|
||||
trackDecl.cloneBefore({
|
||||
prop: prefixTrackProp({
|
||||
prop: prop,
|
||||
prefix: prefix
|
||||
}),
|
||||
value: prefixTrackValue({
|
||||
value: value,
|
||||
gap: gap.row
|
||||
})
|
||||
});
|
||||
return areas;
|
||||
}, {});
|
||||
}
|
||||
} else {
|
||||
hasColumns = true;
|
||||
}
|
||||
});
|
||||
var gridRows = getGridRows(decl.value);
|
||||
|
||||
var GridTemplateAreas = function (_Declaration) {
|
||||
_inherits(GridTemplateAreas, _Declaration);
|
||||
|
||||
function GridTemplateAreas() {
|
||||
_classCallCheck(this, GridTemplateAreas);
|
||||
|
||||
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
||||
}
|
||||
|
||||
GridTemplateAreas.prototype.getRoot = function getRoot(parent) {
|
||||
if (parent.type === 'atrule' || !parent.parent) {
|
||||
return parent;
|
||||
}
|
||||
return this.getRoot(parent.parent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Translate grid-template-areas to separate -ms- prefixed properties
|
||||
*/
|
||||
if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-rows',
|
||||
value: prefixTrackValue({
|
||||
value: "repeat(" + gridRows.length + ", auto)",
|
||||
gap: gap.row
|
||||
}),
|
||||
raws: {}
|
||||
});
|
||||
} // warnings
|
||||
|
||||
|
||||
GridTemplateAreas.prototype.insert = function insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
||||
warnGridGap({
|
||||
gap: gap,
|
||||
hasColumns: hasColumns,
|
||||
decl: decl,
|
||||
result: result
|
||||
});
|
||||
var areas = parseGridAreas({
|
||||
rows: gridRows,
|
||||
gap: gap
|
||||
});
|
||||
warnMissedAreas(areas, decl, result);
|
||||
return decl;
|
||||
};
|
||||
|
||||
var areas = parseGridAreas(decl.value);
|
||||
var missed = Object.keys(areas);
|
||||
|
||||
this.getRoot(decl.parent).walkDecls('grid-area', function (gridArea) {
|
||||
var value = gridArea.value;
|
||||
var area = areas[value];
|
||||
|
||||
missed = missed.filter(function (e) {
|
||||
return e !== value;
|
||||
});
|
||||
|
||||
if (area) {
|
||||
gridArea.parent.walkDecls(/-ms-grid-(row|column)/, function (d) {
|
||||
d.remove();
|
||||
});
|
||||
|
||||
gridArea.cloneBefore({
|
||||
prop: '-ms-grid-row',
|
||||
value: String(area.row.start)
|
||||
});
|
||||
if (area.row.span > 1) {
|
||||
gridArea.cloneBefore({
|
||||
prop: '-ms-grid-row-span',
|
||||
value: String(area.row.span)
|
||||
});
|
||||
}
|
||||
gridArea.cloneBefore({
|
||||
prop: '-ms-grid-column',
|
||||
value: String(area.column.start)
|
||||
});
|
||||
if (area.column.span > 1) {
|
||||
gridArea.cloneBefore({
|
||||
prop: '-ms-grid-column-span',
|
||||
value: String(area.column.span)
|
||||
});
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
if (missed.length > 0) {
|
||||
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '));
|
||||
}
|
||||
|
||||
return decl;
|
||||
};
|
||||
|
||||
return GridTemplateAreas;
|
||||
return GridTemplateAreas;
|
||||
}(Declaration);
|
||||
|
||||
Object.defineProperty(GridTemplateAreas, 'names', {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: ['grid-template-areas']
|
||||
});
|
||||
|
||||
_defineProperty(GridTemplateAreas, "names", ['grid-template-areas']);
|
||||
|
||||
module.exports = GridTemplateAreas;
|
||||
Reference in New Issue
Block a user