|
200 | 200 | /* Indent nested nav items so section hierarchy reads at a glance. |
201 | 201 | * Material's ``navigation.sections`` layout renders section labels |
202 | 202 | * and their children flush-left at the same horizontal position; |
203 | | - * fine for short sections but hard to scan when one runs long (the |
204 | | - * Examples section has 11 entries). A small left-pad on the nested |
205 | | - * links shows the hierarchy without altering typography. Scoped to |
206 | | - * the primary nav so the right-hand TOC sidebar is untouched. */ |
| 203 | + * a small left-pad on the nested links shows the hierarchy without |
| 204 | + * altering typography. Scoped to the primary nav so the right-hand |
| 205 | + * TOC sidebar is untouched. */ |
207 | 206 | .md-nav--primary .md-nav .md-nav__link { |
208 | 207 | padding-left: 0.375rem; |
209 | 208 | } |
210 | 209 |
|
| 210 | +/* Hide the active tab's title inside the sidebar. The top tabs |
| 211 | + * (Documentation / Examples / Patterns) are shown above the |
| 212 | + * content via ``navigation.tabs``; Material also renders the |
| 213 | + * active tab's label as a ``.md-nav__title`` at the top of the |
| 214 | + * sidebar, which is redundant. The level-1 nav is the tab's |
| 215 | + * content; hiding its ``.md-nav__title`` drops the repeated |
| 216 | + * label cleanly. */ |
| 217 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__title { |
| 218 | + display: none; |
| 219 | +} |
| 220 | + |
| 221 | +/* Vertical guide line + extra indent next to the *children* of an |
| 222 | + * expandable sub-section group (Concepts / Model Providers / |
| 223 | + * Reference under Documentation; Foundations / Composition / |
| 224 | + * etc. under Examples). Material renders the section's toggle in |
| 225 | + * two different shapes: |
| 226 | + * |
| 227 | + * - ``<label class="md-nav__link">Composition</label>`` when the |
| 228 | + * section has no ``index.md`` of its own (Examples' topical |
| 229 | + * groups are like this). |
| 230 | + * - ``<div class="md-nav__link md-nav__container">`` when the |
| 231 | + * section has its own ``index.md`` (Documentation's Concepts / |
| 232 | + * Model Providers / Reference are like this, because |
| 233 | + * ``navigation.indexes`` wires the section's index page in via |
| 234 | + * a container that wraps both the index link and the toggle). |
| 235 | + * |
| 236 | + * Keying off either shape directly would also catch Getting Started |
| 237 | + * (which renders the container shape too, since ``navigation.indexes`` |
| 238 | + * rolled its single ``index.md`` child up into the parent and left |
| 239 | + * the level-2 nav empty). Keying instead off "has at least one |
| 240 | + * direct child in the nested level-2 nav" cleanly skips Getting |
| 241 | + * Started (empty nested nav) while matching every real |
| 242 | + * multi-child sub-section in both tabs. Patterns' top-level pages |
| 243 | + * have no sub-section nesting at all, so no line is drawn there. */ |
| 244 | +/* Position the children's nav and shift the children's UL 10px |
| 245 | + * LEFT, applied to ALL sub-sections under the level-1 nav so child |
| 246 | + * links align horizontally regardless of whether the parent |
| 247 | + * sub-section has the vertical guide line (which is itself scoped |
| 248 | + * separately to multi-child sub-sections only). */ |
| 249 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__list > .md-nav__item > .md-nav { |
| 250 | + position: relative; |
| 251 | + margin-left: 0.25rem; |
| 252 | +} |
| 253 | + |
| 254 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__list > .md-nav__item > .md-nav > .md-nav__list { |
| 255 | + margin-left: -0.625rem; |
| 256 | +} |
| 257 | + |
| 258 | +/* Shift the sub-section label (the ``<label>`` or |
| 259 | + * ``<div class="md-nav__container">`` wrapper) 10px LEFT to |
| 260 | + * tighten the layout, while leaving the children's nav (with its |
| 261 | + * vertical guide line) in place. */ |
| 262 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__list > .md-nav__item > .md-nav__link { |
| 263 | + margin-left: -0.625rem; |
| 264 | +} |
| 265 | + |
| 266 | +/* Align label-form labels (Examples: Foundations, Composition, |
| 267 | + * etc.) and direct-link-form items (Patterns: Parameterized entry |
| 268 | + * point, Tool dispatch as node, etc.) with container-form labels |
| 269 | + * (Documentation: Concepts, Model Providers, Reference). The base |
| 270 | + * padding rule (.md-nav--primary .md-nav .md-nav__link |
| 271 | + * { padding-left: 0.375rem }) applies to ANY element with |
| 272 | + * .md-nav__link class. In Documentation, the section toggle is |
| 273 | + * rendered as <div class="md-nav__container"> wrapping |
| 274 | + * <a class="md-nav__link">, and the base rule applies to BOTH the |
| 275 | + * outer div AND the inner a, giving the text 0.75rem of layered |
| 276 | + * left offset. In Examples (<label class="md-nav__link">) and |
| 277 | + * Patterns (<a class="md-nav__link"> directly), the rule applies |
| 278 | + * once and the text only gets 0.375rem of offset; result is text |
| 279 | + * 7.5px left of the Documentation equivalent. This rule overrides |
| 280 | + * the single-application forms' padding to 0.75rem so all |
| 281 | + * sub-section / top-level page text lands at the same X column. |
| 282 | + * ``:not(.md-nav__container)`` excludes Documentation's div wrapper |
| 283 | + * so its layered offset stays intact. */ |
| 284 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__list > .md-nav__item > .md-nav__link:not(.md-nav__container) { |
| 285 | + padding-left: 0.75rem; |
| 286 | +} |
| 287 | + |
| 288 | +/* The vertical guide line, rendered as a ::before pseudo-element |
| 289 | + * (so it can stop 5px short of the nav's bottom edge via |
| 290 | + * ``top: 0; bottom: 5px``). Scoped to any sub-section whose nested |
| 291 | + * nav has at least one child (the ``:has(> .md-nav > .md-nav__list |
| 292 | + * > .md-nav__item)`` predicate); Getting Started's nested nav is |
| 293 | + * empty (single ``index.md`` child got rolled up into the parent |
| 294 | + * link via ``navigation.indexes``) so it doesn't match. A plain |
| 295 | + * border would always cover the full element height; the |
| 296 | + * pseudo-element gives us precise control over both ends. */ |
| 297 | +.md-nav--primary .md-nav[data-md-level="1"] > .md-nav__list > .md-nav__item:has(> .md-nav > .md-nav__list > .md-nav__item) > .md-nav::before { |
| 298 | + content: ""; |
| 299 | + position: absolute; |
| 300 | + left: 0; |
| 301 | + top: 0; |
| 302 | + bottom: 5px; |
| 303 | + width: 1px; |
| 304 | + background: var(--md-default-fg-color--lightest); |
| 305 | +} |
| 306 | + |
211 | 307 | [data-md-color-scheme="slate"] .md-header, |
212 | 308 | [data-md-color-scheme="slate"] .md-footer-meta { |
213 | 309 | background-color: var(--md-footer-bg-color); |
|
0 commit comments