12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var IPropertyDescriptor_1 = require("../IPropertyDescriptor");
- var parser_1 = require("../syntax/parser");
- var length_percentage_1 = require("../types/length-percentage");
- var color_1 = require("../types/color");
- var length_1 = require("../types/length");
- exports.boxShadow = {
- name: 'box-shadow',
- initialValue: 'none',
- type: IPropertyDescriptor_1.PropertyDescriptorParsingType.LIST,
- prefix: false,
- parse: function (tokens) {
- if (tokens.length === 1 && parser_1.isIdentWithValue(tokens[0], 'none')) {
- return [];
- }
- return parser_1.parseFunctionArgs(tokens).map(function (values) {
- var shadow = {
- color: 0x000000ff,
- offsetX: length_percentage_1.ZERO_LENGTH,
- offsetY: length_percentage_1.ZERO_LENGTH,
- blur: length_percentage_1.ZERO_LENGTH,
- spread: length_percentage_1.ZERO_LENGTH,
- inset: false
- };
- var c = 0;
- for (var i = 0; i < values.length; i++) {
- var token = values[i];
- if (parser_1.isIdentWithValue(token, 'inset')) {
- shadow.inset = true;
- }
- else if (length_1.isLength(token)) {
- if (c === 0) {
- shadow.offsetX = token;
- }
- else if (c === 1) {
- shadow.offsetY = token;
- }
- else if (c === 2) {
- shadow.blur = token;
- }
- else {
- shadow.spread = token;
- }
- c++;
- }
- else {
- shadow.color = color_1.color.parse(token);
- }
- }
- return shadow;
- });
- }
- };
- //# sourceMappingURL=box-shadow.js.map
|