Closed blond closed 7 years ago
Depends on https://github.com/bem-sdk/bem-cell/issues/1
Need to implement:
Cross tech decl algebra:
// U — merge
[{ entity: A }] U [{ entity: A, tech: '1' }] →
→ [{ entity: A }, { entity: A, tech: '1' }] // Because any tech can be not '1' in result
[{ entity: A, tech: '1' }] U [{ entity: A, tech: '2' }] →
→ [{ entity: A, tech: '1' }, { entity: A, tech: '2' }]
// / — subtract
[{ entity: A }] / [{ entity: A, tech: 'specified' }] → [{ entity: A }]
[{ entity: A, tech: 'specified' }] / [{ entity: A }] → []
[{ entity: A, tech: 'specified' }] / [{ tech: 'specified' }] → []
// П — intersect
[{ entity: A }] П [{ entity: A, tech: 'specified' }] → [{ entity: A, tech: 'specified' }]
[{ entity: A, tech: '1' }] П [{ entity: A, tech: '2' }] → []
[{ tech: '1' }] П [{ entity: A, tech: '1' }] → [{ entity: A, tech: '1' }]
@zxqfox is it done?
Yeah, it's like done
https://github.com/bem-sdk/bem-cell
In publick API:
format(decl: BemCell[], opts: {format: 'v1'|'v2'|'enb'}): *
stringify(BemCell[], {format: String}): String
merge(BemCell[], BemCell[], ...): BemCell[])
intersect(BemCell[], BemCell[], ...): BemCell[]
subtract(BemCell[], BemCell[]): BemCell[])
In private API:
assign(cell: BemCell, scope: BemEntityName): BemCell
~normalize(*, {format: String}): BemCell[]
UPD:
assign(cell: {entity: BemCell-like, scope: BemCell): BemCell