ye
This commit is contained in:
@@ -17,6 +17,15 @@ _global_scope = {
|
||||
_element_modifier_stack: {}
|
||||
}
|
||||
|
||||
_block_building_lane = ()
|
||||
_element_building_lange = ()
|
||||
|
||||
_work_lane(lane, callback)
|
||||
l = length(lane)
|
||||
for _ in (0..l)
|
||||
piece = pop(lane)
|
||||
callback(piece)
|
||||
|
||||
/*
|
||||
* Gets the selector of the parent class
|
||||
*/
|
||||
@@ -41,8 +50,13 @@ _get_element_selector()
|
||||
* Block according to BEM
|
||||
*/
|
||||
RV-Block(name)
|
||||
.{_css-prefix}-{name}
|
||||
.{name}
|
||||
push(_block_building_lane, {
|
||||
elements: {}
|
||||
block_modifiers: {}
|
||||
})
|
||||
{block}
|
||||
|
||||
for name, element in _global_scope['_selector_blocks_to_generate']
|
||||
& &__{name}
|
||||
for current_block in element.block_list
|
||||
@@ -70,25 +84,30 @@ RV-Block__Modifier(name)
|
||||
* For more see RV-Element___Modifier
|
||||
*/
|
||||
RV-Element(name)
|
||||
element_block_stack = _global_scope['_element_block_stack']
|
||||
append(element_block_stack, block)
|
||||
_global_scope['_element_block_stack'] = element_block_stack
|
||||
// Is there a block to build
|
||||
block_index = (index(called-from, 'RV-Block'))
|
||||
p(called-from block_index slice(called-from, 0, block_index))
|
||||
|
||||
//Detect if the selector will be generated
|
||||
//by an earlier call of RV-Element
|
||||
if not 'RV-Element' in called-from
|
||||
// Saving accumulated modifiers and blocks
|
||||
element = {}
|
||||
element['block_list'] = _global_scope['_element_block_stack']
|
||||
element['modifier_list'] = _global_scope['_element_modifier_stack']
|
||||
if length(_block_building_lane) >= 1
|
||||
push(_block_building_lane, block)
|
||||
|
||||
//Reseting
|
||||
_global_scope['_element_block_stack'] = ()
|
||||
_global_scope['_element_modifier_stack'] = {}
|
||||
current_block = _block_building_lane[-1]
|
||||
|
||||
//Saving element
|
||||
_global_scope['_selector_blocks_to_generate'][name] = element
|
||||
_global_scope['_last_element_name'] = name
|
||||
//Detect if the selector will be generated
|
||||
//by an earlier call of RV-Element
|
||||
if not 'RV-Element' in called-from
|
||||
// Saving accumulated modifiers and blocks
|
||||
element = {}
|
||||
element['block_list'] = _global_scope['_element_block_stack']
|
||||
element['modifier_list'] = _global_scope['_element_modifier_stack']
|
||||
|
||||
//Reseting
|
||||
_global_scope['_element_block_stack'] = ()
|
||||
_global_scope['_element_modifier_stack'] = {}
|
||||
|
||||
//Saving element
|
||||
_global_scope['_selector_blocks_to_generate'][name] = element
|
||||
_global_scope['_last_element_name'] = name
|
||||
|
||||
/*
|
||||
* Generates a CSS class for an element modifier
|
||||
|
Reference in New Issue
Block a user