@f5-sales-demo/docs-theme 4.13.20 → 4.13.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ const fixedEditUrl = editUrl ? editUrl.href.replace('/src/content/docs/', '/docs
30
30
 
31
31
  <Default {...Astro.props}><slot /></Default>
32
32
  {!hideBreadcrumbs && (
33
- <nav class="breadcrumbs" aria-label={t('f5xc.breadcrumb.label')}>
33
+ <nav class="breadcrumbs" data-certificate-management={certificateManagement || undefined} aria-label={t('f5xc.breadcrumb.label')}>
34
34
  <ol>
35
35
  <li><a href={docsHome}>{t('f5xc.breadcrumb.home')}</a></li>
36
36
  <li><a href={import.meta.env.BASE_URL}>{siteTitle}</a></li>
@@ -52,3 +52,16 @@ const fixedEditUrl = editUrl ? editUrl.href.replace('/src/content/docs/', '/docs
52
52
  )}
53
53
  </nav>
54
54
  )}
55
+
56
+ <script>
57
+ import { installCertificateBreadcrumbOffset } from "../src/utils/breadcrumb-offset.ts";
58
+ installCertificateBreadcrumbOffset();
59
+ document.addEventListener("astro:page-load", installCertificateBreadcrumbOffset);
60
+ </script>
61
+
62
+ <style is:global>
63
+ /* Starlight scroll padding already reserves the header and mobile TOC. */
64
+ html:has(.breadcrumbs[data-certificate-management]) main :is(h1, h2, h3, h4, h5, h6) {
65
+ scroll-margin-top: var(--f5-certificate-breadcrumb-height, 3rem);
66
+ }
67
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f5-sales-demo/docs-theme",
3
- "version": "4.13.20",
3
+ "version": "4.13.21",
4
4
  "description": "F5 Distributed Cloud branded Starlight documentation theme",
5
5
  "type": "module",
6
6
  "engines": {
@@ -0,0 +1,30 @@
1
+ /** Account for wrapped Certificate Management breadcrumbs without changing other sites. */
2
+ let observer: ResizeObserver | undefined;
3
+
4
+ export function installCertificateBreadcrumbOffset(): void {
5
+ observer?.disconnect();
6
+ const root = document.documentElement;
7
+ const breadcrumb = document.querySelector<HTMLElement>('.breadcrumbs[data-certificate-management]');
8
+ if (!breadcrumb) {
9
+ root.style.removeProperty('--f5-certificate-breadcrumb-height');
10
+ return;
11
+ }
12
+ const measure = () =>
13
+ root.style.setProperty('--f5-certificate-breadcrumb-height', `${breadcrumb.getBoundingClientRect().height}px`);
14
+ measure();
15
+ observer = new ResizeObserver(measure);
16
+ observer.observe(breadcrumb);
17
+ // Initial fragments can scroll before the measured offset is available.
18
+ if (location.hash) {
19
+ let id: string;
20
+ try {
21
+ id = decodeURIComponent(location.hash.slice(1));
22
+ } catch {
23
+ return;
24
+ }
25
+ const target = document.getElementById(id);
26
+ if (target?.matches('main :is(h1, h2, h3, h4, h5, h6)')) {
27
+ requestAnimationFrame(() => target.scrollIntoView());
28
+ }
29
+ }
30
+ }