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.
Files changed (93) hide show
  1. package/README.md +82 -74
  2. package/package.json +15 -2
  3. package/src/components/CopyCode/CopyCode.astro +21 -7
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
  6. package/src/components/DocsBreadcrumb/README.md +10 -14
  7. package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
  8. package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
  9. package/src/components/DocsSidebar/README.md +25 -21
  10. package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
  11. package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
  12. package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
  13. package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
  14. package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -195
  15. package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
  16. package/src/components/DocsSubHeader/README.md +18 -16
  17. package/src/components/DocsToc/DocsToc.astro +301 -280
  18. package/src/components/DocsToc/DocsToc.scss +20 -21
  19. package/src/components/DocsToc/README.md +11 -9
  20. package/src/components/DocsToc/toTreeNodes.ts +3 -8
  21. package/src/components/DocsTree/DocsTree.astro +32 -20
  22. package/src/components/DocsTree/DocsTreeItem.astro +35 -30
  23. package/src/components/DocsTree/README.md +16 -15
  24. package/src/components/DocsTree/docs-tree.scss +267 -268
  25. package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
  26. package/src/components/GlobalFooter/README.md +3 -2
  27. package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
  28. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
  29. package/src/components/GlobalNavBar/README.md +3 -2
  30. package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
  31. package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
  32. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
  33. package/src/components/MobileSidebarToggle/README.md +3 -2
  34. package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
  35. package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
  36. package/src/components/Search/README.md +1 -0
  37. package/src/components/Search/Search.astro +137 -109
  38. package/src/components/Search/Search.scss +20 -20
  39. package/src/components/SearchAdvanced/README.md +21 -15
  40. package/src/components/SearchAdvanced/SearchAdvanced.astro +205 -133
  41. package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
  42. package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
  43. package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
  44. package/src/components/mdx/ApiLink/README.md +26 -22
  45. package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
  46. package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
  47. package/src/components/mdx/ApiRef/README.md +20 -15
  48. package/src/components/mdx/Badge/Badge.astro +14 -14
  49. package/src/components/mdx/Badge/Badge.scss +61 -56
  50. package/src/components/mdx/Badge/README.md +24 -19
  51. package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
  52. package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
  53. package/src/components/mdx/DocsAside/README.md +22 -22
  54. package/src/components/mdx/Faq/Faq.astro +86 -0
  55. package/src/components/mdx/Faq/Faq.scss +105 -0
  56. package/src/components/mdx/Faq/FaqItem.astro +117 -0
  57. package/src/components/mdx/Faq/README.md +223 -0
  58. package/src/components/mdx/Faq/types.ts +34 -0
  59. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
  60. package/src/components/mdx/PlatformBlock/README.md +6 -8
  61. package/src/components/mdx/Sample/README.md +21 -16
  62. package/src/components/mdx/Sample/Sample.astro +97 -74
  63. package/src/components/mdx/Sample/Sample.scss +132 -132
  64. package/src/content-helper.ts +71 -72
  65. package/src/content.config.ts +1 -6
  66. package/src/integration.ts +566 -512
  67. package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
  68. package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
  69. package/src/layouts/DocsLayout/README.md +24 -35
  70. package/src/lib/nav-helpers.ts +88 -82
  71. package/src/lib/types.ts +76 -76
  72. package/src/llms.ts +205 -166
  73. package/src/platform.ts +312 -162
  74. package/src/plugins/rehype-heading-anchors.ts +45 -45
  75. package/src/plugins/rehype-pagefind-ignore.ts +19 -19
  76. package/src/plugins/rehype-table-wrapper.ts +30 -30
  77. package/src/plugins/remark-docfx.ts +12 -0
  78. package/src/plugins/remark-env-vars.ts +12 -4
  79. package/src/plugins/remark-md-links.ts +10 -4
  80. package/src/scripts/icon-manifest.ts +13 -5
  81. package/src/scripts/sample-widget.ts +557 -501
  82. package/src/sidebar.ts +103 -97
  83. package/src/styles/global/_code-blocks.scss +43 -44
  84. package/src/styles/global/_component-themes.scss +151 -153
  85. package/src/styles/global/_icon-gallery.scss +81 -81
  86. package/src/styles/global/_index.scss +0 -1
  87. package/src/styles/global/_markdown.scss +816 -787
  88. package/src/styles/global/_palette.scss +456 -110
  89. package/src/styles/global/_search-shared.scss +402 -398
  90. package/src/styles/global/_type-scale.scss +127 -127
  91. package/src/styles/global/_variables.scss +138 -111
  92. package/src/styles/theme.scss +41 -41
  93. package/src/virtual-modules.d.ts +11 -2
@@ -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
- // 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;
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
- return html
49
- .replace(/(href|src|action)="(\/)([^"]*)"/g, `$1="${baseOrigin}/$3"`)
50
- .replace(/(href|src|action)='(\/)([^']*)'/g, `$1='${baseOrigin}/$3'`);
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
- 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;
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
- return '';
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
- headerHtml: string;
101
- uiFooterHtml: string;
102
- footerHtml: string;
103
- /** True when the fetch succeeded and the HTML fields are populated. */
104
- prefetched: boolean;
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
- if (_cache.has(lang)) return _cache.get(lang)!;
123
-
124
- const igBase = lang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
125
- const navUrl = `${igBase}/navigation`;
126
-
127
- let headerHtml = '';
128
- let uiFooterHtml = '';
129
- let footerHtml = '';
130
-
131
- try {
132
- const res = await fetch(navUrl, {
133
- credentials: 'omit',
134
- signal: AbortSignal.timeout(15_000),
135
- });
136
- if (res.ok) {
137
- const html = await res.text();
138
- headerHtml = absolutifyNavUrls(
139
- stripScripts(extractOuterHtml(html, '<header[^>]+id="header"')),
140
- igBase,
141
- );
142
- uiFooterHtml = absolutifyNavUrls(
143
- stripScripts(extractOuterHtml(html, '<footer[^>]+class="[^"]*\\bui-footer\\b')),
144
- igBase,
145
- );
146
- footerHtml = absolutifyNavUrls(
147
- stripScripts(extractOuterHtml(html, '<footer[^>]+id="footer"')),
148
- igBase,
149
- );
150
- // Strip the hello-bar promotional strip
151
- headerHtml = headerHtml.replace(/<div[^>]+id="hello-bar"[\s\S]*?<\/div>\s*/i, '');
152
- } else {
153
- console.warn(`[igniteui-astro-components] Nav fetch returned ${res.status} — using static fallback.`);
154
- }
155
- } catch (err: unknown) {
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
- const result: IgNavHtml = { headerHtml, uiFooterHtml, footerHtml, prefetched: !!headerHtml };
160
- _cache.set(lang, result);
161
- return result;
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
- /** 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;
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
- /** 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>;
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
- 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;
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
  }