igniteui-astro-components 0.0.18 → 0.0.19

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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/src/assets/icons/{chatGPT,.svg → chatgpt.svg} +0 -1
  3. package/src/assets/ig-logo.svg +1 -1
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +1 -3
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +12 -3
  6. package/src/components/DocsSidebar/DocsSidebar.astro +26 -7
  7. package/src/components/DocsSidebar/DocsSidebar.scss +35 -28
  8. package/src/components/DocsSidebar/SidebarFilterInput.astro +2 -2
  9. package/src/components/DocsSidebar/SidebarFilterInput.scss +76 -51
  10. package/src/components/DocsSidebar/sidebar-filter.ts +3 -18
  11. package/src/components/DocsSubHeader/DocsSubHeader.astro +93 -114
  12. package/src/components/DocsSubHeader/DocsSubHeader.scss +69 -121
  13. package/src/components/DocsToc/DocsToc.astro +14 -10
  14. package/src/components/DocsToc/DocsToc.scss +7 -5
  15. package/src/components/DocsTree/docs-tree.scss +125 -54
  16. package/src/components/GlobalFooter/GlobalFooter.module.scss +1 -1
  17. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +1 -3
  18. package/src/components/Search/Search.astro +57 -23
  19. package/src/components/Search/Search.scss +15 -21
  20. package/src/components/SearchAdvanced/SearchAdvanced.astro +64 -49
  21. package/src/components/SearchAdvanced/SearchAdvanced.scss +22 -30
  22. package/src/components/mdx/DocsAside/DocsAside.scss +10 -14
  23. package/src/layouts/DocsLayout/DocsLayout.astro +5 -5
  24. package/src/layouts/DocsLayout/DocsLayout.scss +58 -97
  25. package/src/scripts/icon-manifest.ts +73 -0
  26. package/src/scripts/icon-registry.ts +4 -35
  27. package/src/styles/global/_breakpoints.scss +0 -1
  28. package/src/styles/global/_code-blocks.scss +1 -0
  29. package/src/styles/global/_component-themes.scss +133 -125
  30. package/src/styles/global/_icon-gallery.scss +108 -0
  31. package/src/styles/global/_index.scss +1 -0
  32. package/src/styles/global/_markdown.scss +127 -16
  33. package/src/styles/global/_palette.scss +101 -101
  34. package/src/styles/global/_search-shared.scss +302 -315
  35. package/src/styles/global/_type-scale.scss +17 -17
  36. package/src/styles/global/_variables.scss +15 -6
  37. package/src/styles/theme.scss +7 -61
  38. package/src/assets/icons/classes.svg +0 -3
  39. package/src/assets/icons/enumerations.svg +0 -3
  40. package/src/assets/icons/functions.svg +0 -5
  41. package/src/assets/icons/interfaces.svg +0 -3
  42. package/src/assets/icons/type-alias.svg +0 -3
  43. package/src/assets/icons/variables.svg +0 -3
  44. /package/src/assets/icons/{palette,.svg → palette.svg} +0 -0
