igniteui-astro-components 0.0.1

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -0
  3. package/package.json +109 -0
  4. package/src/components/DocsSidebar/DocsSidebar.astro +99 -0
  5. package/src/components/DocsSidebar/README.md +166 -0
  6. package/src/components/DocsSidebar/SidebarFilterInput.astro +74 -0
  7. package/src/components/DocsSidebar/SidebarLabel.astro +40 -0
  8. package/src/components/DocsSidebar/sidebar-filter.ts +393 -0
  9. package/src/components/DocsSidebar/toTreeNodes.ts +66 -0
  10. package/src/components/DocsSubHeader/DocsSubHeader.astro +320 -0
  11. package/src/components/DocsSubHeader/README.md +74 -0
  12. package/src/components/DocsToc/DocsToc.astro +307 -0
  13. package/src/components/DocsToc/README.md +68 -0
  14. package/src/components/DocsToc/toTreeNodes.ts +57 -0
  15. package/src/components/DocsTree/DocsTree.astro +66 -0
  16. package/src/components/DocsTree/DocsTreeItem.astro +84 -0
  17. package/src/components/DocsTree/README.md +105 -0
  18. package/src/components/DocsTree/docs-tree.css +227 -0
  19. package/src/components/DocsTree/types.ts +47 -0
  20. package/src/components/GlobalFooter/GlobalFooter.astro +90 -0
  21. package/src/components/GlobalFooter/GlobalFooter.module.scss +23 -0
  22. package/src/components/GlobalFooter/README.md +35 -0
  23. package/src/components/GlobalNavBar/GlobalNavBar.astro +218 -0
  24. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +215 -0
  25. package/src/components/GlobalNavBar/README.md +49 -0
  26. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +112 -0
  27. package/src/components/MobileSidebarToggle/README.md +31 -0
  28. package/src/components/Search/README.md +43 -0
  29. package/src/components/Search/Search.astro +222 -0
  30. package/src/components/ThemingWidget/README.md +35 -0
  31. package/src/components/ThemingWidget/ThemingWidget.astro +152 -0
  32. package/src/components/mdx/ApiLink/ApiLink.astro +121 -0
  33. package/src/components/mdx/ApiLink/README.md +68 -0
  34. package/src/components/mdx/ApiRef/ApiRef.astro +92 -0
  35. package/src/components/mdx/ApiRef/README.md +50 -0
  36. package/src/components/mdx/DocsAside/DocsAside.astro +86 -0
  37. package/src/components/mdx/DocsAside/README.md +66 -0
  38. package/src/components/mdx/DocsAside/icons/caution.svg +3 -0
  39. package/src/components/mdx/DocsAside/icons/danger.svg +3 -0
  40. package/src/components/mdx/DocsAside/icons/note.svg +3 -0
  41. package/src/components/mdx/DocsAside/icons/tip.svg +4 -0
  42. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +24 -0
  43. package/src/components/mdx/PlatformBlock/README.md +57 -0
  44. package/src/components/mdx/Sample/README.md +59 -0
  45. package/src/components/mdx/Sample/Sample.astro +142 -0
  46. package/src/content-helper.ts +159 -0
  47. package/src/content.config.ts +17 -0
  48. package/src/index.ts +42 -0
  49. package/src/integration.ts +841 -0
  50. package/src/layouts/DocsLayout/DocsLayout.astro +307 -0
  51. package/src/layouts/DocsLayout/README.md +124 -0
  52. package/src/lib/nav-helpers.ts +155 -0
  53. package/src/lib/platform-context.ts +305 -0
  54. package/src/lib/sidebar/helpers.ts +81 -0
  55. package/src/lib/sidebar/types.ts +36 -0
  56. package/src/llms.ts +315 -0
  57. package/src/platform.ts +281 -0
  58. package/src/plugins/remark-docfx.ts +368 -0
  59. package/src/scripts/sample-widget.ts +516 -0
  60. package/src/sidebar.ts +167 -0
  61. package/src/styles/custom.scss +254 -0
  62. package/src/styles/ig-theme.scss +43 -0
  63. package/src/virtual-modules.d.ts +35 -0
package/src/llms.ts ADDED
@@ -0,0 +1,315 @@
1
+ /**
2
+ * llms.ts
3
+ *
4
+ * All logic for generating llms.txt content:
5
+ * – LlmsMeta / LlmsSet types
6
+ * – Frontmatter extraction via gray-matter
7
+ * – Sidebar slug collection
8
+ * – Label disambiguation for AI readability
9
+ * – buildLlmsTxt() – the single function integration.ts calls
10
+ */
11
+
12
+ import fs from 'node:fs';
13
+ import path from 'node:path';
14
+ import matter from 'gray-matter';
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // Public types
18
+ // ---------------------------------------------------------------------------
19
+
20
+ /** LLM-facing metadata for a documentation page, derived from frontmatter. */
21
+ export interface LlmsMeta {
22
+ /** Description shown in llms.txt. Precedence: llms.description > llmsdescription > description */
23
+ description?: string;
24
+ /** Keyword tags. Precedence: llms.keywords > llmskeywords */
25
+ keywords?: string[];
26
+ }
27
+
28
+ /** A named documentation subset that generates its own combined .txt file under /_llms-txt/. */
29
+ export interface LlmsSet {
30
+ /** Display label — also used to derive the URL slug (e.g. "React Grids" → /_llms-txt/react-grids.txt). */
31
+ label: string;
32
+ /** Glob patterns matching page slugs to include. */
33
+ paths: string[];
34
+ /** Short description shown next to the link in llms.txt. */
35
+ description?: string;
36
+ }
37
+
38
+ // ---------------------------------------------------------------------------
39
+ // Internal types
40
+ // ---------------------------------------------------------------------------
41
+
42
+ export interface SidebarItem {
43
+ label?: string;
44
+ slug?: string;
45
+ items?: SidebarItem[];
46
+ }
47
+
48
+ interface FrontmatterData {
49
+ title?: string;
50
+ description?: string;
51
+ llmsdescription?: string;
52
+ llmskeywords?: string | string[];
53
+ llms?: {
54
+ description?: string;
55
+ keywords?: string[];
56
+ };
57
+ }
58
+
59
+ // ---------------------------------------------------------------------------
60
+ // Frontmatter extraction
61
+ // ---------------------------------------------------------------------------
62
+
63
+ export function extractLlmsMeta(raw: string): LlmsMeta {
64
+ let data: FrontmatterData;
65
+ try {
66
+ data = matter(raw).data as FrontmatterData;
67
+ } catch {
68
+ return {};
69
+ }
70
+ const description: string | undefined =
71
+ data.llms?.description ??
72
+ (typeof data.llmsdescription === 'string' ? data.llmsdescription : undefined) ??
73
+ (typeof data.description === 'string' ? data.description : undefined);
74
+ const rawKw = data.llms?.keywords ?? data.llmskeywords;
75
+ const keywords: string[] | undefined = Array.isArray(rawKw)
76
+ ? rawKw
77
+ : typeof rawKw === 'string' ? [rawKw] : undefined;
78
+ return {
79
+ ...(description !== undefined ? { description } : {}),
80
+ ...(keywords?.length ? { keywords } : {}),
81
+ };
82
+ }
83
+
84
+ // ---------------------------------------------------------------------------
85
+ // Sidebar slug collection
86
+ // ---------------------------------------------------------------------------
87
+
88
+ export function collectSlugs(items: SidebarItem[]): string[] {
89
+ return items.flatMap(item => [
90
+ ...(typeof item.slug === 'string' ? [item.slug] : []),
91
+ ...(Array.isArray(item.items) ? collectSlugs(item.items) : []),
92
+ ]);
93
+ }
94
+
95
+ // ---------------------------------------------------------------------------
96
+ // Build a slug → LlmsMeta map by reading source files
97
+ // ---------------------------------------------------------------------------
98
+
99
+ export function buildLlmsMetaMap(docsDir: string, items: SidebarItem[]): Map<string, LlmsMeta> {
100
+ const map = new Map<string, LlmsMeta>();
101
+ for (const slug of collectSlugs(items)) {
102
+ for (const ext of ['.md', '.mdx']) {
103
+ try {
104
+ const raw = fs.readFileSync(path.join(docsDir, slug + ext), 'utf-8');
105
+ const meta = extractLlmsMeta(raw);
106
+ if (meta.description || meta.keywords?.length) map.set(slug, meta);
107
+ break;
108
+ } catch { /* try next ext */ }
109
+ }
110
+ }
111
+ return map;
112
+ }
113
+
114
+ // ---------------------------------------------------------------------------
115
+ // Label generation
116
+ // ---------------------------------------------------------------------------
117
+
118
+ /** Derives a URL-safe slug from a label (matches github-slugger for plain ASCII). */
119
+ export function toUrlSlug(label: string): string {
120
+ return label.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/, '');
121
+ }
122
+
123
+ // ---------------------------------------------------------------------------
124
+ // Broad sections — platform-defined navigation buckets
125
+ // ---------------------------------------------------------------------------
126
+
127
+ /**
128
+ * Top-level navigation buckets for Ignite UI documentation.
129
+ * These labels are treated as organisational groupings, never as label prefixes.
130
+ */
131
+ export const IGDOCS_BROAD_SECTIONS = [
132
+ 'AI-Assisted Development',
133
+ 'General',
134
+ 'Interactivity',
135
+ 'Grids & Lists',
136
+ 'Dashboards',
137
+ 'Charts',
138
+ 'Maps',
139
+ 'Layouts',
140
+ 'Menus',
141
+ 'Frameworks',
142
+ 'Gauges',
143
+ 'Data Entry & Display',
144
+ 'Interactions',
145
+ 'Notifications',
146
+ 'Scheduling',
147
+ 'Styling & Themes',
148
+ 'Deprecated Components',
149
+ ] as const;
150
+
151
+ /** Platforms that use the Ignite UI doc broad sections. */
152
+ const IGDOCS_PLATFORMS = new Set<string>(['angular', 'react', 'blazor', 'web-components']);
153
+
154
+ /**
155
+ * Returns the set of broad-section labels for the given platform.
156
+ * Returns an empty set for platforms with no defined broad sections (appbuilder, slingshot).
157
+ */
158
+ export function getBroadSectionsForPlatform(platform: string | null): ReadonlySet<string> {
159
+ if (platform !== null && IGDOCS_PLATFORMS.has(platform)) {
160
+ return new Set(IGDOCS_BROAD_SECTIONS);
161
+ }
162
+ return new Set();
163
+ }
164
+
165
+ /** Returns `true` when the label is a broad navigation bucket, not a meaningful label prefix. */
166
+ function isBroadSection(label: string, broadSections: ReadonlySet<string>): boolean {
167
+ return broadSections.has(label);
168
+ }
169
+
170
+ // ---------------------------------------------------------------------------
171
+
172
+ const GENERIC_WORDS = new Set([
173
+ 'Overview', 'Introduction', 'Getting Started', 'Quick Start',
174
+ 'Examples', 'Reference', 'Guide', 'Tutorial', 'Configuration', 'Usage',
175
+ 'Theming', 'Sorting', 'Editing', 'Filtering', 'Grouping', 'Paging',
176
+ 'Selection', 'Summaries', 'Toolbar', 'Export', 'Virtualization',
177
+ 'Accessibility', 'Localization', 'Styling',
178
+ ]);
179
+
180
+ function isGeneric(label: string): boolean {
181
+ return GENERIC_WORDS.has(label) || [...GENERIC_WORDS].some(w => label.startsWith(w + ' '));
182
+ }
183
+
184
+ /** Strips a leading `"<prefix> "` from label if present, avoiding "Editing Editing Overview". */
185
+ function stripLeadingDuplicate(label: string, prefix: string): string {
186
+ const candidate = `${prefix} `;
187
+ return label.startsWith(candidate) ? label.slice(candidate.length) : label;
188
+ }
189
+
190
+ /**
191
+ * Build an AI-readable label for a leaf page.
192
+ *
193
+ * Broad-section ancestors (navigation buckets like "Grids & Lists", "Charts")
194
+ * are stripped from the ancestor path first — they carry no prefix value.
195
+ * The remaining (component/subsection) ancestors determine context:
196
+ *
197
+ * filtered 0 — no meaningful ancestors: label as-is.
198
+ * e.g. "Getting Started" under "General" → "Getting Started"
199
+ *
200
+ * filtered 1 — one component ancestor:
201
+ * - generic label → `component label` e.g. "Grid Overview"
202
+ * - specific label → `label` e.g. "List"
203
+ *
204
+ * filtered 2+ — component + subsection ancestors:
205
+ * - generic label → `component subsection label` e.g. "Grid Editing Overview"
206
+ * - specific label → `component label` e.g. "Grid Cell Editing"
207
+ * (stripLeadingDuplicate avoids "Grid Editing Editing Overview")
208
+ */
209
+ function buildLabel(label: string, ancestorPath: string[], broadSections: ReadonlySet<string> = new Set()): string {
210
+ // Strip navigation buckets — they are not useful label prefixes.
211
+ const filtered = ancestorPath.filter(a => !isBroadSection(a, broadSections));
212
+
213
+ if (filtered.length === 0) return label;
214
+
215
+ if (filtered.length === 1) {
216
+ const parent = filtered[0];
217
+ return isGeneric(label) ? `${parent} ${label}` : label;
218
+ }
219
+
220
+ const component = filtered[filtered.length - 2];
221
+ const subsection = filtered[filtered.length - 1];
222
+
223
+ if (isGeneric(label)) {
224
+ const deduped = stripLeadingDuplicate(label, subsection);
225
+ return `${component} ${subsection} ${deduped}`;
226
+ }
227
+
228
+ return `${component} ${label}`;
229
+ }
230
+
231
+ // ---------------------------------------------------------------------------
232
+ // Sidebar walk + llms.txt line generation
233
+ // ---------------------------------------------------------------------------
234
+
235
+ function walkLlmsItems(
236
+ items: SidebarItem[],
237
+ base: string,
238
+ lines: string[],
239
+ meta: Record<string, LlmsMeta>,
240
+ seen: Set<string>,
241
+ ancestorPath: string[] = [],
242
+ depth = 0,
243
+ broadSections: ReadonlySet<string> = new Set(),
244
+ ): void {
245
+ const groups: SidebarItem[] = [];
246
+
247
+ for (const item of items) {
248
+ if (item.slug !== undefined) {
249
+ const slug = item.slug === '' ? 'index' : item.slug;
250
+ if (seen.has(slug)) continue;
251
+ seen.add(slug);
252
+
253
+ const label = buildLabel(item.label ?? slug, ancestorPath, broadSections);
254
+ const m = meta[slug];
255
+ let line = `- [${label}](${base}/${slug}.md)`;
256
+ if (m?.description) line += `: ${m.description}`;
257
+ lines.push(line);
258
+ if (m?.keywords?.length) lines.push(` Tags: ${m.keywords.join(', ')}`);
259
+ continue;
260
+ }
261
+ if (Array.isArray(item.items) && item.items.length > 0) groups.push(item);
262
+ }
263
+
264
+ for (const group of groups) {
265
+ if (depth < 3) {
266
+ const headingLevel = depth === 0 ? 2 : depth + 2;
267
+ lines.push('', `${'#'.repeat(headingLevel)} ${group.label}`, '');
268
+ }
269
+ walkLlmsItems(
270
+ group.items!,
271
+ base,
272
+ lines,
273
+ meta,
274
+ seen,
275
+ [...ancestorPath, group.label ?? ''],
276
+ depth + 1,
277
+ broadSections,
278
+ );
279
+ }
280
+ }
281
+
282
+ // ---------------------------------------------------------------------------
283
+ // Public builder
284
+ // ---------------------------------------------------------------------------
285
+
286
+ export function buildLlmsTxt(
287
+ base: string,
288
+ siteTitle: string,
289
+ siteDescription: string,
290
+ sidebarItems: SidebarItem[],
291
+ metaMap: Map<string, LlmsMeta>,
292
+ llmsSets: LlmsSet[] = [],
293
+ broadSections: ReadonlySet<string> = new Set(),
294
+ ): string {
295
+ const lines: string[] = [
296
+ `# ${siteTitle}`,
297
+ '',
298
+ `> ${siteDescription}`,
299
+ '',
300
+ '## Documentation sets',
301
+ '',
302
+ `- [Abridged documentation](${base}/llms-small.txt): a compact version of the documentation, with non-essential content removed`,
303
+ `- [Combined docs](${base}/llms-full.txt): Single-file Markdown export of all docs.`,
304
+ ``
305
+ ];
306
+
307
+ for (const set of llmsSets) {
308
+ const slug = toUrlSlug(set.label);
309
+ const link = `- [${set.label}](${base}/_llms-txt/${slug}.txt)`;
310
+ lines.push(set.description ? `${link}: ${set.description}` : link);
311
+ }
312
+
313
+ walkLlmsItems(sidebarItems, base, lines, Object.fromEntries(metaMap), new Set(), [], 0, broadSections);
314
+ return lines.join('\n');
315
+ }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * platform.ts
3
+ *
4
+ * Central registry of per-platform CDN assets (styles / scripts) and nav
5
+ * endpoint configuration, ported from igniteui-docfx-template:
6
+ * - template/partials/head.tmpl.partial (styles + AppBuilder init script)
7
+ * - template/partials/scripts.tmpl.partial (scripts per platform)
8
+ * - template/conceptual.html.primary.js (platform flag derivation)
9
+ *
10
+ * Usage from astro.config.ts:
11
+ * import { getPlatformHead } from './src/platform.ts';
12
+ * // inside starlight({ head: getPlatformHead('angular', 'en') })
13
+ *
14
+ * Usage from integration.ts:
15
+ * import { getNavConfig } from './platform.ts';
16
+ * const { navType, navUrl } = getNavConfig(platform, navLang);
17
+ */
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // Types
21
+ // ---------------------------------------------------------------------------
22
+
23
+ /** HTML tag names accepted by Starlight's `head` array. */
24
+ export type HeadTag =
25
+ | 'title' | 'link' | 'style' | 'base'
26
+ | 'meta' | 'script' | 'noscript' | 'template';
27
+
28
+ /** Single entry in Starlight's `head` array — tag, attrs, optional content. */
29
+ export type HeadEntry = {
30
+ tag: HeadTag;
31
+ attrs?: Record<string, string | boolean | undefined>;
32
+ content?: string;
33
+ };
34
+
35
+ export type PlatformKey =
36
+ | 'angular'
37
+ | 'react'
38
+ | 'blazor'
39
+ | 'web-components'
40
+ | 'slingshot'
41
+ | 'appbuilder';
42
+
43
+ /** Locale code for nav/API requests and UI string lookups. */
44
+ export type NavLang = 'en' | 'jp' | 'kr';
45
+
46
+ /**
47
+ * Theme identifier used by nav/footer components.
48
+ * `'igniteui'` is the catch-all for all IG-family sites that don't have a
49
+ * more specific key; the rest match `PlatformKey` exactly.
50
+ */
51
+ export type NavTheme = PlatformKey | 'igniteui';
52
+
53
+ export interface PlatformMeta {
54
+ title: string; description: string;
55
+ key: PlatformKey; devPort: number;
56
+ base: string; label: string;
57
+ lang: NavLang;
58
+ }
59
+
60
+ type NavType = 'infragistics' | 'appbuilder' | 'none';
61
+
62
+ interface PlatformDef {
63
+ navType: NavType;
64
+ styles: HeadEntry[];
65
+ scripts: HeadEntry[];
66
+ }
67
+
68
+ export interface NavConfig {
69
+ navType: NavType;
70
+ navUrl: string | null;
71
+ }
72
+
73
+ // ---------------------------------------------------------------------------
74
+ // Shared IG styles — used by: angular, react, blazor, web-components, slingshot
75
+ // ---------------------------------------------------------------------------
76
+ const IG_STYLES: HeadEntry[] = [
77
+ // Bootstrap is wrapped in a CSS cascade layer so its global resets do not
78
+ // bleed into the Starlight theme. The layer priority order is declared at
79
+ // the top of custom.css: @layer bootstrap, starlight.core, starlight.overrides
80
+ // Note: @import layer() does not support the `integrity` SRI attribute.
81
+ {
82
+ tag: 'style',
83
+ content: '@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css") layer(bootstrap);',
84
+ },
85
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/assets/modern/css/layout.css' } },
86
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/assets/modern/css/animate-custom.css' } },
87
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/assets/modern/css/fontello.css' } },
88
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' } },
89
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/css/navigation.css' } },
90
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://www.infragistics.com/css/footer.css' } },
91
+ ];
92
+
93
+ // ---------------------------------------------------------------------------
94
+ // Shared IG scripts — used by: angular, react, blazor, web-components, slingshot
95
+ // ---------------------------------------------------------------------------
96
+ const IG_SCRIPTS: HeadEntry[] = [
97
+ {
98
+ tag: 'script',
99
+ attrs: {
100
+ src: 'https://code.jquery.com/jquery-3.1.0.js',
101
+ integrity: 'sha256-slogkvB1K3VOkzAI8QITxV3VzpOnkeNVsKvtkYLMjfk=',
102
+ crossorigin: 'anonymous',
103
+ },
104
+ },
105
+ { tag: 'script', attrs: { src: 'https://www.infragistics.com/assets/modern/scripts/plugins.nav.js' } },
106
+ { tag: 'script', attrs: { src: 'https://www.infragistics.com/assets/modern/scripts/navigation.js' } },
107
+ ];
108
+
109
+ // ---------------------------------------------------------------------------
110
+ // AppBuilder styles — source: head.tmpl.partial {{#_isAppBuilder}} block
111
+ // ---------------------------------------------------------------------------
112
+ const APPBUILDER_STYLES: HeadEntry[] = [
113
+ // Mega-menu plugin styles
114
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/uploads/maxmegamenu/style.css?ver=631e5d', media: 'all' } },
115
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-includes/css/dashicons.min.css', media: 'all' } },
116
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu-pro/icons/genericons/genericons/genericons.css', media: 'all' } },
117
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu-pro/icons/fontawesome6/css/all.min.css', media: 'all' } },
118
+ // Bootstrap v4.4 partials — wrapped in a CSS cascade layer so they don't
119
+ // override the Starlight theme. See custom.css @layer declaration.
120
+ {
121
+ tag: 'style',
122
+ content: [
123
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_reboot.css") layer(bootstrap);',
124
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_type.css") layer(bootstrap);',
125
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_grid.css") layer(bootstrap);',
126
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_buttons.css") layer(bootstrap);',
127
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_forms.css") layer(bootstrap);',
128
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_input-group.css") layer(bootstrap);',
129
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_custom-forms.css") layer(bootstrap);',
130
+ '@import url("https://staging.appbuilder.dev/wp-content/themes/slingshot/css/bootstrap.v4.4/_utilities.css") layer(bootstrap);',
131
+ ].join('\n'),
132
+ },
133
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/css/ig-modal.css', media: 'all' } },
134
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/css/styles.css', media: 'all' } },
135
+ // Fonts
136
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Figtree:300,400,700&display=swap' } },
137
+ { tag: 'link', attrs: { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700&display=swap' } },
138
+ ];
139
+
140
+ // ---------------------------------------------------------------------------
141
+ // AppBuilder scripts — source: scripts.tmpl.partial {{#_isAppBuilder}} block
142
+ // These are injected into <head> so they are available when the prebuild
143
+ // header HTML calls jQuery / maxmegamenu on load.
144
+ // ---------------------------------------------------------------------------
145
+ const APPBUILDER_SCRIPTS: HeadEntry[] = [
146
+ // jQuery from staging (megamenu plugins may depend on this specific version)
147
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-includes/js/jquery/jquery.min.js?ver=3.7.1' } },
148
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.4.1' } },
149
+ // Site JS
150
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/js/plugins.js?ver=1' } },
151
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/js/script.js?ver=1' } },
152
+ // Mega-menu plugins
153
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-includes/js/hoverIntent.min.js?ver=1.10.2' } },
154
+ // Inline megamenu config (must precede the megamenu plugin scripts)
155
+ { tag: 'script', attrs: {}, content: 'var megamenu = {"timeout":"300","interval":"100"};' },
156
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu-pro/assets/public.js?ver=2.3.1.1' } },
157
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/plugins/megamenu/js/maxmegamenu.js?ver=3.3.1' } },
158
+ // Contact form + lead tracking
159
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/js/sf.common.js?ver=1' } },
160
+ { tag: 'script', attrs: { src: 'https://www.google.com/recaptcha/api.js?render=6Lc-MFAaAAAAAIWi7UOrSUfUZnVmDUSsXjzS4BgY&ver=1' } },
161
+ { tag: 'script', attrs: { src: 'https://staging.appbuilder.dev/wp-content/themes/slingshot/js/leadTracker.js?ver=1' } },
162
+ ];
163
+
164
+ // ---------------------------------------------------------------------------
165
+ // Platform registry
166
+ // navType drives which endpoint the build-time prefetch uses:
167
+ // 'infragistics' → www/jp.infragistics.com/navigation
168
+ // 'appbuilder' → www.appbuilder.dev/header-footer-export
169
+ // ---------------------------------------------------------------------------
170
+ export const PLATFORM_DEFS: Record<PlatformKey, PlatformDef> = {
171
+ angular: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
172
+ react: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
173
+ blazor: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
174
+ 'web-components': { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
175
+ slingshot: { navType: 'infragistics', styles: IG_STYLES, scripts: IG_SCRIPTS },
176
+ appbuilder: { navType: 'appbuilder', styles: APPBUILDER_STYLES, scripts: APPBUILDER_SCRIPTS },
177
+ };
178
+
179
+ // ---------------------------------------------------------------------------
180
+ // Public API
181
+ // ---------------------------------------------------------------------------
182
+
183
+ /**
184
+ * Shared per-platform metadata for all Ignite UI docs sites.
185
+ * Import this in `astro.config.ts` files instead of duplicating the data.
186
+ */
187
+ export const IGDOCS_PLATFORMS: Record<string, PlatformMeta> = {
188
+ // English
189
+ Angular: {
190
+ lang: 'en', label: 'Angular', key: 'angular', devPort: 4331,
191
+ base: '/docs-angular-new',
192
+ title: 'Ignite UI for Angular',
193
+ description: 'Component documentation for Ignite UI for Angular.',
194
+ },
195
+ React: {
196
+ lang: 'en', label: 'React', key: 'react', devPort: 4332,
197
+ base: '/docs-react-new',
198
+ title: 'Ignite UI for React',
199
+ description: 'Component documentation for Ignite UI for React.',
200
+ },
201
+ WebComponents: {
202
+ lang: 'en', label: 'Web Components', key: 'web-components', devPort: 4333,
203
+ base: '/docs-wc-new',
204
+ title: 'Ignite UI for Web Components',
205
+ description: 'Component documentation for Ignite UI for Web Components.',
206
+ },
207
+ Blazor: {
208
+ lang: 'en', label: 'Blazor', key: 'blazor', devPort: 4334,
209
+ base: '/docs-blazor-new',
210
+ title: 'Ignite UI for Blazor',
211
+ description: 'Component documentation for Ignite UI for Blazor.',
212
+ },
213
+ // Japanese
214
+ AngularJP: {
215
+ lang: 'jp', label: 'Angular', key: 'angular', devPort: 4341,
216
+ base: '/docs-angular-new',
217
+ title: 'Ignite UI for Angular',
218
+ description: 'Component documentation for Ignite UI for Angular.',
219
+ },
220
+ ReactJP: {
221
+ lang: 'jp', label: 'React', key: 'react', devPort: 4342,
222
+ base: '/docs-react-new',
223
+ title: 'Ignite UI for React',
224
+ description: 'Component documentation for Ignite UI for React.',
225
+ },
226
+ WebComponentsJP: {
227
+ lang: 'jp', label: 'Web Components', key: 'web-components', devPort: 4343,
228
+ base: '/docs-wc-new',
229
+ title: 'Ignite UI for Web Components',
230
+ description: 'Component documentation for Ignite UI for Web Components.',
231
+ },
232
+ BlazorJP: {
233
+ lang: 'jp', label: 'Blazor', key: 'blazor', devPort: 4344,
234
+ base: '/docs-blazor-new',
235
+ title: 'Ignite UI for Blazor',
236
+ description: 'Component documentation for Ignite UI for Blazor.',
237
+ },
238
+ };
239
+
240
+ /**
241
+ * Returns an array of Starlight `head` entries for the given platform.
242
+ * Pass the result directly to `starlight({ head: getPlatformHead(...) })`.
243
+ *
244
+ * @param platform - Platform identifier.
245
+ * @param lang - Locale — not currently used but kept for API completeness.
246
+ */
247
+ export function getPlatformHead(platform: string, lang = 'en'): HeadEntry[] {
248
+ const def = PLATFORM_DEFS[platform as PlatformKey];
249
+ if (!def) {
250
+ console.warn(`[docs-template] Unknown platform "${platform}" — no head entries injected.`);
251
+ return [];
252
+ }
253
+ return [
254
+ { tag: 'meta', attrs: { property: 'docs:platform', content: platform } },
255
+ ...def.styles,
256
+ ...def.scripts,
257
+ ];
258
+ }
259
+
260
+ /**
261
+ * Returns the nav endpoint config for the given platform.
262
+ * Used internally by siteMetaIntegration to decide what to prefetch.
263
+ *
264
+ * @param platform - Platform identifier, or `null` for no nav.
265
+ * @param lang - Locale for the nav URL ('en' | 'jp' | 'kr').
266
+ */
267
+ export function getNavConfig(platform: string | null, lang = 'en'): NavConfig {
268
+ const igBase = lang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
269
+ switch (platform) {
270
+ case 'appbuilder':
271
+ return { navType: 'appbuilder', navUrl: 'https://www.appbuilder.dev/header-footer-export' };
272
+ case 'angular':
273
+ case 'react':
274
+ case 'blazor':
275
+ case 'web-components':
276
+ case 'slingshot':
277
+ return { navType: 'infragistics', navUrl: `${igBase}/navigation` };
278
+ default:
279
+ return { navType: 'none', navUrl: null };
280
+ }
281
+ }