@f5-sales-demo/docs-theme 4.4.10 → 4.4.12

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.
@@ -0,0 +1,122 @@
1
+ ---
2
+ import LanguageSelect from 'virtual:starlight/components/LanguageSelect';
3
+ import Search from 'virtual:starlight/components/Search';
4
+ import SiteTitle from 'virtual:starlight/components/SiteTitle';
5
+ import SocialIcons from 'virtual:starlight/components/SocialIcons';
6
+ import ThemeSelect from 'virtual:starlight/components/ThemeSelect';
7
+ import config from 'virtual:starlight/user-config';
8
+ import MegaMenu from './SharedMegaMenu.tsx';
9
+ import MegaMenuMobile from './SharedMegaMenuMobile.tsx';
10
+
11
+ /**
12
+ * Render the `Search` component if Pagefind is enabled or the default search component has been overridden.
13
+ */
14
+ const shouldRenderSearch = config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro';
15
+ ---
16
+
17
+ <div class="header sl-mega-menu-header">
18
+ <div class="title-wrapper sl-flex">
19
+ <SiteTitle />
20
+ </div>
21
+ <nav class="smm-desktop-nav">
22
+ <MegaMenu client:only="react" />
23
+ </nav>
24
+ <div class="sl-flex print:hidden">
25
+ {shouldRenderSearch && <Search />}
26
+ </div>
27
+ <div class="sl-hidden md:sl-flex print:hidden right-group">
28
+ <div class="sl-flex social-icons">
29
+ <SocialIcons />
30
+ </div>
31
+ <ThemeSelect />
32
+ <LanguageSelect />
33
+ </div>
34
+ <div class="smm-mobile-toggle">
35
+ <MegaMenuMobile client:only="react" />
36
+ </div>
37
+ </div>
38
+
39
+ <style>
40
+ @layer starlight.core {
41
+ .header {
42
+ display: flex;
43
+ gap: var(--sl-nav-gap);
44
+ justify-content: space-between;
45
+ align-items: center;
46
+ height: 100%;
47
+ }
48
+
49
+ .title-wrapper {
50
+ /* Prevent long titles overflowing and covering the search and menu buttons on narrow viewports. */
51
+ overflow: clip;
52
+ /* Avoid clipping focus ring around link inside title wrapper. */
53
+ padding: 0.25rem;
54
+ margin: -0.25rem;
55
+ min-width: 0;
56
+ }
57
+
58
+ .right-group,
59
+ .social-icons {
60
+ gap: 1rem;
61
+ align-items: center;
62
+ }
63
+ .social-icons::after {
64
+ content: '';
65
+ height: 2rem;
66
+ border-inline-end: 1px solid var(--sl-color-gray-5);
67
+ }
68
+
69
+ /* Desktop nav is hidden on small screens */
70
+ .smm-desktop-nav {
71
+ display: none;
72
+ }
73
+
74
+ /* Mobile toggle is visible on small screens */
75
+ .smm-mobile-toggle {
76
+ display: flex;
77
+ align-items: center;
78
+ }
79
+
80
+ @media (min-width: 50rem) {
81
+ :global(:root[data-has-sidebar]) {
82
+ --__sidebar-pad: calc(2 * var(--sl-nav-pad-x));
83
+ }
84
+ :global(:root:not([data-has-toc])) {
85
+ --__toc-width: 0rem;
86
+ }
87
+ .header {
88
+ --__sidebar-width: max(0rem, var(--sl-content-inline-start, 0rem) - var(--sl-nav-pad-x));
89
+ --__main-column-fr: calc(
90
+ (
91
+ 100% + var(--__sidebar-pad, 0rem) - var(--__toc-width, var(--sl-sidebar-width)) -
92
+ (2 * var(--__toc-width, var(--sl-nav-pad-x))) - var(--sl-content-inline-start, 0rem) -
93
+ var(--sl-content-width)
94
+ ) / 2
95
+ );
96
+ display: grid;
97
+ grid-template-columns:
98
+ /* 1 (site title) */
99
+ auto
100
+ /* 2 (mega-menu nav) */
101
+ 1fr
102
+ /* 3 (search box) */
103
+ auto
104
+ /* 4 (right items) */
105
+ auto;
106
+ align-content: center;
107
+ }
108
+
109
+ /* Show desktop nav, hide mobile toggle */
110
+ .smm-desktop-nav {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: center;
114
+ min-width: 0;
115
+ }
116
+
117
+ .smm-mobile-toggle {
118
+ display: none;
119
+ }
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,5 @@
1
+ import config from 'virtual:starlight-mega-menu/config';
2
+ import MegaMenu from '@f5-sales-demo/starlight-mega-menu/components/MegaMenu.tsx';
3
+ export default function SharedMegaMenu() {
4
+ return <MegaMenu config={config} />;
5
+ }
@@ -0,0 +1,5 @@
1
+ import config from 'virtual:starlight-mega-menu/config';
2
+ import MegaMenuMobile from '@f5-sales-demo/starlight-mega-menu/components/MegaMenuMobile.tsx';
3
+ export default function SharedMegaMenuMobile() {
4
+ return <MegaMenuMobile config={config} />;
5
+ }
package/index.ts CHANGED
@@ -24,6 +24,7 @@ export default function f5xcDocsTheme(): StarlightPlugin {
24
24
  ],
25
25
  components: {
26
26
  ...config.components,
27
+ Header: '@f5-sales-demo/docs-theme/components/SharedHeader.astro',
27
28
  ...(process.env.DOCS_PROFILE === 'canonical-provider'
28
29
  ? {
29
30
  Sidebar: '@f5-sales-demo/docs-theme/components/ProviderSidebar.astro',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f5-sales-demo/docs-theme",
3
- "version": "4.4.10",
3
+ "version": "4.4.12",
4
4
  "description": "F5 Distributed Cloud branded Starlight documentation theme",
5
5
  "type": "module",
6
6
  "engines": {
@@ -43,7 +43,8 @@
43
43
  "./src/utils/localize-ecosystem-href.ts": "./src/utils/localize-ecosystem-href.ts",
44
44
  "./canonical-route-middleware": "./canonical-route-middleware.ts",
45
45
  "./components/ProviderSidebar.astro": "./components/ProviderSidebar.astro",
46
- "./components/ProviderHeader.astro": "./components/ProviderHeader.astro"
46
+ "./components/ProviderHeader.astro": "./components/ProviderHeader.astro",
47
+ "./components/SharedHeader.astro": "./components/SharedHeader.astro"
47
48
  },
48
49
  "files": [
49
50
  "index.ts",
@@ -79,3 +79,10 @@ describe('localizeEcosystemHref', () => {
79
79
  );
80
80
  });
81
81
  });
82
+
83
+ it('leaves the single-locale mvp menu destination unlocalized', () => {
84
+ for (const locale of ['en', 'fr'])
85
+ expect(localizeEcosystemHref('https://f5-sales-demo.github.io/mvp/', locale)).toBe(
86
+ 'https://f5-sales-demo.github.io/mvp/',
87
+ );
88
+ });
@@ -5,7 +5,7 @@ const ECOSYSTEM_HOST = 'f5-sales-demo.github.io';
5
5
  // Ecosystem sites published as a single locale (no `/<locale>/` path segment).
6
6
  // Injecting a locale slug into links to these produces a 404
7
7
  // (e.g. `/terraform-provider-xcsh/en/`), so they are left unlocalized.
8
- const NON_LOCALIZED_ECOSYSTEM_SLUGS = new Set(['terraform-provider-xcsh', 'docs-control', 'html-to-markdown']);
8
+ const NON_LOCALIZED_ECOSYSTEM_SLUGS = new Set(['terraform-provider-xcsh', 'docs-control', 'html-to-markdown', 'mvp']);
9
9
 
10
10
  export const langToSlug = bcp47ToSlug;
11
11
 
@@ -0,0 +1,14 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { expect, it } from 'vitest';
3
+
4
+ it('bundles menu config in shared clients instead of serialized island props', () => {
5
+ const header = readFileSync(new URL('../../components/SharedHeader.astro', import.meta.url), 'utf8');
6
+ expect(header).not.toContain('config={');
7
+ expect(header).toContain('<ThemeSelect');
8
+ expect(header).toContain('<LanguageSelect');
9
+ expect(header).toContain('<SocialIcons');
10
+ for (const name of ['SharedMegaMenu', 'SharedMegaMenuMobile']) {
11
+ const client = readFileSync(new URL(`../../components/${name}.tsx`, import.meta.url), 'utf8');
12
+ expect(client).toContain('virtual:starlight-mega-menu/config');
13
+ }
14
+ });