line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tags::HTML::Container; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
142151
|
use base qw(Tags::HTML); |
|
5
|
|
|
|
|
40
|
|
|
5
|
|
|
|
|
2589
|
|
4
|
5
|
|
|
5
|
|
38386
|
use strict; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
1630
|
|
5
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
139
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
25
|
use Class::Utils qw(set_params split_params); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1983
|
|
8
|
5
|
|
|
5
|
|
30
|
use Error::Pure qw(err); |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
167
|
|
9
|
5
|
|
|
5
|
|
36
|
use List::Util qw(none); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
308
|
|
10
|
5
|
|
|
5
|
|
29
|
use Readonly; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2793
|
|
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.01; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
20
|
|
|
20
|
1
|
24601
|
my ($class, @params) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create object. |
28
|
20
|
|
|
|
|
84
|
my ($object_params_ar, $other_params_ar) = split_params( |
29
|
|
|
|
|
|
|
['css_container', 'css_inner', 'horiz_align', 'vert_align'], @params); |
30
|
20
|
|
|
|
|
525
|
my $self = $class->SUPER::new(@{$other_params_ar}); |
|
20
|
|
|
|
|
70
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Container align. |
33
|
18
|
|
|
|
|
585
|
$self->{'horiz_align'} = 'center'; |
34
|
18
|
|
|
|
|
35
|
$self->{'vert_align'} = 'center'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# CSS classes. |
37
|
18
|
|
|
|
|
34
|
$self->{'css_container'} = 'container'; |
38
|
18
|
|
|
|
|
32
|
$self->{'css_inner'} = 'inner'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Process params. |
41
|
18
|
|
|
|
|
27
|
set_params($self, @{$object_params_ar}); |
|
18
|
|
|
|
|
51
|
|
42
|
|
|
|
|
|
|
|
43
|
18
|
100
|
|
|
|
179
|
if (! defined $self->{'horiz_align'}) { |
44
|
1
|
|
|
|
|
3
|
err "Parameter 'horiz_align' is required."; |
45
|
|
|
|
|
|
|
} |
46
|
17
|
100
|
|
22
|
|
143
|
if (none { $self->{'horiz_align'} eq $_ } @HORIZ_ALIGN) { |
|
22
|
|
|
|
|
387
|
|
47
|
|
|
|
|
|
|
err "Parameter 'horiz_align' have a bad value.", |
48
|
1
|
|
|
|
|
6
|
'Value', $self->{'horiz_align'}, |
49
|
|
|
|
|
|
|
; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
16
|
100
|
|
|
|
146
|
if (! defined $self->{'vert_align'}) { |
53
|
1
|
|
|
|
|
3
|
err "Parameter 'vert_align' is required."; |
54
|
|
|
|
|
|
|
} |
55
|
15
|
100
|
|
47
|
|
63
|
if (none { $self->{'vert_align'} eq $_ } @VERT_ALIGN) { |
|
47
|
|
|
|
|
446
|
|
56
|
|
|
|
|
|
|
err "Parameter 'vert_align' have a bad value.", |
57
|
1
|
|
|
|
|
11
|
'Value', $self->{'vert_align'}, |
58
|
|
|
|
|
|
|
; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Object. |
62
|
14
|
|
|
|
|
126
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _process { |
66
|
2
|
|
|
2
|
|
28
|
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
|
|
|
|
|
11
|
['a', 'class', $self->{'css_inner'}], |
77
|
|
|
|
|
|
|
); |
78
|
1
|
|
|
|
|
148
|
$tags_cb->($self); |
79
|
1
|
|
|
|
|
85
|
$self->{'tags'}->put( |
80
|
|
|
|
|
|
|
['e', 'div'], |
81
|
|
|
|
|
|
|
['e', 'div'], |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
85
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _process_css { |
88
|
7
|
|
|
7
|
|
81
|
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
|
|
|
|
|
50
|
['d', 'justify-content', $self->{'horiz_align'}], |
95
|
|
|
|
|
|
|
['d', 'height', '100vh'], |
96
|
|
|
|
|
|
|
['e'], |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
7
|
|
|
|
|
1239
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |