static fromCss()

in packages/core/src/rendering/box-shadow.ts [14:29]


  static fromCss(boxShadowProp: Property.BoxShadow): BoxShadow {
    const prop = boxShadowProp.trim()
    const offsetsAndBlur = offsetsAndBlurPattern.exec(prop) || []

    const color = prop.replace(offsetsAndBlurPattern, '').trim() || 'rgb(0,0,0)'
    const offsetX = parseFloat(offsetsAndBlur[1]) || 0
    const offsetY = parseFloat(offsetsAndBlur[2]) || 0
    const blur = parseFloat(offsetsAndBlur[3]) || 0

    return {
      color,
      offsetX,
      offsetY,
      blur,
    }
  }