igniteui-astro-components 0.0.5 → 0.0.7
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 +9 -8
- package/package.json +6 -5
- package/src/components/DocsSidebar/DocsSidebar.astro +10 -2
- package/src/components/DocsSidebar/sidebar-filter.ts +26 -12
- package/src/components/DocsSubHeader/DocsSubHeader.astro +348 -48
- package/src/components/DocsSubHeader/README.md +41 -0
- package/src/components/DocsToc/toTreeNodes.ts +1 -1
- package/src/components/GlobalFooter/GlobalFooter.astro +12 -62
- package/src/components/GlobalFooter/README.md +7 -10
- package/src/components/GlobalNavBar/GlobalNavBar.astro +8 -193
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +0 -5
- package/src/components/GlobalNavBar/README.md +8 -15
- package/src/components/SearchAdvanced/README.md +105 -0
- package/src/components/SearchAdvanced/SearchAdvanced.astro +1056 -0
- package/src/components/ThemingWidget/ThemingWidget.astro +5 -10
- package/src/content.config.ts +1 -1
- package/src/integration.ts +19 -142
- package/src/layouts/DocsLayout/DocsLayout.astro +16 -6
- package/src/lib/nav-helpers.ts +11 -4
- package/src/platform.ts +9 -16
- package/src/plugins/remark-env-vars.ts +110 -0
- package/src/plugins/remark-html-transforms.ts +32 -0
- package/src/plugins/remark-md-links.ts +75 -0
- package/src/scripts/sample-widget.ts +0 -2
- package/src/sidebar.ts +6 -7
- package/src/virtual-modules.d.ts +1 -13
- package/src/plugins/remark-docfx.ts +0 -368
|
@@ -15,6 +15,21 @@ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.as
|
|
|
15
15
|
| Prop | Type | Default | Description |
|
|
16
16
|
|------|------|---------|-------------|
|
|
17
17
|
| `productLinks` | `{ label: string; href: string; platform?: string }[]` | virtual module | Override the cross-product navigation links. |
|
|
18
|
+
| `sidebarItems` | `SidebarEntry[]` | virtual module | Override the sidebar tree used for breadcrumb generation. |
|
|
19
|
+
| `packages` | `string[]` | — | Package names for the package selector dropdown. Hidden when omitted. |
|
|
20
|
+
| `selectedPackage` | `string` | — | Currently selected package (must match one of `packages`). |
|
|
21
|
+
| `packageLabel` | `string` | `'Package'` | Label rendered before the package selector. |
|
|
22
|
+
| `versions` | `string[]` | — | Version labels for the version selector dropdown. Hidden when omitted. |
|
|
23
|
+
| `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
|
|
24
|
+
| `versionLabel` | `string` | `'Version'` | Label rendered before the version selector. |
|
|
25
|
+
| `showThemeToggle` | `boolean` | `false` | Show a light/dark theme toggle button. |
|
|
26
|
+
| `themeStorageKey` | `string` | `'docs-theme'` | `localStorage` key for persisting the theme preference. |
|
|
27
|
+
|
|
28
|
+
## Slots
|
|
29
|
+
|
|
30
|
+
| Slot | Default | Description |
|
|
31
|
+
|------|---------|-------------|
|
|
32
|
+
| `search` | `<Search />` | Override the search widget rendered in the subheader. |
|
|
18
33
|
|
|
19
34
|
## Behaviour
|
|
20
35
|
|
|
@@ -41,3 +56,29 @@ const productLinks = [
|
|
|
41
56
|
|
|
42
57
|
This component is used automatically inside `DocsLayout` — you only need to
|
|
43
58
|
mount it directly when building a custom page shell.
|
|
59
|
+
|
|
60
|
+
### With package/version selectors and theme toggle
|
|
61
|
+
|
|
62
|
+
```astro
|
|
63
|
+
---
|
|
64
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
65
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
66
|
+
---
|
|
67
|
+
<DocsSubHeader
|
|
68
|
+
siteTitle="Ignite UI for Angular"
|
|
69
|
+
packages={['igniteui-angular', 'igniteui-charts']}
|
|
70
|
+
selectedPackage="igniteui-angular"
|
|
71
|
+
packageLabel="Package"
|
|
72
|
+
versions={['19.1 (latest)', '18.2', '18.1']}
|
|
73
|
+
selectedVersion="19.1 (latest)"
|
|
74
|
+
versionLabel="Version"
|
|
75
|
+
showThemeToggle
|
|
76
|
+
themeStorageKey="api-docs-theme"
|
|
77
|
+
productLinks={[]}
|
|
78
|
+
>
|
|
79
|
+
<SearchAdvanced slot="search" showScope tabs={[]} />
|
|
80
|
+
</DocsSubHeader>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The `#package-select` and `#version-select` elements emit native `change`
|
|
84
|
+
events — attach your own navigation logic via `document.getElementById`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapter: Astro `MarkdownHeading[]` → TreeNode[] for the shared DocsTree.
|
|
3
3
|
*
|
|
4
|
-
* Filters headings by `min`/`max` heading level (matching
|
|
4
|
+
* Filters headings by `min`/`max` heading level (matching the TOC
|
|
5
5
|
* config), nests them by depth, and emits TreeNodes whose `href` points
|
|
6
6
|
* at the heading's anchor (`#slug`).
|
|
7
7
|
*
|
|
@@ -2,89 +2,39 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* GlobalFooter
|
|
4
4
|
*
|
|
5
|
-
* Renders the
|
|
6
|
-
* This component is separate from Starlight's own Footer override (which
|
|
7
|
-
* provides the "Edit this page" link and pagination). Mount it INSIDE the
|
|
8
|
-
* Starlight Footer override to place it below the docs navigation footer.
|
|
5
|
+
* Renders the IG global footer directly in the light DOM.
|
|
9
6
|
*
|
|
10
7
|
* Props:
|
|
11
|
-
*
|
|
12
|
-
* lang – locale (default: 'en')
|
|
8
|
+
* lang – locale (default: 'en')
|
|
13
9
|
*/
|
|
14
10
|
interface Props {
|
|
15
|
-
|
|
16
|
-
theme?: NavTheme;
|
|
17
|
-
/** Override the locale. Defaults to virtual module navLang. */
|
|
18
|
-
lang?: NavLang;
|
|
11
|
+
lang: NavLang;
|
|
19
12
|
}
|
|
20
13
|
|
|
21
|
-
import {
|
|
22
|
-
platform as virtualPlatform,
|
|
23
|
-
navLang as virtualNavLang,
|
|
24
|
-
abPrefetched, abFooterHtml, abFooterUtilsHtml, abFooterCopyrightHtml, abContactSalesHtml,
|
|
25
|
-
} from 'virtual:docs-template/nav-html';
|
|
26
14
|
import { fetchIgNav } from '../../lib/nav-helpers.ts';
|
|
27
15
|
import styles from './GlobalFooter.module.scss';
|
|
28
|
-
import type { NavLang
|
|
16
|
+
import type { NavLang } from '../../platform.ts';
|
|
29
17
|
|
|
30
|
-
|
|
18
|
+
interface Props {
|
|
19
|
+
lang: NavLang;
|
|
20
|
+
}
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
const resolvedPlatform = theme ?? virtualPlatform ?? 'igniteui';
|
|
34
|
-
const resolvedLang = (lang ?? virtualNavLang ?? 'en') as NavLang;
|
|
22
|
+
const { lang } = Astro.props as Props;
|
|
35
23
|
|
|
36
|
-
const
|
|
37
|
-
const isIgPlatform = !isAppBuilder;
|
|
24
|
+
const resolvedLang = lang;
|
|
38
25
|
|
|
39
|
-
//
|
|
40
|
-
const igNav =
|
|
26
|
+
// Fetch footer HTML directly (cached per locale per build).
|
|
27
|
+
const igNav = await fetchIgNav(resolvedLang);
|
|
41
28
|
---
|
|
42
29
|
<div class={styles.footer} data-igd-footer>
|
|
43
30
|
|
|
44
31
|
{/* === IgniteUI / default Infragistics footer — fetched via fetchIgNav() === */}
|
|
45
32
|
{
|
|
46
|
-
|
|
33
|
+
igNav?.prefetched && (
|
|
47
34
|
<>
|
|
48
35
|
<Fragment set:html={igNav.uiFooterHtml} />
|
|
49
36
|
{igNav.footerHtml && <Fragment set:html={igNav.footerHtml} />}
|
|
50
37
|
</>
|
|
51
38
|
)
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
{/* === AppBuilder footer (prebuild) === */}
|
|
55
|
-
{
|
|
56
|
-
isAppBuilder && abPrefetched && (
|
|
57
|
-
<>
|
|
58
|
-
{abContactSalesHtml && <Fragment set:html={abContactSalesHtml} />}
|
|
59
|
-
<Fragment set:html={abFooterHtml} />
|
|
60
|
-
{abFooterUtilsHtml && <Fragment set:html={abFooterUtilsHtml} />}
|
|
61
|
-
{abFooterCopyrightHtml && <Fragment set:html={abFooterCopyrightHtml} />}
|
|
62
|
-
|
|
63
|
-
<script is:inline>
|
|
64
|
-
window.addEventListener('load', function () {
|
|
65
|
-
if (window.leadTracker && typeof window.leadTracker.execute === 'function') {
|
|
66
|
-
window.leadTracker.execute({
|
|
67
|
-
macro: 'LeadTracker', lang: 'en',
|
|
68
|
-
leadFormID: 'lead-form_2',
|
|
69
|
-
reaptchaKey: '6Lc-MFAaAAAAAIWi7UOrSUfUZnVmDUSsXjzS4BgY',
|
|
70
|
-
redirectUrl: '', thankYouMessage: '1',
|
|
71
|
-
formContainerId: 'modal-contact-sales-pricing',
|
|
72
|
-
productCode: 'B7', leadProductCode: '', packageName: '',
|
|
73
|
-
productResourceType: '', osSupport: '', installerType: '',
|
|
74
|
-
eventTypeParam: 'contact sales', eventDetailParam: 'form submitted',
|
|
75
|
-
prohibitFreeMail: true, showRequestDemo: false,
|
|
76
|
-
googleEventType: 'Form Submit',
|
|
77
|
-
googleEventLabel: 'Slingshot - Contact Sales Pricing',
|
|
78
|
-
googleEventTypeDownload: '', googleEventLabelDownload: '',
|
|
79
|
-
zoomWebinarId: ''
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (window.customModal && typeof window.customModal.init === 'function') {
|
|
83
|
-
window.customModal.init();
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
</script>
|
|
87
|
-
</>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
40
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GlobalFooter
|
|
2
2
|
|
|
3
|
-
Renders the
|
|
3
|
+
Renders the global footer in the light DOM.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -10,16 +10,13 @@ import GlobalFooter from 'igniteui-astro-components/components/GlobalFooter.astr
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type |
|
|
14
|
-
|
|
15
|
-
| `
|
|
16
|
-
| `lang` | `NavLang` | virtual module value | Override the locale (`'en'` \| `'jp'` \| `'kr'`). |
|
|
13
|
+
| Prop | Type | Description |
|
|
14
|
+
|------|------|-------------|
|
|
15
|
+
| `lang` | `NavLang` | **Required.** Locale — `'en'` \| `'jp'` \| `'kr'`. |
|
|
17
16
|
|
|
18
17
|
## Behaviour
|
|
19
18
|
|
|
20
|
-
-
|
|
21
|
-
- **Static fallback** — falls back to a minimal server-side footer in dev.
|
|
22
|
-
- Separate from Starlight's own Footer override. If you are using Starlight, mount this component *inside* the Starlight Footer override so both footers appear in the correct order.
|
|
19
|
+
- Fetches the IG footer HTML at build time via `fetchIgNav(lang)`.
|
|
23
20
|
|
|
24
21
|
## Example
|
|
25
22
|
|
|
@@ -27,9 +24,9 @@ import GlobalFooter from 'igniteui-astro-components/components/GlobalFooter.astr
|
|
|
27
24
|
---
|
|
28
25
|
import GlobalFooter from 'igniteui-astro-components/components/GlobalFooter.astro';
|
|
29
26
|
---
|
|
30
|
-
<GlobalFooter />
|
|
27
|
+
<GlobalFooter lang="en" />
|
|
31
28
|
```
|
|
32
29
|
|
|
33
30
|
## Configuration
|
|
34
31
|
|
|
35
|
-
Same as `GlobalNavBar` —
|
|
32
|
+
Same as `GlobalNavBar` — `lang` is provided automatically by `DocsLayout` from `navLang` in `virtual:docs-template/site-meta`.
|
|
@@ -2,56 +2,25 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* GlobalNavBar
|
|
4
4
|
*
|
|
5
|
-
* Renders the
|
|
6
|
-
* light DOM. Platform is driven by `siteMetaIntegration({ platform })` in
|
|
7
|
-
* astro.config.ts (exported from the virtual module) and can be overridden
|
|
8
|
-
* per-instance via the `theme` prop.
|
|
9
|
-
*
|
|
10
|
-
* Platforms:
|
|
11
|
-
* igniteui / angular / react / blazor / web-components / slingshot
|
|
12
|
-
* → IG global nav (infragistics.com). Prebuild path uses virtual module
|
|
13
|
-
* headerHtml. Static fallback renders the minimal nav server-side.
|
|
14
|
-
* appbuilder
|
|
15
|
-
* → AppBuilder nav (appbuilder.dev). Prebuild uses abHeaderHtml.
|
|
16
|
-
* Runtime fallback uses the XHR includeContent pattern.
|
|
5
|
+
* Renders the IG global navigation bar directly in the light DOM.
|
|
17
6
|
*
|
|
18
7
|
* CDN styles/scripts for each platform are already injected into <head> by
|
|
19
8
|
* getPlatformHead() in astro.config.ts — not repeated here.
|
|
20
9
|
*/
|
|
21
|
-
import {
|
|
22
|
-
platform as virtualPlatform,
|
|
23
|
-
navLang as virtualNavLang,
|
|
24
|
-
abPrefetched,
|
|
25
|
-
abHeaderHtml,
|
|
26
|
-
} from 'virtual:docs-template/nav-html';
|
|
27
10
|
import { fetchIgNav } from '../../lib/nav-helpers.ts';
|
|
28
11
|
import styles from './GlobalNavBar.module.scss';
|
|
29
|
-
import type { NavLang
|
|
12
|
+
import type { NavLang } from '../../platform.ts';
|
|
30
13
|
|
|
31
14
|
interface Props {
|
|
32
|
-
|
|
33
|
-
theme?: NavTheme;
|
|
34
|
-
/** Override the locale. Defaults to virtual module navLang. */
|
|
35
|
-
lang?: NavLang;
|
|
15
|
+
lang: NavLang;
|
|
36
16
|
}
|
|
37
17
|
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
// Props override the virtual module values (allows per-page overrides)
|
|
41
|
-
const resolvedPlatform = theme ?? virtualPlatform ?? 'igniteui';
|
|
42
|
-
const resolvedLang = (lang ?? virtualNavLang ?? 'en') as NavLang;
|
|
43
|
-
|
|
44
|
-
const isJa = resolvedLang === 'jp';
|
|
45
|
-
const isKr = resolvedLang === 'kr';
|
|
46
|
-
const isAppBuilder = resolvedPlatform === 'appbuilder';
|
|
47
|
-
// All IG-family platforms share the same global nav
|
|
48
|
-
const isIgPlatform = !isAppBuilder;
|
|
18
|
+
const { lang } = Astro.props as Props;
|
|
49
19
|
|
|
50
|
-
const
|
|
20
|
+
const resolvedLang = lang;
|
|
51
21
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
const igNav = isIgPlatform ? await fetchIgNav(resolvedLang) : null;
|
|
22
|
+
// Fetch nav HTML directly (cached per locale per build).
|
|
23
|
+
const igNav = await fetchIgNav(resolvedLang);
|
|
55
24
|
---
|
|
56
25
|
|
|
57
26
|
{/* ============================================================
|
|
@@ -60,159 +29,5 @@ const igNav = isIgPlatform ? await fetchIgNav(resolvedLang) : null;
|
|
|
60
29
|
============================================================ */}
|
|
61
30
|
<div class={styles.navBar} transition:persist="global-nav-bar">
|
|
62
31
|
{/* IG nav — fetched directly via fetchIgNav(); falls back to static markup */}
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
{/* Static fallback — rendered when the fetch is unavailable (offline build) */}
|
|
66
|
-
{isIgPlatform && !igNav?.prefetched && (
|
|
67
|
-
<header id="header" class="globalnav" data-nav-auto-init="false">
|
|
68
|
-
<section id="header-wrap" class="globalnav__container" data-default-height="175" data-sticky-height="60">
|
|
69
|
-
<section class="globalnav__primary clearfix">
|
|
70
|
-
<div class="globalnav__wrapper">
|
|
71
|
-
<div class="globalnav__brand">
|
|
72
|
-
<a href={igBase}>
|
|
73
|
-
<img class="globalnav__logo" src="https://static.infragistics.com/marketing/Website/products/ignite-ui/ignite-ui-logo.svg" alt="Infragistics Logo" />
|
|
74
|
-
</a>
|
|
75
|
-
</div>
|
|
76
|
-
<nav class="globalnav__nav">
|
|
77
|
-
{isJa ? (
|
|
78
|
-
<ul class="globalnav__menu">
|
|
79
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://jp.infragistics.com/products">製品</a></li>
|
|
80
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://jp.infragistics.com/community/blogs">ブログ</a></li>
|
|
81
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://jp.infragistics.com/support">サポート</a></li>
|
|
82
|
-
</ul>
|
|
83
|
-
) : isKr ? (
|
|
84
|
-
<ul class="globalnav__menu">
|
|
85
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/products">제품</a></li>
|
|
86
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/community/blogs">블로그</a></li>
|
|
87
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/support">지원</a></li>
|
|
88
|
-
</ul>
|
|
89
|
-
) : (
|
|
90
|
-
<ul class="globalnav__menu">
|
|
91
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/products">Products</a></li>
|
|
92
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/community/blogs">Blog</a></li>
|
|
93
|
-
<li class="globalnav__item"><a class="globalnav__link" href="https://www.infragistics.com/support">Support</a></li>
|
|
94
|
-
</ul>
|
|
95
|
-
)}
|
|
96
|
-
</nav>
|
|
97
|
-
<div class="globalnav__overlay"></div>
|
|
98
|
-
</div>
|
|
99
|
-
</section>
|
|
100
|
-
</section>
|
|
101
|
-
</header>
|
|
102
|
-
)}
|
|
103
|
-
|
|
104
|
-
{/* ============================================================
|
|
105
|
-
AppBuilder nav
|
|
106
|
-
============================================================ */}
|
|
107
|
-
{isAppBuilder && (
|
|
108
|
-
<>
|
|
109
|
-
{/* Prebuild path — AB header HTML captured at build time */}
|
|
110
|
-
{abPrefetched && (
|
|
111
|
-
<>
|
|
112
|
-
<Fragment set:html={abHeaderHtml} />
|
|
113
|
-
<script is:inline>
|
|
114
|
-
window.addEventListener('load', function () {
|
|
115
|
-
// Fix language-bar links (depends on current page URL at runtime)
|
|
116
|
-
var langBar = document.querySelector('.mega-lang-bar');
|
|
117
|
-
if (langBar) {
|
|
118
|
-
langBar.innerHTML =
|
|
119
|
-
'<a class="mega-custom-icon mega-menu-link" href="#" aria-expanded="false" tabindex="0" aria-label="LangBar">' +
|
|
120
|
-
'<span class="mega-indicator" aria-hidden="true"></span></a>' +
|
|
121
|
-
'<ul class="mega-sub-menu"><li class="mega-menu-item" id="mega-menu-item-8148"><div class="wovn-languages">' +
|
|
122
|
-
'<a href="' + window.location.href.replace('/ja/help/', '/help/') + '" style="display:block;padding-left:10px;color:gray;font-weight:300;">English</a>' +
|
|
123
|
-
'<a href="' + window.location.href.replace('/help/', '/ja/help/') + '" style="display:block;padding-left:10px;color:gray;font-weight:300;">日本語</a>' +
|
|
124
|
-
'</div></li></ul>';
|
|
125
|
-
}
|
|
126
|
-
// Initialise mega menu
|
|
127
|
-
if (window.jQuery && typeof window.jQuery('.max-mega-menu').maxmegamenu === 'function') {
|
|
128
|
-
window.jQuery('.max-mega-menu').maxmegamenu();
|
|
129
|
-
}
|
|
130
|
-
// Search toggle
|
|
131
|
-
var searchIcon = document.querySelector('.mega-search .search-icon');
|
|
132
|
-
var searchInput = document.querySelector('.mega-search input[type=text]');
|
|
133
|
-
if (searchIcon) searchIcon.onclick = function () { _abSearchToggle(); };
|
|
134
|
-
if (searchInput) searchInput.onblur = function () { _abSearchToggle(); };
|
|
135
|
-
|
|
136
|
-
function _abSearchToggle() {
|
|
137
|
-
var form = document.querySelector('.mega-search');
|
|
138
|
-
var inp = document.querySelector('.mega-search input[type=text]');
|
|
139
|
-
if (!form) return;
|
|
140
|
-
if (form.classList.contains('mega-search-open')) {
|
|
141
|
-
form.classList.replace('mega-search-open', 'mega-search-closed');
|
|
142
|
-
if (inp) { inp.setAttribute('placeholder', ''); inp.value = ''; inp.setAttribute('tabindex', '0'); }
|
|
143
|
-
} else {
|
|
144
|
-
form.classList.replace('mega-search-closed', 'mega-search-open');
|
|
145
|
-
if (inp) { inp.setAttribute('placeholder', 'Search...'); inp.focus(); inp.setAttribute('tabindex', '-1'); }
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
</script>
|
|
150
|
-
</>
|
|
151
|
-
)}
|
|
152
|
-
|
|
153
|
-
{/*
|
|
154
|
-
Runtime fallback — XHR fetch of AB header at page load.
|
|
155
|
-
---------------------------------------------------------
|
|
156
|
-
This path executes when the build-time prefetch of
|
|
157
|
-
https://www.appbuilder.dev/header-footer-export was unavailable
|
|
158
|
-
(abPrefetched === false).
|
|
159
|
-
|
|
160
|
-
It fires a client-side XHR on window load and injects the returned
|
|
161
|
-
headerHtml into #ab-nav-container. The footerHtml is appended to
|
|
162
|
-
document.getElementById('footer'), which may conflict with the
|
|
163
|
-
GlobalFooter component rendered by CustomPageFrame.
|
|
164
|
-
|
|
165
|
-
Known downsides:
|
|
166
|
-
- Visible layout shift: header appears only after the page load event.
|
|
167
|
-
- Requires the client to reach appbuilder.dev at runtime (cross-origin).
|
|
168
|
-
- The footer injection target (#footer) is fragile and couples
|
|
169
|
-
this component to the DOM shape of GlobalFooter.
|
|
170
|
-
|
|
171
|
-
TODO: Consider removing this fallback entirely. If the build-time
|
|
172
|
-
prefetch is consistently reliable, this branch is never reached. A static
|
|
173
|
-
minimal fallback or a clear error state would be more predictable than a
|
|
174
|
-
delayed XHR-driven render.
|
|
175
|
-
*/}
|
|
176
|
-
{!abPrefetched && (
|
|
177
|
-
<>
|
|
178
|
-
<div id="ab-nav-container"></div>
|
|
179
|
-
<script is:inline>
|
|
180
|
-
(function () {
|
|
181
|
-
var includeContent = {
|
|
182
|
-
settings: {
|
|
183
|
-
url: 'https://www.appbuilder.dev/header-footer-export',
|
|
184
|
-
selector: '#header-container',
|
|
185
|
-
},
|
|
186
|
-
processInclude: function () {
|
|
187
|
-
var self = this;
|
|
188
|
-
var xhr = new XMLHttpRequest();
|
|
189
|
-
xhr.open('GET', self.settings.url, true);
|
|
190
|
-
xhr.onreadystatechange = function () {
|
|
191
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
192
|
-
try {
|
|
193
|
-
var data = JSON.parse(xhr.responseText);
|
|
194
|
-
var header = data.headerHtml || '';
|
|
195
|
-
var footer = data.footerHtml || '';
|
|
196
|
-
var container = document.getElementById('ab-nav-container');
|
|
197
|
-
if (container) container.innerHTML = header;
|
|
198
|
-
var footerEl = document.getElementById('footer');
|
|
199
|
-
if (footerEl) footerEl.innerHTML += footer;
|
|
200
|
-
} catch (e) {
|
|
201
|
-
/* no-op – nav unavailable */
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
xhr.send();
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
window.addEventListener('load', function () {
|
|
209
|
-
includeContent.processInclude();
|
|
210
|
-
});
|
|
211
|
-
})();
|
|
212
|
-
</script>
|
|
213
|
-
</>
|
|
214
|
-
)}
|
|
215
|
-
</>
|
|
216
|
-
)}
|
|
217
|
-
|
|
32
|
+
{igNav?.prefetched && <Fragment set:html={igNav.headerHtml} />}
|
|
218
33
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GlobalNavBar
|
|
2
2
|
|
|
3
|
-
Renders the
|
|
3
|
+
Renders the global navigation bar in the light DOM. Supports IG-family platforms (`angular`, `react`, `blazor`, `web-components`, `slingshot`, `igniteui`).
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -10,17 +10,15 @@ import GlobalNavBar from 'igniteui-astro-components/components/GlobalNavBar.astr
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type |
|
|
14
|
-
|
|
15
|
-
| `
|
|
16
|
-
| `lang` | `NavLang` | virtual module value | Override the locale (`'en'` \| `'jp'` \| `'kr'`). |
|
|
13
|
+
| Prop | Type | Description |
|
|
14
|
+
|------|------|-------------|
|
|
15
|
+
| `lang` | `NavLang` | **Required.** Locale — `'en'` \| `'jp'` \| `'kr'`. |
|
|
17
16
|
|
|
18
|
-
`
|
|
17
|
+
`NavLang`: `'en' | 'jp' | 'kr'`
|
|
19
18
|
|
|
20
19
|
## Behaviour
|
|
21
20
|
|
|
22
|
-
-
|
|
23
|
-
- **Static fallback** — when pre-fetched HTML is unavailable (local dev), a minimal server-side nav is rendered.
|
|
21
|
+
- Fetches the IG header HTML at build time via `fetchIgNav(lang)`.
|
|
24
22
|
- The nav bar is marked `transition:persist="global-nav-bar"` so it does not re-render during Astro View Transitions navigation.
|
|
25
23
|
|
|
26
24
|
## Example
|
|
@@ -29,20 +27,15 @@ import GlobalNavBar from 'igniteui-astro-components/components/GlobalNavBar.astr
|
|
|
29
27
|
---
|
|
30
28
|
import GlobalNavBar from 'igniteui-astro-components/components/GlobalNavBar.astro';
|
|
31
29
|
---
|
|
32
|
-
|
|
33
|
-
<GlobalNavBar />
|
|
34
|
-
|
|
35
|
-
<!-- Override per-page -->
|
|
36
|
-
<GlobalNavBar theme="react" lang="en" />
|
|
30
|
+
<GlobalNavBar lang="en" />
|
|
37
31
|
```
|
|
38
32
|
|
|
39
33
|
## Configuration
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
`lang` is provided automatically by `DocsLayout` from the `navLang` value in the `virtual:docs-template/site-meta` virtual module, which is set in `astro.config.ts`:
|
|
42
36
|
|
|
43
37
|
```ts
|
|
44
38
|
createDocsSite({
|
|
45
|
-
platform: 'angular',
|
|
46
39
|
navLang: 'en',
|
|
47
40
|
// …
|
|
48
41
|
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# SearchAdvanced
|
|
2
|
+
|
|
3
|
+
Client-side API search dialog that loads a JSON search index and performs all matching against symbol and member names. Supports configurable result tabs and optional package-scope filtering.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```astro
|
|
8
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `class` | `string` | — | CSS class for the outer element |
|
|
16
|
+
| `indexUrl` | `string` | `${BASE_URL}api-search-index.json` | URL to the JSON search index |
|
|
17
|
+
| `placeholder` | `string` | `"Search"` | Search input placeholder text |
|
|
18
|
+
| `showScope` | `boolean` | `false` | Show scope selector (current package / all packages) |
|
|
19
|
+
| `tabs` | `SearchTab[]` | `[]` | Tab categories (besides the always-present "All" tab) |
|
|
20
|
+
| `allTabLimit` | `number` | `10` | Max results per category in the "All" tab |
|
|
21
|
+
|
|
22
|
+
### `SearchTab`
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
interface SearchTab {
|
|
26
|
+
/** Unique identifier for this tab/category */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Display label for the tab */
|
|
29
|
+
label: string;
|
|
30
|
+
/**
|
|
31
|
+
* Kind codes from the index that map to this category.
|
|
32
|
+
* Use '__name__' for the page-names category.
|
|
33
|
+
* Member kind codes: 'p' = property, 'a' = accessor, 'm' = method, 'e' = event, 'c' = constructor.
|
|
34
|
+
*/
|
|
35
|
+
kindCodes: string[];
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Minimal (single "All" tab, no scope)
|
|
42
|
+
|
|
43
|
+
```astro
|
|
44
|
+
---
|
|
45
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
46
|
+
---
|
|
47
|
+
<SearchAdvanced indexUrl="/api-search-index.json" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### With scope and full tab set (like api-docs)
|
|
51
|
+
|
|
52
|
+
```astro
|
|
53
|
+
---
|
|
54
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
55
|
+
|
|
56
|
+
const tabs = [
|
|
57
|
+
{ id: 'names', label: 'Names', kindCodes: ['__name__'] },
|
|
58
|
+
{ id: 'properties', label: 'Properties', kindCodes: ['p'] },
|
|
59
|
+
{ id: 'accessors', label: 'Accessors', kindCodes: ['a'] },
|
|
60
|
+
{ id: 'methods', label: 'Methods', kindCodes: ['m'] },
|
|
61
|
+
{ id: 'events', label: 'Events', kindCodes: ['e'] },
|
|
62
|
+
{ id: 'constructors', label: 'Constructors', kindCodes: ['c'] },
|
|
63
|
+
];
|
|
64
|
+
---
|
|
65
|
+
<SearchAdvanced showScope tabs={tabs} />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Custom subset of tabs
|
|
69
|
+
|
|
70
|
+
```astro
|
|
71
|
+
---
|
|
72
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
73
|
+
|
|
74
|
+
const tabs = [
|
|
75
|
+
{ id: 'names', label: 'Types', kindCodes: ['__name__'] },
|
|
76
|
+
{ id: 'members', label: 'Members', kindCodes: ['p', 'a', 'm', 'e', 'c'] },
|
|
77
|
+
];
|
|
78
|
+
---
|
|
79
|
+
<SearchAdvanced tabs={tabs} indexUrl="/my-index.json" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Index Format
|
|
83
|
+
|
|
84
|
+
The component expects a JSON file with the following structure:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"pages": [
|
|
89
|
+
{
|
|
90
|
+
"u": "/path/to/page",
|
|
91
|
+
"n": "ClassName",
|
|
92
|
+
"k": "class",
|
|
93
|
+
"v": "1.0.0",
|
|
94
|
+
"p": "angular",
|
|
95
|
+
"g": "package-name",
|
|
96
|
+
"m": [["memberName", "p"], ["onClick", "e"]]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Keyboard Shortcuts
|
|
103
|
+
|
|
104
|
+
- `Ctrl+K` / `⌘K` — open/close the search dialog
|
|
105
|
+
- `Escape` — close the dialog
|