igniteui-astro-components 0.0.3 → 0.0.5
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/package.json +2 -2
- package/src/components/DocsSidebar/DocsSidebar.astro +10 -3
- package/src/components/DocsSidebar/toTreeNodes.ts +17 -5
- package/src/components/mdx/ApiLink/ApiLink.astro +2 -2
- package/src/components/mdx/ApiRef/ApiRef.astro +2 -2
- package/src/components/mdx/PlatformBlock/PlatformBlock.astro +2 -2
- package/src/components/mdx/Sample/Sample.astro +3 -3
- package/src/index.ts +2 -2
- package/src/integration.ts +11 -8
- package/src/lib/types.ts +66 -0
- package/src/virtual-modules.d.ts +13 -0
- package/src/lib/platform-context.ts +0 -305
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-astro-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"./components/mdx/Sample.astro": "./src/components/mdx/Sample/Sample.astro",
|
|
65
65
|
"./lib/sidebar/types": "./src/lib/sidebar/types.ts",
|
|
66
66
|
"./lib/sidebar/helpers": "./src/lib/sidebar/helpers.ts",
|
|
67
|
-
"./lib/
|
|
67
|
+
"./lib/types": "./src/lib/types.ts",
|
|
68
68
|
"./plugins/remark-docfx": "./src/plugins/remark-docfx.ts",
|
|
69
69
|
"./styles/custom.scss": "./src/styles/custom.scss",
|
|
70
70
|
"./styles/ig-theme.scss": "./src/styles/ig-theme.scss",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Package: igniteui-webcomponents (public, MIT) — change the import path
|
|
9
9
|
* in the <script> block below to use @infragistics/igniteui-webcomponents.
|
|
10
10
|
*/
|
|
11
|
-
import { sidebar as sidebarData } from 'virtual:docs-template/site-meta';
|
|
11
|
+
import { sidebar as sidebarData, trailingSlash as configuredTrailingSlash } from 'virtual:docs-template/site-meta';
|
|
12
12
|
import SidebarFilterInput from './SidebarFilterInput.astro';
|
|
13
13
|
import './DocsSidebar.scss';
|
|
14
14
|
import SidebarLabel from './SidebarLabel.astro';
|
|
@@ -24,11 +24,18 @@ interface Props {
|
|
|
24
24
|
* Useful when consuming the component without `siteMetaIntegration`.
|
|
25
25
|
*/
|
|
26
26
|
items?: SidebarEntry[];
|
|
27
|
+
/**
|
|
28
|
+
* Append trailing slash to sidebar links.
|
|
29
|
+
* Defaults to the value derived from the site's `trailingSlash` Astro config
|
|
30
|
+
* (exposed via the virtual module). Falls back to `true` if not configured.
|
|
31
|
+
*/
|
|
32
|
+
trailingSlash?: boolean;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
const
|
|
35
|
+
const useTrailingSlash = configuredTrailingSlash !== 'never';
|
|
36
|
+
const { currentSlug = '', items: itemsProp, trailingSlash = useTrailingSlash } = Astro.props;
|
|
30
37
|
const items = (itemsProp ?? sidebarData) as SidebarEntry[];
|
|
31
|
-
const nodes = toTreeNodes(items, currentSlug);
|
|
38
|
+
const nodes = toTreeNodes(items, currentSlug, { trailingSlash });
|
|
32
39
|
const activeId = normalizeSlug(currentSlug);
|
|
33
40
|
---
|
|
34
41
|
|
|
@@ -18,15 +18,21 @@ import { isGroup, isInitiallyOpen, joinPath, normalizeSlug } from '../../lib/sid
|
|
|
18
18
|
|
|
19
19
|
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
|
20
20
|
|
|
21
|
-
const linkHref = (slug: string): string => {
|
|
21
|
+
const linkHref = (slug: string, trailingSlash: boolean): string => {
|
|
22
22
|
const normalized = normalizeSlug(slug);
|
|
23
|
-
|
|
23
|
+
const suffix = trailingSlash ? '/' : '';
|
|
24
|
+
if (!normalized) {
|
|
25
|
+
// Root (docs index): ensure href is at least '/' when base is empty.
|
|
26
|
+
return `${base}${suffix}` || '/';
|
|
27
|
+
}
|
|
28
|
+
return `${base}/${normalized}${suffix}`;
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
const toNode = (
|
|
27
32
|
entry: SidebarEntry,
|
|
28
33
|
ancestors: string[],
|
|
29
34
|
currentSlug: string,
|
|
35
|
+
trailingSlash: boolean,
|
|
30
36
|
): TreeNode => {
|
|
31
37
|
const path = joinPath(ancestors, entry.label);
|
|
32
38
|
|
|
@@ -36,7 +42,7 @@ const toNode = (
|
|
|
36
42
|
label: entry.label,
|
|
37
43
|
expanded: isInitiallyOpen(entry, currentSlug) || undefined,
|
|
38
44
|
children: entry.items.map((child) =>
|
|
39
|
-
toNode(child, [...ancestors, entry.label], currentSlug),
|
|
45
|
+
toNode(child, [...ancestors, entry.label], currentSlug, trailingSlash),
|
|
40
46
|
),
|
|
41
47
|
itemData: {
|
|
42
48
|
path,
|
|
@@ -49,7 +55,7 @@ const toNode = (
|
|
|
49
55
|
return {
|
|
50
56
|
id: normalizeSlug(entry.slug),
|
|
51
57
|
label: entry.label,
|
|
52
|
-
href: linkHref(entry.slug),
|
|
58
|
+
href: linkHref(entry.slug, trailingSlash),
|
|
53
59
|
itemData: {
|
|
54
60
|
path,
|
|
55
61
|
label: entry.label,
|
|
@@ -60,7 +66,13 @@ const toNode = (
|
|
|
60
66
|
};
|
|
61
67
|
};
|
|
62
68
|
|
|
69
|
+
export interface ToTreeNodesOptions {
|
|
70
|
+
/** Append trailing slash to sidebar links. Defaults to `true`. */
|
|
71
|
+
trailingSlash?: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
63
74
|
export const toTreeNodes = (
|
|
64
75
|
entries: SidebarEntry[],
|
|
65
76
|
currentSlug: string,
|
|
66
|
-
|
|
77
|
+
{ trailingSlash = true }: ToTreeNodesOptions = {},
|
|
78
|
+
): TreeNode[] => entries.map((entry) => toNode(entry, [], currentSlug, trailingSlash));
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* <ApiLink kind="enum" type="CalendarSelection" />
|
|
39
39
|
* → <a href="…/enums/igniteui-react.igrcalendarselection.html">…</a>
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import type { PlatformContext } from '../../../lib/types.ts';
|
|
42
42
|
|
|
43
43
|
type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function';
|
|
44
44
|
|
|
@@ -89,7 +89,7 @@ const KIND_SEGMENT: Record<ApiKind, string> = {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
const { type, kind = 'class', member, pkg = 'core', label, prefixed = true, suffix = true } = Astro.props;
|
|
92
|
-
const { prefix, apiPackages } =
|
|
92
|
+
const { prefix, apiPackages } = Astro.locals.platformContext as PlatformContext;
|
|
93
93
|
|
|
94
94
|
const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
|
|
95
95
|
const baseType = prefixed ? `${prefix}${type}` : type;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* <!-- skip auto-prefix for fully-qualified names -->
|
|
18
18
|
* <ApiRef types={["IgbToast"]} prefixed={false} />
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import type { PlatformContext } from '../../../lib/types.ts';
|
|
21
21
|
|
|
22
22
|
type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function';
|
|
23
23
|
|
|
@@ -58,7 +58,7 @@ const KIND_SEGMENT: Record<ApiKind, string> = {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const { types, kind = 'class', pkg = 'core', prefixed = true, suffix = true } = Astro.props;
|
|
61
|
-
const { prefix, apiPackages } =
|
|
61
|
+
const { prefix, apiPackages } = Astro.locals.platformContext as PlatformContext;
|
|
62
62
|
|
|
63
63
|
const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
|
|
64
64
|
const segment = KIND_SEGMENT[kind];
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* This paragraph only appears in Angular and React docs.
|
|
11
11
|
* </PlatformBlock>
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import type { PlatformContext } from '../../../lib/types';
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
16
|
/** Comma-separated list of platform names to show content for. */
|
|
@@ -19,6 +19,6 @@ interface Props {
|
|
|
19
19
|
|
|
20
20
|
const { for: forProp } = Astro.props;
|
|
21
21
|
const allowed = forProp.split(',').map((s) => s.trim());
|
|
22
|
-
const { name } =
|
|
22
|
+
const { name } = Astro.locals.platformContext as PlatformContext;
|
|
23
23
|
---
|
|
24
24
|
{allowed.includes(name) && <slot />}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* DV samples (charts/, gauges/, maps/, excel/) automatically use dvDemosBaseUrl
|
|
15
15
|
* when a separate demosBaseUrl is present in the environment config.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import type { PlatformContext } from '../../../lib/types.ts';
|
|
18
18
|
import './Sample.scss';
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
@@ -34,8 +34,8 @@ interface Props {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const { src, height = 400, alt = '', lob = false, dv = false, crm = false, iframeOnly = false, fullscreenBtn = false } = Astro.props;
|
|
37
|
-
const { name, lower } =
|
|
38
|
-
const env =
|
|
37
|
+
const { name, lower } = Astro.locals.platformContext as PlatformContext;
|
|
38
|
+
const env = Astro.locals.envVars ?? {};
|
|
39
39
|
|
|
40
40
|
// DV samples (charts, gauges, maps, excel) use dvDemosBaseUrl when available.
|
|
41
41
|
const DV_PREFIXES = ['gauges/', 'maps/', 'excel/', 'charts/'];
|
package/src/index.ts
CHANGED
package/src/integration.ts
CHANGED
|
@@ -212,20 +212,23 @@ export function siteMetaIntegration({
|
|
|
212
212
|
|
|
213
213
|
// Navigation buckets for this platform — stripped from ancestor paths during label generation.
|
|
214
214
|
const broadSections = getBroadSectionsForPlatform(effectivePlatform);
|
|
215
|
-
|
|
216
|
-
export const sidebar = ${JSON.stringify(sidebar ?? [])};
|
|
217
|
-
export const productLinks = ${JSON.stringify(productLinks)};
|
|
218
|
-
export const headEntries = ${JSON.stringify(head ?? [])};
|
|
219
|
-
`;
|
|
220
|
-
|
|
221
|
-
// Captured from astro:config:done; used to generate llms.txt content.
|
|
215
|
+
// Captured from astro:config:done; used to generate llms.txt content and virtual module.
|
|
222
216
|
let configuredSite = '';
|
|
217
|
+
// Cached virtual module source — built once in astro:config:done after
|
|
218
|
+
// trailingSlash is known and reused on every subsequent Vite load() call.
|
|
219
|
+
let siteMetaCode = '';
|
|
223
220
|
|
|
224
221
|
return {
|
|
225
222
|
name: 'docs-template:site-meta',
|
|
226
223
|
hooks: {
|
|
227
224
|
'astro:config:done'({ config }) {
|
|
228
225
|
configuredSite = (config.site?.toString() ?? '').replace(/\/$/, '');
|
|
226
|
+
siteMetaCode = `export const title = ${JSON.stringify(title)};
|
|
227
|
+
export const sidebar = ${JSON.stringify(sidebar ?? [])};
|
|
228
|
+
export const productLinks = ${JSON.stringify(productLinks)};
|
|
229
|
+
export const headEntries = ${JSON.stringify(head ?? [])};
|
|
230
|
+
export const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
|
231
|
+
`;
|
|
229
232
|
},
|
|
230
233
|
'astro:config:setup'({ updateConfig, injectRoute }) {
|
|
231
234
|
injectRoute({
|
|
@@ -283,7 +286,7 @@ export const headEntries = ${JSON.stringify(head ?? [])};
|
|
|
283
286
|
if (id === navVirtualId) return navResolvedId;
|
|
284
287
|
},
|
|
285
288
|
async load(id: string) {
|
|
286
|
-
if (id === resolvedId) return
|
|
289
|
+
if (id === resolvedId) return siteMetaCode;
|
|
287
290
|
if (id !== navResolvedId) return;
|
|
288
291
|
|
|
289
292
|
// Return cached module code — fetched at most once per build.
|
package/src/lib/types.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type PlatformName = 'Angular' | 'React' | 'WebComponents' | 'Blazor';
|
|
2
|
+
|
|
3
|
+
export interface ApiPackageConfig {
|
|
4
|
+
/** TypeDoc documentation root URL (no trailing slash). */
|
|
5
|
+
docRoot: string;
|
|
6
|
+
/**
|
|
7
|
+
* Package identifier as it appears in the TypeDoc URL path.
|
|
8
|
+
* Core packages use hyphens ("igniteui-react"),
|
|
9
|
+
* sub-packages use underscores ("igniteui_react_charts").
|
|
10
|
+
*/
|
|
11
|
+
packageId: string;
|
|
12
|
+
/**
|
|
13
|
+
* When true the package prefix is omitted from the class URL, e.g.
|
|
14
|
+
* Angular docs use `/classes/IgxGridComponent.html` (no `packageId.` prefix).
|
|
15
|
+
*/
|
|
16
|
+
noPackagePrefix?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* When true the class name casing is preserved as-is (no .toLowerCase()).
|
|
19
|
+
* New-style API sites (react-apis-new, wc-apis-new, blazor-apis-new) use PascalCase URLs.
|
|
20
|
+
*/
|
|
21
|
+
preserveCase?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optional suffix appended to the class name before lowercasing, e.g.
|
|
24
|
+
* Angular DV packages append "Component" so `CategoryChart` resolves to
|
|
25
|
+
* `igniteui_angular_charts.igxcategorychartcomponent.html`.
|
|
26
|
+
* Only applied when `prefixed={true}`.
|
|
27
|
+
*/
|
|
28
|
+
classSuffix?: string;
|
|
29
|
+
/**
|
|
30
|
+
* When true, member anchor names are PascalCase (first letter uppercased).
|
|
31
|
+
* Blazor TypeDoc uses PascalCase anchors, e.g. `#SingleExpand` instead of `#singleExpand`.
|
|
32
|
+
*/
|
|
33
|
+
pascalCaseMembers?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface PlatformContext {
|
|
37
|
+
name: PlatformName;
|
|
38
|
+
/** Lower-case slug used in URLs, e.g. "angular" */
|
|
39
|
+
lower: string;
|
|
40
|
+
/** Component class prefix, e.g. "Igx" / "Igr" / "Igc" / "Igb" */
|
|
41
|
+
prefix: string;
|
|
42
|
+
productName: string;
|
|
43
|
+
productSpinal: string;
|
|
44
|
+
/**
|
|
45
|
+
* Per-package API documentation config keyed by short name.
|
|
46
|
+
* "core" is always the main component package.
|
|
47
|
+
* Other keys match the logical package category: "charts", "grids",
|
|
48
|
+
* "gauges", "maps", "inputs", "layouts", "excel", "spreadsheet", etc.
|
|
49
|
+
*
|
|
50
|
+
* URL for a class: {docRoot}/classes/{packageId}.{PrefixType}.html
|
|
51
|
+
* URL for a member: {docRoot}/classes/{packageId}.{PrefixType}.html#{member}
|
|
52
|
+
*/
|
|
53
|
+
apiPackages: Record<string, ApiPackageConfig>;
|
|
54
|
+
packages: {
|
|
55
|
+
common: string;
|
|
56
|
+
charts: string;
|
|
57
|
+
grids: string;
|
|
58
|
+
gauges: string;
|
|
59
|
+
maps: string;
|
|
60
|
+
};
|
|
61
|
+
links: {
|
|
62
|
+
github: string;
|
|
63
|
+
forums: string;
|
|
64
|
+
repoSamples: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
package/src/virtual-modules.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import type { PlatformContext } from './lib/types.ts';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace App {
|
|
5
|
+
interface Locals {
|
|
6
|
+
platformContext?: PlatformContext;
|
|
7
|
+
envVars?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
declare module 'virtual:docs-template/site-meta' {
|
|
2
13
|
export const sidebar: { label: string; slug?: string; items?: unknown[] }[];
|
|
3
14
|
export const title: string;
|
|
@@ -13,6 +24,8 @@ declare module 'virtual:docs-template/site-meta' {
|
|
|
13
24
|
attrs?: Record<string, string | boolean | undefined>;
|
|
14
25
|
content?: string;
|
|
15
26
|
}>;
|
|
27
|
+
/** Astro trailingSlash config value: 'always' | 'never' | 'ignore'. */
|
|
28
|
+
export const trailingSlash: 'always' | 'never' | 'ignore';
|
|
16
29
|
}
|
|
17
30
|
|
|
18
31
|
import type { NavLang, NavTheme } from './platform.ts';
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed platform configuration — replaces the per-platform `replacements`
|
|
3
|
-
* array in docConfig.json with a first-class TypeScript object.
|
|
4
|
-
*
|
|
5
|
-
* Components and MDX files import `getPlatformContext()` directly instead of
|
|
6
|
-
* relying on string-replacement tokens like {Platform} or {ProductName}.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'node:fs';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
|
|
12
|
-
export type PlatformName = 'Angular' | 'React' | 'WebComponents' | 'Blazor';
|
|
13
|
-
|
|
14
|
-
export interface ApiPackageConfig {
|
|
15
|
-
/** TypeDoc documentation root URL (no trailing slash). */
|
|
16
|
-
docRoot: string;
|
|
17
|
-
/**
|
|
18
|
-
* Package identifier as it appears in the TypeDoc URL path.
|
|
19
|
-
* Core packages use hyphens ("igniteui-react"),
|
|
20
|
-
* sub-packages use underscores ("igniteui_react_charts").
|
|
21
|
-
*/
|
|
22
|
-
packageId: string;
|
|
23
|
-
/**
|
|
24
|
-
* When true the package prefix is omitted from the class URL, e.g.
|
|
25
|
-
* Angular docs use `/classes/IgxGridComponent.html` (no `packageId.` prefix).
|
|
26
|
-
*/
|
|
27
|
-
noPackagePrefix?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* When true the class name casing is preserved as-is (no .toLowerCase()).
|
|
30
|
-
* New-style API sites (react-apis-new, wc-apis-new, blazor-apis-new) use PascalCase URLs.
|
|
31
|
-
*/
|
|
32
|
-
preserveCase?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Optional suffix appended to the class name before lowercasing, e.g.
|
|
35
|
-
* Angular DV packages append "Component" so `CategoryChart` resolves to
|
|
36
|
-
* `igniteui_angular_charts.igxcategorychartcomponent.html`.
|
|
37
|
-
* Only applied when `prefixed={true}`.
|
|
38
|
-
*/
|
|
39
|
-
classSuffix?: string;
|
|
40
|
-
/**
|
|
41
|
-
* When true, member anchor names are PascalCase (first letter uppercased).
|
|
42
|
-
* Blazor TypeDoc uses PascalCase anchors, e.g. `#SingleExpand` instead of `#singleExpand`.
|
|
43
|
-
*/
|
|
44
|
-
pascalCaseMembers?: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface PlatformContext {
|
|
48
|
-
name: PlatformName;
|
|
49
|
-
/** Lower-case slug used in URLs, e.g. "angular" */
|
|
50
|
-
lower: string;
|
|
51
|
-
/** Component class prefix, e.g. "Igx" / "Igr" / "Igc" / "Igb" */
|
|
52
|
-
prefix: string;
|
|
53
|
-
productName: string;
|
|
54
|
-
productSpinal: string;
|
|
55
|
-
/**
|
|
56
|
-
* Per-package API documentation config keyed by short name.
|
|
57
|
-
* "core" is always the main component package.
|
|
58
|
-
* Other keys match the logical package category: "charts", "grids",
|
|
59
|
-
* "gauges", "maps", "inputs", "layouts", "excel", "spreadsheet", etc.
|
|
60
|
-
*
|
|
61
|
-
* URL for a class: {docRoot}/classes/{packageId}.{PrefixType}.html
|
|
62
|
-
* URL for a member: {docRoot}/classes/{packageId}.{PrefixType}.html#{member}
|
|
63
|
-
*/
|
|
64
|
-
apiPackages: Record<string, ApiPackageConfig>;
|
|
65
|
-
packages: {
|
|
66
|
-
common: string;
|
|
67
|
-
charts: string;
|
|
68
|
-
grids: string;
|
|
69
|
-
gauges: string;
|
|
70
|
-
maps: string;
|
|
71
|
-
};
|
|
72
|
-
links: {
|
|
73
|
-
github: string;
|
|
74
|
-
forums: string;
|
|
75
|
-
repoSamples: string;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const PLATFORMS: Record<PlatformName, PlatformContext> = {
|
|
80
|
-
Angular: {
|
|
81
|
-
name: 'Angular',
|
|
82
|
-
lower: 'angular',
|
|
83
|
-
prefix: 'Igx',
|
|
84
|
-
productName: 'Ignite UI for Angular',
|
|
85
|
-
productSpinal: 'ignite-ui-angular',
|
|
86
|
-
apiPackages: {
|
|
87
|
-
core: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular/latest', packageId: 'igniteui-angular', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
88
|
-
charts: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-charts/latest', packageId: 'igniteui-angular-charts', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
89
|
-
grids: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular/latest', packageId: 'igniteui-angular', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
90
|
-
gauges: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-gauges/latest', packageId: 'igniteui-angular-gauges', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
91
|
-
maps: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-maps/latest', packageId: 'igniteui-angular-maps', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
92
|
-
excel: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-excel/latest', packageId: 'igniteui-angular-excel', noPackagePrefix: true, preserveCase: true },
|
|
93
|
-
spreadsheet: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-spreadsheet/latest', packageId: 'igniteui-angular-spreadsheet', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
94
|
-
inputs: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-inputs/latest', packageId: 'igniteui-angular-inputs', noPackagePrefix: true, preserveCase: true },
|
|
95
|
-
layouts: { docRoot: 'https://staging.infragistics.com/angular-apis-new/angular/igniteui-angular-layouts/latest', packageId: 'igniteui-angular-layouts', noPackagePrefix: true, preserveCase: true },
|
|
96
|
-
},
|
|
97
|
-
packages: {
|
|
98
|
-
common: 'igniteui-angular',
|
|
99
|
-
charts: 'igniteui-angular-charts',
|
|
100
|
-
grids: 'igniteui-angular',
|
|
101
|
-
gauges: 'igniteui-angular-gauges',
|
|
102
|
-
maps: 'igniteui-angular-maps',
|
|
103
|
-
},
|
|
104
|
-
links: {
|
|
105
|
-
github: 'https://github.com/IgniteUI/igniteui-angular',
|
|
106
|
-
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-angular',
|
|
107
|
-
repoSamples: 'https://github.com/IgniteUI/igniteui-angular-examples/tree/master/samples',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
React: {
|
|
111
|
-
name: 'React',
|
|
112
|
-
lower: 'react',
|
|
113
|
-
prefix: 'Igr',
|
|
114
|
-
productName: 'Ignite UI for React',
|
|
115
|
-
productSpinal: 'ignite-ui-react',
|
|
116
|
-
apiPackages: {
|
|
117
|
-
core: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react/19.5.1', packageId: 'igniteui-react', noPackagePrefix: true, preserveCase: true },
|
|
118
|
-
charts: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-charts/latest', packageId: 'igniteui-react-charts', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
119
|
-
grids: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-grids/19.5.1', packageId: 'igniteui-react-grids', noPackagePrefix: true, preserveCase: true },
|
|
120
|
-
gauges: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-gauges/latest', packageId: 'igniteui-react-gauges', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
121
|
-
maps: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-maps/latest', packageId: 'igniteui-react-maps', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
122
|
-
inputs: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-inputs/latest', packageId: 'igniteui-react-inputs', noPackagePrefix: true, preserveCase: true },
|
|
123
|
-
layouts: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-layouts/latest', packageId: 'igniteui-react-layouts', noPackagePrefix: true, preserveCase: true },
|
|
124
|
-
excel: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-excel/latest', packageId: 'igniteui-react-excel', noPackagePrefix: true, preserveCase: true },
|
|
125
|
-
spreadsheet: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-spreadsheet/latest', packageId: 'igniteui-react-spreadsheet', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
126
|
-
datasources: { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-datasources/latest', packageId: 'igniteui-react-datasources', noPackagePrefix: true, preserveCase: true },
|
|
127
|
-
'grid-lite': { docRoot: 'https://staging.infragistics.com/react-apis-new/react/igniteui-react-grids/19.5.1', packageId: 'igniteui-react-grids', noPackagePrefix: true, preserveCase: true },
|
|
128
|
-
},
|
|
129
|
-
packages: {
|
|
130
|
-
common: '@infragistics/igniteui-react',
|
|
131
|
-
charts: '@infragistics/igniteui-react-charts',
|
|
132
|
-
grids: '@infragistics/igniteui-react-grids',
|
|
133
|
-
gauges: '@infragistics/igniteui-react-gauges',
|
|
134
|
-
maps: '@infragistics/igniteui-react-maps',
|
|
135
|
-
},
|
|
136
|
-
links: {
|
|
137
|
-
github: 'https://github.com/IgniteUI/igniteui-react',
|
|
138
|
-
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-react',
|
|
139
|
-
repoSamples: 'https://github.com/IgniteUI/igniteui-react-examples/tree/master/samples',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
WebComponents: {
|
|
143
|
-
name: 'WebComponents',
|
|
144
|
-
lower: 'webcomponents',
|
|
145
|
-
prefix: 'Igc',
|
|
146
|
-
productName: 'Ignite UI for Web Components',
|
|
147
|
-
productSpinal: 'ignite-ui-web-components',
|
|
148
|
-
apiPackages: {
|
|
149
|
-
core: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents/latest', packageId: 'igniteui-webcomponents', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
150
|
-
charts: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-charts/latest', packageId: 'igniteui-webcomponents-charts', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
151
|
-
grids: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-grids/latest', packageId: 'igniteui-webcomponents-grids', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
152
|
-
gauges: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-gauges/latest', packageId: 'igniteui-webcomponents-gauges', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
153
|
-
maps: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-maps/latest', packageId: 'igniteui-webcomponents-maps', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
154
|
-
inputs: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-inputs/latest', packageId: 'igniteui-webcomponents-inputs', noPackagePrefix: true, preserveCase: true },
|
|
155
|
-
layouts: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-layouts/latest', packageId: 'igniteui-webcomponents-layouts', noPackagePrefix: true, preserveCase: true },
|
|
156
|
-
excel: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-excel/latest', packageId: 'igniteui-webcomponents-excel', noPackagePrefix: true, preserveCase: true },
|
|
157
|
-
spreadsheet: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-spreadsheet/latest', packageId: 'igniteui-webcomponents-spreadsheet', noPackagePrefix: true, preserveCase: true, classSuffix: 'Component' },
|
|
158
|
-
datasources: { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-webcomponents-datasources/latest', packageId: 'igniteui-webcomponents-datasources', noPackagePrefix: true, preserveCase: true },
|
|
159
|
-
'grid-lite': { docRoot: 'https://staging.infragistics.com/wc-apis-new/wc/igniteui-grid-lite/latest', packageId: 'igniteui-grid-lite', noPackagePrefix: true, preserveCase: true },
|
|
160
|
-
},
|
|
161
|
-
packages: {
|
|
162
|
-
common: 'igniteui-webcomponents',
|
|
163
|
-
charts: 'igniteui-webcomponents-charts',
|
|
164
|
-
grids: 'igniteui-webcomponents-grids',
|
|
165
|
-
gauges: 'igniteui-webcomponents-gauges',
|
|
166
|
-
maps: 'igniteui-webcomponents-maps',
|
|
167
|
-
},
|
|
168
|
-
links: {
|
|
169
|
-
github: 'https://github.com/IgniteUI/igniteui-webcomponents',
|
|
170
|
-
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-web-components',
|
|
171
|
-
repoSamples: 'https://github.com/IgniteUI/igniteui-webcomponents-examples/tree/master/samples',
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
Blazor: {
|
|
175
|
-
name: 'Blazor',
|
|
176
|
-
lower: 'blazor',
|
|
177
|
-
prefix: 'Igb',
|
|
178
|
-
productName: 'Ignite UI for Blazor',
|
|
179
|
-
productSpinal: 'ignite-ui-blazor',
|
|
180
|
-
apiPackages: {
|
|
181
|
-
core: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
182
|
-
charts: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
183
|
-
grids: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
184
|
-
gauges: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
185
|
-
maps: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
186
|
-
excel: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor.Documents.Excel/25.1.x', packageId: 'IgniteUI.Blazor.Documents.Excel', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
187
|
-
spreadsheet: { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor/25.1.x', packageId: 'IgniteUI.Blazor', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
188
|
-
'grid-lite': { docRoot: 'https://staging.infragistics.com/blazor-apis-new/blazor/IgniteUI.Blazor.GridLite/25.1.x', packageId: 'IgniteUI.Blazor.GridLite', noPackagePrefix: true, preserveCase: true, pascalCaseMembers: true },
|
|
189
|
-
},
|
|
190
|
-
packages: {
|
|
191
|
-
common: 'IgniteUI.Blazor',
|
|
192
|
-
charts: 'IgniteUI.Blazor',
|
|
193
|
-
grids: 'IgniteUI.Blazor',
|
|
194
|
-
gauges: 'IgniteUI.Blazor',
|
|
195
|
-
maps: 'IgniteUI.Blazor',
|
|
196
|
-
},
|
|
197
|
-
links: {
|
|
198
|
-
github: 'https://github.com/IgniteUI/igniteui-blazor',
|
|
199
|
-
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-blazor',
|
|
200
|
-
repoSamples: 'https://github.com/IgniteUI/igniteui-blazor-examples/tree/master/samples',
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
let _ctx: PlatformContext | null = null;
|
|
206
|
-
let _env: Record<string, string> | null = null;
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Returns the platform context for the current build.
|
|
210
|
-
* Resolution order: PLATFORM env var → .platform.json → 'React' default.
|
|
211
|
-
*
|
|
212
|
-
* Result is cached for the build lifetime.
|
|
213
|
-
*/
|
|
214
|
-
export function getPlatformContext(): PlatformContext {
|
|
215
|
-
if (_ctx) return _ctx;
|
|
216
|
-
|
|
217
|
-
let name: PlatformName = 'React';
|
|
218
|
-
|
|
219
|
-
const envPlatform = process.env.PLATFORM as PlatformName | undefined;
|
|
220
|
-
if (envPlatform && PLATFORMS[envPlatform]) {
|
|
221
|
-
name = envPlatform;
|
|
222
|
-
} else {
|
|
223
|
-
try {
|
|
224
|
-
const cfgPath = path.resolve(process.cwd(), '.platform.json');
|
|
225
|
-
if (fs.existsSync(cfgPath)) {
|
|
226
|
-
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf-8'));
|
|
227
|
-
if (cfg.platform && PLATFORMS[cfg.platform as PlatformName]) {
|
|
228
|
-
name = cfg.platform as PlatformName;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
} catch { /* use default */ }
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
_ctx = PLATFORMS[name];
|
|
235
|
-
return _ctx;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Reads the environment variables for the current build mode.
|
|
240
|
-
* Resolves {environment:key} tokens used by components and the Vite plugin.
|
|
241
|
-
*
|
|
242
|
-
* Returns an empty object if environment.json is not found (e.g. before
|
|
243
|
-
* generate.mjs has run — or when environment.json is absorbed into this config
|
|
244
|
-
* in a full MDX migration).
|
|
245
|
-
*/
|
|
246
|
-
export function getEnvVars(): Record<string, string> {
|
|
247
|
-
if (_env) return _env;
|
|
248
|
-
|
|
249
|
-
const { name } = getPlatformContext();
|
|
250
|
-
const lang = process.env.LANG_CODE ?? 'en';
|
|
251
|
-
const mode = process.env.DOCS_ENV ?? process.env.NODE_ENV ?? 'development';
|
|
252
|
-
|
|
253
|
-
// Primary: generated/environment.json (written by generate.mjs when present)
|
|
254
|
-
try {
|
|
255
|
-
const envPath = path.resolve(process.cwd(), 'generated', name, lang, 'environment.json');
|
|
256
|
-
const all = JSON.parse(fs.readFileSync(envPath, 'utf-8'));
|
|
257
|
-
const vars = (all[mode] ?? all['development'] ?? {}) as Record<string, string>;
|
|
258
|
-
if (Object.keys(vars).length > 0) {
|
|
259
|
-
_env = vars;
|
|
260
|
-
return _env;
|
|
261
|
-
}
|
|
262
|
-
} catch { /* fall through */ }
|
|
263
|
-
|
|
264
|
-
// Secondary: DOCS_SOURCE_PATH-based environment.json (Angular docs approach)
|
|
265
|
-
try {
|
|
266
|
-
const sourcePath = process.env.DOCS_SOURCE_PATH;
|
|
267
|
-
if (sourcePath) {
|
|
268
|
-
const sourceRoot = path.resolve(sourcePath);
|
|
269
|
-
const parent = path.dirname(sourceRoot);
|
|
270
|
-
const candidates = [
|
|
271
|
-
path.join(sourceRoot, 'en', 'environment.json'),
|
|
272
|
-
path.join(sourceRoot, 'environment.json'),
|
|
273
|
-
path.join(parent, 'environment.json'),
|
|
274
|
-
path.join(parent, 'en', 'environment.json'),
|
|
275
|
-
];
|
|
276
|
-
const envPath = candidates.find(c => fs.existsSync(c));
|
|
277
|
-
if (envPath) {
|
|
278
|
-
const all = JSON.parse(fs.readFileSync(envPath, 'utf-8'));
|
|
279
|
-
const vars = (all[mode] ?? all['production'] ?? {}) as Record<string, string>;
|
|
280
|
-
if (Object.keys(vars).length > 0) {
|
|
281
|
-
_env = vars;
|
|
282
|
-
return _env;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
} catch { /* fall through to docConfig fallback */ }
|
|
287
|
-
|
|
288
|
-
// Fallback: read samplesBrowsers directly from docConfig.json — no generate step needed.
|
|
289
|
-
// This is the only source needed in a full-MDX build where generate.mjs is not run.
|
|
290
|
-
try {
|
|
291
|
-
const docConfig = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'docConfig.json'), 'utf-8'));
|
|
292
|
-
const demosUrl: string = docConfig[name]?.samplesBrowsers?.[mode]
|
|
293
|
-
?? docConfig[name]?.samplesBrowsers?.['development']
|
|
294
|
-
?? '';
|
|
295
|
-
_env = {
|
|
296
|
-
dvDemosBaseUrl: demosUrl,
|
|
297
|
-
demosBaseUrl: demosUrl,
|
|
298
|
-
infragisticsBaseUrl: 'https://www.infragistics.com',
|
|
299
|
-
};
|
|
300
|
-
} catch {
|
|
301
|
-
_env = {};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return _env!;
|
|
305
|
-
}
|