All Projects → bem → themekit

bem / themekit

Licence: other
Build system of design-tokens for any platforms

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to themekit

Style Dictionary
A build system for creating cross-platform styles.
Stars: ✭ 2,097 (+3395%)
Mutual labels:  build-system, design-tokens, style-tokens
parsers
Specify is a central platform for companies who want to unify their brand identity, by connecting their design system tools.
Stars: ✭ 50 (-16.67%)
Mutual labels:  design-tokens, design-system, style-dictionary
Theme Ui
Build consistent, themeable React apps based on constraint-based design principles
Stars: ✭ 4,150 (+6816.67%)
Mutual labels:  design-tokens, design-system
stitchwind
A bridge between Tailwind and Stitches
Stars: ✭ 33 (-45%)
Mutual labels:  design-tokens, design-system
theme-ui-native
Build consistent, themeable React Native apps based on constraint-based design principles
Stars: ✭ 67 (+11.67%)
Mutual labels:  design-tokens, design-system
ocean-web
Blu's Design System
Stars: ✭ 25 (-58.33%)
Mutual labels:  design-system
react-toolkit
Flexible components html + css + react using BEM convention. Maybe, you can call it "Design System" !
Stars: ✭ 89 (+48.33%)
Mutual labels:  design-system
smores-react
🍭 Marshmallow React components
Stars: ✭ 34 (-43.33%)
Mutual labels:  design-system
cmany
Easily batch-build cmake projects!
Stars: ✭ 15 (-75%)
Mutual labels:  build-system
Rocket.Chat.Fuselage
React port of Rocket.Chat's design system, Fuselage
Stars: ✭ 61 (+1.67%)
Mutual labels:  design-system
design-system
A resource for creating user interfaces based on brand, UX, and dev principles
Stars: ✭ 17 (-71.67%)
Mutual labels:  design-system
alfred
(v0.2) Even Batman needs a little help. Task runner. Automator. Build system.
Stars: ✭ 62 (+3.33%)
Mutual labels:  build-system
automeka
Implicit and module-aware build system for future C++
Stars: ✭ 20 (-66.67%)
Mutual labels:  build-system
grommet-theme-hpe
Hewlett Packard Enterprise grommet theme
Stars: ✭ 16 (-73.33%)
Mutual labels:  design-system
assembler
A modern UI framework
Stars: ✭ 171 (+185%)
Mutual labels:  design-system
hope-ui-design-system
Hope UI - Open Source Bootstrap 5 Design System
Stars: ✭ 37 (-38.33%)
Mutual labels:  design-system
l3build
A testing and building system for LaTeX
Stars: ✭ 63 (+5%)
Mutual labels:  build-system
polarwind
Envoy's product component library
Stars: ✭ 17 (-71.67%)
Mutual labels:  design-system
kconfig
Kconfig for ARM based MCUs
Stars: ✭ 15 (-75%)
Mutual labels:  build-system
frontend
#ChallengeTime Front-End Toolkit with useful additional CSS and JS Scripts http://gmkhussain.github.io/frontend
Stars: ✭ 26 (-56.67%)
Mutual labels:  design-system

themekit

npm examples node

Themkit is a build system for design-tokens for any platform. This system is based on style-dictionary API and redefinition levels, which allows you to describe platform-specific values. Themkit provides you to extend existing themes in order to supplement or redefine existing tokens, it also allows you to use the basic theme set and add it to the service.

Features

  • 🔍 Clear format (json or yaml) for developers and designers.
  • 📚 Define tokens once and get result for any format, for example js, css or json.
  • 🛠 Every part of the theme or some of the tokens is extendable and overridable.
  • 💻 Tokens may be defined for several web platforms, for example desktop and touch.

Installation

# via npm
npm i -DE @yandex/themekit
# or yarn
yarn add --dev @yandex/themekit

Usage

A themekit is available as a CLI tool.

build

Builds themes for configured formats.

USAGE
  $ themekit build

OPTIONS
  -c, --config=config  [default: themekit.config.{js,json,yml}] The path to a themekit config file.
  -e, --entry=entry    Builds selected entries.
  -o, --output=output  Builds selected outputs.
  -w, --watch          Auto rebuilds themes after change sources.

Get started

More usage cases you can see in examples.

Tool configuration

First, you need to create a config file themekit.config.json at project root:

{
  "entry": {
    "light": "./src/theme/light.theme.json"
  },
  "output": {
    "css": {
      "transforms": ["name/cti/kebab"],
      "buildPath": "./src/theme/themes",
      "files": [
        {
          "destination": "[entry]/[platform]/root.css",
          "format": "css/variables"
        }
      ]
    }
  }
}

