| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Tags::HTML::Container; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
240127
|
use base qw(Tags::HTML); |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
4571
|
|
|
4
|
8
|
|
|
8
|
|
89444
|
use strict; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
238
|
|
|
5
|
8
|
|
|
8
|
|
34
|
use warnings; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
2555
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
44
|
use Class::Utils qw(set_params split_params); |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
522
|
|
|
8
|
8
|
|
|
8
|
|
43
|
use Error::Pure qw(err); |
|
|
8
|
|
|
|
|
12
|
|
|
|
8
|
|
|
|
|
420
|
|
|
9
|
8
|
|
|
8
|
|
44
|
use List::Util 1.33 qw(none); |
|
|
8
|
|
|
|
|
182
|
|
|
|
8
|
|
|
|
|
546
|
|
|
10
|
8
|
|
|
8
|
|
4958
|
use Mo::utils 0.01 qw(check_required); |
|
|
8
|
|
|
|
|
23598
|
|
|
|
8
|
|
|
|
|
199
|
|
|
11
|
8
|
|
|
8
|
|
6220
|
use Mo::utils::CSS 0.07 qw(check_css_class check_css_unit); |
|
|
8
|
|
|
|
|
87102
|
|
|
|
8
|
|
|
|
|
199
|
|
|
12
|
8
|
|
|
8
|
|
897
|
use Readonly; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
7424
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Readonly::Array our @HORIZ_ALIGN => qw(center left right); |
|
15
|
|
|
|
|
|
|
Readonly::Array our @VERT_ALIGN => qw(base bottom center fit top); |
|
16
|
|
|
|
|
|
|
Readonly::Hash our %VERT_CONV => ( |
|
17
|
|
|
|
|
|
|
'base' => 'baseline', |
|
18
|
|
|
|
|
|
|
'bottom' => 'flex-end', |
|
19
|
|
|
|
|
|
|
'center' => 'center', |
|
20
|
|
|
|
|
|
|
'fit' => 'stretch', |
|
21
|
|
|
|
|
|
|
'top' => 'flex-start', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = 0.10; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
|
27
|
36
|
|
|
36
|
1
|
1848707
|
my ($class, @params) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Create object. |
|
30
|
36
|
|
|
|
|
218
|
my ($object_params_ar, $other_params_ar) = split_params( |
|
31
|
|
|
|
|
|
|
['css_container', 'css_inner', 'height', 'horiz_align', |
|
32
|
|
|
|
|
|
|
'padding', 'vert_align'], @params); |
|
33
|
36
|
|
|
|
|
1052
|
my $self = $class->SUPER::new(@{$other_params_ar}); |
|
|
36
|
|
|
|
|
192
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Container align. |
|
36
|
32
|
|
|
|
|
1172
|
$self->{'horiz_align'} = 'center'; |
|
37
|
32
|
|
|
|
|
93
|
$self->{'vert_align'} = 'center'; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# CSS classes. |
|
40
|
32
|
|
|
|
|
76
|
$self->{'css_container'} = 'container'; |
|
41
|
32
|
|
|
|
|
112
|
$self->{'css_inner'} = 'inner'; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Height. |
|
44
|
32
|
|
|
|
|
80
|
$self->{'height'} = '100vh'; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Padding. |
|
47
|
32
|
|
|
|
|
88
|
$self->{'padding'} = undef; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Process params. |
|
50
|
32
|
|
|
|
|
69
|
set_params($self, @{$object_params_ar}); |
|
|
32
|
|
|
|
|
111
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
32
|
|
|
|
|
392
|
check_required($self, 'horiz_align'); |
|
53
|
31
|
100
|
|
36
|
|
486
|
if (none { $self->{'horiz_align'} eq $_ } @HORIZ_ALIGN) { |
|
|
36
|
|
|
|
|
448
|
|
|
54
|
|
|
|
|
|
|
err "Parameter 'horiz_align' have a bad value.", |
|
55
|
1
|
|
|
|
|
10
|
'Value', $self->{'horiz_align'}, |
|
56
|
|
|
|
|
|
|
; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
30
|
|
|
|
|
414
|
check_required($self, 'vert_align'); |
|
60
|
29
|
100
|
|
88
|
|
281
|
if (none { $self->{'vert_align'} eq $_ } @VERT_ALIGN) { |
|
|
88
|
|
|
|
|
607
|
|
|
61
|
|
|
|
|
|
|
err "Parameter 'vert_align' have a bad value.", |
|
62
|
1
|
|
|
|
|
9
|
'Value', $self->{'vert_align'}, |
|
63
|
|
|
|
|
|
|
; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
28
|
|
|
|
|
361
|
check_css_class($self, 'css_container'); |
|
67
|
26
|
|
|
|
|
614
|
check_css_class($self, 'css_inner'); |
|
68
|
|
|
|
|
|
|
|
|
69
|
24
|
|
|
|
|
408
|
check_css_unit($self, 'height'); |
|
70
|
21
|
|
|
|
|
2607
|
check_css_unit($self, 'padding'); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Object. |
|
73
|
21
|
|
|
|
|
592
|
return $self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _cleanup { |
|
77
|
2
|
|
|
2
|
|
35
|
my ($self, $cleanup_cb) = @_; |
|
78
|
|
|
|
|
|
|
|
|
79
|
2
|
100
|
|
|
|
8
|
if (defined $cleanup_cb) { |
|
80
|
1
|
|
|
|
|
2
|
$cleanup_cb->($self); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
8
|
return; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _init { |
|
87
|
2
|
|
|
2
|
|
23
|
my ($self, $init_cb) = @_; |
|
88
|
|
|
|
|
|
|
|
|
89
|
2
|
100
|
|
|
|
5
|
if (defined $init_cb) { |
|
90
|
1
|
|
|
|
|
3
|
$init_cb->($self); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
2
|
|
|
|
|
4
|
return; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _prepare { |
|
97
|
2
|
|
|
2
|
|
37
|
my ($self, $prepare_cb) = @_; |
|
98
|
|
|
|
|
|
|
|
|
99
|
2
|
100
|
|
|
|
8
|
if (defined $prepare_cb) { |
|
100
|
1
|
|
|
|
|
6
|
$prepare_cb->($self); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
2
|
|
|
|
|
7
|
return; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub _process { |
|
107
|
2
|
|
|
2
|
|
57
|
my ($self, $tags_cb) = @_; |
|
108
|
|
|
|
|
|
|
|
|
109
|
2
|
100
|
|
|
|
9
|
if (! defined $tags_cb) { |
|
110
|
1
|
|
|
|
|
6
|
err "There is no contained callback with Tags code."; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
$self->{'tags'}->put( |
|
114
|
|
|
|
|
|
|
['b', 'div'], |
|
115
|
|
|
|
|
|
|
['a', 'class', $self->{'css_container'}], |
|
116
|
|
|
|
|
|
|
['b', 'div'], |
|
117
|
1
|
|
|
|
|
34
|
['a', 'class', $self->{'css_inner'}], |
|
118
|
|
|
|
|
|
|
); |
|
119
|
1
|
|
|
|
|
171
|
$tags_cb->($self); |
|
120
|
1
|
|
|
|
|
48
|
$self->{'tags'}->put( |
|
121
|
|
|
|
|
|
|
['e', 'div'], |
|
122
|
|
|
|
|
|
|
['e', 'div'], |
|
123
|
|
|
|
|
|
|
); |
|
124
|
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
86
|
return; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub _process_css { |
|
129
|
9
|
|
|
9
|
|
162
|
my ($self, $css_cb) = @_; |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$self->{'css'}->put( |
|
132
|
|
|
|
|
|
|
['s', '.'.$self->{'css_container'}], |
|
133
|
|
|
|
|
|
|
['d', 'display', 'flex'], |
|
134
|
|
|
|
|
|
|
['d', 'align-items', $VERT_CONV{$self->{'vert_align'}}], |
|
135
|
|
|
|
|
|
|
['d', 'justify-content', $self->{'horiz_align'}], |
|
136
|
|
|
|
|
|
|
['d', 'height', $self->{'height'}], |
|
137
|
|
|
|
|
|
|
defined $self->{'padding'} ? ( |
|
138
|
9
|
100
|
|
|
|
122
|
['d', 'padding', $self->{'padding'}], |
|
139
|
|
|
|
|
|
|
) : (), |
|
140
|
|
|
|
|
|
|
['e'], |
|
141
|
|
|
|
|
|
|
); |
|
142
|
9
|
100
|
|
|
|
2319
|
if (defined $css_cb) { |
|
143
|
1
|
|
|
|
|
4
|
$css_cb->($self); |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
9
|
|
|
|
|
135
|
return; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
__END__ |