line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::Container; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
137166
|
use base qw(Tags::HTML); |
|
5
|
|
|
|
|
42
|
|
|
5
|
|
|
|
|
2693
|
|
4
|
5
|
|
|
5
|
|
39638
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
94
|
|
5
|
5
|
|
|
5
|
|
1684
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
153
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
29
|
use Class::Utils qw(set_params split_params); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
1848
|
|
8
|
5
|
|
|
5
|
|
50
|
use Error::Pure qw(err); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
169
|
|
9
|
5
|
|
|
5
|
|
26
|
use List::Util qw(none); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
257
|
|
10
|
5
|
|
|
5
|
|
30
|
use Readonly; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
2864
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Readonly::Array our @HORIZ_ALIGN => qw(center left right); |
13
|
|
|
|
|
|
|
Readonly::Array our @VERT_ALIGN => qw(base bottom center fit top); |
14
|
|
|
|
|
|
|
Readonly::Hash our %VERT_CONV => ( |
15
|
|
|
|
|
|
|
'base' => 'baseline', |
16
|
|
|
|
|
|
|
'bottom' => 'flex-end', |
17
|
|
|
|
|
|
|
'center' => 'center', |
18
|
|
|
|
|
|
|
'fit' => 'stretch', |
19
|
|
|
|
|
|
|
'top' => 'flex-start', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = 0.03; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
20
|
|
|
20
|
1
|
24838
|
my ($class, @params) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create object. |
28
|
20
|
|
|
|
|
91
|
my ($object_params_ar, $other_params_ar) = split_params( |
29
|
|
|
|
|
|
|
['css_container', 'css_inner', 'height', 'horiz_align', 'vert_align'], @params); |
30
|
20
|
|
|
|
|
545
|
my $self = $class->SUPER::new(@{$other_params_ar}); |
|
20
|
|
|
|
|
72
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Container align. |
33
|
18
|
|
|
|
|
491
|
$self->{'horiz_align'} = 'center'; |
34
|
18
|
|
|
|
|
36
|
$self->{'vert_align'} = 'center'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# CSS classes. |
37
|
18
|
|
|
|
|
37
|
$self->{'css_container'} = 'container'; |
38
|
18
|
|
|
|
|
31
|
$self->{'css_inner'} = 'inner'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Height. |
41
|
18
|
|
|
|
|
47
|
$self->{'height'} = '100vh'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Process params. |
44
|
18
|
|
|
|
|
31
|
set_params($self, @{$object_params_ar}); |
|
18
|
|
|
|
|
50
|
|
45
|
|
|
|
|
|
|
|
46
|
18
|
100
|
|
|
|
225
|
if (! defined $self->{'horiz_align'}) { |
47
|
1
|
|
|
|
|
6
|
err "Parameter 'horiz_align' is required."; |
48
|
|
|
|
|
|
|
} |
49
|
17
|
100
|
|
22
|
|
99
|
if (none { $self->{'horiz_align'} eq $_ } @HORIZ_ALIGN) { |
|
22
|
|
|
|
|
366
|
|
50
|
|
|
|
|
|
|
err "Parameter 'horiz_align' have a bad value.", |
51
|
1
|
|
|
|
|
5
|
'Value', $self->{'horiz_align'}, |
52
|
|
|
|
|
|
|
; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
16
|
100
|
|
|
|
71
|
if (! defined $self->{'vert_align'}) { |
56
|
1
|
|
|
|
|
4
|
err "Parameter 'vert_align' is required."; |
57
|
|
|
|
|
|
|
} |
58
|
15
|
100
|
|
47
|
|
55
|
if (none { $self->{'vert_align'} eq $_ } @VERT_ALIGN) { |
|
47
|
|
|
|
|
404
|
|
59
|
|
|
|
|
|
|
err "Parameter 'vert_align' have a bad value.", |
60
|
1
|
|
|
|
|
11
|
'Value', $self->{'vert_align'}, |
61
|
|
|
|
|
|
|
; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Object. |
65
|
14
|
|
|
|
|
119
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _process { |
69
|
2
|
|
|
2
|
|
34
|
my ($self, $tags_cb) = @_; |
70
|
|
|
|
|
|
|
|
71
|
2
|
100
|
|
|
|
7
|
if (! defined $tags_cb) { |
72
|
1
|
|
|
|
|
4
|
err "There is no contained callback with Tags code."; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$self->{'tags'}->put( |
76
|
|
|
|
|
|
|
['b', 'div'], |
77
|
|
|
|
|
|
|
['a', 'class', $self->{'css_container'}], |
78
|
|
|
|
|
|
|
['b', 'div'], |
79
|
1
|
|
|
|
|
13
|
['a', 'class', $self->{'css_inner'}], |
80
|
|
|
|
|
|
|
); |
81
|
1
|
|
|
|
|
162
|
$tags_cb->($self); |
82
|
1
|
|
|
|
|
47
|
$self->{'tags'}->put( |
83
|
|
|
|
|
|
|
['e', 'div'], |
84
|
|
|
|
|
|
|
['e', 'div'], |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
79
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _process_css { |
91
|
7
|
|
|
7
|
|
73
|
my $self = shift; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$self->{'css'}->put( |
94
|
|
|
|
|
|
|
['s', '.'.$self->{'css_container'}], |
95
|
|
|
|
|
|
|
['d', 'display', 'flex'], |
96
|
|
|
|
|
|
|
['d', 'align-items', $VERT_CONV{$self->{'vert_align'}}], |
97
|
|
|
|
|
|
|
['d', 'justify-content', $self->{'horiz_align'}], |
98
|
7
|
|
|
|
|
45
|
['d', 'height', $self->{'height'}], |
99
|
|
|
|
|
|
|
['e'], |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
7
|
|
|
|
|
1195
|
return; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |