igniteui-astro-components 0.0.26 → 0.0.28
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.
- package/README.md +82 -74
- package/package.json +16 -9
- package/src/components/CopyCode/CopyCode.astro +21 -7
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
- package/src/components/DocsBreadcrumb/README.md +10 -14
- package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
- package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
- package/src/components/DocsSidebar/README.md +25 -21
- package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
- package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
- package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
- package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
- package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -185
- package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -169
- package/src/components/DocsSubHeader/README.md +18 -16
- package/src/components/DocsToc/DocsToc.astro +301 -280
- package/src/components/DocsToc/DocsToc.scss +20 -21
- package/src/components/DocsToc/README.md +11 -9
- package/src/components/DocsToc/toTreeNodes.ts +3 -8
- package/src/components/DocsTree/DocsTree.astro +32 -20
- package/src/components/DocsTree/DocsTreeItem.astro +35 -30
- package/src/components/DocsTree/README.md +16 -15
- package/src/components/DocsTree/docs-tree.scss +267 -268
- package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
- package/src/components/GlobalFooter/README.md +3 -2
- package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
- package/src/components/GlobalNavBar/README.md +3 -2
- package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
- package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
- package/src/components/MobileSidebarToggle/README.md +3 -2
- package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
- package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
- package/src/components/Search/README.md +1 -0
- package/src/components/Search/Search.astro +137 -109
- package/src/components/Search/Search.scss +20 -20
- package/src/components/SearchAdvanced/README.md +21 -15
- package/src/components/SearchAdvanced/SearchAdvanced.astro +220 -133
- package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
- package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
- package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
- package/src/components/mdx/ApiLink/README.md +26 -22
- package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
- package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
- package/src/components/mdx/ApiRef/README.md +20 -15
- package/src/components/mdx/Badge/Badge.astro +14 -14
- package/src/components/mdx/Badge/Badge.scss +61 -56
- package/src/components/mdx/Badge/README.md +24 -19
- package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
- package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
- package/src/components/mdx/DocsAside/README.md +22 -22
- package/src/components/mdx/Faq/Faq.astro +86 -0
- package/src/components/mdx/Faq/Faq.scss +105 -0
- package/src/components/mdx/Faq/FaqItem.astro +117 -0
- package/src/components/mdx/Faq/README.md +223 -0
- package/src/components/mdx/Faq/types.ts +34 -0
- package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
- package/src/components/mdx/PlatformBlock/README.md +6 -8
- package/src/components/mdx/Sample/README.md +21 -16
- package/src/components/mdx/Sample/Sample.astro +97 -74
- package/src/components/mdx/Sample/Sample.scss +132 -132
- package/src/content-helper.ts +71 -72
- package/src/content.config.ts +1 -6
- package/src/integration.ts +566 -512
- package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
- package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
- package/src/layouts/DocsLayout/README.md +24 -35
- package/src/lib/nav-helpers.ts +88 -82
- package/src/lib/types.ts +76 -76
- package/src/llms.ts +205 -166
- package/src/platform.ts +312 -162
- package/src/plugins/rehype-heading-anchors.ts +45 -45
- package/src/plugins/rehype-pagefind-ignore.ts +19 -19
- package/src/plugins/rehype-table-wrapper.ts +30 -30
- package/src/plugins/remark-docfx.ts +12 -0
- package/src/plugins/remark-env-vars.ts +12 -4
- package/src/plugins/remark-md-links.ts +10 -4
- package/src/scripts/icon-manifest.ts +13 -5
- package/src/scripts/sample-widget.ts +557 -501
- package/src/sidebar.ts +103 -97
- package/src/styles/global/_code-blocks.scss +43 -44
- package/src/styles/global/_component-themes.scss +151 -153
- package/src/styles/global/_icon-gallery.scss +81 -81
- package/src/styles/global/_index.scss +0 -1
- package/src/styles/global/_markdown.scss +816 -787
- package/src/styles/global/_palette.scss +456 -110
- package/src/styles/global/_search-shared.scss +402 -398
- package/src/styles/global/_type-scale.scss +127 -127
- package/src/styles/global/_variables.scss +138 -111
- package/src/styles/theme.scss +49 -40
- package/src/virtual-modules.d.ts +11 -2
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
* moved to the `DocsBreadcrumb` component, rendered inside the main frame.
|
|
14
14
|
*/
|
|
15
15
|
import { platform as virtualPlatform } from 'virtual:docs-template/nav-html';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
productLinks,
|
|
18
|
+
sidebar as sidebarData,
|
|
19
|
+
title as siteTitle,
|
|
20
|
+
packages as virtualPackages,
|
|
21
|
+
selectedPackage as virtualSelectedPackage,
|
|
22
|
+
} from 'virtual:docs-template/site-meta';
|
|
17
23
|
import Search from '../Search/Search.astro';
|
|
18
24
|
import type { SidebarEntry } from '../../lib/sidebar/types';
|
|
19
25
|
import { getBreadcrumb } from '../../lib/sidebar/helpers';
|
|
@@ -28,10 +34,11 @@ const PLATFORM_ICONS: Record<string, string> = {
|
|
|
28
34
|
|
|
29
35
|
function getPlatformIcon(text: string): string | null {
|
|
30
36
|
const t = text.toLowerCase();
|
|
31
|
-
if (t.includes('angular'))
|
|
32
|
-
if (t.includes('react'))
|
|
33
|
-
if (t.includes('blazor'))
|
|
34
|
-
if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc'))
|
|
37
|
+
if (t.includes('angular')) return 'angular-logo';
|
|
38
|
+
if (t.includes('react')) return 'react-logo';
|
|
39
|
+
if (t.includes('blazor')) return 'blazor-logo';
|
|
40
|
+
if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc'))
|
|
41
|
+
return 'wc-logo';
|
|
35
42
|
return null;
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -112,14 +119,20 @@ const filteredLinks = resolvedLinks.filter((l: ProductLink) => l.platform !== cu
|
|
|
112
119
|
type PackageEntry = string | { label: string; value?: string; href?: string };
|
|
113
120
|
const rawPackages = packagesProp ?? (virtualPackages?.length > 0 ? virtualPackages : undefined);
|
|
114
121
|
const packages = (rawPackages as PackageEntry[] | undefined)?.map((p: PackageEntry) =>
|
|
115
|
-
|
|
122
|
+
typeof p === 'string'
|
|
123
|
+
? { label: p, value: p, href: undefined }
|
|
124
|
+
: { label: p.label, value: p.value ?? p.label, href: p.href },
|
|
116
125
|
);
|
|
117
|
-
const selectedPackage =
|
|
118
|
-
|
|
126
|
+
const selectedPackage =
|
|
127
|
+
selectedPackageProp ?? (virtualSelectedPackage || undefined) ?? packages?.[0]?.value;
|
|
128
|
+
const platformIcon =
|
|
129
|
+
PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
|
|
130
|
+
const selectedPackageLabel =
|
|
131
|
+
packages?.find((p) => p.value === selectedPackage)?.label ?? selectedPackage ?? '';
|
|
119
132
|
|
|
120
133
|
const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
|
|
121
134
|
const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
|
|
122
|
-
const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs :
|
|
135
|
+
const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : pageTitle ? [pageTitle] : [];
|
|
123
136
|
|
|
124
137
|
const PLATFORM_LABELS: Record<string, string> = {
|
|
125
138
|
angular: 'Angular',
|
|
@@ -131,208 +144,266 @@ const platformLabel = currentPlatform ? (PLATFORM_LABELS[currentPlatform] ?? nul
|
|
|
131
144
|
---
|
|
132
145
|
|
|
133
146
|
<docs-subheader-menu class="igd-docs-subheader" data-platform={currentPlatform ?? ''}>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
<div class="igd-logo">
|
|
148
|
+
<!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
|
|
149
|
+
<igc-icon-button
|
|
150
|
+
class="subheader-sidebar-toggle"
|
|
151
|
+
variant="flat"
|
|
152
|
+
data-sidebar-toggle
|
|
153
|
+
aria-label="Toggle sidebar navigation"
|
|
154
|
+
aria-expanded="false"
|
|
155
|
+
title="Toggle sidebar"
|
|
156
|
+
>
|
|
157
|
+
<igc-icon name="hamburger-menu" collection="docs" aria-hidden="true"></igc-icon>
|
|
158
|
+
</igc-icon-button>
|
|
159
|
+
<div class="igd-logo__text">
|
|
160
|
+
{/* Keep as <span>, not <h1> — avoids competing with the page <h1> in search. */}
|
|
161
|
+
<span class="igd-logo-text">{logoText}</span>
|
|
162
|
+
{platformLabel && <span class="igd-logo__platform">for {platformLabel}</span>}
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
151
165
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
166
|
+
<div class="igd-docs-subheader__content">
|
|
167
|
+
<!-- Search (overridable via named slot) -->
|
|
168
|
+
<slot name="search"><Search /></slot>
|
|
155
169
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)}
|
|
171
|
-
|
|
172
|
-
<!-- Version selector -->
|
|
173
|
-
{versions && versions.length > 0 && (
|
|
174
|
-
<igc-select distance="4" id="version-select" class="igd-version-select" outlined value={selectedVersion} aria-label={versionLabel}>
|
|
175
|
-
{versions.map((v) => (
|
|
176
|
-
<igc-select-item value={v}>{v}</igc-select-item>
|
|
177
|
-
))}
|
|
178
|
-
</igc-select>
|
|
170
|
+
{/* Package selector */}
|
|
171
|
+
{
|
|
172
|
+
packages && packages.length > 0 && (
|
|
173
|
+
<>
|
|
174
|
+
<igc-select
|
|
175
|
+
distance="4"
|
|
176
|
+
id="package-select"
|
|
177
|
+
class="igd-package-select"
|
|
178
|
+
outlined
|
|
179
|
+
value={selectedPackage}
|
|
180
|
+
aria-label={packageLabel}
|
|
181
|
+
>
|
|
182
|
+
{platformIcon && (
|
|
183
|
+
<igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true" />
|
|
179
184
|
)}
|
|
185
|
+
{packages.map((p) => {
|
|
186
|
+
const icon = getPlatformIcon(p.value ?? '') ?? getPlatformIcon(p.label ?? '');
|
|
187
|
+
return (
|
|
188
|
+
<igc-select-item value={p.value} data-href={p.href}>
|
|
189
|
+
{icon && (
|
|
190
|
+
<igc-icon slot="prefix" name={icon} collection="docs" aria-hidden="true" />
|
|
191
|
+
)}
|
|
192
|
+
{p.label}
|
|
193
|
+
</igc-select-item>
|
|
194
|
+
);
|
|
195
|
+
})}
|
|
196
|
+
</igc-select>
|
|
197
|
+
<igc-tooltip
|
|
198
|
+
id="package-tooltip"
|
|
199
|
+
class="igd-package-select-tooltip"
|
|
200
|
+
anchor="package-select"
|
|
201
|
+
placement="bottom"
|
|
202
|
+
with-arrow
|
|
203
|
+
>
|
|
204
|
+
{selectedPackageLabel}
|
|
205
|
+
</igc-tooltip>
|
|
206
|
+
</>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
180
209
|
|
|
210
|
+
<!-- Version selector -->
|
|
211
|
+
{
|
|
212
|
+
versions && versions.length > 0 && (
|
|
213
|
+
<igc-select
|
|
214
|
+
distance="4"
|
|
215
|
+
id="version-select"
|
|
216
|
+
class="igd-version-select"
|
|
217
|
+
outlined
|
|
218
|
+
value={selectedVersion}
|
|
219
|
+
aria-label={versionLabel}
|
|
220
|
+
>
|
|
221
|
+
{versions.map((v) => (
|
|
222
|
+
<igc-select-item value={v}>{v}</igc-select-item>
|
|
223
|
+
))}
|
|
224
|
+
</igc-select>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
181
227
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
228
|
+
<!-- TODO WHY WE NEED THIS? -->
|
|
229
|
+
<!--{filteredLinks.length > 0 && (-->
|
|
230
|
+
<!-- <div class="subheader-links">-->
|
|
231
|
+
<!-- {filteredLinks.map((link, i) => (-->
|
|
232
|
+
<!-- <>-->
|
|
233
|
+
<!-- {i > 0 && <span class="product-sep" aria-hidden="true">|</span>}-->
|
|
234
|
+
<!-- <a href={link.href} class="product-link">{link.label}</a>-->
|
|
235
|
+
<!-- </>-->
|
|
236
|
+
<!-- ))}-->
|
|
237
|
+
<!-- </div>-->
|
|
238
|
+
<!--)}-->
|
|
239
|
+
</div>
|
|
194
240
|
</docs-subheader-menu>
|
|
195
241
|
|
|
196
242
|
<script>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// Preserve the full label for accessibility and hover disclosure.
|
|
215
|
-
nativeInput.setAttribute('aria-label', text);
|
|
216
|
-
nativeInput.title = text;
|
|
243
|
+
if (!customElements.get('docs-subheader-menu')) {
|
|
244
|
+
class DocsSubHeaderMenu extends HTMLElement {
|
|
245
|
+
connectedCallback() {
|
|
246
|
+
// Package selector navigation
|
|
247
|
+
const packageSelect = this.querySelector('#package-select');
|
|
248
|
+
const packageTooltip = this.querySelector<any>('#package-tooltip');
|
|
249
|
+
if (packageSelect) {
|
|
250
|
+
// Truncates the native input value directly so the '\u2026' is baked in,
|
|
251
|
+
// Keep the full package label in the native input and apply truncation
|
|
252
|
+
// only as a visual style so assistive technologies still get the full text.
|
|
253
|
+
function applyTriggerTruncation() {
|
|
254
|
+
const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
|
|
255
|
+
const nativeInput = igcInput?.shadowRoot?.querySelector(
|
|
256
|
+
'input',
|
|
257
|
+
) as HTMLInputElement | null;
|
|
258
|
+
if (!nativeInput || !nativeInput.value) return;
|
|
217
259
|
|
|
218
|
-
|
|
219
|
-
nativeInput.style.overflow = 'hidden';
|
|
220
|
-
nativeInput.style.textOverflow = 'ellipsis';
|
|
221
|
-
nativeInput.style.whiteSpace = 'nowrap';
|
|
222
|
-
}
|
|
260
|
+
const text = nativeInput.value;
|
|
223
261
|
|
|
224
|
-
|
|
225
|
-
|
|
262
|
+
// Preserve the full label for accessibility and hover disclosure.
|
|
263
|
+
nativeInput.setAttribute('aria-label', text);
|
|
264
|
+
nativeInput.title = text;
|
|
226
265
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
266
|
+
// Apply truncation only to the rendered text.
|
|
267
|
+
nativeInput.style.overflow = 'hidden';
|
|
268
|
+
nativeInput.style.textOverflow = 'ellipsis';
|
|
269
|
+
nativeInput.style.whiteSpace = 'nowrap';
|
|
270
|
+
}
|
|
232
271
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
|
|
236
|
-
const href = item?.dataset?.href;
|
|
237
|
-
if (href) window.location.href = href;
|
|
238
|
-
// Sync tooltip content with the new selection label
|
|
239
|
-
if (packageTooltip) {
|
|
240
|
-
packageTooltip.textContent = item?.textContent?.trim() ?? val;
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
// Only show the package tooltip when the label is visually truncated
|
|
245
|
-
if (packageTooltip && packageSelect) {
|
|
246
|
-
packageTooltip.addEventListener('igcOpening', (e: Event) => {
|
|
247
|
-
const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
|
|
248
|
-
const nativeInput = igcInput?.shadowRoot?.querySelector('input');
|
|
249
|
-
// Show when we applied manual truncation (ends with '\u2026') or
|
|
250
|
-
// when there is natural CSS overflow.
|
|
251
|
-
const truncated = nativeInput?.value?.endsWith('\u2026');
|
|
252
|
-
const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
|
|
253
|
-
if (!truncated && !overflows) {
|
|
254
|
-
e.preventDefault();
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
272
|
+
// Run after igcInput's Lit render cycle settles (two rAFs = after microtasks + first paint)
|
|
273
|
+
requestAnimationFrame(() => requestAnimationFrame(() => applyTriggerTruncation()));
|
|
258
274
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
document.body.toggleAttribute('data-sidebar-open', !expanded);
|
|
265
|
-
sidebarBtn.setAttribute('aria-expanded', String(!expanded));
|
|
266
|
-
});
|
|
267
|
-
}
|
|
275
|
+
// igcInput re-renders with the full text each time the dropdown closes;
|
|
276
|
+
// re-apply truncation afterwards.
|
|
277
|
+
packageSelect.addEventListener('igcClosed', () =>
|
|
278
|
+
requestAnimationFrame(() => applyTriggerTruncation()),
|
|
279
|
+
);
|
|
268
280
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
281
|
+
packageSelect.addEventListener('igcChange', (e: Event) => {
|
|
282
|
+
const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
|
|
283
|
+
const item = packageSelect.querySelector<HTMLElement>(
|
|
284
|
+
`igc-select-item[value="${val}"]`,
|
|
285
|
+
);
|
|
286
|
+
const href = item?.dataset?.href;
|
|
287
|
+
if (href) window.location.href = href;
|
|
288
|
+
// Sync tooltip content with the new selection label
|
|
289
|
+
if (packageTooltip) {
|
|
290
|
+
packageTooltip.textContent = item?.textContent?.trim() ?? val;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// Only show the package tooltip when the label is visually truncated
|
|
295
|
+
if (packageTooltip && packageSelect) {
|
|
296
|
+
// Hide tooltip when the dropdown opens
|
|
297
|
+
packageSelect.addEventListener('igcOpening', () => packageTooltip.hide?.());
|
|
277
298
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
299
|
+
packageTooltip.addEventListener('igcOpening', (e: Event) => {
|
|
300
|
+
// Never show tooltip while the dropdown is open
|
|
301
|
+
if ((packageSelect as any).open) {
|
|
302
|
+
e.preventDefault();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
|
|
306
|
+
const nativeInput = igcInput?.shadowRoot?.querySelector('input');
|
|
307
|
+
// Show when we applied manual truncation (ends with '\u2026') or
|
|
308
|
+
// when there is natural CSS overflow.
|
|
309
|
+
const truncated = nativeInput?.value?.endsWith('\u2026');
|
|
310
|
+
const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
|
|
311
|
+
if (!truncated && !overflows) {
|
|
312
|
+
e.preventDefault();
|
|
283
313
|
}
|
|
314
|
+
});
|
|
284
315
|
}
|
|
285
316
|
|
|
286
|
-
|
|
317
|
+
// Sidebar toggle
|
|
318
|
+
const sidebarBtn = this.querySelector<HTMLButtonElement>('[data-sidebar-toggle]');
|
|
319
|
+
if (sidebarBtn) {
|
|
320
|
+
sidebarBtn.addEventListener('click', () => {
|
|
321
|
+
const expanded = document.body.hasAttribute('data-sidebar-open');
|
|
322
|
+
document.body.toggleAttribute('data-sidebar-open', !expanded);
|
|
323
|
+
sidebarBtn.setAttribute('aria-expanded', String(!expanded));
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Close sidebar on Escape
|
|
328
|
+
document.addEventListener('keyup', (e: KeyboardEvent) => {
|
|
329
|
+
if (e.key === 'Escape' && document.body.hasAttribute('data-sidebar-open')) {
|
|
330
|
+
document.body.removeAttribute('data-sidebar-open');
|
|
331
|
+
sidebarBtn?.setAttribute('aria-expanded', 'false');
|
|
332
|
+
sidebarBtn?.focus();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// Close sidebar on page navigation
|
|
337
|
+
document.addEventListener('astro:page-load', () => {
|
|
338
|
+
document.body.removeAttribute('data-sidebar-open');
|
|
339
|
+
sidebarBtn?.setAttribute('aria-expanded', 'false');
|
|
340
|
+
});
|
|
341
|
+
}
|
|
287
342
|
}
|
|
343
|
+
|
|
344
|
+
customElements.define('docs-subheader-menu', DocsSubHeaderMenu);
|
|
345
|
+
}
|
|
288
346
|
</script>
|
|
289
347
|
|
|
290
348
|
<script>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
349
|
+
import {
|
|
350
|
+
defineComponents,
|
|
351
|
+
IgcIconComponent,
|
|
352
|
+
IgcIconButtonComponent,
|
|
353
|
+
IgcSelectComponent,
|
|
354
|
+
IgcSelectItemComponent,
|
|
355
|
+
IgcTooltipComponent,
|
|
356
|
+
} from 'igniteui-webcomponents';
|
|
357
|
+
import { registerIcons } from '../../scripts/icon-registry';
|
|
358
|
+
defineComponents(
|
|
359
|
+
IgcIconComponent,
|
|
360
|
+
IgcIconButtonComponent,
|
|
361
|
+
IgcSelectComponent,
|
|
362
|
+
IgcSelectItemComponent,
|
|
363
|
+
IgcTooltipComponent,
|
|
364
|
+
);
|
|
365
|
+
registerIcons();
|
|
295
366
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
367
|
+
function getPlatformIcon(text: string): string | null {
|
|
368
|
+
const t = text.toLowerCase();
|
|
369
|
+
if (t.includes('angular')) return 'angular-logo';
|
|
370
|
+
if (t.includes('react')) return 'react-logo';
|
|
371
|
+
if (t.includes('blazor')) return 'blazor-logo';
|
|
372
|
+
if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc'))
|
|
373
|
+
return 'wc-logo';
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
304
376
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
377
|
+
function syncTriggerIcon(select: Element, val: string) {
|
|
378
|
+
const icon = getPlatformIcon(val);
|
|
379
|
+
let prefixIcon = select.querySelector<any>(':scope > igc-icon[slot="prefix"]');
|
|
380
|
+
if (icon) {
|
|
381
|
+
if (!prefixIcon) {
|
|
382
|
+
prefixIcon = document.createElement('igc-icon') as any;
|
|
383
|
+
prefixIcon.setAttribute('slot', 'prefix');
|
|
384
|
+
prefixIcon.setAttribute('aria-hidden', 'true');
|
|
385
|
+
prefixIcon.setAttribute('collection', 'docs');
|
|
386
|
+
select.prepend(prefixIcon);
|
|
387
|
+
}
|
|
388
|
+
prefixIcon.setAttribute('name', icon);
|
|
389
|
+
} else if (prefixIcon) {
|
|
390
|
+
prefixIcon.remove();
|
|
320
391
|
}
|
|
392
|
+
}
|
|
321
393
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
394
|
+
function initSelectors() {
|
|
395
|
+
const packageSelect = document.querySelector('#package-select');
|
|
396
|
+
if (packageSelect) {
|
|
397
|
+
packageSelect.addEventListener('igcChange', (e: Event) => {
|
|
398
|
+
const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
|
|
399
|
+
const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
|
|
400
|
+
syncTriggerIcon(packageSelect, val);
|
|
401
|
+
const href = item?.dataset?.href;
|
|
402
|
+
if (href) window.location.href = href;
|
|
403
|
+
});
|
|
333
404
|
}
|
|
405
|
+
}
|
|
334
406
|
|
|
335
|
-
|
|
336
|
-
|
|
407
|
+
document.addEventListener('astro:page-load', initSelectors);
|
|
408
|
+
initSelectors();
|
|
337
409
|
</script>
|
|
338
|
-
|