line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::Container; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
129984
|
use base qw(Tags::HTML); |
|
5
|
|
|
|
|
37
|
|
|
5
|
|
|
|
|
2522
|
|
4
|
5
|
|
|
5
|
|
38262
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
99
|
|
5
|
5
|
|
|
5
|
|
1612
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
177
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
27
|
use Class::Utils qw(set_params split_params); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1833
|
|
8
|
5
|
|
|
5
|
|
40
|
use Error::Pure qw(err); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
169
|
|
9
|
5
|
|
|
5
|
|
25
|
use List::Util qw(none); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
265
|
|
10
|
5
|
|
|
5
|
|
30
|
use Readonly; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
2788
|
|
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.02; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
20
|
|
|
20
|
1
|
23967
|
my ($class, @params) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create object. |
28
|
20
|
|
|
|
|
87
|
my ($object_params_ar, $other_params_ar) = split_params( |
29
|
|
|
|
|
|
|
['css_container', 'css_inner', 'horiz_align', 'vert_align'], @params); |
30
|
20
|
|
|
|
|
547
|
my $self = $class->SUPER::new(@{$other_params_ar}); |
|
20
|
|
|
|
|
69
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Container align. |
33
|
18
|
|
|
|
|
543
|
$self->{'horiz_align'} = 'center'; |
34
|
18
|
|
|
|
|
37
|
$self->{'vert_align'} = 'center'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# CSS classes. |
37
|
18
|
|
|
|
|
37
|
$self->{'css_container'} = 'container'; |
38
|
18
|
|
|
|
|
35
|
$self->{'css_inner'} = 'inner'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Process params. |
41
|
18
|
|
|
|
|
28
|
set_params($self, @{$object_params_ar}); |
|
18
|
|
|
|
|
51
|
|
42
|
|
|
|
|
|
|
|
43
|
18
|
100
|
|
|
|
180
|
if (! defined $self->{'horiz_align'}) { |
44
|
1
|
|
|
|
|
5
|
err "Parameter 'horiz_align' is required."; |
45
|
|
|
|
|
|
|
} |
46
|
17
|
100
|
|
22
|
|
157
|
if (none { $self->{'horiz_align'} eq $_ } @HORIZ_ALIGN) { |
|
22
|
|
|
|
|
372
|
|
47
|
|
|
|
|
|
|
err "Parameter 'horiz_align' have a bad value.", |
48
|
1
|
|
|
|
|
4
|
'Value', $self->{'horiz_align'}, |
49
|
|
|
|
|
|
|
; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
16
|
100
|
|
|
|
86
|
if (! defined $self->{'vert_align'}) { |
53
|
1
|
|
|
|
|
4
|
err "Parameter 'vert_align' is required."; |
54
|
|
|
|
|
|
|
} |
55
|
15
|
100
|
|
47
|
|
61
|
if (none { $self->{'vert_align'} eq $_ } @VERT_ALIGN) { |
|
47
|
|
|
|
|
407
|
|
56
|
|
|
|
|
|
|
err "Parameter 'vert_align' have a bad value.", |
57
|
1
|
|
|
|
|
5
|
'Value', $self->{'vert_align'}, |
58
|
|
|
|
|
|
|
; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Object. |
62
|
14
|
|
|
|
|
90
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _process { |
66
|
2
|
|
|
2
|
|
29
|
my ($self, $tags_cb) = @_; |
67
|
|
|
|
|
|
|
|
68
|
2
|
100
|
|
|
|
5
|
if (! defined $tags_cb) { |
69
|
1
|
|
|
|
|
4
|
err "There is no contained callback with Tags code."; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$self->{'tags'}->put( |
73
|
|
|
|
|
|
|
['b', 'div'], |
74
|
|
|
|
|
|
|
['a', 'class', $self->{'css_container'}], |
75
|
|
|
|
|
|
|
['b', 'div'], |
76
|
1
|
|
|
|
|
10
|
['a', 'class', $self->{'css_inner'}], |
77
|
|
|
|
|
|
|
); |
78
|
1
|
|
|
|
|
149
|
$tags_cb->($self); |
79
|
1
|
|
|
|
|
46
|
$self->{'tags'}->put( |
80
|
|
|
|
|
|
|
['e', 'div'], |
81
|
|
|
|
|
|
|
['e', 'div'], |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
72
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _process_css { |
88
|
7
|
|
|
7
|
|
77
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$self->{'css'}->put( |
91
|
|
|
|
|
|
|
['s', '.'.$self->{'css_container'}], |
92
|
|
|
|
|
|
|
['d', 'display', 'flex'], |
93
|
|
|
|
|
|
|
['d', 'align-items', $VERT_CONV{$self->{'vert_align'}}], |
94
|
7
|
|
|
|
|
47
|
['d', 'justify-content', $self->{'horiz_align'}], |
95
|
|
|
|
|
|
|
['d', 'height', '100vh'], |
96
|
|
|
|
|
|
|
['e'], |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
7
|
|
|
|
|
1274
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |