igniteui-astro-components 0.0.18 → 0.0.20
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 +1 -1
- package/src/assets/icons/{chatGPT,.svg → chatgpt.svg} +0 -1
- package/src/assets/ig-logo.svg +1 -1
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +1 -3
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +12 -3
- package/src/components/DocsSidebar/DocsSidebar.astro +26 -7
- package/src/components/DocsSidebar/DocsSidebar.scss +35 -28
- package/src/components/DocsSidebar/SidebarFilterInput.astro +2 -2
- package/src/components/DocsSidebar/SidebarFilterInput.scss +76 -51
- package/src/components/DocsSidebar/sidebar-filter.ts +3 -18
- package/src/components/DocsSubHeader/DocsSubHeader.astro +93 -114
- package/src/components/DocsSubHeader/DocsSubHeader.scss +69 -121
- package/src/components/DocsToc/DocsToc.astro +14 -10
- package/src/components/DocsToc/DocsToc.scss +7 -5
- package/src/components/DocsTree/docs-tree.scss +125 -54
- package/src/components/GlobalFooter/GlobalFooter.module.scss +1 -1
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +1 -3
- package/src/components/Search/Search.astro +57 -23
- package/src/components/Search/Search.scss +15 -21
- package/src/components/SearchAdvanced/SearchAdvanced.astro +64 -49
- package/src/components/SearchAdvanced/SearchAdvanced.scss +22 -30
- package/src/components/mdx/ApiLink/ApiLink.astro +90 -149
- package/src/components/mdx/ApiLink/README.md +75 -73
- package/src/components/mdx/ApiLink/api-link-index.ts +223 -0
- package/src/components/mdx/DocsAside/DocsAside.scss +10 -14
- package/src/layouts/DocsLayout/DocsLayout.astro +5 -5
- package/src/layouts/DocsLayout/DocsLayout.scss +58 -97
- package/src/lib/types.ts +21 -7
- package/src/scripts/icon-manifest.ts +73 -0
- package/src/scripts/icon-registry.ts +4 -35
- package/src/styles/global/_breakpoints.scss +0 -1
- package/src/styles/global/_code-blocks.scss +1 -0
- package/src/styles/global/_component-themes.scss +133 -125
- package/src/styles/global/_icon-gallery.scss +108 -0
- package/src/styles/global/_index.scss +1 -0
- package/src/styles/global/_markdown.scss +127 -16
- package/src/styles/global/_palette.scss +101 -101
- package/src/styles/global/_search-shared.scss +302 -315
- package/src/styles/global/_type-scale.scss +17 -17
- package/src/styles/global/_variables.scss +15 -6
- package/src/styles/theme.scss +7 -61
- package/src/assets/icons/classes.svg +0 -3
- package/src/assets/icons/enumerations.svg +0 -3
- package/src/assets/icons/functions.svg +0 -5
- package/src/assets/icons/interfaces.svg +0 -3
- package/src/assets/icons/type-alias.svg +0 -3
- package/src/assets/icons/variables.svg +0 -3
- /package/src/assets/icons/{palette,.svg → palette.svg} +0 -0
|
@@ -2,41 +2,26 @@
|
|
|
2
2
|
@use '../../styles/global/search-shared' as *;
|
|
3
3
|
|
|
4
4
|
@layer components {
|
|
5
|
+
.igd-search-shell {
|
|
6
|
+
grid-template-rows: auto calc(100% - (var(--search-header-footer-height) * 1));
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
api-search-advanced {
|
|
6
10
|
display: contents;
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
.igd-search-header {
|
|
10
|
-
igc-input::part(container) {
|
|
11
|
-
&:focus-within {
|
|
12
|
-
box-shadow:
|
|
13
|
-
0 0 0 1px var(--igd-accent),
|
|
14
|
-
inset 0 1px 0 var(--igd-accent),
|
|
15
|
-
inset 0 -1px 0 var(--igd-accent),
|
|
16
|
-
inset -1px 0 0 var(--igd-accent);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
12
|
#search-scope-trigger-icon {
|
|
23
13
|
margin-inline-start: rem(16px);
|
|
24
14
|
}
|
|
25
15
|
}
|
|
26
16
|
|
|
27
|
-
.search-trigger {
|
|
28
|
-
color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
17
|
// TODO BUG IN THE TAB COMPONENT
|
|
32
18
|
igc-tabs::part(inner) {
|
|
33
19
|
flex-grow: 1;
|
|
34
|
-
|
|
35
20
|
}
|
|
36
21
|
|
|
37
22
|
igc-tabs {
|
|
38
23
|
igc-divider {
|
|
39
|
-
margin-block: rem(
|
|
24
|
+
margin-block: rem(16px) rem(24px);
|
|
40
25
|
|
|
41
26
|
&:last-of-type {
|
|
42
27
|
display: none;
|
|
@@ -53,7 +38,6 @@
|
|
|
53
38
|
|
|
54
39
|
.igd-search-tabs {
|
|
55
40
|
--item-background: var(--igd-layout-sections-bg);
|
|
56
|
-
--indicator-color: transparent;
|
|
57
41
|
--button-color: var(--igd-accent);
|
|
58
42
|
--button-hover-color: var(--igd-accent);
|
|
59
43
|
--button-background: var(--igd-layout-sections-bg);
|
|
@@ -92,21 +76,34 @@
|
|
|
92
76
|
|
|
93
77
|
igc-tab::part(content),
|
|
94
78
|
igc-tab::part(base) {
|
|
95
|
-
@include type-style('
|
|
79
|
+
@include type-style('body-2') {
|
|
96
80
|
margin: 0;
|
|
97
81
|
}
|
|
98
82
|
}
|
|
99
83
|
|
|
84
|
+
igc-tab::part(base) {
|
|
85
|
+
gap: rem(4px);
|
|
86
|
+
}
|
|
87
|
+
|
|
100
88
|
igc-tab::part(tab-body) {
|
|
101
89
|
overflow-y: auto;
|
|
102
90
|
flex: 1 1 auto;
|
|
103
91
|
min-height: 0;
|
|
104
|
-
padding-block: rem(
|
|
92
|
+
padding-block: rem(16px);
|
|
93
|
+
padding-inline: 0;
|
|
94
|
+
border-block-start: var(--igd-app-outline);
|
|
105
95
|
}
|
|
106
96
|
}
|
|
107
97
|
|
|
108
98
|
.igd-search-tab-count {
|
|
109
|
-
color: light-dark(var(--ig-gray-
|
|
99
|
+
color: light-dark(var(--ig-gray-400), var(--ig-gray-300));
|
|
100
|
+
|
|
101
|
+
&::before {
|
|
102
|
+
content: '(';
|
|
103
|
+
}
|
|
104
|
+
&::after {
|
|
105
|
+
content: ')';
|
|
106
|
+
}
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
.igd-search-refine-hint {
|
|
@@ -130,17 +127,12 @@
|
|
|
130
127
|
}
|
|
131
128
|
|
|
132
129
|
igc-divider {
|
|
133
|
-
--color: light-dark(var(--ig-gray-
|
|
130
|
+
--color: light-dark(var(--ig-gray-200), var(--ig-gray-300));
|
|
134
131
|
}
|
|
135
132
|
|
|
136
133
|
.igd-search-scope {
|
|
137
134
|
max-width: rem(250px);
|
|
138
135
|
|
|
139
|
-
&::part(input) {
|
|
140
|
-
min-width: 0;
|
|
141
|
-
overflow: hidden;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
136
|
&::part(native-input) {
|
|
145
137
|
min-width: 0;
|
|
146
138
|
overflow: hidden;
|
|
@@ -2,213 +2,154 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Inline API documentation link.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* <!-- core package — class (default kind) -->
|
|
11
|
-
* <ApiLink type="Toast" />
|
|
12
|
-
* → <a href="…/classes/igniteui-react.igrtoast.html"><code>IgrToast</code></a>
|
|
13
|
-
*
|
|
14
|
-
* <!-- class member -->
|
|
15
|
-
* <ApiLink type="Toast" member="show" label="Show" />
|
|
16
|
-
* → <a href="…/classes/igniteui-react.igrtoast.html#show"><code>Show</code></a>
|
|
17
|
-
*
|
|
18
|
-
* <!-- sub-package class -->
|
|
19
|
-
* <ApiLink pkg="charts" type="CategoryChart" />
|
|
20
|
-
*
|
|
21
|
-
* <!-- function (no platform prefix) -->
|
|
22
|
-
* <ApiLink kind="function" type="configureTheme" prefixed={false} />
|
|
23
|
-
* → <a href="…/functions/igniteui-react.configureTheme.html"><code>configureTheme</code></a>
|
|
24
|
-
*
|
|
25
|
-
* <!-- variable (fully-qualified) -->
|
|
26
|
-
* <ApiLink kind="variable" type="IgrCalendarResourceStringEN" prefixed={false} />
|
|
27
|
-
* → <a href="…/variables/igniteui-react.IgrCalendarResourceStringEN.html">…</a>
|
|
28
|
-
*
|
|
29
|
-
* <!-- type alias -->
|
|
30
|
-
* <ApiLink kind="type" type="AbsolutePosition" prefixed={false} />
|
|
31
|
-
* → <a href="…/types/igniteui-react.AbsolutePosition.html"><code>AbsolutePosition</code></a>
|
|
32
|
-
*
|
|
33
|
-
* <!-- interface -->
|
|
34
|
-
* <ApiLink kind="interface" type="ComboTemplateProps" prefixed={false} />
|
|
35
|
-
* → <a href="…/interfaces/igniteui-react.ComboTemplateProps.html">…</a>
|
|
36
|
-
*
|
|
37
|
-
* <!-- enum -->
|
|
38
|
-
* <ApiLink kind="enum" type="CalendarSelection" />
|
|
39
|
-
* → <a href="…/enums/igniteui-react.igrcalendarselection.html">…</a>
|
|
5
|
+
* TypeDoc links resolve against the compact api-docs ApiLink index. If the
|
|
6
|
+
* index does not contain the requested symbol/member, it renders code text
|
|
7
|
+
* instead of guessing a URL.
|
|
40
8
|
*/
|
|
41
9
|
import type { PlatformContext } from '../../../lib/types.ts';
|
|
10
|
+
import {
|
|
11
|
+
resolveApiLinkFromIndex,
|
|
12
|
+
type TypeDocKind,
|
|
13
|
+
} from './api-link-index';
|
|
42
14
|
import './ApiLink.scss';
|
|
43
15
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Props for SASS API documentation links (`kind="sass"`). */
|
|
16
|
+
/** Props for Sass API documentation links (`kind="sass"`). */
|
|
47
17
|
type SassProps = {
|
|
18
|
+
/** Selects Sass API link mode. */
|
|
48
19
|
kind: 'sass';
|
|
49
|
-
/**
|
|
20
|
+
/** Anchor fragment without `#`, e.g. `mixin-slide-in-left`. */
|
|
50
21
|
type?: string;
|
|
51
|
-
/**
|
|
22
|
+
/** Sass module path segment, e.g. `animations` or `themes`. */
|
|
52
23
|
module?: string;
|
|
53
|
-
/**
|
|
54
|
-
* When true, wraps the label in <code>.
|
|
55
|
-
* @default true — matches TypeDoc ApiLink code-formatting behaviour.
|
|
56
|
-
* Set to false for descriptive/prose labels.
|
|
57
|
-
*/
|
|
24
|
+
/** Wrap the rendered label in `<code>`. Defaults to `true`. */
|
|
58
25
|
code?: boolean;
|
|
59
|
-
/** Override the
|
|
26
|
+
/** Override the rendered label. */
|
|
60
27
|
label?: string;
|
|
61
28
|
};
|
|
62
29
|
|
|
63
|
-
/** Props for TypeDoc API documentation links
|
|
30
|
+
/** Props for TypeDoc API documentation links. */
|
|
64
31
|
type TypeDocProps = {
|
|
65
32
|
/**
|
|
66
|
-
* TypeDoc symbol kind.
|
|
67
|
-
*
|
|
33
|
+
* TypeDoc symbol kind. Narrows registry lookup when the same symbol exists
|
|
34
|
+
* as multiple TypeDoc kinds.
|
|
68
35
|
*/
|
|
69
|
-
kind?:
|
|
36
|
+
kind?: TypeDocKind;
|
|
70
37
|
/**
|
|
71
38
|
* Short type/symbol name without platform prefix, e.g. "Toast".
|
|
72
39
|
* Required for all TypeDoc kinds.
|
|
73
40
|
*/
|
|
74
41
|
type: string;
|
|
75
|
-
/** Optional member
|
|
42
|
+
/** Optional class/interface member, property, method, or enum value anchor. */
|
|
76
43
|
member?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Package key as defined in platform-context apiPackages.
|
|
79
|
-
* Defaults to "core" (the main component package).
|
|
80
|
-
* Use "charts", "grids", "gauges", "maps", "inputs", "layouts",
|
|
81
|
-
* "excel", "spreadsheet", "datasources" for sub-packages.
|
|
82
|
-
*/
|
|
44
|
+
/** Package key used only to filter ambiguous registry matches. */
|
|
83
45
|
pkg?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Override the display text. Defaults to the (prefixed) name,
|
|
86
|
-
* optionally suffixed with ".member".
|
|
87
|
-
*/
|
|
46
|
+
/** Override the rendered label. */
|
|
88
47
|
label?: string;
|
|
89
48
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* fully-qualified name or a non-prefixed symbol like a function name.
|
|
49
|
+
* Whether to prepend the platform prefix before registry lookup.
|
|
50
|
+
* @default true
|
|
93
51
|
*/
|
|
94
52
|
prefixed?: boolean;
|
|
95
53
|
/**
|
|
96
|
-
*
|
|
97
|
-
* is appended to the class name. Set to false for utility/non-component classes
|
|
98
|
-
* that do not carry the platform class suffix (e.g. FilteringOperand, SortingStrategy).
|
|
54
|
+
* Whether to try the platform class suffix before the unsuffixed symbol.
|
|
99
55
|
* @default true
|
|
100
56
|
*/
|
|
101
57
|
suffix?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Comma-separated list of platforms (e.g. "React" or "React,Blazor") for
|
|
104
|
-
* which the API link does NOT exist on the documentation site. When the
|
|
105
|
-
* current platform matches any entry the component renders the type name
|
|
106
|
-
* as plain inline code (no link), preserving the symbol reference for the
|
|
107
|
-
* reader without producing a broken URL.
|
|
108
|
-
*
|
|
109
|
-
* Use this instead of wrapping a single <ApiLink> in a <PlatformBlock>
|
|
110
|
-
* just to hide it from a specific platform.
|
|
111
|
-
*/
|
|
112
|
-
exclude?: string;
|
|
113
|
-
/**
|
|
114
|
-
* Comma-separated list of platforms for which the package classSuffix
|
|
115
|
-
* (e.g. "Component") should NOT be appended, overriding the package default.
|
|
116
|
-
* Useful when the same type is a plain class on some platforms but carries
|
|
117
|
-
* a framework suffix on others (e.g. "Angular,WebComponents").
|
|
118
|
-
*
|
|
119
|
-
* Does not suppress the link — combine with `exclude` to suppress entirely.
|
|
120
|
-
*/
|
|
121
|
-
excludeSuffixFor?: string;
|
|
122
|
-
/**
|
|
123
|
-
* Comma-separated list of platforms for which the platform prefix
|
|
124
|
-
* (Igr/Igx/Igc/Igb) should NOT be prepended, overriding the package default.
|
|
125
|
-
* Useful when a symbol has no prefix on certain platforms.
|
|
126
|
-
*
|
|
127
|
-
* Does not suppress the link — combine with `exclude` to suppress entirely.
|
|
128
|
-
*/
|
|
129
|
-
excludePrefixFor?: string;
|
|
130
|
-
|
|
131
58
|
};
|
|
132
59
|
|
|
133
60
|
type Props = SassProps | TypeDocProps;
|
|
134
61
|
|
|
135
|
-
const KIND_SEGMENT: Record<Exclude<ApiKind, 'sass'>, string> = {
|
|
136
|
-
class: 'classes',
|
|
137
|
-
interface: 'interfaces',
|
|
138
|
-
enum: 'enums',
|
|
139
|
-
type: 'types',
|
|
140
|
-
variable: 'variables',
|
|
141
|
-
function: 'functions',
|
|
142
|
-
};
|
|
143
|
-
|
|
144
62
|
const ctx = Astro.locals.platformContext as PlatformContext;
|
|
145
|
-
const {
|
|
63
|
+
const { prefix, apiPackages } = ctx;
|
|
146
64
|
const label = Astro.props.label;
|
|
147
65
|
|
|
148
|
-
|
|
66
|
+
function getIndexedDisplayName(resolvedName: string, displayBaseName: string, type: string, classSuffix?: string) {
|
|
67
|
+
if (resolvedName === type) return type;
|
|
68
|
+
if (classSuffix && resolvedName === `${type}${classSuffix}`) return type;
|
|
69
|
+
if (classSuffix && resolvedName === `${displayBaseName}${classSuffix}`) return type;
|
|
70
|
+
return displayBaseName;
|
|
71
|
+
}
|
|
149
72
|
|
|
150
73
|
let url: string;
|
|
151
74
|
let displayLabel: string;
|
|
152
75
|
let renderCode: boolean;
|
|
153
|
-
let
|
|
76
|
+
let renderLink = false;
|
|
154
77
|
|
|
155
78
|
if (Astro.props.kind === 'sass') {
|
|
156
79
|
const { type, module, code = true } = Astro.props;
|
|
157
|
-
if (!module) console.warn('[ApiLink] kind="sass" requires a `module` prop
|
|
80
|
+
if (!module) console.warn('[ApiLink] kind="sass" requires a `module` prop - link may be malformed.');
|
|
158
81
|
const base = ctx.sassApiUrl?.trim().replace(/\/+$/, '');
|
|
159
82
|
const anchor = type ? `#${type}` : '';
|
|
160
83
|
if (!base) {
|
|
161
|
-
console.warn('[ApiLink] kind="sass" requires `platformContext.sassApiUrl` to be configured
|
|
84
|
+
console.warn('[ApiLink] kind="sass" requires `platformContext.sassApiUrl` to be configured - falling back to "#".');
|
|
162
85
|
url = '#';
|
|
163
86
|
} else {
|
|
164
87
|
url = `${base}/${module ?? ''}${anchor}`;
|
|
165
88
|
}
|
|
166
89
|
displayLabel = label ?? type ?? module ?? '';
|
|
167
90
|
renderCode = code;
|
|
91
|
+
renderLink = true;
|
|
168
92
|
} else {
|
|
169
93
|
const {
|
|
170
|
-
type,
|
|
171
|
-
|
|
172
|
-
|
|
94
|
+
type,
|
|
95
|
+
member,
|
|
96
|
+
pkg = 'core',
|
|
97
|
+
prefixed = true,
|
|
98
|
+
suffix = true,
|
|
173
99
|
} = Astro.props;
|
|
174
|
-
|
|
175
|
-
const isSuffixExcluded = splitList(excludeSuffixFor).includes(platformName);
|
|
176
|
-
const isPrefixExcluded = splitList(excludePrefixFor).includes(platformName);
|
|
177
|
-
const effectivePrefixed = prefixed && !isPrefixExcluded;
|
|
178
|
-
const effectiveSuffix = suffix && !isSuffixExcluded;
|
|
100
|
+
const explicitKind = 'kind' in Astro.props ? Astro.props.kind : undefined;
|
|
179
101
|
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
? `#${pkgConfig.pascalCaseMembers ? member.charAt(0).toUpperCase() + member.slice(1) : member}`
|
|
191
|
-
: '';
|
|
192
|
-
url = `${pkgConfig.docRoot}/classes/${classSlug}${memberAnchor}`;
|
|
193
|
-
} else {
|
|
194
|
-
const slug = pkgConfig.noPackagePrefix
|
|
195
|
-
? baseType
|
|
196
|
-
: `${pkgConfig.packageId}.${baseType}`;
|
|
197
|
-
const memberAnchorNonClass = member
|
|
198
|
-
? `#${
|
|
199
|
-
kind === 'enum'
|
|
200
|
-
? member
|
|
201
|
-
: pkgConfig.pascalCaseMembers
|
|
202
|
-
? member.charAt(0).toUpperCase() + member.slice(1)
|
|
203
|
-
: member.toLowerCase()
|
|
204
|
-
}`
|
|
205
|
-
: '';
|
|
206
|
-
url = `${pkgConfig.docRoot}/${segment}/${slug}${memberAnchorNonClass}`;
|
|
207
|
-
}
|
|
102
|
+
const effectivePrefixed = prefixed;
|
|
103
|
+
const effectiveSuffix = suffix;
|
|
104
|
+
|
|
105
|
+
// pkg is an ambiguity override. Without an explicit pkg prop, search the
|
|
106
|
+
// combined api-docs index so symbols can resolve from any package.
|
|
107
|
+
const explicitPkg = typeof Astro.props.pkg === 'string' && Astro.props.pkg.length > 0;
|
|
108
|
+
const pkgConfig = apiPackages[explicitPkg ? pkg : 'core'] ?? apiPackages.core;
|
|
109
|
+
const baseType = effectivePrefixed ? `${prefix}${type}` : type;
|
|
110
|
+
|
|
111
|
+
url = '';
|
|
208
112
|
displayLabel = label ?? (member ? `${baseType}.${member}` : baseType);
|
|
209
113
|
renderCode = true;
|
|
114
|
+
|
|
115
|
+
const indexed = resolveApiLinkFromIndex({
|
|
116
|
+
ctx,
|
|
117
|
+
pkgConfig,
|
|
118
|
+
explicitPkg,
|
|
119
|
+
type,
|
|
120
|
+
member,
|
|
121
|
+
explicitKind,
|
|
122
|
+
prefix,
|
|
123
|
+
prefixed: effectivePrefixed,
|
|
124
|
+
suffix: effectiveSuffix,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (indexed.status === 'resolved') {
|
|
128
|
+
url = indexed.url;
|
|
129
|
+
renderLink = true;
|
|
130
|
+
const indexedDisplay = getIndexedDisplayName(indexed.symbolName, baseType, type, pkgConfig.classSuffix);
|
|
131
|
+
displayLabel = label ?? (indexed.memberName ? `${indexedDisplay}.${indexed.memberName}` : indexedDisplay);
|
|
132
|
+
} else if (indexed.status === 'ambiguous') {
|
|
133
|
+
const symbol = member ? `${type}.${member}` : type;
|
|
134
|
+
throw new Error(`[ApiLink] Ambiguous API symbol "${symbol}" matched registry candidate "${indexed.candidate}". Add pkg= or kind= to disambiguate.`);
|
|
135
|
+
} else if (indexed.status === 'member-missing') {
|
|
136
|
+
renderLink = false;
|
|
137
|
+
if (import.meta.env.DEV) {
|
|
138
|
+
console.warn(`[ApiLink] Registry symbol "${indexed.candidate}" exists, but member "${member}" was not found. Rendering code text instead of a guessed URL.`);
|
|
139
|
+
}
|
|
140
|
+
} else if (indexed.status === 'missing') {
|
|
141
|
+
renderLink = false;
|
|
142
|
+
if (import.meta.env.DEV) {
|
|
143
|
+
console.warn(`[ApiLink] Registry miss for ${type}${member ? `.${member}` : ''}. Rendering code text instead of a guessed URL.`);
|
|
144
|
+
}
|
|
145
|
+
} else if (indexed.status === 'unavailable') {
|
|
146
|
+
renderLink = false;
|
|
147
|
+
if (import.meta.env.DEV) {
|
|
148
|
+
console.warn(`[ApiLink] ApiLink registry is unavailable for ${type}${member ? `.${member}` : ''}. Rendering code text.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
210
151
|
}
|
|
211
152
|
---
|
|
212
|
-
{
|
|
213
|
-
? <code>{displayLabel}</code>
|
|
214
|
-
:
|
|
153
|
+
{renderLink
|
|
154
|
+
? <a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>
|
|
155
|
+
: renderCode ? <code>{displayLabel}</code> : displayLabel}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# ApiLink
|
|
2
2
|
|
|
3
|
-
Renders an inline API link with platform-aware
|
|
3
|
+
Renders an inline API documentation link with platform-aware resolution.
|
|
4
4
|
|
|
5
|
-
For TypeDoc symbols,
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
For TypeDoc symbols, `ApiLink` first queries the generated api-docs link index.
|
|
6
|
+
That index contains the real symbol names, packages, URL segments, and member
|
|
7
|
+
anchors produced by api-docs. If the index is unavailable, or if a symbol is
|
|
8
|
+
missing from it, `ApiLink` renders plain code text instead of generating a
|
|
9
|
+
guessed URL.
|
|
10
|
+
|
|
11
|
+
Sass links are separate and still use `kind="sass"`.
|
|
8
12
|
|
|
9
13
|
## Import
|
|
10
14
|
|
|
@@ -12,101 +16,99 @@ links when `kind="sass"`.
|
|
|
12
16
|
import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Preferred Usage
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
| `prefixed` | `boolean` | `true` | When `true`, prepends the platform prefix (`Igr`/`Igx`/`Igc`/`Igb`) to `type`. Set `false` for already-qualified names or non-prefixed symbols like function names. |
|
|
25
|
-
| `suffix` | `boolean` | `true` | When `true`, appends the platform class suffix (e.g. `Component` for Angular). Set `false` for utility classes that do not carry a suffix. |
|
|
26
|
-
| `exclude` | `string` | — | Comma-separated platform names where the link should not render. Matching platforms render the label as plain inline `<code>`. |
|
|
27
|
-
| `excludeSuffixFor` | `string` | — | Comma-separated platform names where `classSuffix` should not be appended, even when `suffix` is `true`. |
|
|
28
|
-
| `excludePrefixFor` | `string` | — | Comma-separated platform names where the platform prefix should not be prepended, even when `prefixed` is `true`. |
|
|
21
|
+
Author MDX with the unprefixed API name:
|
|
22
|
+
|
|
23
|
+
```mdx
|
|
24
|
+
<ApiLink type="Grid" />
|
|
25
|
+
<ApiLink type="Grid" member="rowSelection" />
|
|
26
|
+
<ApiLink type="CategoryChart" />
|
|
27
|
+
```
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
The resolver handles platform prefix/suffix candidates, package lookup, kind
|
|
30
|
+
lookup, URL segment lookup, and member anchor lookup.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
Omitting `pkg` relies on `platformContext.apiLinkIndex` being available. When
|
|
33
|
+
the index is unavailable, `ApiLink` renders code text and does not guess a URL.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
from `platformContext.sassApiUrl`.
|
|
35
|
+
## TypeDoc Props
|
|
37
36
|
|
|
38
37
|
| Prop | Type | Default | Description |
|
|
39
38
|
|------|------|---------|-------------|
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
39
|
+
| `type` | `string` | *(required)* | Short symbol name without platform prefix, e.g. `"Grid"` instead of `"IgrGrid"`. |
|
|
40
|
+
| `member` | `string` | — | Optional member name. Resolved through the generated member map when available. |
|
|
41
|
+
| `label` | `string` | auto | Override the display text. |
|
|
42
|
+
| `pkg` | `string` | — | Ambiguity override only. Use when the same symbol exists in multiple packages and the combined index cannot choose safely. |
|
|
43
|
+
| `kind` | `'class' \| 'interface' \| 'enum' \| 'type' \| 'variable' \| 'function'` | auto | Optional narrowing. Usually unnecessary when the index is available. |
|
|
44
|
+
| `prefixed` | `boolean` | `true` | Candidate-name override for symbols that are never platform-prefixed. Avoid for new docs when the index can resolve the symbol. |
|
|
45
|
+
| `suffix` | `boolean` | `true` | Candidate-name override for symbols that never use the platform class suffix. Avoid for new docs when the index can resolve the symbol. |
|
|
46
|
+
|
|
47
|
+
Platform names use `PlatformContext.name`: `Angular`, `React`,
|
|
48
|
+
`WebComponents`, or `Blazor`.
|
|
45
49
|
|
|
46
50
|
## Examples
|
|
47
51
|
|
|
48
52
|
```mdx
|
|
49
|
-
{/*
|
|
50
|
-
<ApiLink type="
|
|
51
|
-
{/* → <a href="…/classes/igniteui-react.igrtoast.html"><code>IgrToast</code></a> */}
|
|
53
|
+
{/* Let the generated index find package, kind, and exact symbol name. */}
|
|
54
|
+
<ApiLink type="Grid" />
|
|
52
55
|
|
|
53
|
-
{/*
|
|
54
|
-
<ApiLink type="
|
|
56
|
+
{/* Member anchors are resolved from the generated member map. */}
|
|
57
|
+
<ApiLink type="Grid" member="rowSelection" />
|
|
55
58
|
|
|
56
|
-
{/*
|
|
57
|
-
<ApiLink
|
|
59
|
+
{/* Use pkg only when the symbol name is ambiguous across packages. */}
|
|
60
|
+
<ApiLink type="Workbook" pkg="excel" />
|
|
61
|
+
```
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
<ApiLink kind="function" type="configureTheme" prefixed={false} />
|
|
63
|
+
## ApiLink Index
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
`ApiLink` resolves TypeDoc symbols from `platformContext.apiLinkIndex`, a compact
|
|
66
|
+
registry generated from api-docs TypeDoc data and stored by the docs host. The
|
|
67
|
+
component does not fetch api-docs during the documentation build.
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
<ApiLink kind="interface" type="ComboTemplateProps" prefixed={false} />
|
|
69
|
+
The docs host loads one latest registry per platform, for example:
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
```txt
|
|
72
|
+
src/data/api-link-index/angular/staging-latest.json
|
|
73
|
+
src/data/api-link-index/webcomponents/staging-latest.json
|
|
74
|
+
```
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
<ApiLink type="SortingStrategy" suffix={false} />
|
|
76
|
+
Registry symbol fields are intentionally short because the files are large:
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
| Field | Meaning |
|
|
79
|
+
|-------|---------|
|
|
80
|
+
| `p` | Package id that owns the symbol. |
|
|
81
|
+
| `u` | Root-relative API URL path for the symbol page. |
|
|
82
|
+
| `k` | Symbol kind, e.g. `class`, `interface`, `enum`, `type`. |
|
|
83
|
+
| `m` | Member name to anchor map. |
|
|
76
84
|
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
When `pkg` is present, `ApiLink` uses it only as a package filter for ambiguous
|
|
86
|
+
symbol names; package URLs and kinds still come from the registry.
|
|
87
|
+
When a symbol is ambiguous, omitting `pkg` or `kind` causes `ApiLink` to throw
|
|
88
|
+
during rendering instead of guessing a URL.
|
|
89
|
+
When a symbol is not found, `ApiLink` renders code text instead of generating a
|
|
90
|
+
guessed URL.
|
|
91
|
+
When a registry symbol exists but the requested member does not, `ApiLink`
|
|
92
|
+
renders code text instead of generating a guessed member URL.
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
## Sass Props
|
|
95
|
+
Use `kind="sass"` for Sass API reference links. Sass links do not use the
|
|
96
|
+
api-docs link index; they read their base URL from `platformContext.sassApiUrl`.
|
|
82
97
|
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
| Prop | Type | Default | Description |
|
|
99
|
+
|------|------|---------|-------------|
|
|
100
|
+
| `kind` | `'sass'` | *(required)* | Enables Sass API link mode. |
|
|
101
|
+
| `module` | `string` | — | Sass module path segment, e.g. `"animations"` or `"themes"`. |
|
|
102
|
+
| `type` | `string` | — | Anchor fragment without `#`, e.g. `"mixin-slide-in-left"`. Omit it to link to the module page. |
|
|
103
|
+
| `label` | `string` | auto | Override the display text. Defaults to `type`, then `module`, then an empty string. |
|
|
104
|
+
| `code` | `boolean` | `true` | Wrap the label in `<code>`. Set `false` for prose labels. |
|
|
85
105
|
|
|
86
|
-
|
|
106
|
+
```mdx
|
|
107
|
+
<ApiLink kind="sass" module="animations" label="animations Sass module" code={false} />
|
|
87
108
|
<ApiLink kind="sass" module="animations" type="mixin-slide-in-left" label="slide-in-left" />
|
|
88
109
|
```
|
|
89
110
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
The current platform is read from the `PLATFORM` environment variable (set at build time). Use `siteMetaIntegration({ platform })` or `createDocsSite({ platform })` in `astro.config.ts`:
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
createDocsSite({ platform: 'react' });
|
|
96
|
-
// prefix → 'Igr', docRoot → 'https://www.infragistics.com/products/ignite-ui-react/docs/typescript/latest'
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Supported platforms and their prefixes:
|
|
100
|
-
|
|
101
|
-
| Platform | Prefix | Class suffix |
|
|
102
|
-
|----------|--------|--------------|
|
|
103
|
-
| `Angular` | `Igx` | `Component` (DV pkgs only) |
|
|
104
|
-
| `React` | `Igr` | — |
|
|
105
|
-
| `WebComponents` | `Igc` | — |
|
|
106
|
-
| `Blazor` | `Igb` | — |
|
|
107
|
-
|
|
108
|
-
For Sass links, make sure `platformContext.sassApiUrl` is configured. The URL is
|
|
109
|
-
assembled as:
|
|
111
|
+
Sass URL shape:
|
|
110
112
|
|
|
111
113
|
```txt
|
|
112
114
|
{sassApiUrl}/{module}#{type}
|