@@ -17,9 +17,6 @@ import { productLinks, sidebar as sidebarData, title as siteTitle, packages as v
17
17
  import Search from '../Search/Search.astro';
18
18
  import type { SidebarEntry } from '../../lib/sidebar/types';
19
19
  import { getBreadcrumb } from '../../lib/sidebar/helpers';
20
- import logoRaw from '../../assets/ig-logo.svg?raw';
21
- import moonRaw from '../../assets/icons/moon.svg?raw';
22
- import sunRaw from '../../assets/icons/sun.svg?raw';
23
20
  import './DocsSubHeader.scss';
24
21
 
25
22
  const PLATFORM_ICONS: Record<string, string> = {
@@ -29,6 +26,15 @@ const PLATFORM_ICONS: Record<string, string> = {
29
26
  'web-components': 'wc-logo',
30
27
  };
31
28
 
29
+ function getPlatformIcon(text: string): string | null {
30
+ const t = text.toLowerCase();
31
+ if (t.includes('angular')) return 'angular-logo';
32
+ if (t.includes('react')) return 'react-logo';
33
+ if (t.includes('blazor')) return 'blazor-logo';
34
+ if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc')) return 'wc-logo';
35
+ return null;
36
+ }
37
+
32
38
  interface ProductLink {
33
39
  label: string;
34
40
  href: string;
@@ -97,7 +103,7 @@ const {
97
103
  versionLabel = 'Version',
98
104
  showThemeToggle = false,
99
105
  themeStorageKey = 'docs-theme',
100
- logoText = 'IgniteUI',
106
+ logoText = 'Ignite UI',
101
107
  } = Astro.props;
102
108
  const resolvedSiteTitle = siteTitleProp ?? siteTitle;
103
109
  const currentPlatform = virtualPlatform ?? null;
@@ -108,74 +114,69 @@ const rawPackages = packagesProp ?? (virtualPackages?.length > 0 ? virtualPackag
108
114
  const packages = (rawPackages as PackageEntry[] | undefined)?.map((p: PackageEntry) =>
109
115
  typeof p === 'string' ? { label: p, value: p, href: undefined } : { label: p.label, value: p.value ?? p.label, href: p.href }
110
116
  );
111
- const selectedPackage = selectedPackageProp ?? (virtualSelectedPackage || undefined);
117
+ const selectedPackage = selectedPackageProp ?? (virtualSelectedPackage || undefined) ?? packages?.[0]?.value;
112
118
  const platformIcon = PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
113
119
 
114
120
  const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
115
121
  const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
116
122
  const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitle] : []);
123
+
124
+ const PLATFORM_LABELS: Record<string, string> = {
125
+ angular: 'Angular',
126
+ react: 'React',
127
+ blazor: 'Blazor',
128
+ 'web-components': 'Web Components',
129
+ };
130
+ const platformLabel = currentPlatform ? (PLATFORM_LABELS[currentPlatform] ?? null) : null;
117
131
  ---
118
132
 
119
133
  <docs-subheader-menu class="igd-docs-subheader" data-platform={currentPlatform ?? ''}>
120
-
121
134
  <div class="igd-logo">
122
- <Fragment set:html={logoRaw} />
123
- <span class="igd-logo-text">{logoText}</span>
135
+ <!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
136
+ <igc-icon-button
137
+ class="subheader-sidebar-toggle"
138
+ variant="flat"
139
+ data-sidebar-toggle
140
+ aria-label="Toggle sidebar navigation"
141
+ aria-expanded="false"
142
+ title="Toggle sidebar">
143
+ <igc-icon name="hamburger-menu" collection="docs" aria-hidden="true"></igc-icon>
144
+ </igc-icon-button>
145
+ <div class="igd-logo__text">
146
+ <h1>{logoText}</h1>
147
+ {platformLabel && <span class="igd-logo__platform">for {platformLabel}</span>}
148
+ </div>
124
149
  </div>
125
150
 
126
151
  <div class="igd-docs-subheader__content">
127
152
  <!-- Search (overridable via named slot) -->
128
153
  <slot name="search"><Search /></slot>
129
154
 
130
- <!-- Package selector (optional) -->
155
+ <!-- Package selector -->
131
156
  {packages && packages.length > 0 && (
132
- <igc-select distance="17" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
157
+ <igc-select distance="4" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
133
158
  {platformIcon && <igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
134
- {packages.map((p) => (
135
- <igc-select-item value={p.value} data-href={p.href}>{p.label}</igc-select-item>
136
- ))}
159
+ {packages.map((p) => {
160
+ const icon = getPlatformIcon(p.value ?? '') ?? getPlatformIcon(p.label ?? '');
161
+ return (
162
+ <igc-select-item value={p.value} data-href={p.href}>
163
+ {icon && <igc-icon slot="prefix" name={icon} collection="docs" aria-hidden="true"></igc-icon>}
164
+ {p.label}
165
+ </igc-select-item>
166
+ );
167
+ })}
137
168
  </igc-select>
138
169
  )}
139
- {packages && packages.length > 0 && (
140
- <igc-tooltip anchor="package-select" id="package-tooltip" placement="bottom-end" with-arrow>
141
- {packages.find(p => p.value === selectedPackage)?.label ?? selectedPackage ?? ''}
142
- </igc-tooltip>
143
- )}
144
170
 
145
- <!-- Version selector (optional) -->
171
+ <!-- Version selector -->
146
172
  {versions && versions.length > 0 && (
147
- <igc-select distance="17" class="igd-version-select" id="version-select" outlined value={selectedVersion} aria-label={versionLabel}>
173
+ <igc-select distance="4" id="version-select" class="igd-version-select" outlined value={selectedVersion} aria-label={versionLabel}>
148
174
  {versions.map((v) => (
149
- <igc-select-item value={v}>{v}</igc-select-item>
175
+ <igc-select-item value={v}>{v}</igc-select-item>
150
176
  ))}
151
177
  </igc-select>
152
178
  )}
153
179
 
154
- <!-- Toggle Astro light/dark mode -->
155
- {showThemeToggle && (
156
- <igc-icon-button
157
- class="subheader-theme-toggle"
158
- variant="flat"
159
- data-theme-toggle
160
- data-theme-key={themeStorageKey}
161
- aria-label="Toggle theme"
162
- title="Toggle light/dark theme">
163
- <span class="theme-icon theme-icon--sun" aria-hidden="true"><Fragment set:html={sunRaw} /></span>
164
- <span class="theme-icon theme-icon--moon" aria-hidden="true"><Fragment set:html={moonRaw} /></span>
165
- </igc-icon-button>
166
- )}
167
-
168
- <!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
169
- <igc-icon-button
170
- class="subheader-sidebar-toggle"
171
- variant="flat"
172
- data-sidebar-toggle
173
- aria-label="Toggle sidebar navigation"
174
- aria-expanded="false"
175
- title="Toggle sidebar">
176
- <igc-icon name="dropdown-indicator-bold" collection="docs" class="toggle-icon toggle-icon--dropdown" aria-hidden="true"></igc-icon>
177
- <igc-icon name="hamburger-menu" collection="docs" class="toggle-icon toggle-icon--hamburger" aria-hidden="true"></igc-icon>
178
- </igc-icon-button>
179
180
 
180
181
  <!-- TODO WHY WE NEED THIS? -->
181
182
  <!--{filteredLinks.length > 0 && (-->
@@ -278,71 +279,6 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
278
279
  document.body.removeAttribute('data-sidebar-open');
279
280
  sidebarBtn?.setAttribute('aria-expanded', 'false');
280
281
  });
281
-
282
- // Theme toggle
283
- const themeBtn = this.querySelector<HTMLElement>('[data-theme-toggle]');
284
- if (themeBtn) {
285
- themeBtn.addEventListener('click', () => {
286
- const current = document.documentElement.getAttribute('data-theme');
287
- const next = current === 'dark' ? 'light' : 'dark';
288
- document.documentElement.setAttribute('data-theme', next);
289
- const key = themeBtn.dataset.themeKey || 'docs-theme';
290
- try { localStorage.setItem(key, next); } catch (_) {}
291
-
292
- // Force WebKit to repaint the document scrollbar so
293
- // ::-webkit-scrollbar-* styles pick up the new data-theme.
294
- const html = document.documentElement;
295
- const saved = html.style.overflow;
296
- html.style.overflow = 'hidden';
297
- html.offsetHeight; // trigger reflow
298
- html.style.overflow = saved;
299
- });
300
- }
301
-
302
- // Swap text → logo when the GlobalNavBar scrolls out of view.
303
- const globalNav = document.querySelector('[data-astro-transition-persist="global-nav-bar"]');
304
- if (globalNav) {
305
- const observer = new IntersectionObserver(
306
- ([entry]) => {
307
- this.classList.toggle('igd-docs-subheader--pinned', !entry.isIntersecting);
308
- },
309
- { threshold: 0 }
310
- );
311
- observer.observe(globalNav);
312
-
313
- // On page navigation, always reset to the unpinned state.
314
- // The observer fires mid-transition (GlobalNavBar briefly clipped)
315
- // and would leave --pinned set when the new page loads at scroll=0.
316
- document.addEventListener('astro:before-swap', () => {
317
- this.classList.remove('igd-docs-subheader--pinned');
318
- });
319
- }
320
-
321
- // Close open selects on scroll, and prevent the browser's
322
- // focus-triggered scrollIntoView from jumping the page when a
323
- // select is clicked while the user is scrolled down.
324
- const selectsForScroll = Array.from(
325
- this.querySelectorAll<HTMLElement>('#package-select, #version-select')
326
- );
327
- selectsForScroll.forEach(select => {
328
- let savedY: number | null = null;
329
- let guardTimer: ReturnType<typeof setTimeout> | null = null;
330
-
331
- // pointerdown fires before focus is assigned to save scroll position
332
- select.addEventListener('pointerdown', () => {
333
- savedY = window.scrollY;
334
- if (guardTimer) clearTimeout(guardTimer);
335
- guardTimer = setTimeout(() => { savedY = null; guardTimer = null; }, 300);
336
- });
337
-
338
- window.addEventListener('scroll', () => {
339
- if (savedY !== null) {
340
- window.scrollTo({ top: savedY, left: 0, behavior: 'instant' });
341
- return;
342
- }
343
- if ((select as any).open) (select as any).hide();
344
- }, { passive: true });
345
- });
346
282
  }
347
283
  }
348
284
 
@@ -351,8 +287,51 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
351
287
  </script>
352
288
 
353
289
  <script>
354
- import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent } from 'igniteui-webcomponents';
355
- import '../../scripts/icon-registry';
356
- defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent);
290
+ import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent } from 'igniteui-webcomponents';
291
+ import { registerIcons } from '../../scripts/icon-registry';
292
+ defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent);
293
+ registerIcons();
294
+
295
+ function getPlatformIcon(text: string): string | null {
296
+ const t = text.toLowerCase();
297
+ if (t.includes('angular')) return 'angular-logo';
298
+ if (t.includes('react')) return 'react-logo';
299
+ if (t.includes('blazor')) return 'blazor-logo';
300
+ if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc')) return 'wc-logo';
301
+ return null;
302
+ }
303
+
304
+ function syncTriggerIcon(select: Element, val: string) {
305
+ const icon = getPlatformIcon(val);
306
+ let prefixIcon = select.querySelector<any>(':scope > igc-icon[slot="prefix"]');
307
+ if (icon) {
308
+ if (!prefixIcon) {
309
+ prefixIcon = document.createElement('igc-icon') as any;
310
+ prefixIcon.setAttribute('slot', 'prefix');
311
+ prefixIcon.setAttribute('aria-hidden', 'true');
312
+ prefixIcon.setAttribute('collection', 'docs');
313
+ select.prepend(prefixIcon);
314
+ }
315
+ prefixIcon.setAttribute('name', icon);
316
+ } else if (prefixIcon) {
317
+ prefixIcon.remove();
318
+ }
319
+ }
320
+
321
+ function initSelectors() {
322
+ const packageSelect = document.querySelector('#package-select');
323
+ if (packageSelect) {
324
+ packageSelect.addEventListener('igcChange', (e: Event) => {
325
+ const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
326
+ const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
327
+ syncTriggerIcon(packageSelect, val);
328
+ const href = item?.dataset?.href;
329
+ if (href) window.location.href = href;
330
+ });
331
+ }
332
+ }
333
+
334
+ document.addEventListener('astro:page-load', initSelectors);
335
+ initSelectors();
357
336
  </script>
