<commit_before>[![npm](https://img.shields.io/npm/v/@yummies/yummies.svg?style=flat-square)](https://www.npmjs.com/package/@yummies/yummies)
[![travis](http://img.shields.io/travis/yummies/yummies.svg?style=flat-square)](https://travis-ci.org/yummies/yummies)
[![coverage](http://img.shields.io/coveralls/yummies/yummies/master.svg?style=flat-square)](https://coveralls.io/r/yummies/yummies)
[![deps](http://img.shields.io/david/yummies/yummies.svg?style=flat-square)](https://david-dm.org/yummies/yummies)
[![gitter](http://img.shields.io/badge/gitter-join_chat-brightgreen.svg?style=flat-square)](https://gitter.im/yummies/yummies)

WIP
<commit_msg>:pencil: update README<commit_after>[![npm](https://img.shields.io/npm/v/@yummies/yummies.svg?style=flat-square)](https://www.npmjs.com/package/@yummies/yummies)
[![travis](http://img.shields.io/travis/yummies/yummies.svg?style=flat-square)](https://travis-ci.org/yummies/yummies)
[![coverage](http://img.shields.io/coveralls/yummies/yummies/master.svg?style=flat-square)](https://coveralls.io/r/yummies/yummies)
[![deps](http://img.shields.io/david/yummies/yummies.svg?style=flat-square)](https://david-dm.org/yummies/yummies)
[![gitter](http://img.shields.io/badge/gitter-join_chat-brightgreen.svg?style=flat-square)](https://gitter.im/yummies/yummies)

## Install

```
npm i @yummies/yummies
```

## Overview

Like [BEM methodology](https://en.bem.info/method/definitions/) and using [React](https://facebook.github.io/react/)? How about that:

```js
import Yummies from '@yummies/yummies';

class MyComponent extends Yummies.Component {
    constructor() {
        this.state = {
            test: null
        };
    }

    render() {
        return {
            block: 'my-component',
            mods: {
                test: this.state.test
            },
            content: {
                elem: 'input',
                tag: 'input',
                mods: {
                    type: 'search'
                },
                mix: {
                    block: 'my-another-component',
                    elem: 'input'
                },
                props: {
                    placeholder: 'search'
                }
            }
        };
    }
}

const MyComponentFactory = Yummies.createFactory(MyComponent);

Yummies.render(MyComponentFactory(), document.body);
```

## BEM

Similar to [BEMJSON](https://en.bem.info/technology/bemjson/v2/bemjson/):

##### `block <string>`

[Block](https://en.bem.info/method/definitions/#block) name.

##### `elem <string>`

[Element](https://en.bem.info/method/definitions/#element) name. Understands current block context so no need to repeat `block` inside nested elements.

##### `mods <object>`

* `block` + `mods` – [block modifiers](https://en.bem.info/method/definitions/#modifiers-for-blocks)
* `elem` + `mods` – [element modifiers](https://en.bem.info/method/definitions/#element-modifiers)

Can be shorthanded with `true` as modifier value.

##### `mix <array|object>`

[Mix](https://en.bem.info/forum/issues/4/) additional className(s) from another BEM entity(ies).

##### `tag <string>`

HTML tag, `div` by default.

##### `content <*>`

Any possible content such as strings, arrays, BEMJSON, React Elements, …

## Inheritance

Already knows about [BEM Levels of definition](https://en.bem.info/method/filesystem/#levels-of-definition)? Good, because we have it as "Layers" – checkout [babel-plugin-yummies](https://github.com/yummies/babel-plugin-yummies) – multilayer components inheritance for Yummies.

## API

### Patched methods

The following [React Top-Level API](https://facebook.github.io/react/docs/top-level-api.html) methods are patched to support the new format:

##### `render()`

```js
Yummies.render({ block: 'my-component' }, document.body);
```

##### `renderToString()`

```js
Yummies.renderToString({ block: 'my-component' });
```

##### `renderToStaticMarkup()`

```js
Yummies.renderToStaticMarkup({ block: 'my-component' });
```

##### `createElement()`

```js
Yummies.createElement({ block: 'my-component' });
```

```js
Yummies.createElement(class extends Yummies.Component { … });
```

##### `createFactory()`

```js
Yummies.createFactory(class extends Yummies.Component { … });
```

### Additional helpers

##### `buildClassName(<object>)`

Build className string from BEMJSON object.

```js
Yummies.buildClassName({ block: 'my-component', elem: 'title' });
```

##### `yummify(<array>)`

Collect all the inherited classes chain and return a ReactElement Factory.
See [babel-plugin-yummies](https://github.com/yummies/babel-plugin-yummies) for more details.

```js
Yummies.yummify([ … ]);
```

##### `yummifyRaw(<array>)`

Collect all the inherited classes chain and return a resulted Class Factory.
See [babel-plugin-yummies](https://github.com/yummies/babel-plugin-yummies) for more details.

```js
Yummies.yummifyRaw([ … ]);
```

{'fraction_non_alphanumeric': 0.18812691914022517, 'fraction_numerical': 0.00040941658137154553, 'mean_word_length': 3.6935638808837656, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 25, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6552929', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1652, 'n_words': 269}