2.0.13 • Published 5 months ago

@fbem/core v2.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@fbem/core npm

@fbem/core is a core package for functional BEM. It provides utility for parsing BEM entities into BEM structure, which is used for code generation.

This package is base for all other packages. Basically you shouldn't use it.

Getting started

npm i @fbem/core

Types

type NamingOptions = {
  prefix: string;
  elem: string;
  modName: string;
  modVal: string;
};

type StringMod = {
  type: 'string';
  values: Record<string, string>;
};

type BooleanMod = {
  type: 'boolean';
  value: string;
};

type Mod = StringMod | BooleanMod;

type BemParams = {
  base: string;
  mods: Record<string, Mod>;
};

type BemFunctionName = string;

type BemStructure = Record<BemFunctionName, BemParams>;

const createBemStructure: (classesMap: Record<string, string>, naming: NamingOptions) => BemStructure;

const parseBem: (className: string, naming: NamingOptions) => {
  block: string;
  elem: string;
  modName: string;
  modVal: string;
}

API

createBemStructure: (classesMap: Record<string, string>, naming: NamingOptions) => BemStructure

Description

The function is used to convert a map of CSS classes into a structure that is used for code generation.

parseBem: (className: string, naming: NamingOptions) => { block: string; elem: string; modName: string; modVal: string; }

Description

The function is used to parse the CSS class into its constituent entities.

2.0.13

5 months ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.7

1 year ago

2.0.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago