css-grid-template-parser
Version:
A simple CSS Grid template parser
30 lines • 898 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.rect = exports.area = exports.track = void 0;
function track(start, end) {
return {
start: start,
end: end,
span: end - start,
};
}
exports.track = track;
function area(rect) {
var _a = rect.x, x = _a === void 0 ? 0 : _a, _b = rect.y, y = _b === void 0 ? 0 : _b, _c = rect.width, width = _c === void 0 ? 0 : _c, _d = rect.height, height = _d === void 0 ? 0 : _d;
return {
column: track(x + 1, x + width + 1),
row: track(y + 1, y + height + 1),
};
}
exports.area = area;
function rect(area) {
var column = area.column, row = area.row;
return {
x: column.start - 1,
y: row.start - 1,
width: column.end - column.start,
height: row.end - row.start,
};
}
exports.rect = rect;
//# sourceMappingURL=primitives.js.map