s
This commit is contained in:
parent
d6c3cea86c
commit
e37315f90f
@ -30,25 +30,8 @@ RV-Block(name)
|
||||
* according to BEM.
|
||||
*/
|
||||
RV-Block__Modifier(name)
|
||||
// Determining if we are inside a block or after a block
|
||||
call_stack = _call_stack_till_first_block()
|
||||
if 'RV-Block' in call_stack
|
||||
// We are called inside a block
|
||||
push(_block_modifier_block_stack, @block{block})
|
||||
attach('RV-Block', unquote('--' + name), block)
|
||||
|
||||
//Detect if the selector will be generated
|
||||
//by an earlier call of RV-Element
|
||||
if not 'RV-Block__Modifier' in call_stack
|
||||
block_list = _pop_stack(_block_modifier_block_stack)
|
||||
_block_modifier_building_lane[name] = {
|
||||
block_list: block_list
|
||||
}
|
||||
else
|
||||
// We are not called inside a block
|
||||
// Is there a block to attach to
|
||||
if _last_block_name != null
|
||||
.{_last_block_name}--{name}
|
||||
{block}
|
||||
|
||||
/*
|
||||
* Generates an CSS class for an element
|
||||
@ -57,6 +40,7 @@ RV-Block__Modifier(name)
|
||||
*/
|
||||
RV-Element(name)
|
||||
attach('RV-Block', unquote('__' + name), block)
|
||||
tow(name, block)
|
||||
|
||||
|
||||
|
||||
@ -70,36 +54,5 @@ RV-Element(name)
|
||||
* from RV-Element
|
||||
*/
|
||||
RV-Element__Modifier(name)
|
||||
counter = 0
|
||||
for fn in called-from
|
||||
if fn is 'RV-Element'
|
||||
counter += 1
|
||||
|
||||
if counter <= 1
|
||||
element_modifier_block_stack = _global_scope['_element_modifier_block_stack']
|
||||
append(element_modifier_block_stack, block)
|
||||
_global_scope['_element_modifier_block_stack'] = element_modifier_block_stack
|
||||
|
||||
//Is this modifier beeing included by another modifier
|
||||
if not 'RV-Element__Modifier' in called-from
|
||||
//No
|
||||
//Is this modifier beeing called in in- or postfix
|
||||
if not 'RV-Element' in called-from
|
||||
//Yes
|
||||
last_element_name = _global_scope['_last_element_name']
|
||||
|
||||
//Accesing the last generated element and appending the modifier
|
||||
element = _global_scope['_selector_blocks_to_generate'][last_element_name]
|
||||
modifier_list = element['modifier_list']
|
||||
modifier_list[name] = _global_scope['_element_modifier_block_stack']
|
||||
element['modifier_list'] = modifier_list
|
||||
|
||||
_global_scope['_selector_blocks_to_generate'][last_element_name] = element
|
||||
else
|
||||
//No
|
||||
_global_scope['_element_modifier_stack'][name] = _global_scope['_element_modifier_block_stack']
|
||||
|
||||
_global_scope['_element_modifier_block_stack'] = ()
|
||||
else
|
||||
p('wurstwasser')
|
||||
attach('RV-Element', '--' + name, block)
|
||||
|
@ -1,6 +1,7 @@
|
||||
_lanes = {}
|
||||
_stacks = {}
|
||||
_last_name = {}
|
||||
_being_towed = {}
|
||||
|
||||
_reset_last_name(block_type=null)
|
||||
if block_type == null
|
||||
@ -103,14 +104,14 @@ _pop_lane(block_type=null)
|
||||
return {}
|
||||
|
||||
attach(parent_type, suffix, block)
|
||||
_being_towed[_current_block_type()] = true
|
||||
call_stack = _call_stack_till_first(parent_type)
|
||||
if parent_type in call_stack
|
||||
// We are called inside a block
|
||||
_push_onto_stack(block)
|
||||
//Detect if the selector will be generated
|
||||
//by an earlier call of RV-Element
|
||||
_current_block = _current_block_type()
|
||||
if not _curent_block in (call_stack)
|
||||
if not _current_block_type() in (call_stack)
|
||||
block_list = _pop_stack()
|
||||
_put_into_lane(suffix, block_list, parent_type)
|
||||
else
|
||||
@ -118,21 +119,28 @@ attach(parent_type, suffix, block)
|
||||
// Is there a block to attach to
|
||||
_last_parent_name = _get_last_name(parent_type)
|
||||
if _last_parent_name != null
|
||||
& .{_last_parent_name}{suffix}
|
||||
&.{_last_parent_name}{suffix}
|
||||
--attach 'blubb'
|
||||
{block}
|
||||
|
||||
tow(name, block, block_type=null)
|
||||
if block_type == null
|
||||
if block_type == null // Determining if we are inside a block or after a block
|
||||
block_type = called-from[0]
|
||||
|
||||
.{name}
|
||||
if not block_type in _being_towed
|
||||
prefix = '.'+name
|
||||
{prefix}
|
||||
{block}
|
||||
else
|
||||
prefix = ''
|
||||
|
||||
{prefix}
|
||||
if block_type in _lanes
|
||||
for suffix, block_list in _pop_lane(block_type)
|
||||
& .{name}{suffix}
|
||||
for b in block_list
|
||||
{b}
|
||||
p('name' name 'suffix' suffix)
|
||||
& {name}{suffix}
|
||||
for current_block in block_list
|
||||
{current_block}
|
||||
|
||||
_set_last_name(name, block_type)
|
||||
|
||||
|
@ -133,6 +133,9 @@ RV-Fan()
|
||||
color black
|
||||
--blubb wasser
|
||||
|
||||
+RV-Element__Modifier('Wurst')
|
||||
--wurst 'wurst'
|
||||
|
||||
+RV-Element('Affter')
|
||||
--hasi 'lein'
|
||||
|
||||
|
@ -318,32 +318,23 @@
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
.Fan {
|
||||
--base-height: 280px;
|
||||
--base-width: 320px;
|
||||
display: flex;
|
||||
.Fächer {
|
||||
--wurst: yeet;
|
||||
}
|
||||
.Fan.Fan--fullWidth {
|
||||
flex-flow: row wrap;
|
||||
.Fächer BLubb--Wurst {
|
||||
--wurst: 'wurst';
|
||||
}
|
||||
.Fan.Fan--vertical {
|
||||
flex-direction: column;
|
||||
width: max-content;
|
||||
.Fächer Fächer__BLubb {
|
||||
color: #000;
|
||||
--blubb: wasser;
|
||||
}
|
||||
.Fan.Fan--horizontal {
|
||||
flex-direction: row;
|
||||
.Fächer__Affter {
|
||||
--attach: 'blubb';
|
||||
--hasi: 'lein';
|
||||
}
|
||||
.Fan.Fan--auto {
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
.wurst .Fächer {
|
||||
display: flex;
|
||||
}
|
||||
.wurst .Fächer .wurst .Fächer__Base--wurst {
|
||||
--wurst: wasser;
|
||||
}
|
||||
.wurst .wurst__Base--wurst {
|
||||
--wurst: wasser;
|
||||
.Fächer--Mafter {
|
||||
--attach: 'blubb';
|
||||
--blubb: 'bernd';
|
||||
}
|
||||
.RV-FlexGrid__Container {
|
||||
display: grid;
|
||||
|
Loading…
Reference in New Issue
Block a user