igniteui-astro-components 0.0.6 → 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 +4 -4
- 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/SearchAdvanced.astro +20 -11
- 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 +3 -4
- 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
package/README.md
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Reusable [Astro](https://astro.build) components, layouts, integrations, and
|
|
4
4
|
utilities used to build Infragistics / Ignite UI documentation sites.
|
|
5
5
|
|
|
6
|
-
This package
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for consumer repos.
|
|
6
|
+
This package provides the navbar, sidebar, search, page frame, and MDX
|
|
7
|
+
components for Infragistics documentation sites, keeping the integration
|
|
8
|
+
story simple for consumer repos.
|
|
10
9
|
|
|
11
10
|
> **Status:** internal — published from this repo as a parallel copy of the
|
|
12
11
|
> components living in `docs-template`. Both trees are kept in sync until
|
|
@@ -73,7 +72,7 @@ export { default as Sample } from 'igniteui-astro-components/components/md
|
|
|
73
72
|
Pull in the base styles once (e.g. from your root layout or `astro.config`):
|
|
74
73
|
|
|
75
74
|
```ts
|
|
76
|
-
import 'igniteui-astro-components/styles/custom.
|
|
75
|
+
import 'igniteui-astro-components/styles/custom.scss';
|
|
77
76
|
import 'igniteui-astro-components/styles/ig-theme.scss';
|
|
78
77
|
```
|
|
79
78
|
|
|
@@ -234,7 +233,7 @@ const sidebar: SidebarEntry[] = [/* … your tree … */];
|
|
|
234
233
|
|
|
235
234
|
| Export | Purpose | Docs |
|
|
236
235
|
| --- | --- | --- |
|
|
237
|
-
| `…/components/GlobalNavBar.astro` | IG
|
|
236
|
+
| `…/components/GlobalNavBar.astro` | IG global navigation bar | [README](src/components/GlobalNavBar/README.md) |
|
|
238
237
|
| `…/components/GlobalFooter.astro` | IG global footer | [README](src/components/GlobalFooter/README.md) |
|
|
239
238
|
| `…/components/DocsSubHeader.astro` | Secondary fixed bar — site title + breadcrumb + product links + search | [README](src/components/DocsSubHeader/README.md) |
|
|
240
239
|
| `…/components/Search.astro` | Pagefind-powered full-text search modal | [README](src/components/Search/README.md) |
|
|
@@ -272,13 +271,15 @@ const sidebar: SidebarEntry[] = [/* … your tree … */];
|
|
|
272
271
|
| `…/content` | Content collection helpers |
|
|
273
272
|
| `…/content-config` | Default content collection schema |
|
|
274
273
|
| `…/llms` | `llms.txt` manifest generator |
|
|
275
|
-
| `…/plugins/remark-
|
|
274
|
+
| `…/plugins/remark-env-vars` | Remark plugin — `{Environment.X}` token substitution |
|
|
275
|
+
| `…/plugins/remark-md-links` | Remark plugin — `.md` → slug link rewriting + `DOCS_BASE` prepending |
|
|
276
|
+
| `…/plugins/remark-html-transforms` | Remark plugin — divider→`<hr>`, code lang normalization, img src fixes |
|
|
276
277
|
|
|
277
278
|
### Styles
|
|
278
279
|
|
|
279
280
|
| Export | Purpose |
|
|
280
281
|
| --- | --- |
|
|
281
|
-
| `…/styles/custom.
|
|
282
|
+
| `…/styles/custom.scss` | Base tokens + sidebar/sample styles |
|
|
282
283
|
| `…/styles/ig-theme.scss` | IG color palette mapped to design tokens |
|
|
283
284
|
|
|
284
285
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-astro-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
"./lib/sidebar/types": "./src/lib/sidebar/types.ts",
|
|
67
67
|
"./lib/sidebar/helpers": "./src/lib/sidebar/helpers.ts",
|
|
68
68
|
"./lib/types": "./src/lib/types.ts",
|
|
69
|
-
"./plugins/remark-
|
|
69
|
+
"./plugins/remark-env-vars": "./src/plugins/remark-env-vars.ts",
|
|
70
|
+
"./plugins/remark-md-links": "./src/plugins/remark-md-links.ts",
|
|
71
|
+
"./plugins/remark-html-transforms": "./src/plugins/remark-html-transforms.ts",
|
|
70
72
|
"./styles/custom.scss": "./src/styles/custom.scss",
|
|
71
73
|
"./styles/theme.scss": "./src/styles/theme.scss",
|
|
72
74
|
"./package.json": "./package.json"
|
|
@@ -84,11 +86,9 @@
|
|
|
84
86
|
"@fontsource-variable/instrument-sans": "^5.2.8",
|
|
85
87
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
86
88
|
"igniteui-webcomponents": "^7.1.3",
|
|
87
|
-
"js-yaml": "^4.1.0",
|
|
88
89
|
"jsdom": "^29.0.1"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
|
-
"@types/js-yaml": "^4.0.9",
|
|
92
92
|
"@types/jsdom": "^21.1.7",
|
|
93
93
|
"astro": "^6.1.6",
|
|
94
94
|
"igniteui-theming": "^26.0.1",
|
|
@@ -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
|
});
|
|
@@ -380,23 +380,32 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
private async fetchIndex(): Promise<IndexedPage[]> {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
let data: unknown;
|
|
384
|
+
try {
|
|
385
|
+
const r = await fetch(this.indexUrl);
|
|
386
|
+
if (!r.ok) return [];
|
|
387
|
+
data = await r.json();
|
|
388
|
+
} catch {
|
|
389
|
+
return [];
|
|
390
|
+
}
|
|
386
391
|
|
|
387
392
|
// Single-file format: { pages: [...] }
|
|
388
|
-
if (Array.isArray(data?.pages)) {
|
|
389
|
-
return data.pages as IndexedPage[];
|
|
393
|
+
if (Array.isArray((data as any)?.pages)) {
|
|
394
|
+
return (data as any).pages as IndexedPage[];
|
|
390
395
|
}
|
|
391
396
|
|
|
392
397
|
// Manifest format: { files: ["pkg/version.json", ...] }
|
|
393
|
-
if (Array.isArray(data?.files)) {
|
|
398
|
+
if (Array.isArray((data as any)?.files)) {
|
|
394
399
|
const baseUrl = this.indexUrl.replace(/[^/]*$/, '');
|
|
395
|
-
const fetches = (data.files as string[]).map(async (file: string) => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
+
const fetches: Promise<IndexedPage[]>[] = ((data as any).files as string[]).map(async (file: string) => {
|
|
401
|
+
try {
|
|
402
|
+
const res = await fetch(`${baseUrl}${file}`);
|
|
403
|
+
if (!res.ok) return [];
|
|
404
|
+
const d = await res.json();
|
|
405
|
+
return Array.isArray(d?.pages) ? d.pages as IndexedPage[] : [];
|
|
406
|
+
} catch {
|
|
407
|
+
return [];
|
|
408
|
+
}
|
|
400
409
|
});
|
|
401
410
|
const results = await Promise.all(fetches);
|
|
402
411
|
return results.flat();
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* ThemingWidget
|
|
4
4
|
*
|
|
5
|
-
* Renders the `<igniteui-theming-widget>` web component.
|
|
6
|
-
* behaviour from igniteui-docfx-template:
|
|
7
|
-
* template/partials/themeselect*.tmpl.partial
|
|
8
|
-
* src/app/handlers/theming.ts
|
|
9
|
-
*
|
|
5
|
+
* Renders the `<igniteui-theming-widget>` web component.
|
|
10
6
|
* Behaviour:
|
|
11
7
|
* - `themeApiUrl` and `widgetVersion` are resolved from environment.json at
|
|
12
|
-
* build time via the `virtual:docs-template/nav-html` virtual module
|
|
13
|
-
* (same step as the header/footer prefetch in siteMetaIntegration).
|
|
8
|
+
* build time via the `virtual:docs-template/nav-html` virtual module.
|
|
14
9
|
* - Renders nothing when `themeApiUrl` is unavailable.
|
|
15
10
|
* - The widget container starts hidden and is revealed client-side only
|
|
16
11
|
* when at least one themeable `<iframe>` is found on the page.
|
|
@@ -88,9 +83,9 @@ const lang = language === 'jp' ? 'ja' : undefined;
|
|
|
88
83
|
}
|
|
89
84
|
|
|
90
85
|
// ── Replay theme into a newly loaded iframe ──────────────────────────────
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
86
|
+
// When an iframe finishes loading we immediately push the persisted
|
|
87
|
+
// themeStyle into it so samples that loaded after a theme was already
|
|
88
|
+
// selected pick it up.
|
|
94
89
|
function onIframeLoad(e: Event) {
|
|
95
90
|
const iframe = e.target as HTMLIFrameElement;
|
|
96
91
|
if (iframe.classList.contains('no-theming')) return;
|
package/src/content.config.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { createDocsCollection } from './content-helper.ts';
|
|
5
5
|
|
|
6
6
|
// TODO: remove these template-specific exclusions once the source repos add
|
|
7
|
-
// proper
|
|
7
|
+
// proper frontmatter to these files (no `title` → fail schema).
|
|
8
8
|
export const collections = {
|
|
9
9
|
docs: createDocsCollection(process.env.DOCS_SOURCE_PATH, {
|
|
10
10
|
exclude: [
|