@@ -10,36 +10,67 @@ use Tracy\Helpers;
10
10
11
11
?>
12
12
<style class="tracy-debug">
13
- #tracy-debug .nette-RoutingPanel table {
14
- font: 9pt/1.5 Consolas, monospace;
13
+ #tracy-debug .nette-RoutingPanel-grid {
14
+ background: #FDF5CE;
15
+ display: grid;
16
+ grid-template-columns: auto 1fr auto auto;
17
+ border: 1px solid #E6DFBF;
15
18
}
16
19
17
- #tracy-debug .nette-RoutingPanel tr {
18
- border: #d6ceb0 0 solid;
20
+ #tracy-debug .nette-RoutingPanel-grid-inner,
21
+ #tracy-debug .nette-RoutingPanel-grid-columns {
22
+ grid-column: 1 / span 4;
23
+ display: grid;
24
+ grid-template-columns: subgrid;
19
25
}
20
26
21
- #tracy-debug .nette-RoutingPanel .yes td {
27
+ #tracy-debug .nette-RoutingPanel-grid-columns:nth-child(2n) {
28
+ background: rgba(0,0,0,0.02);
29
+ }
30
+
31
+ #tracy-debug .nette-RoutingPanel-grid-group-header {
32
+ grid-column: 2 / span 3;
33
+ font-size: 90%;
34
+ }
35
+
36
+ #tracy-debug .nette-RoutingPanel-grid-header {
37
+ color: #655E5E;
38
+ background: #F4F3F1;
39
+ font-size: 90%;
40
+ font-weight: bold;
41
+ }
42
+
43
+ #tracy-debug .nette-RoutingPanel-grid-inner .nette-RoutingPanel-grid-inner {
44
+ background: #0000000d;
45
+ padding: 2px 3px;
46
+ }
47
+
48
+ #tracy-debug .nette-RoutingPanel-grid-columns > div {
49
+ border-bottom: 1px solid #E6DFBF;
50
+ border-right: 1px solid #E6DFBF;
51
+ padding: 2px 5px;
52
+ }
53
+
54
+ #tracy-debug .nette-RoutingPanel-status-yes {
22
55
background: #BDE678 !important;
23
56
}
24
57
25
- #tracy-debug .nette-RoutingPanel . may td {
58
+ #tracy-debug .nette-RoutingPanel-status- may {
26
59
background: #C1D3FF !important;
27
60
}
28
61
29
- #tracy-debug .nette-RoutingPanel . error td {
62
+ #tracy-debug .nette-RoutingPanel-status- error {
30
63
background: #ffd2c3 !important;
31
64
}
32
65
33
- #tracy-debug .nette-RoutingPanel td. symbol {
34
- text-align: center ;
66
+ #tracy-debug .nette-RoutingPanel- symbol {
67
+ text-align: right ;
35
68
}
36
69
37
- #tracy-debug .nette-RoutingPanel td:first-child {
38
- width: 20px;
39
- }
40
-
41
- #tracy-debug .nette-RoutingPanel td:nth-child(2) {
42
- white-space: nowrap;
70
+ #tracy-debug .nette-RoutingPanel .tracy-dump.tracy-dump {
71
+ padding: 0;
72
+ margin: 0;
73
+ border: none;
43
74
}
44
75
45
76
#tracy-debug .nette-RoutingPanel pre, #tracy-debug .nette-RoutingPanel code {
@@ -72,54 +103,75 @@ use Tracy\Helpers;
72
103
</div>
73
104
74
105
<div class="tracy-inner-container">
75
- <?php if (empty ($ routers )): ?>
76
- <p>No routers defined.</p>
106
+ <?php if (empty ($ routes )): ?>
107
+ <p>No routes defined.</p>
77
108
78
109
<?php else : ?>
79
- <table>
80
- <thead>
81
- <tr>
82
- <th></th>
83
- <th>Mask / Class</th>
84
- <th>Defaults</th>
85
- <?php if ($ hasModule ): ?> <th>Module</th><?php endif ?>
86
- <th>Matched as</th>
87
- </tr>
88
- </thead>
89
-
90
- <tbody>
91
- <?php foreach ($ routers as $ router ): ?>
92
- <tr class="<?= $ router ->matched ?> " style="border-width: <?= ($ router ->gutterTop ?? 0 ) * 3 ?> px 0 <?= ($ router ->gutterBottom ?? 0 ) * 3 ?> px <?= $ router ->level * 6 ?> px">
93
- <td class="symbol" title="<?= Helpers::escapeHtml (['yes ' => 'matched as first ' , 'may ' => 'suitable but not matched as first ' , 'no ' => '' , 'oneway ' => 'one-way ' , 'error ' => 'error ' ][$ router ->matched ]) ?> "
94
- ><?= ['yes ' => '✓ ' , 'may ' => '≈ ' , 'no ' => '' , 'oneway ' => '⛔ ' , 'error ' => '❌ ' ][$ router ->matched ] ?> </td>
95
-
96
- <td><code title="<?= Helpers::escapeHtml ($ router ->class ) ?> "><?=
97
- $ router ->path === '' ? '' : '<small> ' . Helpers::escapeHtml ($ router ->path ) . '</small> ' ,
98
- isset ($ router ->mask ) ? str_replace (['/ ' , '- ' ], ['<wbr>/ ' , '<wbr>- ' ], Helpers::escapeHtml ($ router ->mask )) : str_replace ('\\' , '<wbr> \\' , Helpers::escapeHtml ($ router ->class ))
99
- ?> </code></td>
100
-
101
- <td><code>
102
- <?php foreach ($ router ->defaults as $ key => $ value ): ?>
103
- <?= Helpers::escapeHtml ($ key ), ' = ' , is_string ($ value ) ? Helpers::escapeHtml ($ value ) . '<br /> ' : Dumper::toHtml ($ value , [Dumper::COLLAPSE => true , Dumper::LIVE => true ]) ?>
104
- <?php endforeach ?>
105
- </code></td>
110
+ <div class="nette-RoutingPanel-grid">
111
+ <div class="nette-RoutingPanel-grid-columns nette-RoutingPanel-grid-header">
112
+ <div></div>
113
+ <div>Mask / Class</div>
114
+ <div>Defaults</div>
115
+ <div>Matched as</div>
116
+ </div>
117
+ <?php
106
118
107
- <?php if ($ hasModule ): ?> <td><code><?= Helpers::escapeHtml ($ router ->module ) ?> </code></td><?php endif ?>
119
+ $ show = function ($ info , $ path = '' ) use (&$ show ) {
120
+ if (is_array ($ info )) {
121
+ ?>
122
+ <div class="nette-RoutingPanel-grid-inner">
123
+ <?php if ($ info ['domain ' ] || $ info ['module ' ]): ?>
124
+ <div class="nette-RoutingPanel-grid-group-header">
125
+ <?= $ info ['domain ' ] ? 'domain = ' . Helpers::escapeHtml ($ info ['domain ' ]) : '' ?>
126
+ <?= $ info ['module ' ] ? ' module = ' . Helpers::escapeHtml ($ info ['module ' ]) : '' ?>
127
+ </div>
128
+ <?php endif ?>
129
+ <?php
130
+ $ path .= $ info ['path ' ];
131
+ foreach ($ info ['routes ' ] as $ route ) {
132
+ $ show ($ route , $ path );
133
+ }
134
+ ?>
135
+ </div>
136
+ <?php
137
+ return ;
138
+ }
108
139
109
- <td><?php if ($ router ->params ): ?> <code>
110
- <?php $ params = $ router ->params ; ?>
140
+ $ route = $ info ;
141
+ ?>
142
+ <div class="nette-RoutingPanel-grid-columns nette-RoutingPanel-status-<?= $ route ->matched ?> ">
143
+ <div class="nette-RoutingPanel-symbol" title="<?= Helpers::escapeHtml (['yes ' => 'matched as first ' , 'may ' => 'suitable but not matched as first ' , 'no ' => '' , 'oneway ' => 'one-way ' , 'error ' => 'error ' ][$ route ->matched ]) ?> "
144
+ ><?= ['yes ' => '✓ ' , 'may ' => '≈ ' , 'no ' => '' , 'oneway ' => '⛔ ' , 'error ' => '❌ ' ][$ route ->matched ] ?> </div>
145
+
146
+ <div><code title="<?= Helpers::escapeHtml ($ route ->class ) ?> "><?=
147
+ $ path === '' ? '' : '<small> ' . Helpers::escapeHtml ($ path ) . '</small> ' ,
148
+ isset ($ route ->mask ) ? str_replace (['/ ' , '- ' ], ['<wbr>/ ' , '<wbr>- ' ], Helpers::escapeHtml ($ route ->mask )) : str_replace ('\\' , '<wbr> \\' , Helpers::escapeHtml ($ route ->class ))
149
+ ?> </code></div>
150
+
151
+ <div><code>
152
+ <?php foreach ($ route ->defaults as $ key => $ value ): ?>
153
+ <?= Helpers::escapeHtml ($ key ), ' = ' , is_string ($ value ) ? Helpers::escapeHtml ($ value ) . '<br> ' : Dumper::toHtml ($ value , [Dumper::COLLAPSE => true , Dumper::LIVE => true ]) ?>
154
+ <?php endforeach ?>
155
+ </code></div>
156
+
157
+ <div><?php if ($ route ->params ): ?> <code>
158
+ <?php $ params = $ route ->params ; ?>
111
159
<?php if (isset ($ params [Presenter::PresenterKey])): ?>
112
160
<strong><?= Helpers::escapeHtml ($ params ['presenter ' ] . ': ' . (isset ($ params [Presenter::ActionKey]) ? $ params [Presenter::ActionKey] : Presenter::DefaultAction)) ?> </strong><br />
113
161
<?php unset($ params [Presenter::PresenterKey], $ params [Presenter::ActionKey]) ?>
114
162
<?php endif ?>
115
163
<?php foreach ($ params as $ key => $ value ): ?>
116
- <?= Helpers::escapeHtml ($ key ), ' = ' , is_string ($ value ) ? Helpers::escapeHtml ($ value ) . '<br / > ' : Dumper::toHtml ($ value , [Dumper::COLLAPSE => true , Dumper::LIVE => true ]) ?>
164
+ <?= Helpers::escapeHtml ($ key ), ' = ' , is_string ($ value ) ? Helpers::escapeHtml ($ value ) . '<br> ' : Dumper::toHtml ($ value , [Dumper::COLLAPSE => true , Dumper::LIVE => true ]) ?>
117
165
<?php endforeach ?>
118
- </code><?php elseif ($ router ->error ): ?> <strong><?= Helpers::escapeHtml ($ router ->error ->getMessage ()) ?> </strong><?php endif ?> </td>
119
- </tr>
120
- <?php endforeach ?>
121
- </tbody>
122
- </table>
166
+ </code><?php elseif ($ route ->error ): ?> <strong><?= Helpers::escapeHtml ($ route ->error ->getMessage ()) ?> </strong><?php endif ?> </div>
167
+ </div>
168
+ <?php
169
+ };
170
+
171
+ $ show ($ routes );
172
+
173
+ ?>
174
+ </div>
123
175
<?php endif ?>
124
176
</div>
125
177
</div>
0 commit comments