UNPKG

twrnc

Version:
52 lines (51 loc) 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.outlineOffset = exports.outlineWidth = exports.outlineStyle = void 0; const helpers_1 = require("../helpers"); const ALLOWED_STYLE_VALUES = [`dotted`, `dashed`]; function outlineStyle(value) { if (!ALLOWED_STYLE_VALUES.includes(value)) return null; return (0, helpers_1.complete)({ outlineStyle: value, }); } exports.outlineStyle = outlineStyle; function outlineWidth(value, config) { const configValue = config === null || config === void 0 ? void 0 : config[value]; if (configValue) { const parsedConfigValue = (0, helpers_1.parseStyleVal)(configValue); if (parsedConfigValue !== null) { return (0, helpers_1.complete)({ outlineWidth: parsedConfigValue, }); } } const parsedValue = (0, helpers_1.parseUnconfigged)(value); if (parsedValue !== null) { return (0, helpers_1.complete)({ outlineWidth: parsedValue, }); } return null; } exports.outlineWidth = outlineWidth; function outlineOffset(value, isNegative, config) { const configValue = config === null || config === void 0 ? void 0 : config[value]; if (configValue) { const parsedConfigValue = (0, helpers_1.parseStyleVal)(configValue); if (parsedConfigValue !== null) { return (0, helpers_1.complete)({ outlineOffset: isNegative ? -parsedConfigValue : parsedConfigValue, }); } } const parsedValue = (0, helpers_1.parseUnconfigged)(value); if (parsedValue !== null) { return (0, helpers_1.complete)({ outlineOffset: isNegative ? -parsedValue : parsedValue, }); } return null; } exports.outlineOffset = outlineOffset;