Open blond opened 8 years ago
var relations = {
entity: { block: 'A' },
onlyWith: [
{ entity: { block: 'B' } }
],
dependOn: [
{ entity: { block: 'C' } }
]
};
Т.е. это надо будет дважды прописывать? И для блока A, и для B?
Real examples could be easily a bad architecture.
onlyWith: [
{ entity: { block: 'B' } }
],
You sure that we need entity
here?
Do you specified RelationNode types (or something like that) already?
Т.е. это надо будет дважды прописывать? И для блока A, и для B?
Нет. Если в декларации есть A и B то работает, если чего-то нет, то не работает. В какой последовательности записали — неважно.
Смущает синтаксис? Есть идеи как лучше?
You sure that we need entity here?
Yes. This is consistent with other cases. And we can specify the technology.
onlyWith: [
{
entity: { block: 'B' },
tech: 'js'
}
]
Do you specified RelationNode types (or something like that) already?
What do you mean by RelationNode types?
Смущает синтаксис? Есть идеи как лучше?
Смущает то, что надо будет помнить про вхождение блока B в зависимостях блока А Если удаляем блок В, то надо будет лезть во все блоки и чистить зависимости.
What do you mean by RelationNode types?
I mean we need specification for node types.
Смущает то, что надо будет помнить про вхождение блока B в зависимостях блока А
Так это жизненная необходимость :) Без такого рода зависимостей не избежать избыточного кода.
Такие зависимости можно писать не в файлах блока, а каких-нибудь файлах уровня или проекта. Но это уже дело вкуса.
I mean we need specification for node types.
Relations is not graph, although very similar. Therefore, there are no nodes and their types.
Or do you mean that we should describe the relations format?
@blond The question of missing terminology. What is relation? Where are dependency-edges?
There are cases when several entities depend on other entity.
The dependency should be added only when both entities are in declaration.
Example:
Real examples:
{ block: 'checkbox', modName: 'theme', modVal: 'islands'
with{ block: 'checkbox', modName: 'type', modVal: 'button' }
depend on{ block: 'button', modName: 'theme', modVal: 'islands' }
.islands
theme ofbutton
should be added only ifcheckbox
hastype_button
modifier withislands
theme.Code in
bem-components
— https://github.com/bem/bem-components/blob/5406834d2f35911574ec49f974c0788c800d7835/design/common.blocks/checkbox/_theme/checkbox_theme_islands.deps.js{ block: 'dropdown', modName: 'theme', modVal: 'islands'
with{ block: 'dropdown', modName: 'switcher', modVal: 'link' }
depend on{ block: 'link', modName: 'theme', modVal: 'islands' }
.islands
theme oflink
should be added only ifdropdown
hasswitcher_link
modifier withislands
theme.Code in
bem-components
— https://github.com/bem/bem-components/blob/5406834d2f35911574ec49f974c0788c800d7835/design/common.blocks/dropdown/_theme/dropdown_theme_islands.deps.jsQuotes:
Taken from https://github.com/bem/bem-tools/pull/463.