Skip to content

Commit

Permalink
feat(v3): init packages
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogradov committed Nov 26, 2018
1 parent bfaf77b commit d652328
Show file tree
Hide file tree
Showing 106 changed files with 13,955 additions and 2,091 deletions.
File renamed without changes.
14 changes: 0 additions & 14 deletions config/babel.common.js

This file was deleted.

21 changes: 0 additions & 21 deletions config/rollup.config.common.js

This file was deleted.

31 changes: 0 additions & 31 deletions config/rollup.config.preact.js

This file was deleted.

29 changes: 0 additions & 29 deletions config/rollup.config.react.js

This file was deleted.

3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"lerna": "2.5.1",
"lerna": "3.1.4",
"packages": [
".",
"packages/*"
],
"command": {
Expand Down
44 changes: 25 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
{
"name": "bem-react-core",
"version": "2.0.0",
"description": "BEM React Core",
"name": "bem-react",
"private": true,
"version": "3.0.0",
"description": "BEM React",
"repository": {
"url": "git://github.com/bem/bem-react-core.git",
"type": "git"
},
"keywords": [
"bem",
"react",
"preact",
"core"
],
"license": "MPL-2.0",
"scripts": {
"lint": "tsc -p . --noEmit && tslint -p . -t stylish",
"lint": "lerna run lint",
"test": "lerna run test",
"prepush": "lerna run test",
"commitmsg": "commitlint -e $GIT_PARAMS"
},
"devDependencies": {
"@babel/core": "7.0.0",
"@babel/helper-module-imports": "7.0.0",
"@babel/preset-env": "7.0.0",
"@commitlint/cli": "6.1.3",
"@commitlint/config-conventional": "6.1.3",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-transform-object-assign": "6.22.0",
"babel-preset-env": "^1.6.1",
"gzip-size-cli": "2.1.0",
"@types/jest": "23.3.1",
"@types/react": "16.4.12",
"@types/react-dom": "16.0.7",
"chalk": "2.4.1",
"gzip-size-cli": "3.0.0",
"husky": "0.14.3",
"lerna": "^2.5.1",
"npm-run-all": "4.1.2",
"react-test-renderer": "16.3.0",
"rollup": "0.57.1",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "9.1.0",
"jest": "23.5.0",
"lerna": "3.2.0",
"rollup": "0.65.0",
"rollup-plugin-babel": "4.0.2",
"rollup-plugin-commonjs": "9.1.6",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-replace": "2.0.0",
"tslint": "5.9.1",
"tslint-react": "3.5.1",
"typescript": "2.8.1",
"uglify-js": "3.3.18"
"rollup-plugin-typescript2": "0.17.0",
"rollup-plugin-uglify": "4.0.0",
"ts-jest": "23.1.4",
"tslint": "5.11.0",
"tslint-react": "3.6.0",
"typescript": "3.0.1",
"uglify-js": "3.4.8"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"/Users/grape/Sources/bem-react-core/packages/classname/classname.tsx":{"path":"/Users/grape/Sources/bem-react-core/packages/classname/classname.tsx","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":36},"end":{"line":3,"column":79}},"2":{"start":{"line":4,"column":12},"end":{"line":18,"column":1}},"3":{"start":{"line":20,"column":17},"end":{"line":20,"column":71}},"4":{"start":{"line":21,"column":20},"end":{"line":23,"column":5}},"5":{"start":{"line":22,"column":8},"end":{"line":22,"column":174}},"6":{"start":{"line":22,"column":93},"end":{"line":22,"column":153}},"7":{"start":{"line":24,"column":25},"end":{"line":35,"column":5}},"8":{"start":{"line":25,"column":23},"end":{"line":25,"column":53}},"9":{"start":{"line":26,"column":8},"end":{"line":33,"column":11}},"10":{"start":{"line":27,"column":12},"end":{"line":32,"column":13}},"11":{"start":{"line":28,"column":16},"end":{"line":31,"column":25}},"12":{"start":{"line":34,"column":8},"end":{"line":34,"column":24}},"13":{"start":{"line":36,"column":4},"end":{"line":44,"column":10}},"14":{"start":{"line":36,"column":44},"end":{"line":44,"column":7}},"15":{"start":{"line":37,"column":8},"end":{"line":43,"column":98}},"16":{"start":{"line":46,"column":0},"end":{"line":46,"column":32}},"17":{"start":{"line":47,"column":0},"end":{"line":47,"column":31}},"18":{"start":{"line":48,"column":0},"end":{"line":65,"column":2}},"19":{"start":{"line":49,"column":18},"end":{"line":49,"column":20}},"20":{"start":{"line":50,"column":4},"end":{"line":52,"column":5}},"21":{"start":{"line":51,"column":8},"end":{"line":51,"column":36}},"22":{"start":{"line":53,"column":20},"end":{"line":53,"column":22}},"23":{"start":{"line":54,"column":22},"end":{"line":54,"column":31}},"24":{"start":{"line":55,"column":24},"end":{"line":55,"column":52}},"25":{"start":{"line":56,"column":4},"end":{"line":63,"column":5}},"26":{"start":{"line":57,"column":20},"end":{"line":57,"column":39}},"27":{"start":{"line":58,"column":8},"end":{"line":60,"column":9}},"28":{"start":{"line":59,"column":12},"end":{"line":59,"column":21}},"29":{"start":{"line":61,"column":8},"end":{"line":61,"column":31}},"30":{"start":{"line":62,"column":8},"end":{"line":62,"column":33}},"31":{"start":{"line":64,"column":4},"end":{"line":64,"column":28}}},"fnMap":{"0":{"name":"withNaming","decl":{"start":{"line":19,"column":9},"end":{"line":19,"column":19}},"loc":{"start":{"line":19,"column":28},"end":{"line":45,"column":1}},"line":19},"1":{"name":"(anonymous_1)","decl":{"start":{"line":21,"column":20},"end":{"line":21,"column":21}},"loc":{"start":{"line":21,"column":40},"end":{"line":23,"column":5}},"line":21},"2":{"name":"(anonymous_2)","decl":{"start":{"line":22,"column":73},"end":{"line":22,"column":74}},"loc":{"start":{"line":22,"column":91},"end":{"line":22,"column":155}},"line":22},"3":{"name":"(anonymous_3)","decl":{"start":{"line":24,"column":25},"end":{"line":24,"column":26}},"loc":{"start":{"line":24,"column":54},"end":{"line":35,"column":5}},"line":24},"4":{"name":"(anonymous_4)","decl":{"start":{"line":26,"column":42},"end":{"line":26,"column":43}},"loc":{"start":{"line":26,"column":58},"end":{"line":33,"column":9}},"line":26},"5":{"name":"(anonymous_5)","decl":{"start":{"line":36,"column":11},"end":{"line":36,"column":12}},"loc":{"start":{"line":36,"column":42},"end":{"line":44,"column":9}},"line":36},"6":{"name":"(anonymous_6)","decl":{"start":{"line":36,"column":52},"end":{"line":36,"column":53}},"loc":{"start":{"line":36,"column":108},"end":{"line":44,"column":5}},"line":36},"7":{"name":"(anonymous_7)","decl":{"start":{"line":48,"column":21},"end":{"line":48,"column":22}},"loc":{"start":{"line":48,"column":33},"end":{"line":65,"column":1}},"line":48}},"branchMap":{"0":{"loc":{"start":{"line":22,"column":100},"end":{"line":22,"column":152}},"type":"cond-expr","locations":[{"start":{"line":22,"column":129},"end":{"line":22,"column":135}},{"start":{"line":22,"column":138},"end":{"line":22,"column":152}}],"line":22},"1":{"loc":{"start":{"line":26,"column":8},"end":{"line":33,"column":10}},"type":"binary-expr","locations":[{"start":{"line":26,"column":8},"end":{"line":26,"column":12}},{"start":{"line":26,"column":16},"end":{"line":33,"column":10}}],"line":26},"2":{"loc":{"start":{"line":27,"column":12},"end":{"line":32,"column":13}},"type":"if","locations":[{"start":{"line":27,"column":12},"end":{"line":32,"column":13}},{"start":{"line":27,"column":12},"end":{"line":32,"column":13}}],"line":27},"3":{"loc":{"start":{"line":27,"column":16},"end":{"line":27,"column":46}},"type":"binary-expr","locations":[{"start":{"line":27,"column":16},"end":{"line":27,"column":26}},{"start":{"line":27,"column":30},"end":{"line":27,"column":46}}],"line":27},"4":{"loc":{"start":{"line":30,"column":29},"end":{"line":30,"column":76}},"type":"cond-expr","locations":[{"start":{"line":30,"column":51},"end":{"line":30,"column":55}},{"start":{"line":30,"column":58},"end":{"line":30,"column":76}}],"line":30},"5":{"loc":{"start":{"line":37,"column":15},"end":{"line":43,"column":97}},"type":"cond-expr","locations":[{"start":{"line":38,"column":14},"end":{"line":40,"column":107}},{"start":{"line":41,"column":14},"end":{"line":43,"column":97}}],"line":37},"6":{"loc":{"start":{"line":38,"column":14},"end":{"line":40,"column":107}},"type":"cond-expr","locations":[{"start":{"line":39,"column":18},"end":{"line":39,"column":98}},{"start":{"line":40,"column":18},"end":{"line":40,"column":107}}],"line":38},"7":{"loc":{"start":{"line":41,"column":14},"end":{"line":43,"column":97}},"type":"cond-expr","locations":[{"start":{"line":42,"column":18},"end":{"line":42,"column":108}},{"start":{"line":43,"column":18},"end":{"line":43,"column":97}}],"line":41},"8":{"loc":{"start":{"line":58,"column":8},"end":{"line":60,"column":9}},"type":"if","locations":[{"start":{"line":58,"column":8},"end":{"line":60,"column":9}},{"start":{"line":58,"column":8},"end":{"line":60,"column":9}}],"line":58},"9":{"loc":{"start":{"line":58,"column":12},"end":{"line":58,"column":50}},"type":"binary-expr","locations":[{"start":{"line":58,"column":12},"end":{"line":58,"column":24}},{"start":{"line":58,"column":28},"end":{"line":58,"column":50}}],"line":58}},"s":{"0":1,"1":1,"2":1,"3":2,"4":2,"5":29,"6":82,"7":2,"8":29,"9":29,"10":25,"11":21,"12":29,"13":2,"14":29,"15":29,"16":1,"17":1,"18":1,"19":32,"20":32,"21":66,"22":32,"23":32,"24":32,"25":32,"26":67,"27":67,"28":3,"29":64,"30":64,"31":32},"f":{"0":2,"1":29,"2":82,"3":29,"4":25,"5":29,"6":29,"7":32},"b":{"0":[9,73],"1":[29,21],"2":[21,4],"3":[25,6],"4":[10,11],"5":[4,25],"6":[1,3],"7":[4,21],"8":[3,64],"9":[67,65]},"_coverageSchema":"d34fc3e6b8297bcde183f5492bcb8fcb36775295","hash":"33cea08c9fcd5067194bc3be3138b11f5d06925d","contentHash":"6c9bfd85fd596d81cf5fee758a225b7c"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"/Users/grape/Sources/bem-react-core/packages/classname/classname.tsx":{"path":"/Users/grape/Sources/bem-react-core/packages/classname/classname.tsx","statementMap":{"0":{"start":{"line":3,"column":14},"end":{"line":17,"column":1}},"1":{"start":{"line":73,"column":19},"end":{"line":73,"column":43}},"2":{"start":{"line":75,"column":22},"end":{"line":76,"column":130}},"3":{"start":{"line":76,"column":8},"end":{"line":76,"column":130}},"4":{"start":{"line":76,"column":60},"end":{"line":76,"column":112}},"5":{"start":{"line":78,"column":27},"end":{"line":91,"column":5}},"6":{"start":{"line":79,"column":32},"end":{"line":79,"column":49}},"7":{"start":{"line":81,"column":8},"end":{"line":88,"column":11}},"8":{"start":{"line":82,"column":12},"end":{"line":87,"column":13}},"9":{"start":{"line":83,"column":16},"end":{"line":86,"column":20}},"10":{"start":{"line":90,"column":8},"end":{"line":90,"column":24}},"11":{"start":{"line":93,"column":4},"end":{"line":107,"column":6}},"12":{"start":{"line":94,"column":8},"end":{"line":106,"column":9}},"13":{"start":{"line":99,"column":12},"end":{"line":105,"column":102}},"14":{"start":{"line":135,"column":18},"end":{"line":135,"column":35}},"15":{"start":{"line":152,"column":26},"end":{"line":167,"column":1}},"16":{"start":{"line":153,"column":20},"end":{"line":153,"column":22}},"17":{"start":{"line":154,"column":24},"end":{"line":154,"column":33}},"18":{"start":{"line":155,"column":26},"end":{"line":155,"column":54}},"19":{"start":{"line":157,"column":4},"end":{"line":164,"column":5}},"20":{"start":{"line":158,"column":8},"end":{"line":160,"column":9}},"21":{"start":{"line":159,"column":12},"end":{"line":159,"column":21}},"22":{"start":{"line":162,"column":8},"end":{"line":162,"column":31}},"23":{"start":{"line":163,"column":8},"end":{"line":163,"column":33}},"24":{"start":{"line":166,"column":4},"end":{"line":166,"column":28}}},"fnMap":{"0":{"name":"withNaming","decl":{"start":{"line":72,"column":16},"end":{"line":72,"column":26}},"loc":{"start":{"line":72,"column":61},"end":{"line":108,"column":1}},"line":72},"1":{"name":"(anonymous_1)","decl":{"start":{"line":75,"column":22},"end":{"line":75,"column":23}},"loc":{"start":{"line":76,"column":8},"end":{"line":76,"column":130}},"line":76},"2":{"name":"(anonymous_2)","decl":{"start":{"line":76,"column":50},"end":{"line":76,"column":51}},"loc":{"start":{"line":76,"column":60},"end":{"line":76,"column":112}},"line":76},"3":{"name":"(anonymous_3)","decl":{"start":{"line":78,"column":27},"end":{"line":78,"column":28}},"loc":{"start":{"line":78,"column":102},"end":{"line":91,"column":5}},"line":78},"4":{"name":"(anonymous_4)","decl":{"start":{"line":81,"column":42},"end":{"line":81,"column":43}},"loc":{"start":{"line":81,"column":50},"end":{"line":88,"column":9}},"line":81},"5":{"name":"(anonymous_5)","decl":{"start":{"line":93,"column":11},"end":{"line":93,"column":12}},"loc":{"start":{"line":94,"column":8},"end":{"line":106,"column":9}},"line":94},"6":{"name":"(anonymous_6)","decl":{"start":{"line":94,"column":8},"end":{"line":94,"column":9}},"loc":{"start":{"line":98,"column":13},"end":{"line":106,"column":9}},"line":98},"7":{"name":"(anonymous_7)","decl":{"start":{"line":152,"column":26},"end":{"line":152,"column":27}},"loc":{"start":{"line":152,"column":57},"end":{"line":167,"column":1}},"line":152}},"branchMap":{"0":{"loc":{"start":{"line":76,"column":60},"end":{"line":76,"column":112}},"type":"cond-expr","locations":[{"start":{"line":76,"column":89},"end":{"line":76,"column":95}},{"start":{"line":76,"column":98},"end":{"line":76,"column":112}}],"line":76},"1":{"loc":{"start":{"line":81,"column":8},"end":{"line":88,"column":10}},"type":"binary-expr","locations":[{"start":{"line":81,"column":8},"end":{"line":81,"column":12}},{"start":{"line":81,"column":16},"end":{"line":88,"column":10}}],"line":81},"2":{"loc":{"start":{"line":82,"column":12},"end":{"line":87,"column":13}},"type":"if","locations":[{"start":{"line":82,"column":12},"end":{"line":87,"column":13}},{"start":{"line":82,"column":12},"end":{"line":87,"column":13}}],"line":82},"3":{"loc":{"start":{"line":82,"column":16},"end":{"line":82,"column":46}},"type":"binary-expr","locations":[{"start":{"line":82,"column":16},"end":{"line":82,"column":26}},{"start":{"line":82,"column":30},"end":{"line":82,"column":46}}],"line":82},"4":{"loc":{"start":{"line":85,"column":25},"end":{"line":85,"column":72}},"type":"cond-expr","locations":[{"start":{"line":85,"column":47},"end":{"line":85,"column":51}},{"start":{"line":85,"column":54},"end":{"line":85,"column":72}}],"line":85},"5":{"loc":{"start":{"line":99,"column":19},"end":{"line":105,"column":101}},"type":"cond-expr","locations":[{"start":{"line":100,"column":18},"end":{"line":102,"column":111}},{"start":{"line":103,"column":18},"end":{"line":105,"column":101}}],"line":99},"6":{"loc":{"start":{"line":100,"column":18},"end":{"line":102,"column":111}},"type":"cond-expr","locations":[{"start":{"line":101,"column":22},"end":{"line":101,"column":102}},{"start":{"line":102,"column":22},"end":{"line":102,"column":111}}],"line":100},"7":{"loc":{"start":{"line":103,"column":18},"end":{"line":105,"column":101}},"type":"cond-expr","locations":[{"start":{"line":104,"column":22},"end":{"line":104,"column":112}},{"start":{"line":105,"column":22},"end":{"line":105,"column":101}}],"line":103},"8":{"loc":{"start":{"line":158,"column":8},"end":{"line":160,"column":9}},"type":"if","locations":[{"start":{"line":158,"column":8},"end":{"line":160,"column":9}},{"start":{"line":158,"column":8},"end":{"line":160,"column":9}}],"line":158},"9":{"loc":{"start":{"line":158,"column":12},"end":{"line":158,"column":50}},"type":"binary-expr","locations":[{"start":{"line":158,"column":12},"end":{"line":158,"column":24}},{"start":{"line":158,"column":28},"end":{"line":158,"column":50}}],"line":158}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0]}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 7 additions & 0 deletions packages/classname/classname.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare type NoStrictEntityMods = Record<string, string | boolean | number | undefined>;
export declare type ClassNameInitilizer = (blockName: string, elemName?: string) => ClassNameFormatter;
export declare type ClassNameList = Array<string | undefined>;
export declare type ClassNameFormatter = (elemNameOrBlockMods?: NoStrictEntityMods | string | null, elemModsOrBlockMix?: NoStrictEntityMods | ClassNameList | null, elemMix?: ClassNameList) => string;
export declare function withNaming(preset: any): ClassNameInitilizer;
export declare const cn: ClassNameInitilizer;
export declare const classnames: (...strings: (string | undefined)[]) => string;
34 changes: 34 additions & 0 deletions packages/classname/classname.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { stringifyWrapper } from '@bem/sdk.naming.entity.stringify';

const react = require('@bem/sdk.naming.presets/react');

export type NoStrictEntityMods = Record<string, string | boolean | number | undefined>;

export type EntityFormatter = (mods?: NoStrictEntityMods) => string;

function modsToArray(block: string, elem?: string, mods?: NoStrictEntityMods) {
const arr = [];

if (!mods) return [];

for (const modName in mods) {
if (mods[modName] || mods[modName] === 0) {
arr.push({
block,
elem,
mod: {
name: modName,
val: mods[modName] === true ? true : String(mods[modName]),
},
});
}
}

return arr;
}

export function entity(block: string, elem?: string): EntityFormatter {
const naming = stringifyWrapper(react);

return (mods?: NoStrictEntityMods) => modsToArray(block, elem, mods).map(naming).join(' ');
}
Loading

0 comments on commit d652328

Please sign in to comment.