358
337
 
@@ -1,7 +1,6 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
2
 
3
3
  @layer components {
4
-
5
4
  .igd-docs-subheader {
6
5
  position: sticky;
7
6
  inset: 0;
@@ -19,55 +18,67 @@
19
18
  z-index: 1;
20
19
  background-color: var(--igd-layout-sections-bg);
21
20
  view-transition-name: docs-subheader;
21
+ padding-inline-start: rem(24px);
22
22
 
23
23
  .igd-logo {
24
24
  display: flex;
25
25
  align-items: center;
26
26
  height: 100%;
27
- padding-inline: rem(32px) rem(16px);
28
-
29
- > svg {
30
- min-width: rem(79px);
31
- height: rem(22px);
32
- opacity: 0;
33
- transition: opacity 200ms ease, transform 200ms ease;
34
- position: absolute;
27
+ padding-inline: 0 rem(16px);
35
28
 
36
- .logo-type {
37
- fill: var(--igd-logo-type);
29
+ .igd-logo__text {
30
+ display: flex;
31
+ flex-direction: column;
32
+ justify-content: center;
33
+
34
+ > h1 {
35
+ @include type-style('h3') {
36
+ margin-block-end: rem(6px);
37
+ line-height: 1;
38
+ };
39
+
40
+ color: var(--ig-gray-800);
38
41
  }
39
42
  }
40
43
 
41
- > .igd-logo-text {
42
- @include type-style('body-2') {
44
+ .igd-logo__platform {
45
+ @include type-style('subtitle', false) {
46
+ line-height: 1;
43
47
  margin: 0;
44
48
  };
45
-
46
- opacity: 1;
47
- transition: opacity 200ms ease, transform 200ms ease;
49
+
50
+ color: var(--ig-gray-500);
51
+
48
52
  }
49
-
50
- border-inline-end: var(--igd-app-outline);
51
53
  }
52
-
53
- // Logo area: text visible by default, logo hidden.
54
- // When the GlobalNavBar scrolls out of view, .docs-subheader--pinned is added
55
- // and the logo fades in while the text fades out.
56
- &--pinned {
57
- .igd-logo {
58
- svg {
59
- opacity: 1;
60
- transform: translateY(0);
61
- position: relative;
62
- }
63
-
64
- .igd-logo-text {
65
- opacity: 0;
66
- transform: translateY(4px);
67
- position: absolute;
68
- pointer-events: none;
69
- }
70
- }
54
+
55
+ // TODO THIS AND THE FILTER CAN BE UNDEr ONCE CLASS SINCE THE THEME IS THE SAME NO NEED TO REPEAT
56
+ igc-input {
57
+ --ig-input-group-input-suffix-color: light-dark(var(--ig-gray-900), var(--ig-gray-800));
58
+ --ig-input-group-input-suffix-color--filled: light-dark(var(--ig-gray-900), var(--ig-gray-800));
59
+ --ig-input-group-input-suffix-color--focused: light-dark(var(--ig-gray-900), var(--ig-gray-800));
60
+ --ig-input-group-idle-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-800));
61
+ --ig-input-group-filled-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-900));
62
+ --ig-input-group-placeholder-color: var(--ig-gray-500);
63
+ --ig-input-group-hover-placeholder-color: var(--ig-gray-500);
64
+
65
+ --input-prefix-background: transparent;
66
+ --input-prefix-background--focused: transparent;
67
+ --input-prefix-background--filled: transparent;
68
+
69
+ --input-suffix-background: transparent;
70
+ --input-suffix-background--focused: transparent;
71
+ --input-suffix-background--filled: transparent;
72
+
73
+ --ig-flat-button-hover-background: transparent;
74
+ --ig-flat-button-focus-background: transparent;
75
+ --ig-flat-button-icon-color-hover: var(--igd-accent);
76
+ --ig-flat-button-icon-color-focus: var(--igd-accent);
77
+ --border-border-radius: var(--igd-border-radius-xl);
78
+ --border-background: light-dark(var(--ig-gray-50), var(--ig-gray-50));
79
+ --border-color: var(--ig-gray-400);
80
+ --hover-border-color: var(--ig-gray-400);
81
+ --focused-border-color: var(--igd-accent);
71
82
  }
72
83
  }
73
84
 
@@ -77,13 +88,28 @@
77
88
  height: 100%;
78
89
  gap: rem(16px);
79
90
  min-width: 0;
80
-
81
- > igc-select:first-of-type {
82
- margin-inline-start: auto;
83
- }
91
+ justify-content: end;
84
92
 
85
93
  &:last-child {
86
- margin-inline-end: rem(32px);
94
+ margin-inline-end: rem(24px);
95
+ }
96
+
97
+ > igc-input {
98
+ --border-color: transparent;
99
+ --hover-border-color: transparent;
100
+ --size: #{rem(38px)};
101
+
102
+ &::part(container) {
103
+ &::before {
104
+ display: none;
105
+ }
106
+ }
107
+
108
+ &:focus-within {
109
+ &::part(container) {
110
+ border-color: var(--focused-border-color);
111
+ }
112
+ }
87
113
  }
88
114
  }
89
115
 
@@ -104,29 +130,10 @@
104
130
  }
105
131
  }
106
132
 
107
- .igd-version-select {
108
- &::part(native-input) {
109
- field-sizing: content;
110
- }
111
- }
112
-
133
+ .igd-version-select,
113
134
  .igd-package-select {
114
- &::part(prefix),
115
- &::part(toggle-icon) {
116
- flex-shrink: 0;
117
- }
118
-
119
- &::part(input) {
120
- min-width: 0;
121
- overflow: hidden;
122
- }
123
-
124
135
  &::part(native-input) {
125
136
  field-sizing: content;
126
- min-width: 0;
127
- overflow: hidden;
128
- text-overflow: ellipsis;
129
- white-space: nowrap;
130
137
  }
131
138
  }
132
139
 
@@ -146,65 +153,6 @@
146
153
 
147
154
  --active-foreground: var(--igd-accent);
148
155
  --active-background: transparent;
149
-
150
- .toggle-icon--hamburger {
151
- display: none;
152
- }
153
- }
154
-
155
- // When the subheader becomes sticky, swap dropdown-indicator → hamburger.
156
- .igd-docs-subheader--pinned .subheader-sidebar-toggle {
157
- .toggle-icon--dropdown {
158
- display: none;
159
- }
160
-
161
- .toggle-icon--hamburger {
162
- display: flex;
163
- }
164
- }
165
-
166
- // Theme toggle: show sun in dark mode, moon in light mode.
167
- .subheader-theme-toggle {
168
- --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-900));
169
- --background: transparent;
170
- --border-color: transparent;
171
-
172
- --hover-foreground: var(--igd-accent);
173
- --hover-background: transparent;
174
-
175
- --focus-foreground: var(--igd-accent);
176
- --focus-background: transparent;
177
-
178
- --active-foreground: var(--igd-accent);
179
- --active-background: transparent;
180
-
181
- .theme-icon {
182
- display: flex;
183
- }
184
-
185
- .theme-icon--moon {
186
- display: none;
187
- }
188
-
189
- :root[data-theme='dark'] & {
190
- .theme-icon--sun {
191
- display: flex;
192
- }
193
-
194
- .theme-icon--moon {
195
- display: none;
196
- }
197
- }
198
-
199
- :root:not([data-theme='dark']) & {
200
- .theme-icon--sun {
201
- display: none;
202
- }
203
-
204
- .theme-icon--moon {
205
- display: flex;
206
- }
207
- }
208
156
  }
