scss-library/components/00_Global/_mebgenerator.styl

136 lines
2.8 KiB
Stylus
Raw Normal View History

2021-01-15 01:28:34 +01:00
_block = {
stack: {}
2021-01-15 01:28:34 +01:00
elements: {}
block_modifiers: {}
2021-01-15 01:28:34 +01:00
element_stack: () ()
element_modifier_stack: () ()
block_modifier_stack: () ()
current_elements: () ()
current_element_modifiers: () ()
current_block_modifiers: () ()
}
2021-01-15 01:28:34 +01:00
reset_block()
_block.stack = {}
_block.elements = {}
_block.block_modifiers = {}
2021-01-15 01:28:34 +01:00
_block.element_stack = {}
_block.element_modifier_stack = {}
_block.block_modifier_stack = {}
2021-01-15 01:28:34 +01:00
_block.current_elements = () ()
_block.current_element_modifiers = () ()
_block.current_block_modifiers = () ()
2021-01-15 01:28:34 +01:00
_include = {
elements: {}
element_modifires: {}
block_modifiers: {}
element_stack: {}
element_modifier_stack: {}
block_modifier_stack: {}
}
2021-01-15 01:28:34 +01:00
reset_include()
_aliases.element_aliases = {}
_aliases.element_modifires_aliases = {}
_aliases.block_modifiers_aliases = {}
_aliases.element_alias_stack = {}
_aliases.element_modifires_alias_stack = {}
_aliases.block_modifiers_alias_stack = {}
2021-01-15 01:28:34 +01:00
_block_map = {}
2021-01-15 01:28:34 +01:00
RV-Include(block_name, alias = null)
RV-Squash()
{block}
RV-Block(block_name)
2021-01-15 01:28:34 +01:00
{block}
push(_block.elements, _block.current_elements)
push(_block.block_modifiers, _block.current_block_modifiers)
2021-01-15 01:28:34 +01:00
_block_map[block_name] = _block
2021-01-15 01:28:34 +01:00
reset_block()
2021-01-15 01:28:34 +01:00
RV-Element(element_name)
if 'RV-Include' in called-from
if 'RV-Element' in called-from
push(_include.element_stack, element_name)
else
2021-01-15 01:28:34 +01:00
for alias in _include.element_stack
_include.elements[alias] = element_name
_include.elements[element_name] = element_name
if 'RV-Element' in called-from
2021-01-15 01:28:34 +01:00
push(_state.element_stack, block)
else
element = {
type: 'RV-Element'
name: element_name
blocks: (block)
modifiers: _block.current_element_modifiers
}
_block.current_element_modifiers = () ()
2021-01-15 01:28:34 +01:00
for child in _block.element_stack
if child != ()
push(element.blocks, child)
_block.element_stack = () ()
2021-01-15 01:28:34 +01:00
if 'RV-Block__Modifier' in called-from
push(_block.current_elements, element)
else
_block.elements[elemante_name] = element
RV-Element__Modifier(modifier_name)
if 'RV-Element__Modifier' in called-from
2021-01-15 01:28:34 +01:00
push(_state.element_modifier_stack, block)
else
modifier = {
type: 'RV-Element__Modifier'
name: modifier_name
2021-01-15 01:28:34 +01:00
blocks: (block)
}
2021-01-15 01:28:34 +01:00
for child in _block.element_modifier_stack
if child != ()
push(modifier.blocks, child)
_block.element_modifier_stack = () ()
2021-01-15 01:28:34 +01:00
push(_block.current_element_modifiers, modifier)
RV-Block__Modifier(modifier_name)
if 'RV-Block__Modifier' in called-from
2021-01-15 01:28:34 +01:00
push(_block.block_modifier_stack, block)
else
modifier = {
type: 'RV-Block__Modifier'
name: modifier_name
2021-01-15 01:28:34 +01:00
blocks: (block)
elements: _block.current_elements
}
2021-01-15 01:28:34 +01:00
_block.current_elements = () ()
2021-01-15 01:28:34 +01:00
for child in _block.block_modifier_stack
if child != ()
push(modifier.blocks, child)
_block.block_modifier_stack = () ()
2021-01-15 01:28:34 +01:00
_block.block_modifiers[modifier_name] = modifier