136 lines
2.8 KiB
Stylus
136 lines
2.8 KiB
Stylus
_block = {
|
|
stack: {}
|
|
elements: {}
|
|
block_modifiers: {}
|
|
|
|
element_stack: () ()
|
|
element_modifier_stack: () ()
|
|
block_modifier_stack: () ()
|
|
|
|
current_elements: () ()
|
|
current_element_modifiers: () ()
|
|
current_block_modifiers: () ()
|
|
}
|
|
|
|
reset_block()
|
|
_block.stack = {}
|
|
_block.elements = {}
|
|
_block.block_modifiers = {}
|
|
|
|
_block.element_stack = {}
|
|
_block.element_modifier_stack = {}
|
|
_block.block_modifier_stack = {}
|
|
|
|
_block.current_elements = () ()
|
|
_block.current_element_modifiers = () ()
|
|
_block.current_block_modifiers = () ()
|
|
|
|
|
|
_include = {
|
|
elements: {}
|
|
element_modifires: {}
|
|
block_modifiers: {}
|
|
|
|
element_stack: {}
|
|
element_modifier_stack: {}
|
|
block_modifier_stack: {}
|
|
|
|
|
|
|
|
}
|
|
|
|
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 = {}
|
|
|
|
_block_map = {}
|
|
|
|
RV-Include(block_name, alias = null)
|
|
|
|
|
|
RV-Squash()
|
|
{block}
|
|
|
|
RV-Block(block_name)
|
|
{block}
|
|
|
|
push(_block.elements, _block.current_elements)
|
|
push(_block.block_modifiers, _block.current_block_modifiers)
|
|
|
|
_block_map[block_name] = _block
|
|
|
|
reset_block()
|
|
|
|
|
|
RV-Element(element_name)
|
|
if 'RV-Include' in called-from
|
|
if 'RV-Element' in called-from
|
|
push(_include.element_stack, element_name)
|
|
else
|
|
for alias in _include.element_stack
|
|
_include.elements[alias] = element_name
|
|
_include.elements[element_name] = element_name
|
|
|
|
if 'RV-Element' in called-from
|
|
push(_state.element_stack, block)
|
|
else
|
|
element = {
|
|
type: 'RV-Element'
|
|
name: element_name
|
|
blocks: (block)
|
|
modifiers: _block.current_element_modifiers
|
|
}
|
|
_block.current_element_modifiers = () ()
|
|
|
|
for child in _block.element_stack
|
|
if child != ()
|
|
push(element.blocks, child)
|
|
_block.element_stack = () ()
|
|
|
|
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
|
|
push(_state.element_modifier_stack, block)
|
|
else
|
|
modifier = {
|
|
type: 'RV-Element__Modifier'
|
|
name: modifier_name
|
|
blocks: (block)
|
|
}
|
|
|
|
for child in _block.element_modifier_stack
|
|
if child != ()
|
|
push(modifier.blocks, child)
|
|
_block.element_modifier_stack = () ()
|
|
|
|
push(_block.current_element_modifiers, modifier)
|
|
|
|
RV-Block__Modifier(modifier_name)
|
|
if 'RV-Block__Modifier' in called-from
|
|
push(_block.block_modifier_stack, block)
|
|
else
|
|
modifier = {
|
|
type: 'RV-Block__Modifier'
|
|
name: modifier_name
|
|
blocks: (block)
|
|
elements: _block.current_elements
|
|
}
|
|
_block.current_elements = () ()
|
|
|
|
for child in _block.block_modifier_stack
|
|
if child != ()
|
|
push(modifier.blocks, child)
|
|
_block.block_modifier_stack = () ()
|
|
|
|
_block.block_modifiers[modifier_name] = modifier
|