@volverjs/style 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -322,6 +322,10 @@ $-state-suffixes: (
|
|
|
322
322
|
|
|
323
323
|
@if meta.type-of(map.get($map, $key)) == 'map' {
|
|
324
324
|
@each $element, $value in map.get($map, $key) {
|
|
325
|
+
// `$block` is the block selector alone, threaded down unchanged
|
|
326
|
+
// from `spread-map-into-bem`: what a state or a transition
|
|
327
|
+
// expands to travels in `$modifier` instead. Passing a selector
|
|
328
|
+
// list here would suffix its last entry alone.
|
|
325
329
|
$selector: $block + '__' + $element;
|
|
326
330
|
|
|
327
331
|
// combinator
|
|
@@ -354,6 +358,10 @@ $-state-suffixes: (
|
|
|
354
358
|
|
|
355
359
|
@if $alias {
|
|
356
360
|
@if $modifier {
|
|
361
|
+
// One entry per selector of the modifier, in the same
|
|
362
|
+
// order as `$selector` above: `spread-map-into-states`
|
|
363
|
+
// pairs the two lists by index, so an `_alias` has to be
|
|
364
|
+
// a single selector, not a list of them.
|
|
357
365
|
$aliases: ();
|
|
358
366
|
|
|
359
367
|
@each $item in selector.parse($modifier) {
|
|
@@ -442,15 +450,35 @@ $-state-suffixes: (
|
|
|
442
450
|
@each $state, $value in map.get($map, $key) {
|
|
443
451
|
@if list.index($-valid-states, $state) {
|
|
444
452
|
$selectors: ();
|
|
453
|
+
$block-items: selector.parse($block);
|
|
454
|
+
$alias-items: ();
|
|
455
|
+
|
|
456
|
+
// `$block` and `$alias` are built side by side by the caller,
|
|
457
|
+
// one entry per selector of the parent, so they are walked by
|
|
458
|
+
// index: the alias belongs to the block item it was nested
|
|
459
|
+
// under. Suffixing the list as a whole would reach its last
|
|
460
|
+
// entry alone and leave the ones before it in the rule bare.
|
|
461
|
+
@if $alias {
|
|
462
|
+
$alias-items: selector.parse($alias);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
$i: 0;
|
|
466
|
+
|
|
467
|
+
@each $block-item in $block-items {
|
|
468
|
+
$i: $i + 1;
|
|
469
|
+
$alias-item: null;
|
|
470
|
+
|
|
471
|
+
@if $i <= list.length($alias-items) {
|
|
472
|
+
$alias-item: list.nth($alias-items, $i);
|
|
473
|
+
}
|
|
445
474
|
|
|
446
|
-
@each $block-item in selector.parse($block) {
|
|
447
475
|
$selectors: list.join(
|
|
448
476
|
$selectors,
|
|
449
477
|
('#{$modifier}#{$block-item}--#{$state}', '#{$modifier}#{$block-item}.#{$state}')
|
|
450
478
|
);
|
|
451
479
|
|
|
452
|
-
@if $alias {
|
|
453
|
-
$selectors: list.join($selectors, '#{$modifier}#{$alias}.#{$state}');
|
|
480
|
+
@if $alias-item {
|
|
481
|
+
$selectors: list.join($selectors, '#{$modifier}#{$alias-item}.#{$state}');
|
|
454
482
|
}
|
|
455
483
|
|
|
456
484
|
// Special state handling - use function to get updated selectors
|
|
@@ -458,7 +486,7 @@ $-state-suffixes: (
|
|
|
458
486
|
$state: $state,
|
|
459
487
|
$block-item: $block-item,
|
|
460
488
|
$modifier: $modifier,
|
|
461
|
-
$alias: $alias,
|
|
489
|
+
$alias: $alias-item,
|
|
462
490
|
$selectors: $selectors
|
|
463
491
|
);
|
|
464
492
|
}
|
|
@@ -558,6 +586,27 @@ $-state-suffixes: (
|
|
|
558
586
|
$block: &;
|
|
559
587
|
}
|
|
560
588
|
|
|
589
|
+
// A state and a transition hand their whole selector list down as the
|
|
590
|
+
// modifier, so the block is compounded onto each of its entries: written
|
|
591
|
+
// as one interpolation it would reach the last entry alone and leave the
|
|
592
|
+
// ones before it in the rule unscoped.
|
|
593
|
+
$selector: '#{$modifier}#{$block}';
|
|
594
|
+
|
|
595
|
+
@if $modifier and $modifier != '' and $block {
|
|
596
|
+
$selectors: ();
|
|
597
|
+
|
|
598
|
+
@each $modifier-item in selector.parse($modifier) {
|
|
599
|
+
@each $block-item in selector.parse($block) {
|
|
600
|
+
$selectors: list.join(
|
|
601
|
+
$selectors,
|
|
602
|
+
'#{$modifier-item}#{$block-item}'
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
$selector: list-to-string($selectors);
|
|
608
|
+
}
|
|
609
|
+
|
|
561
610
|
@if meta.type-of(map.get($map, $key)) == 'map' {
|
|
562
611
|
@each $breakpoint, $value in map.get($map, $key) {
|
|
563
612
|
@if string.index($breakpoint, '-') {
|
|
@@ -566,7 +615,7 @@ $-state-suffixes: (
|
|
|
566
615
|
|
|
567
616
|
@if map.has-key($bps, $bp) {
|
|
568
617
|
@if $operator == 'up' {
|
|
569
|
-
@include wrap-with-where($selector:
|
|
618
|
+
@include wrap-with-where($selector: $selector, $enabled: $zero-specificity) {
|
|
570
619
|
@include media-breakpoint-up($bp, $bps) {
|
|
571
620
|
@include spread-map-into-attrs(
|
|
572
621
|
$original: $original,
|
|
@@ -581,7 +630,7 @@ $-state-suffixes: (
|
|
|
581
630
|
}
|
|
582
631
|
|
|
583
632
|
@if $operator == 'down' {
|
|
584
|
-
@include wrap-with-where($selector:
|
|
633
|
+
@include wrap-with-where($selector: $selector, $enabled: $zero-specificity) {
|
|
585
634
|
@include media-breakpoint-down($bp, $bps) {
|
|
586
635
|
@include spread-map-into-attrs(
|
|
587
636
|
$original: $original,
|
|
@@ -596,7 +645,7 @@ $-state-suffixes: (
|
|
|
596
645
|
}
|
|
597
646
|
|
|
598
647
|
@if map.has-key($bps, $operator) {
|
|
599
|
-
@include wrap-with-where($selector:
|
|
648
|
+
@include wrap-with-where($selector: $selector, $enabled: $zero-specificity) {
|
|
600
649
|
@include media-breakpoint-between($operator, $bp, $bps) {
|
|
601
650
|
@include spread-map-into-attrs(
|
|
602
651
|
$original: $original,
|
|
@@ -611,7 +660,7 @@ $-state-suffixes: (
|
|
|
611
660
|
}
|
|
612
661
|
}
|
|
613
662
|
} @else if map.has-key($bps, $breakpoint) {
|
|
614
|
-
@include wrap-with-where($selector:
|
|
663
|
+
@include wrap-with-where($selector: $selector, $enabled: $zero-specificity) {
|
|
615
664
|
@include media-breakpoint-up($breakpoint, $bps) {
|
|
616
665
|
@include spread-map-into-attrs(
|
|
617
666
|
$original: $original,
|
|
@@ -765,6 +814,11 @@ $-state-suffixes: (
|
|
|
765
814
|
);
|
|
766
815
|
$alias: map.get($map, 'element', $element, '_alias');
|
|
767
816
|
|
|
817
|
+
// The alias is a second selector for the same element, not a
|
|
818
|
+
// descendant of the first, so the list is glued with a comma
|
|
819
|
+
// before it is emitted: interpolating it would join the two
|
|
820
|
+
// with a space and compile them to one selector that matches
|
|
821
|
+
// a `.vv-input-text` nested inside its own element.
|
|
768
822
|
@if $alias {
|
|
769
823
|
$element-selector: list.append(
|
|
770
824
|
$element-selector,
|
|
@@ -773,7 +827,7 @@ $-state-suffixes: (
|
|
|
773
827
|
}
|
|
774
828
|
|
|
775
829
|
@include wrap-with-where(
|
|
776
|
-
$selector: $element-selector,
|
|
830
|
+
$selector: list-to-string($element-selector),
|
|
777
831
|
$enabled: $zero-specificity
|
|
778
832
|
) {
|
|
779
833
|
@extend %#{$block}-state-#{$state}__#{$element} !optional;
|
|
@@ -794,7 +848,7 @@ $-state-suffixes: (
|
|
|
794
848
|
}
|
|
795
849
|
|
|
796
850
|
@include wrap-with-where(
|
|
797
|
-
$selector: $element-selector-state,
|
|
851
|
+
$selector: list-to-string($element-selector-state),
|
|
798
852
|
$enabled: $zero-specificity
|
|
799
853
|
) {
|
|
800
854
|
@extend %#{$block}-state-#{$state}-element-#{$element}--#{$element-state}
|
|
@@ -816,7 +870,7 @@ $-state-suffixes: (
|
|
|
816
870
|
}
|
|
817
871
|
|
|
818
872
|
@include wrap-with-where(
|
|
819
|
-
$selector: $element-selector-pseudo,
|
|
873
|
+
$selector: list-to-string($element-selector-pseudo),
|
|
820
874
|
$enabled: $zero-specificity
|
|
821
875
|
) {
|
|
822
876
|
@extend %#{$block}-state-#{$state}-element-#{$element}--#{$pseudo}
|