Mayor upgrade: modifers are squashed when any parent is nested
This commit is contained in:
parent
514b300916
commit
150b7c1f2c
@ -74,13 +74,21 @@ is_nested_in(parent_name)
|
||||
not_nested_in(parent_name)
|
||||
return !(parent_name in called-from)
|
||||
|
||||
RV-Level(name, name_delimiter, allowed_parent_levels, selector_callback)
|
||||
is_any_parent_nested()
|
||||
//RV-Level RV-Element--modifier RV-Element RV-Block--modifier RV-BreakPoint--horizontal RV-Block--modifier RV-Fan--horizontal RV-Block
|
||||
for i in (length(called-from)...0)
|
||||
i = i - 1
|
||||
if i != index(called-from, called-from[i])
|
||||
return true
|
||||
return false
|
||||
|
||||
RV-Level(name, name_delimiter, allowed_parent_levels, selector_callback, squash_if_parent_nested=false)
|
||||
if name == null
|
||||
name = auto_name(name_delimiter)
|
||||
not_in_parent = true
|
||||
for parent_level in allowed_parent_levels
|
||||
not_in_parent = not_in_parent && not_nested_in(parent_level)
|
||||
if is_nested_in('RV-Squash') || not_in_parent
|
||||
if not_in_parent || is_nested_in('RV-Squash')
|
||||
{block}
|
||||
else if is_nested()
|
||||
store_alias(name)
|
||||
@ -91,6 +99,9 @@ RV-Level(name, name_delimiter, allowed_parent_levels, selector_callback)
|
||||
name = lookup_alias(name)
|
||||
apply_alias_stack(name)
|
||||
|
||||
if squash_if_parent_nested && is_any_parent_nested()
|
||||
{block}
|
||||
else
|
||||
{selector_callback(name)}
|
||||
{block}
|
||||
|
||||
@ -116,11 +127,11 @@ RV-Element(name=null)
|
||||
|
||||
|
||||
RV-Element--modifier(name=null)
|
||||
+RV-Level(name, '--', ('RV-Element'), @(name){return '&--' + name})
|
||||
+RV-Level(name, '--', ('RV-Element'), @(name){return '&--' + name}, true)
|
||||
{block}
|
||||
|
||||
RV-Block--modifier(name=null)
|
||||
+RV-Level(name, '--', ('RV-Block'), @(name){return '&--' + name})
|
||||
+RV-Level(name, '--', ('RV-Block'), @(name){return '&--' + name}, true)
|
||||
{block}
|
||||
|
||||
RV-Squash()
|
||||
|
Loading…
Reference in New Issue
Block a user