1
-
1
+ /* -------------------toc-------------------- */
2
2
.ptx-toc {
3
3
/* IMPORTANT height must be calculated by javascript. */
4
4
width : 240px ;
15
15
background : # fff ;
16
16
}
17
17
18
- .ptx-toc > ul : first-child > li : last-child {
18
+ .ptx-toc > . toc-item-list : first-child > . toc-item : last-child {
19
19
border-bottom : 8px solid # 999 ;
20
20
}
21
21
22
- /* Aligns toc to the top and side of the allotted space, respectively */
23
- .ptx-toc ul {
24
- margin : 0px ;
25
- padding : 0px ;
26
- list-style-type : none;
27
- }
22
+ /* -------------------toc-items-------------------- */
28
23
24
+ .ptx-toc {
25
+ --codenumber-pad-left : 0.3rem ;
26
+ --codenumber-pad-right : 0.5rem ;
29
27
30
- /* Places codenumbers */
31
- .ptx-toc .codenumber {
32
- padding-left : 0.3rem ;
33
- display : inline-block;
34
- }
35
- .ptx-toc .codenumber + .title {
36
- padding-left : 0.3rem ;
28
+ /* first level indentation set to line up with second
29
+ level indentation to minimize ragged edge*/
30
+ --toc-indent-first : calc (1.0rem + var (--codenumber-pad-left ) + var (--codenumber-pad-right ));
31
+ --toc-indent-second : calc (1.7rem + var (--codenumber-pad-left ) + var (--codenumber-pad-right ));
32
+ /* third level needs more space for numbering */
33
+ --toc-indent-third : calc (2.2rem + var (--codenumber-pad-left ) + var (--codenumber-pad-right ));
37
34
}
38
- .ptx-toc .internal > .title : first-child {
39
- padding-left : 1.0rem ;
35
+
36
+ /* will be less indentation */
37
+ .ptx-toc : is (.depth1 , .parts .depth2 ) {
38
+ --codenumber-pad-right : 0.5rem ;
40
39
}
41
- .ptx-toc .structural .structural .codenumber {
42
- padding-top : 0.2em ;
43
- font-size : 80% ;
40
+
41
+ .ptx-toc .toc-item-list {
42
+ margin : 0px ;
43
+ padding : 0px ;
44
+ list-style-type : none;
44
45
}
45
46
46
- /*
47
- .ptx-toc :is(.toc-frontmatter, .toc-backmatter) > .toc-title-box > a .title {
48
- margin-left: 1.5rem;
47
+ .ptx-toc .toc-item {
48
+ border-top : 1px solid var (--tocborder , # d1d1d1 );
49
49
}
50
- */
51
50
52
- .ptx-toc .toc-part > .toc-title-box > a .codenumber {
53
- min-width : 1.5rem ;
54
- padding-right : 0.3rem ;
51
+ /* -------------------title-box------------------- */
52
+
53
+ .ptx-toc .toc-title-box {
54
+ display : flex;
55
55
}
56
56
57
- .ptx-toc .toc-chapter > .toc-title-box > a .codenumber {
58
- min-width : 1.9rem ;
59
- padding-right : 0.3rem ;
57
+ .ptx-toc .toc-title-box > .internal {
58
+ position : relative;
59
+ display : flex;
60
+ flex-grow : 1 ;
61
+ padding : 0.2em ;
62
+ font-family : "PT Serif" , "Times New Roman" , Times, serif;
63
+ font-weight : bold;
60
64
}
61
65
62
- .ptx-toc .toc-backmatter .toc-item-list .toc-item .codenumber {
63
- min-width : 1.9rem ;
64
- padding-right : 0.3rem ;
66
+ /* at second level, switch fonts */
67
+ .ptx-toc .toc-item-list .toc-item-list .toc-title-box > .internal {
68
+ font-family : "Open Sans" , "Helvetica Neue" , Helvetica, Arial, sans-serif;
69
+ font-weight : normal;
65
70
}
66
71
67
- . ptx-toc . toc-chapter . toc-item-list . toc-item . codenumber {
68
- min-width : 2.5 rem ;
69
- padding-right : 0.3 rem ;
72
+ /* Extra border above top level items */
73
+ . ptx-toc > . toc-item-list > . toc-item {
74
+ border-top : 2 px solid var ( --tocborder , # d1d1d1 ) ;
70
75
}
71
76
72
- .ptx-toc .toc-chapter .toc-item-list .toc-item-list .toc-item .codenumber {
73
- min-width : 3.3rem ;
74
- padding-right : 0.3rem ;
77
+ .ptx-toc .toc-item .active {
78
+ box-shadow : rgba (0 , 0 , 0 , 0.5 ) 0 2px 5px inset;
75
79
}
76
80
77
- .ptx-toc .toc-chapter .toc-item-list .toc-item .codenumber {
81
+
82
+ /* -------------------codenumbers-------------------- */
83
+ .ptx-toc .codenumber {
84
+ min-width : var (--toc-indent-first );
85
+ padding-left : var (--codenumber-pad-left );
86
+ padding-right : var (--codenumber-pad-right );
87
+ display : inline-block;
88
+ text-align : left;
89
+ flex-grow : 0 ;
90
+ }
91
+
92
+ /* second level of numbering */
93
+ /* anything 1+ levels deeper than a chapter in a book */
94
+ .book .ptx-toc .toc-chapter .toc-item-list .codenumber ,
95
+ /* anything 1+ levels deeper than a section in an article */
96
+ .article .ptx-toc .toc-section .toc-item-list .codenumber ,
97
+ /* anything 1+ levels deeper than backmatter */
98
+ .ptx-toc .toc-backmatter .toc-item-list .codenumber
99
+ {
78
100
font-size : 80% ;
79
101
padding-top : 0.16em ;
80
- }
81
-
82
- /* no codenumbers on subsections (anything under section) */
83
- .ptx-toc .toc-section .toc-item-list .toc-item a > .codenumber {
102
+ min-width : var (--toc-indent-second );
103
+ }
104
+
105
+ /* third level of numbering */
106
+ /* anything 2+ levels deeper than a chapter in a book */
107
+ .book .ptx-toc .toc-chapter .toc-item-list .toc-item-list .codenumber ,
108
+ /* anything 2+ levels deeper than a section in an article */
109
+ .article .ptx-toc .toc-section .toc-item-list .toc-item-list .codenumber ,
110
+ /* anything 2+ levels deeper than backmatter */
111
+ .ptx-toc .toc-backmatter .toc-item-list .toc-item-list .codenumber
112
+ {
113
+ min-width : var (--toc-indent-third );
84
114
visibility : hidden;
85
115
}
86
- .ptx-toc .toc-section .toc-item-list .toc-item a : hover > .codenumber {
116
+
117
+ /* reveal on interaction */
118
+ .ptx-toc .toc-item-list .toc-item-list .toc-item-list a : is (: hover , : focus ) > .codenumber {
87
119
visibility : visible;
88
120
}
89
121
90
- .ptx-toc ul .structural ul .structural .title : empty ::after {
91
- content : "empty heading!" ;
92
- font-weight : bold;
93
- }
94
- .ptx-toc ul .structural ul .structural ul .structural .title {
95
- font-size : 90% ;
96
- }
97
- .ptx-toc ul .structural ul .structural ul .structural ul .structural .title {
98
- font-size : 90% ;
99
- font-style : italic;
122
+ /* -------------------titles-------------------- */
123
+ .ptx-toc .toc-title-box .title {
124
+ flex-grow : 1 ;
100
125
}
101
126
102
- .ptx-toc .part > a .codenumber {
103
- position : relative;
104
- display : block;
105
- float : left;
106
- margin-right : 0.7em ;
107
- }
108
- .ptx-toc .part > a .title {
109
- display : block;
110
- margin-left : 1em ;
127
+ /* Any toc item without a codenumber needs indentation
128
+ Can't select absence of a preceeding, so indent all titles
129
+ and then clear indent if there is a codenumber */
130
+ .ptx-toc .toc-item .toc-title-box .title {
131
+ margin-left : var (--toc-indent-first );
111
132
}
112
133
113
- .ptx-toc .toc-item {
114
- border-top : 1px solid var (--tocborder , # d1d1d1 );
134
+ /* second level as defined by codenumber selectors */
135
+ .book .ptx-toc .toc-chapter .toc-item-list .title ,
136
+ .article .ptx-toc .toc-section .toc-item-list .title ,
137
+ .ptx-toc .toc-backmatter .toc-item-list .title
138
+ {
139
+ margin-left : var (--toc-indent-second );
115
140
}
116
141
117
- .ptx-toc ul .structural li a {
118
- position : relative;
119
- display : block;
120
- padding : 2.86957px ;
121
- padding : 0.2em ;
122
- /* padding-left: 0.5em; */
123
- font-family : "PT Serif" , "Times New Roman" , Times, serif;
124
- font-weight : bold;
125
- }
126
- .ptx-toc ul .structural ul .structural li a {
127
- font-family : "Open Sans" , "Helvetica Neue" , Helvetica, Arial, sans-serif;
128
- font-weight : normal;
129
- display : flex;
142
+ /* third level as defined by codenumber selectors */
143
+ .book .ptx-toc .toc-chapter .toc-item-list .toc-item-list .title ,
144
+ .article .ptx-toc .toc-section .toc-item-list .toc-item-list .title ,
145
+ .ptx-toc .toc-backmatter .toc-item-list .toc-item-list .title
146
+ {
147
+ margin-left : var (--toc-indent-third );
130
148
}
131
149
132
- /* Removes underlines from links in toc */
133
- .ptx-toc ul . structural li a , . ptx- toc ul . structural li a : link , . ptx-toc ul . structural li a : visited , . ptx- toc ul . structural li a : hover , . ptx-toc ul . structural li a : focus , . ptx-toc ul . structural li a : active {
134
- text-decoration : none ;
150
+ /* unless there is a codenumber */
151
+ .ptx-toc . toc-item > . toc-title-box . codenumber + . title {
152
+ margin-left : 0 !important ;
135
153
}
136
154
137
- /*
138
- .ptx-toc > ul > li a, .ptx-toc > ul > li a:link, .ptx-toc > ul > li a:visited {
155
+ . ptx-toc ul . structural ul . structural . title : empty :: after {
156
+ content : "empty heading!" ;
139
157
font-weight : bold;
140
- font-family: "PT Serif", "Times New Roman", Times, serif;
141
- padding-left: 0.2em;
142
- }
143
- */
144
-
145
- /* Extra border above top level items */
146
- .ptx-toc > .toc-item-list > .toc-item {
147
- border-top : 2px solid var (--tocborder , # d1d1d1 );
148
158
}
149
159
150
- /* Allows both "top" and bottom border of a subsection to be highlighted on hover */
151
- .ptx-toc ul .structural li ul .structural a : hover {
152
- /*
153
- omitting, because it caused a "jump"
154
- border-top: 1px solid #3c110a;
155
- */
156
- /*
157
- margin-top: -1px;
158
- */
159
- }
160
160
161
- /* Removes double border between last subsection and next section */
162
- .ptx-toc > ul .structural li ul .structural li : last-child a {
163
- border-bottom : none;
161
+ .ptx-toc .toc-chapter .toc-item-list .title ,
162
+ .ptx-toc .toc-section .toc-item-list .title ,
163
+ /* 2 levels deep in back matter */
164
+ .ptx-toc .toc-backmatter .toc-item-list .toc-item-list .title
165
+ {
166
+ font-size : 90% ;
164
167
}
165
168
166
-
167
- .ptx-toc ul .structural li a : active {
168
- box-shadow : rgba (0 , 0 , 0 , 0.5 ) 0 2px 5px inset;
169
+ .ptx-toc .toc-chapter .toc-item-list .toc-item-list .title ,
170
+ .ptx-toc .toc-section .toc-item-list .toc-item-list .title ,
171
+ /* 3 levels deep in back matter */
172
+ .ptx-toc .toc-backmatter .toc-item-list .toc-item-list .toc-item-list .title
173
+ {
174
+ font-style : italic;
169
175
}
170
176
177
+ /* ??? */
171
178
.ptx-toc ul .structural li a .has-chevron {
172
179
padding-right : 2em ;
173
180
}
174
- .ptx-toc .toc-item {
175
- position : relative;
176
- }
177
181
182
+ /* -------------------depth controls-------------------- */
178
183
.ptx-toc .depth0 ul .structural {
179
184
display : none;
180
185
}
@@ -201,6 +206,8 @@ omitting, because it caused a "jump"
201
206
color : var (--parttoctextactive );
202
207
}
203
208
209
+
210
+ /* -------------------focused toc-------------------- */
204
211
/* Hide all but active area of book */
205
212
.ptx-toc .focused ul .structural : not (.contains-active ) > li {
206
213
display : none;
@@ -225,15 +232,6 @@ omitting, because it caused a "jump"
225
232
border : 0 ;
226
233
}
227
234
228
- .toc-title-box {
229
- display : flex;
230
- }
231
-
232
- .ptx-toc ul .structural li .toc-title-box a {
233
- flex : 1 1 ;
234
- display : flex;
235
- }
236
-
237
235
.ptx-toc .focused .toc-expander {
238
236
border : 0 ;
239
237
padding : 2px 5px ;
0 commit comments