UNPKG

nehan

Version:

Html layout engine for paged-media written in Typescript

55 lines 1.83 kB
import { LogicalEdgeSize, LogicalEdgeDirections, Utils, CssText, } from "./public-api"; export var LogicalBorderWidthKeyword; (function (LogicalBorderWidthKeyword) { LogicalBorderWidthKeyword["THIN"] = "thin"; LogicalBorderWidthKeyword["MEDIUM"] = "medium"; LogicalBorderWidthKeyword["THICK"] = "thick"; })(LogicalBorderWidthKeyword || (LogicalBorderWidthKeyword = {})); export const LogicalBorderWidthKeywordSize = { thin: 2, medium: 4, thick: 6 }; export class LogicalBorderWidth extends LogicalEdgeSize { static parseShorthand(css_text) { const vs = CssText.getValue4D(css_text.value); return [ { prop: "border-before-width", value: vs[0] }, { prop: "border-end-width", value: vs[1] }, { prop: "border-after-width", value: vs[2] }, { prop: "border-start-width", value: vs[3] } ]; } static load(element) { return new LogicalBorderWidth(LogicalEdgeDirections.reduce((size, direction) => { size[direction] = LogicalEdgeSize.loadDirection(element, `border-${direction}-width`); return size; }, {})); } static get none() { return new LogicalBorderWidth(LogicalEdgeSize.zeroValue); } clone() { return new LogicalBorderWidth(this.values); } clearBefore() { this.before = 0; } clearEnd() { this.end = 0; } clearAfter() { this.after = 0; } clearStart() { this.start = 0; } getPropByLogicalDirection(direction) { return `border-${direction}-width`; } acceptCssEvaluator(visitor) { return visitor.visitLogicalBorderWidth(this); } } LogicalBorderWidth.keywords = Utils.Enum.toValueArray(LogicalBorderWidthKeyword); //# sourceMappingURL=logical-border-width.js.map