209
157
 
210
158
  #package-tooltip {
@@ -32,12 +32,14 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
32
32
  ---
33
33
 
34
34
  {nodes.length > 0 && (
35
- <docs-toc class="toc-sidebar" data-offset-target={offsetTarget}>
36
- <h2 class="toc-sidebar__heading" id="toc-heading">{label}</h2>
37
- <nav aria-labelledby="toc-heading">
38
- <DocsTree nodes={nodes} variant="toc" />
39
- </nav>
40
- </docs-toc>
35
+ <aside class="toc-wrapper">
36
+ <docs-toc class="toc-sidebar" data-offset-target={offsetTarget}>
37
+ <h2 class="toc-sidebar__heading" id="toc-heading">{label}</h2>
38
+ <nav aria-labelledby="toc-heading">
39
+ <DocsTree nodes={nodes} variant="toc" />
40
+ </nav>
41
+ </docs-toc>
42
+ </aside>
41
43
  )}
42
44
 
43
45
  <script>
@@ -69,7 +71,7 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
69
71
  this.resizeObserver?.disconnect();
70
72
  this.resizeObserver = undefined;
71
73
  this.offsetEl = null;
72
- document.documentElement.style.removeProperty('scroll-padding-top');
74
+ document.documentElement.style.removeProperty('--igd-toc-subheader-bottom');
73
75
  if (this.rafId !== undefined) {
74
76
  cancelAnimationFrame(this.rafId);
75
77
  this.rafId = undefined;
@@ -154,6 +156,8 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
154
156
  if (!this.offsetEl) return;
155
157
 
156
158
  this.syncScrollPadding();
159
+ // Re-sync after layout settles (fonts, reflow) on initial load / navigation.
160
+ requestAnimationFrame(() => this.syncScrollPadding());
157
161
 
158
162
  // Re-measure when the header itself resizes (responsive collapse,
159
163
  // font-load reflow, etc.).
@@ -163,8 +167,9 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
163
167
 
164
168
  private syncScrollPadding() {
165
169
  if (!this.offsetEl) return;
166
- const px = Math.round(this.offsetEl.getBoundingClientRect().bottom + 8);
167
- document.documentElement.style.scrollPaddingTop = `${px}px`;
170
+ const px = Math.round(this.offsetEl.getBoundingClientRect().bottom);
171
+ // Write only the measured subheader height; the CSS adds --igd-toc-scroll-offset on top.
172
+ document.documentElement.style.setProperty('--igd-toc-subheader-bottom', `${px}px`);
168
173
  }
169
174
 
170
175
  private update() {
@@ -267,4 +272,3 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
267
272
  });
268
273
  });
269
274
  </script>
270
-
@@ -10,20 +10,22 @@
10
10
  top: var(--igd-header-height);
11
11
  max-width: var(--ig-toc-width);
12
12
  width: 100%;
13
- min-width: rem(280px);
13
+ min-width: rem(256px);
14
14
  max-height: calc(100vh - var(--igd-header-height));
15
15
  overflow-y: auto;
16
- padding: rem(24px);
16
+ padding-block: rem(24px);
17
+ }
18
+
19
+ .toc-wrapper {
17
20
  border-inline-end: var(--igd-app-outline);
18
21
  border-block-end: var(--igd-app-outline);
19
22
  background-color: var(--igd-layout-sections-bg);
23
+ height: 100%;
20
24
  }
21
25
 
22
26
 
23
27
  .toc-sidebar__heading {
24
- @include type-style('body-2') {
25
- margin: 0;
26
- };
28
+ @include type-style('body-2');
27
29
 
28
30
  color: var(--ig-gray-500);
29
31
  padding-block-end: rem(8px);