line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moonshine::Bootstrap::Component; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16034
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
420
|
use Moonshine::Element; |
|
1
|
|
|
|
|
24465
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
419
|
use Moonshine::Magic; |
|
1
|
|
|
|
|
39766
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
330
|
use Moonshine::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
721
|
use Moonshine::Component; |
|
1
|
|
|
|
|
10741
|
|
|
1
|
|
|
|
|
37
|
|
11
|
1
|
|
|
1
|
|
6
|
use Params::Validate qw(:all); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
128
|
|
12
|
1
|
|
|
1
|
|
5
|
use feature qw/switch/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
13
|
1
|
|
|
1
|
|
4
|
no if $] >= 5.017011, warnings => 'experimental::smartmatch'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
extends ("Moonshine::Component"); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
BEGIN { |
20
|
|
|
|
|
|
|
my %grid = ( |
21
|
|
|
|
|
|
|
map { |
22
|
1
|
|
|
1
|
|
632
|
$_ => 0, |
|
3
|
|
|
|
|
35
|
|
23
|
|
|
|
|
|
|
$_ . '_base' => { default => 'col-' . $_ . '-' }, |
24
|
|
|
|
|
|
|
$_ . '_offset' => 0, |
25
|
|
|
|
|
|
|
$_ . '_offset_base' => { default => 'col-' . $_ . '-offset-' }, |
26
|
|
|
|
|
|
|
$_ . '_pull' => 0, |
27
|
|
|
|
|
|
|
$_ . '_pull_base' => { default => 'col-' . $_ . '-pull-' }, |
28
|
|
|
|
|
|
|
$_ . '_push' => 0, |
29
|
|
|
|
|
|
|
$_ . '_push_base' => { default => 'col-' . $_ . '-push-' }, |
30
|
|
|
|
|
|
|
} qw/xs sm md/ |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my %modify_spec = ( |
34
|
|
|
|
|
|
|
( |
35
|
15
|
|
|
|
|
12
|
map { $_ => 0 } |
36
|
|
|
|
|
|
|
qw/row switch lead txt switch_base class_base sizing |
37
|
|
|
|
|
|
|
sizing_base alignment alignment_base active disable |
38
|
|
|
|
|
|
|
justified justified_base container/ |
39
|
|
|
|
|
|
|
), |
40
|
|
|
|
|
|
|
( |
41
|
3
|
|
|
|
|
11
|
map { $_ => { optional => 1, type => ARRAYREF } } |
42
|
|
|
|
|
|
|
qw/before_element after_element children/ |
43
|
|
|
|
|
|
|
), |
44
|
|
|
|
|
|
|
%grid, |
45
|
|
|
|
|
|
|
( |
46
|
1
|
|
|
|
|
3
|
map { $_ . '_base' => { default => $_ } } |
|
4
|
|
|
|
|
20
|
|
47
|
|
|
|
|
|
|
qw/active lead row container/ |
48
|
|
|
|
|
|
|
), |
49
|
|
|
|
|
|
|
disable_base => { default => 'disabled' }, |
50
|
|
|
|
|
|
|
txt_base => { default => 'text-' }, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
has( |
53
|
|
|
|
|
|
|
modifier_spec => sub { |
54
|
|
|
|
|
|
|
return \%modify_spec; |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
grid_spec => sub { |
57
|
|
|
|
|
|
|
return \%grid |
58
|
|
|
|
|
|
|
} |
59
|
1
|
|
|
|
|
29
|
); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub modify { |
63
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
64
|
0
|
|
|
|
|
|
my ( $base, $build, $modify ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
for (qw/class_base/) { |
67
|
0
|
0
|
|
|
|
|
if ( defined $modify->{$_} ) { |
68
|
0
|
|
|
|
|
|
$base->{class} = prepend_str( $modify->{ $_ }, $base->{class} ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my @grid_keys = map { $_ } |
73
|
0
|
|
|
|
|
|
grep { $_ !~ m{_base$}xms } sort keys %{ $self->grid_spec }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
for ( @grid_keys, qw/switch sizing alignment txt/ ) { |
75
|
0
|
0
|
|
|
|
|
if ( my $append_class = join_class( $modify->{ $_ . '_base' }, $modify->{$_} ) ) { |
76
|
0
|
|
|
|
|
|
$base->{class} = prepend_str( $append_class, $base->{class} ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
for (qw/active justified disable row lead/) { |
81
|
0
|
0
|
|
|
|
|
if ( defined $modify->{$_} ) { |
82
|
0
|
|
|
|
|
|
$base->{class} = prepend_str( $modify->{ $_ . '_base' }, $base->{class} ); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
if ( my $container = $modify->{container} ) { |
87
|
0
|
|
|
|
|
|
my $cb = $modify->{container_base}; |
88
|
0
|
0
|
|
|
|
|
my $container_class = ( $container =~ m/^\D/ ) |
89
|
|
|
|
|
|
|
? sprintf "%s-%s", $cb, $container |
90
|
|
|
|
|
|
|
: $cb; |
91
|
0
|
|
|
|
|
|
$base->{class} = prepend_str( $container_class, $base->{class} ); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $base, $build, $modify; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |