igniteui-astro-components 0.0.27 → 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 +15 -2
- 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 -195
- package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
- 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 +205 -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 +41 -41
- package/src/virtual-modules.d.ts +11 -2
package/src/lib/nav-helpers.ts
CHANGED
|
@@ -29,12 +29,12 @@ const _require = createRequire(import.meta.url);
|
|
|
29
29
|
* jsdom is resolved at Node runtime and never bundled into the prerender chunk.
|
|
30
30
|
*/
|
|
31
31
|
export function stripScripts(html: string): string {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
33
|
+
const { JSDOM } = _require('jsdom') as typeof import('jsdom');
|
|
34
|
+
const dom = new JSDOM(html);
|
|
35
|
+
const { document } = dom.window;
|
|
36
|
+
document.querySelectorAll('script').forEach((el: Element) => el.remove());
|
|
37
|
+
return document.body.innerHTML;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -45,9 +45,9 @@ export function stripScripts(html: string): string {
|
|
|
45
45
|
* local dev-server origin and Astro's client-side router intercepts them.
|
|
46
46
|
*/
|
|
47
47
|
export function absolutifyNavUrls(html: string, baseOrigin: string): string {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
return html
|
|
49
|
+
.replace(/(href|src|action)="(\/)([^"]*)"/g, `$1="${baseOrigin}/$3"`)
|
|
50
|
+
.replace(/(href|src|action)='(\/)([^']*)'/g, `$1='${baseOrigin}/$3'`);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -59,37 +59,39 @@ export function absolutifyNavUrls(html: string, baseOrigin: string): string {
|
|
|
59
59
|
* @param openPattern - Regex source for the opening tag (no flags).
|
|
60
60
|
*/
|
|
61
61
|
export function extractOuterHtml(html: string, openPattern: string): string {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (name !== tagName) continue;
|
|
87
|
-
if (isSelfClose) continue;
|
|
88
|
-
if (isClose) { depth--; if (depth === 0) return html.slice(startIdx, tagRe.lastIndex); }
|
|
89
|
-
else depth++;
|
|
62
|
+
const openRe = new RegExp(openPattern, 'i');
|
|
63
|
+
const tagRe = /<\/?([a-z][a-z0-9]*)[^>]*>/gi;
|
|
64
|
+
|
|
65
|
+
let tagName: string | null = null;
|
|
66
|
+
let depth = 0;
|
|
67
|
+
let startIdx = -1;
|
|
68
|
+
|
|
69
|
+
let m: RegExpExecArray | null;
|
|
70
|
+
while ((m = tagRe.exec(html)) !== null) {
|
|
71
|
+
const full = m[0];
|
|
72
|
+
const name = m[1].toLowerCase();
|
|
73
|
+
const isSelfClose = full.endsWith('/>');
|
|
74
|
+
const isClose = full.startsWith('</');
|
|
75
|
+
|
|
76
|
+
if (tagName === null) {
|
|
77
|
+
if (openRe.test(full)) {
|
|
78
|
+
tagName = name;
|
|
79
|
+
startIdx = m.index;
|
|
80
|
+
depth = isSelfClose ? 0 : 1;
|
|
81
|
+
if (depth === 0) return full;
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
90
84
|
}
|
|
91
85
|
|
|
92
|
-
|
|
86
|
+
if (name !== tagName) continue;
|
|
87
|
+
if (isSelfClose) continue;
|
|
88
|
+
if (isClose) {
|
|
89
|
+
depth--;
|
|
90
|
+
if (depth === 0) return html.slice(startIdx, tagRe.lastIndex);
|
|
91
|
+
} else depth++;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return '';
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
// ---------------------------------------------------------------------------
|
|
@@ -97,11 +99,11 @@ export function extractOuterHtml(html: string, openPattern: string): string {
|
|
|
97
99
|
// ---------------------------------------------------------------------------
|
|
98
100
|
|
|
99
101
|
export interface IgNavHtml {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
headerHtml: string;
|
|
103
|
+
uiFooterHtml: string;
|
|
104
|
+
footerHtml: string;
|
|
105
|
+
/** True when the fetch succeeded and the HTML fields are populated. */
|
|
106
|
+
prefetched: boolean;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
/** Module-level cache keyed by locale — fetch runs at most once per locale per build. */
|
|
@@ -119,44 +121,48 @@ const _cache = new Map<string, IgNavHtml>();
|
|
|
119
121
|
* network is unavailable (offline builds, CI without outbound access, etc.)
|
|
120
122
|
*/
|
|
121
123
|
export async function fetchIgNav(lang: NavLang = 'en'): Promise<IgNavHtml> {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
console.warn(`[igniteui-astro-components] Could not fetch IG nav: ${(err as Error).message} — using static fallback.`);
|
|
124
|
+
if (_cache.has(lang)) return _cache.get(lang)!;
|
|
125
|
+
|
|
126
|
+
const igBase = lang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
|
|
127
|
+
const navUrl = `${igBase}/navigation`;
|
|
128
|
+
|
|
129
|
+
let headerHtml = '';
|
|
130
|
+
let uiFooterHtml = '';
|
|
131
|
+
let footerHtml = '';
|
|
132
|
+
|
|
133
|
+
try {
|
|
134
|
+
const res = await fetch(navUrl, {
|
|
135
|
+
credentials: 'omit',
|
|
136
|
+
signal: AbortSignal.timeout(15_000),
|
|
137
|
+
});
|
|
138
|
+
if (res.ok) {
|
|
139
|
+
const html = await res.text();
|
|
140
|
+
headerHtml = absolutifyNavUrls(
|
|
141
|
+
stripScripts(extractOuterHtml(html, '<header[^>]+id="header"')),
|
|
142
|
+
igBase,
|
|
143
|
+
);
|
|
144
|
+
uiFooterHtml = absolutifyNavUrls(
|
|
145
|
+
stripScripts(extractOuterHtml(html, '<footer[^>]+class="[^"]*\\bui-footer\\b')),
|
|
146
|
+
igBase,
|
|
147
|
+
);
|
|
148
|
+
footerHtml = absolutifyNavUrls(
|
|
149
|
+
stripScripts(extractOuterHtml(html, '<footer[^>]+id="footer"')),
|
|
150
|
+
igBase,
|
|
151
|
+
);
|
|
152
|
+
// Strip the hello-bar promotional strip
|
|
153
|
+
headerHtml = headerHtml.replace(/<div[^>]+id="hello-bar"[\s\S]*?<\/div>\s*/i, '');
|
|
154
|
+
} else {
|
|
155
|
+
console.warn(
|
|
156
|
+
`[igniteui-astro-components] Nav fetch returned ${res.status} — using static fallback.`,
|
|
157
|
+
);
|
|
157
158
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
} catch (err: unknown) {
|
|
160
|
+
console.warn(
|
|
161
|
+
`[igniteui-astro-components] Could not fetch IG nav: ${(err as Error).message} — using static fallback.`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const result: IgNavHtml = { headerHtml, uiFooterHtml, footerHtml, prefetched: !!headerHtml };
|
|
166
|
+
_cache.set(lang, result);
|
|
167
|
+
return result;
|
|
162
168
|
}
|
package/src/lib/types.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
1
|
export type PlatformName = 'Angular' | 'React' | 'WebComponents' | 'Blazor';
|
|
2
2
|
|
|
3
3
|
export interface ApiPackageConfig {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
/** TypeDoc documentation root URL (no trailing slash). */
|
|
5
|
+
docRoot: string;
|
|
6
|
+
/**
|
|
7
|
+
* Package identifier as it appears in the API docs registry and route,
|
|
8
|
+
* e.g. "igniteui-react" or "igniteui-react-charts".
|
|
9
|
+
*/
|
|
10
|
+
packageId: string;
|
|
11
|
+
/**
|
|
12
|
+
* When true the package prefix is omitted from the class URL, e.g.
|
|
13
|
+
* Angular docs use `/classes/IgxGridComponent.html` (no `packageId.` prefix).
|
|
14
|
+
*/
|
|
15
|
+
noPackagePrefix?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* When true the class name casing is preserved as-is (no .toLowerCase()).
|
|
18
|
+
* New-style API sites (react-apis-new, wc-apis-new, blazor-apis-new) use PascalCase URLs.
|
|
19
|
+
*/
|
|
20
|
+
preserveCase?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Preferred class-name suffix used by ApiLink. The generated registry tries
|
|
23
|
+
* both the suffixed and unsuffixed names, so this does not mean every API
|
|
24
|
+
* symbol is expected to have the suffix.
|
|
25
|
+
*/
|
|
26
|
+
classSuffix?: string;
|
|
27
|
+
/**
|
|
28
|
+
* When true, member anchor names are PascalCase (first letter uppercased).
|
|
29
|
+
* Blazor TypeDoc uses PascalCase anchors, e.g. `#SingleExpand` instead of `#singleExpand`.
|
|
30
|
+
*/
|
|
31
|
+
pascalCaseMembers?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** Compact ApiLink symbol entry as stored in the generated registry JSON. */
|
|
35
35
|
type ApiLinkIndexEntry = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
/** Package id that owns this symbol. */
|
|
37
|
+
p?: string;
|
|
38
|
+
/** Root-relative URL to the symbol page, e.g. "/api/react/igniteui-react/19.5/classes/IgrGrid". */
|
|
39
|
+
u: string;
|
|
40
|
+
/** Symbol kind, e.g. "class", "interface", "enum". */
|
|
41
|
+
k?: string;
|
|
42
|
+
/** Member name to anchor map, e.g. { rowSelection: "rowSelection" }. */
|
|
43
|
+
m?: Record<string, string>;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export interface PlatformContext {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
47
|
+
name: PlatformName;
|
|
48
|
+
/** Optional compact ApiLink symbol index loaded by the docs host at build time. */
|
|
49
|
+
apiLinkIndex?: {
|
|
50
|
+
symbols?: Record<string, ApiLinkIndexEntry | ApiLinkIndexEntry[]>;
|
|
51
|
+
};
|
|
52
|
+
/** Lower-case slug used in URLs, e.g. "angular" */
|
|
53
|
+
lower: string;
|
|
54
|
+
/** Component class prefix, e.g. "Igx" / "Igr" / "Igc" / "Igb" */
|
|
55
|
+
prefix: string;
|
|
56
|
+
productName: string;
|
|
57
|
+
productSpinal: string;
|
|
58
|
+
/**
|
|
59
|
+
* Per-package API documentation config keyed by short name.
|
|
60
|
+
* "core" is always the main component package.
|
|
61
|
+
* Other keys match the logical package category: "charts", "grids",
|
|
62
|
+
* "gauges", "maps", "inputs", "layouts", "excel", "spreadsheet", etc.
|
|
63
|
+
*
|
|
64
|
+
* URL for a class: {docRoot}/classes/{packageId}.{PrefixType}.html
|
|
65
|
+
* URL for a member: {docRoot}/classes/{packageId}.{PrefixType}.html#{member}
|
|
66
|
+
*/
|
|
67
|
+
apiPackages: Record<string, ApiPackageConfig>;
|
|
68
|
+
packages: {
|
|
69
|
+
common: string;
|
|
70
|
+
charts: string;
|
|
71
|
+
grids: string;
|
|
72
|
+
gauges: string;
|
|
73
|
+
maps: string;
|
|
74
|
+
};
|
|
75
|
+
links: {
|
|
76
|
+
github: string;
|
|
77
|
+
forums: string;
|
|
78
|
+
repoSamples: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Sass API documentation base URL.
|
|
82
|
+
* Used as a base for link path concatenation - must have **no trailing slash**
|
|
83
|
+
* to avoid accidental `//` in generated URLs.
|
|
84
|
+
* @example `https://www.infragistics.com/products/ignite-ui-angular/angular/components/themes/sass`
|
|
85
|
+
*/
|
|
86
|
+
sassApiUrl?: string;
|
|
87
87
|
}
|