Giter Club home page Giter Club logo

cidercsskit's Introduction

❓ About This Project

CiderCSSKit is lightweight CSS parser written as a pure Swift package. It was primarily designed to work with CiderKit, but the goal is to make it as agnostic as possible.

🪄 Features

CiderCSSKit is still a work-in-progress. So many CSS features are not currenlty supported.

Here's the list of existing and missing features:

  • provides easy access to style properties, in bulk or individually
  • named colors are already implemented
  • built-in functions are limited to rgb and rgba
  • complex CSS combinators (>, +, and ~) are not implemented
  • no support pseudo-elements (like ::first-line for example)
  • no support for parametric pseudo-classes (like :nth-child() for example)
  • no support for attribute selectors (like a[target] or a[target="_blank"])

Supported Attributes

The list of supported attributes is fairly limited for now but will expand over time.

  • background-color
  • border-image and its sub-attributes
    • border-image-outset
    • border-image-repeat
    • border-image-slice
    • border-image-source
    • border-image-width
  • color
  • font and its sub-attributes
    • font-family
    • font-size
    • font-stretch
    • font-style
    • font-variant
    • font-weight
    • line-height
  • padding and its sub-attributes
    • padding-bottom
    • padding-left
    • padding-right
    • padding-top
  • text-align
  • transform-origin
  • vertical-align

Planned improvements

Even if the ultimate goal is to support all syntax features, there is a long road ahead. Below is a list of short-term planned improvements:

  • Add support for hsl() color function (#12)
  • Add support for the adjacent sibling combinator (+) (#6)
  • Add support for the child combinator (>) (#7)
  • Add support for the general sibling combinator (~) (#8)
  • Provides basic validation configurations for most common attributes, functions and keywords

Previously Closed Issues

🚀 Getting Started

The full documentation of the package is available here.

📦 Installation with Swift Package Manager

CiderCSSKit is available through Swift Package Manager.

As a Package Dependency

To install it, simply add the dependency to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/chsxf/CiderCSSKit.git", requirement: .branch("main")),
],
targets: [
    .target(name: "YourTarget", dependencies: ["CiderCSSKit"]),
]

As a Project Dependency in Xcode

  • In Xcode, select File > Add Packages... and enter https://github.com/chsxf/CiderCSSKit.git in the search field (top-right).
  • Then select Branch as the Dependency Rule with main in the associated text field.
  • Then select the project of your choice in the Add to Project list.
  • Finally, click the Add Package button.

⚖️ License

Unless stated otherwise, all source code and assets are distributed under the MIT License.

cidercsskit's People

Stargazers

 avatar

Watchers

 avatar

Forkers

bobbyski

cidercsskit's Issues

Fix `rgb()` and `rbga()` methods

For now, rgb() and rgba() methods are not parsed correctly. They expect 4 decimal components ranging from 0 to 1, but the specification calls for three decimals (RGB) from 0 to 255, and one (A) from 0 to 1.

Full documentation for version `0.1`

Custom Pages

  • Getting Started with CiderCSSKit
  • Custom Validations and Attributes

Essentials

  • CSSParser
  • CSSRules
  • CSSConsumer
  • CSSAttributes

Values

  • CSSValue
  • CSSAngleUnit
  • CSSLenghtUnit
  • CSSColorKeywords

Error Management

  • CSSParserErrors

Extending and Validating

  •  CSSValidationConfiguration
  • CSSValueType
  • CSSValueGroupingType
  • CSSValueShorthandGroupDescriptor
  • CSSAttributeExpansion
  • CSSAttributeExpanders
  • CSSFunctionHelpers

Tokens

  • CSSToken
  • CSSTokenType

Enumerations

  • CSSColorSpace
  • CSSLengthUnitErrors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.