A output section based on style-dictionary platforms config.

themekit config interface

{
  /**
   * Map with themes
   */
  entry: Record<string, string>
  /**
   * Map with output formats
   *
   * @see https://amzn.github.io/style-dictionary/#/config?id=configjson
   */
  output: Record<string, {
    /**
     * List of transforms should be applied for each token
     *
     * @see https://amzn.github.io/style-dictionary/#/transforms
     */
    transforms: string[]
    /**
     * A preset that contains the transforms set
     *
     * @see https://amzn.github.io/style-dictionary/#/transform_groups
     */
    transformGroup?: string
    /**
     * Output directory for building results
     */
    buildPath: string
    /**
     * @see https://amzn.github.io/style-dictionary/#/actions
     */
    actions: string[]
    /**
     * List of files to get at the output
     */
    files: Array<{
      /**
       * Output filepath, also supports helper placeholders:
       * [entry] — theme name
       * [platform] — platform name
       */
      destination: string
      /**
       * Output format
       *
       * @see https://amzn.github.io/style-dictionary/#/formats
       */
      format: string
      /**
       * Filter applied for each tokens
       */
      filter: any
    }>
  }>
}

Theme configuration

The basic theme configuration consists of the sources section, which lists which tokens should include to this theme (you can specify the full path or glob).

{
  "sources": [
    "./src/theme/tokens/typography.tokens.yml",
    "./src/theme/tokens/color-light.tokens.yml",
    "./src/components/**/*.tokens.yml"
  ]
}

theme config interface

{
  /**
   * Extendable theme
   */
  extends?: string
  /**
   * Platforms that should be included in the theme (default common)
   */
  platforms?: Array<'common' | 'deskpad' | 'desktop' | 'touch' | 'touch-pad' | 'touch-phone'>
  /**
   * Mappers list
   */
  mappers?: string[]
  /**
   * Sources list
   */
  sources: string[]
}

Tokens

Tokens can include additional properties such as comment or group for documentation or meta information for processing, also can be used as aliases, see more at style-dictionary properties.

A themekit support write tokens in json or yaml format:

yaml

component:
  type:
    base:
      fillColor:
        value: '#000'
      typoColor:
        value: '#fff'
    danger:
      fillColor:
        value: '#f00'
      typoColor:
        value: '#fff'

json

{
  "component": {
    "type": {
      "base": {
        "fillColor": {
          "value": "#000"
        },
        "typoColor": {
          "value": "#fff"
        }
      },
      "danger": {
        "fillColor": {
          "value": "#f00"
        },
        "typoColor": {
          "value": "#fff"
        }
      }
    }
  }
}

token interface

{
  /**
   * Token value
   */
  value: string
  /**
   * Token group
   */
  group?: string
  /**
   * Token comment
   */
  comment?: string
}

Additional features

💻 Platforms

A themekit supports platforms allows you to collect tokens for a specific platform such as desktop or touch, by default tokens included only from common platform.

Each platform contains a several levels:

platforms levels
common common
deskpad common + deskpad
desktop common + deskpad + desktop
touch common + touch
touch-pad common + deskpad + touch + touch-pad
touch-phone common + touch + touch-phone

theme config

Platform should be written in file name after @ symbol (exclude common level).

{
  "platforms": ["desktop", "touch"],
  "sources": [
    "./tokens/project.tokens.yml",
    "./tokens/[email protected]",
    "./tokens/[email protected]"
  ]
}

🌈 Color processing

A themekit supports modifying colors for token values. Available next modifiers:

  • h — change hue
  • s — change saturation
  • l — change lightness
  • a — change alpha channel

tool config

Need define process-color for output actions:

{
  "output": {
    "css": {
      "actions": ["process-color"]
    }
  }
}

tokens

Just use a necessary modifier for your color:

component:
  type:
    base:
      fillColor:
        value: 'color(#000 a(80%))'

result

At result you get plain value with color:

:root {
  --component-type-base-fill-color: rgba(0, 0, 0, 0.8);
}

Formats

🗂 css/variables

tool config

{
  "output": {
    "css": {
      "transforms": ["name/cti/kebab"],
      "buildPath": "./src/theme/themes",
      "files": [
        {
          "destination": "[entry]/[platform]/root.css",
          "format": "css/variables",
          "options": {
            // default: ":root"
            "selector": ".MyTheme",
            // default: false
            "useAliasVariables": true
          }
        }
      ]
    }
  }
}

License

MPL-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].