igniteui-astro-components 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +82 -74
  2. package/package.json +16 -9
  3. package/src/components/CopyCode/CopyCode.astro +21 -7
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
  6. package/src/components/DocsBreadcrumb/README.md +10 -14
  7. package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
  8. package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
  9. package/src/components/DocsSidebar/README.md +25 -21
  10. package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
  11. package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
  12. package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
  13. package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
  14. package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -185
  15. package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -169
  16. package/src/components/DocsSubHeader/README.md +18 -16
  17. package/src/components/DocsToc/DocsToc.astro +301 -280
  18. package/src/components/DocsToc/DocsToc.scss +20 -21
  19. package/src/components/DocsToc/README.md +11 -9
  20. package/src/components/DocsToc/toTreeNodes.ts +3 -8
  21. package/src/components/DocsTree/DocsTree.astro +32 -20
  22. package/src/components/DocsTree/DocsTreeItem.astro +35 -30
  23. package/src/components/DocsTree/README.md +16 -15
  24. package/src/components/DocsTree/docs-tree.scss +267 -268
  25. package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
  26. package/src/components/GlobalFooter/README.md +3 -2
  27. package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
  28. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
  29. package/src/components/GlobalNavBar/README.md +3 -2
  30. package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
  31. package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
  32. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
  33. package/src/components/MobileSidebarToggle/README.md +3 -2
  34. package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
  35. package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
  36. package/src/components/Search/README.md +1 -0
  37. package/src/components/Search/Search.astro +137 -109
  38. package/src/components/Search/Search.scss +20 -20
  39. package/src/components/SearchAdvanced/README.md +21 -15
  40. package/src/components/SearchAdvanced/SearchAdvanced.astro +220 -133
  41. package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
  42. package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
  43. package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
  44. package/src/components/mdx/ApiLink/README.md +26 -22
  45. package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
  46. package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
  47. package/src/components/mdx/ApiRef/README.md +20 -15
  48. package/src/components/mdx/Badge/Badge.astro +14 -14
  49. package/src/components/mdx/Badge/Badge.scss +61 -56
  50. package/src/components/mdx/Badge/README.md +24 -19
  51. package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
  52. package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
  53. package/src/components/mdx/DocsAside/README.md +22 -22
  54. package/src/components/mdx/Faq/Faq.astro +86 -0
  55. package/src/components/mdx/Faq/Faq.scss +105 -0
  56. package/src/components/mdx/Faq/FaqItem.astro +117 -0
  57. package/src/components/mdx/Faq/README.md +223 -0
  58. package/src/components/mdx/Faq/types.ts +34 -0
  59. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
  60. package/src/components/mdx/PlatformBlock/README.md +6 -8
  61. package/src/components/mdx/Sample/README.md +21 -16
  62. package/src/components/mdx/Sample/Sample.astro +97 -74
  63. package/src/components/mdx/Sample/Sample.scss +132 -132
  64. package/src/content-helper.ts +71 -72
  65. package/src/content.config.ts +1 -6
  66. package/src/integration.ts +566 -512
  67. package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
  68. package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
  69. package/src/layouts/DocsLayout/README.md +24 -35
  70. package/src/lib/nav-helpers.ts +88 -82
  71. package/src/lib/types.ts +76 -76
  72. package/src/llms.ts +205 -166
  73. package/src/platform.ts +312 -162
  74. package/src/plugins/rehype-heading-anchors.ts +45 -45
  75. package/src/plugins/rehype-pagefind-ignore.ts +19 -19
  76. package/src/plugins/rehype-table-wrapper.ts +30 -30
  77. package/src/plugins/remark-docfx.ts +12 -0
  78. package/src/plugins/remark-env-vars.ts +12 -4
  79. package/src/plugins/remark-md-links.ts +10 -4
  80. package/src/scripts/icon-manifest.ts +13 -5
  81. package/src/scripts/sample-widget.ts +557 -501
  82. package/src/sidebar.ts +103 -97
  83. package/src/styles/global/_code-blocks.scss +43 -44
  84. package/src/styles/global/_component-themes.scss +151 -153
  85. package/src/styles/global/_icon-gallery.scss +81 -81
  86. package/src/styles/global/_index.scss +0 -1
  87. package/src/styles/global/_markdown.scss +816 -787
  88. package/src/styles/global/_palette.scss +456 -110
  89. package/src/styles/global/_search-shared.scss +402 -398
  90. package/src/styles/global/_type-scale.scss +127 -127
  91. package/src/styles/global/_variables.scss +138 -111
  92. package/src/styles/theme.scss +49 -40
  93. package/src/virtual-modules.d.ts +11 -2
@@ -34,15 +34,15 @@ the index is unavailable, `ApiLink` renders code text and does not guess a URL.
34
34
 
35
35
  ## TypeDoc Props
36
36
 
37
- | Prop | Type | Default | Description |
38
- |------|------|---------|-------------|
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. |
37
+ | Prop | Type | Default | Description |
38
+ | ---------- | ------------------------------------------------------------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
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
46
 
47
47
  Platform names use `PlatformContext.name`: `Angular`, `React`,
48
48
  `WebComponents`, or `Blazor`.
@@ -51,12 +51,15 @@ Platform names use `PlatformContext.name`: `Angular`, `React`,
51
51
 
52
52
  ```mdx
53
53
  {/* Let the generated index find package, kind, and exact symbol name. */}
54
+
54
55
  <ApiLink type="Grid" />
55
56
 
56
57
  {/* Member anchors are resolved from the generated member map. */}
58
+
57
59
  <ApiLink type="Grid" member="rowSelection" />
58
60
 
59
61
  {/* Use pkg only when the symbol name is ambiguous across packages. */}
62
+
60
63
  <ApiLink type="Workbook" pkg="excel" />
61
64
  ```
62
65
 
@@ -75,12 +78,12 @@ src/data/api-link-index/webcomponents/staging-latest.json
75
78
 
76
79
  Registry symbol fields are intentionally short because the files are large:
77
80
 
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. |
81
+ | Field | Meaning |
82
+ | ----- | ------------------------------------------------------- |
83
+ | `p` | Package id that owns the symbol. |
84
+ | `u` | Root-relative API URL path for the symbol page. |
85
+ | `k` | Symbol kind, e.g. `class`, `interface`, `enum`, `type`. |
86
+ | `m` | Member name to anchor map. |
84
87
 
85
88
  When `pkg` is present, `ApiLink` uses it only as a package filter for ambiguous
86
89
  symbol names; package URLs and kinds still come from the registry.
@@ -92,16 +95,17 @@ When a registry symbol exists but the requested member does not, `ApiLink`
92
95
  renders code text instead of generating a guessed member URL.
93
96
 
94
97
  ## Sass Props
98
+
95
99
  Use `kind="sass"` for Sass API reference links. Sass links do not use the
96
100
  api-docs link index; they read their base URL from `platformContext.sassApiUrl`.
97
101
 
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. |
102
+ | Prop | Type | Default | Description |
103
+ | -------- | --------- | ------------ | ---------------------------------------------------------------------------------------------- |
104
+ | `kind` | `'sass'` | _(required)_ | Enables Sass API link mode. |
105
+ | `module` | `string` | — | Sass module path segment, e.g. `"animations"` or `"themes"`. |
106
+ | `type` | `string` | — | Anchor fragment without `#`, e.g. `"mixin-slide-in-left"`. Omit it to link to the module page. |
107
+ | `label` | `string` | auto | Override the display text. Defaults to `type`, then `module`, then an empty string. |
108
+ | `code` | `boolean` | `true` | Wrap the label in `<code>`. Set `false` for prose labels. |
105
109
 
106
110
  ```mdx
107
111
  <ApiLink kind="sass" module="animations" label="animations Sass module" code={false} />
@@ -4,220 +4,243 @@ export type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'fu
4
4
  export type TypeDocKind = Exclude<ApiKind, 'sass'>;
5
5
 
6
6
  export const KIND_SEGMENT: Record<TypeDocKind, string> = {
7
- class: 'classes',
8
- interface: 'interfaces',
9
- enum: 'enums',
10
- type: 'types',
11
- variable: 'variables',
12
- function: 'functions',
7
+ class: 'classes',
8
+ interface: 'interfaces',
9
+ enum: 'enums',
10
+ type: 'types',
11
+ variable: 'variables',
12
+ function: 'functions',
13
13
  };
14
14
 
15
15
  type ApiLinkIndexSymbol = {
16
- /** Package id. */
17
- p?: string;
18
- /** URL. */
19
- u: string;
20
- /** Kind. */
21
- k?: TypeDocKind;
22
- /** Member name to anchor map. */
23
- m?: Record<string, string>;
16
+ /** Package id. */
17
+ p?: string;
18
+ /** URL. */
19
+ u: string;
20
+ /** Kind. */
21
+ k?: TypeDocKind;
22
+ /** Member name to anchor map. */
23
+ m?: Record<string, string>;
24
24
  };
25
25
 
26
26
  type ApiLinkIndexFile = {
27
- symbols?: Record<string, ApiLinkIndexSymbol | ApiLinkIndexSymbol[]>;
27
+ symbols?: Record<string, ApiLinkIndexSymbol | ApiLinkIndexSymbol[]>;
28
28
  };
29
29
 
30
30
  export type ApiLinkIndexResolution =
31
- | { status: 'resolved'; url: string; symbolName: string; memberName: string; memberAnchor: string }
32
- | { status: 'ambiguous'; candidate: string }
33
- | { status: 'member-missing'; candidate: string }
34
- | { status: 'missing' }
35
- | { status: 'unavailable' };
31
+ | {
32
+ status: 'resolved';
33
+ url: string;
34
+ symbolName: string;
35
+ memberName: string;
36
+ memberAnchor: string;
37
+ }
38
+ | { status: 'ambiguous'; candidate: string }
39
+ | { status: 'member-missing'; candidate: string }
40
+ | { status: 'missing' }
41
+ | { status: 'unavailable' };
36
42
 
37
- const upperFirst = (value: string) => value ? value.charAt(0).toUpperCase() + value.slice(1) : value;
43
+ const upperFirst = (value: string) =>
44
+ value ? value.charAt(0).toUpperCase() + value.slice(1) : value;
38
45
 
39
46
  function buildCandidateNames(options: {
40
- type: string;
41
- explicitKind?: TypeDocKind;
42
- prefix: string;
43
- prefixed: boolean;
44
- suffix: boolean;
45
- classSuffix?: string;
47
+ type: string;
48
+ explicitKind?: TypeDocKind;
49
+ prefix: string;
50
+ prefixed: boolean;
51
+ suffix: boolean;
52
+ classSuffix?: string;
46
53
  }): string[] {
47
- const candidates = new Set<string>();
48
- const baseNames = new Set<string>();
49
-
50
- if (options.prefixed) baseNames.add(`${options.prefix}${options.type}`);
51
- baseNames.add(options.type);
52
-
53
- for (const baseName of baseNames) {
54
- if ((!options.explicitKind || options.explicitKind === 'class') && options.suffix && options.classSuffix) {
55
- candidates.add(`${baseName}${options.classSuffix}`);
56
- }
57
- candidates.add(baseName);
54
+ const candidates = new Set<string>();
55
+ const baseNames = new Set<string>();
56
+
57
+ if (options.prefixed) baseNames.add(`${options.prefix}${options.type}`);
58
+ baseNames.add(options.type);
59
+
60
+ for (const baseName of baseNames) {
61
+ if (
62
+ (!options.explicitKind || options.explicitKind === 'class') &&
63
+ options.suffix &&
64
+ options.classSuffix
65
+ ) {
66
+ candidates.add(`${baseName}${options.classSuffix}`);
58
67
  }
68
+ candidates.add(baseName);
69
+ }
59
70
 
60
- return [...candidates];
71
+ return [...candidates];
61
72
  }
62
73
 
63
- function resolveIndexedMember(symbol: ApiLinkIndexSymbol, member: string | undefined): { memberName: string; memberAnchor: string } | null {
64
- if (!member) return { memberName: '', memberAnchor: '' };
74
+ function resolveIndexedMember(
75
+ symbol: ApiLinkIndexSymbol,
76
+ member: string | undefined,
77
+ ): { memberName: string; memberAnchor: string } | null {
78
+ if (!member) return { memberName: '', memberAnchor: '' };
65
79
 
66
- const members = symbol.m ?? {};
67
- const candidates = new Set([member, upperFirst(member), member.toLowerCase()]);
80
+ const members = symbol.m ?? {};
81
+ const candidates = new Set([member, upperFirst(member), member.toLowerCase()]);
68
82
 
69
- for (const candidate of candidates) {
70
- if (Object.hasOwn(members, candidate)) {
71
- return { memberName: candidate, memberAnchor: members[candidate] };
72
- }
83
+ for (const candidate of candidates) {
84
+ if (Object.hasOwn(members, candidate)) {
85
+ return { memberName: candidate, memberAnchor: members[candidate] };
73
86
  }
87
+ }
74
88
 
75
- const normalized = member.toLowerCase();
76
- for (const [registryMember, memberAnchor] of Object.entries(members)) {
77
- if (registryMember.toLowerCase() === normalized) {
78
- return { memberName: registryMember, memberAnchor };
79
- }
89
+ const normalized = member.toLowerCase();
90
+ for (const [registryMember, memberAnchor] of Object.entries(members)) {
91
+ if (registryMember.toLowerCase() === normalized) {
92
+ return { memberName: registryMember, memberAnchor };
80
93
  }
94
+ }
81
95
 
82
- return null;
96
+ return null;
83
97
  }
84
98
 
85
99
  function findIndexedSymbol(options: {
86
- index: ApiLinkIndexFile;
87
- candidates: string[];
88
- packageId?: string;
89
- explicitKind?: TypeDocKind;
90
- member?: string;
91
- }): { name: string; symbol: ApiLinkIndexSymbol; memberName: string; memberAnchor: string } | { ambiguous: true; candidate: string } | { memberMissing: true; candidate: string } | null {
92
- const symbols = options.index.symbols ?? {};
93
- let ambiguity: { ambiguous: true; candidate: string } | null = null;
94
- let memberMissing: { memberMissing: true; candidate: string } | null = null;
95
-
96
- for (const name of options.candidates) {
97
- const value = symbols[name];
98
- if (!value) continue;
99
-
100
- const symbolList = Array.isArray(value) ? value : [value];
101
- const matches = new Map<string, {
102
- name: string;
103
- symbol: ApiLinkIndexSymbol;
104
- memberName: string;
105
- memberAnchor: string;
106
- }>();
107
- let matchedSymbol = false;
108
-
109
- for (const symbol of symbolList) {
110
- if (options.packageId && symbol.p !== options.packageId) continue;
111
- if (options.explicitKind && symbol.k !== options.explicitKind) continue;
112
- matchedSymbol = true;
113
- const memberMatch = resolveIndexedMember(symbol, options.member);
114
- if (memberMatch === null) continue;
115
-
116
- const key = `${symbol.u}#${memberMatch.memberAnchor}`;
117
- matches.set(key, {
118
- name,
119
- symbol,
120
- memberName: memberMatch.memberName,
121
- memberAnchor: memberMatch.memberAnchor,
122
- });
123
- }
124
-
125
- if (matches.size === 1) {
126
- return matches.values().next().value!;
127
- }
128
- if (matches.size > 1 && !ambiguity) {
129
- ambiguity = { ambiguous: true, candidate: name };
130
- }
131
- if (matches.size === 0 && matchedSymbol && options.member && !memberMissing) {
132
- memberMissing = { memberMissing: true, candidate: name };
133
- }
100
+ index: ApiLinkIndexFile;
101
+ candidates: string[];
102
+ packageId?: string;
103
+ explicitKind?: TypeDocKind;
104
+ member?: string;
105
+ }):
106
+ | { name: string; symbol: ApiLinkIndexSymbol; memberName: string; memberAnchor: string }
107
+ | { ambiguous: true; candidate: string }
108
+ | { memberMissing: true; candidate: string }
109
+ | null {
110
+ const symbols = options.index.symbols ?? {};
111
+ let ambiguity: { ambiguous: true; candidate: string } | null = null;
112
+ let memberMissing: { memberMissing: true; candidate: string } | null = null;
113
+
114
+ for (const name of options.candidates) {
115
+ const value = symbols[name];
116
+ if (!value) continue;
117
+
118
+ const symbolList = Array.isArray(value) ? value : [value];
119
+ const matches = new Map<
120
+ string,
121
+ {
122
+ name: string;
123
+ symbol: ApiLinkIndexSymbol;
124
+ memberName: string;
125
+ memberAnchor: string;
126
+ }
127
+ >();
128
+ let matchedSymbol = false;
129
+
130
+ for (const symbol of symbolList) {
131
+ if (options.packageId && symbol.p !== options.packageId) continue;
132
+ if (options.explicitKind && symbol.k !== options.explicitKind) continue;
133
+ matchedSymbol = true;
134
+ const memberMatch = resolveIndexedMember(symbol, options.member);
135
+ if (memberMatch === null) continue;
136
+
137
+ const key = `${symbol.u}#${memberMatch.memberAnchor}`;
138
+ matches.set(key, {
139
+ name,
140
+ symbol,
141
+ memberName: memberMatch.memberName,
142
+ memberAnchor: memberMatch.memberAnchor,
143
+ });
144
+ }
145
+
146
+ if (matches.size === 1) {
147
+ return matches.values().next().value!;
148
+ }
149
+ if (matches.size > 1 && !ambiguity) {
150
+ ambiguity = { ambiguous: true, candidate: name };
151
+ }
152
+ if (matches.size === 0 && matchedSymbol && options.member && !memberMissing) {
153
+ memberMissing = { memberMissing: true, candidate: name };
134
154
  }
155
+ }
135
156
 
136
- return ambiguity ?? memberMissing;
157
+ return ambiguity ?? memberMissing;
137
158
  }
138
159
 
139
160
  function absolutizeIndexUrl(indexedPath: string, docRoot: string): string {
140
- if (!indexedPath.startsWith('/')) return indexedPath;
161
+ if (!indexedPath.startsWith('/')) return indexedPath;
141
162
 
142
- try {
143
- return `${new URL(docRoot).origin}${indexedPath}`;
144
- } catch {
145
- return indexedPath;
146
- }
163
+ try {
164
+ return `${new URL(docRoot).origin}${indexedPath}`;
165
+ } catch {
166
+ return indexedPath;
167
+ }
147
168
  }
148
169
 
149
170
  function getCandidateClassSuffixes(options: {
150
- ctx: PlatformContext;
151
- explicitPkg: boolean;
152
- pkgConfig: ApiPackageConfig;
171
+ ctx: PlatformContext;
172
+ explicitPkg: boolean;
173
+ pkgConfig: ApiPackageConfig;
153
174
  }): Array<string | undefined> {
154
- if (options.explicitPkg) {
155
- return [options.pkgConfig.classSuffix];
156
- }
175
+ if (options.explicitPkg) {
176
+ return [options.pkgConfig.classSuffix];
177
+ }
157
178
 
158
- const suffixes = new Set<string | undefined>();
159
- for (const pkg of Object.values(options.ctx.apiPackages)) {
160
- suffixes.add(pkg.classSuffix);
161
- }
179
+ const suffixes = new Set<string | undefined>();
180
+ for (const pkg of Object.values(options.ctx.apiPackages)) {
181
+ suffixes.add(pkg.classSuffix);
182
+ }
162
183
 
163
- // Put undefined (no suffix) last so suffixed names are tried first.
164
- return [...suffixes].sort((a, b) => (a === undefined ? 1 : b === undefined ? -1 : 0));
184
+ // Put undefined (no suffix) last so suffixed names are tried first.
185
+ return [...suffixes].sort((a, b) => (a === undefined ? 1 : b === undefined ? -1 : 0));
165
186
  }
166
187
 
167
188
  export function resolveApiLinkFromIndex(options: {
168
- ctx: PlatformContext;
169
- pkgConfig: ApiPackageConfig;
170
- explicitPkg: boolean;
171
- type: string;
172
- member?: string;
173
- explicitKind?: TypeDocKind;
174
- prefix: string;
175
- prefixed: boolean;
176
- suffix: boolean;
189
+ ctx: PlatformContext;
190
+ pkgConfig: ApiPackageConfig;
191
+ explicitPkg: boolean;
192
+ type: string;
193
+ member?: string;
194
+ explicitKind?: TypeDocKind;
195
+ prefix: string;
196
+ prefixed: boolean;
197
+ suffix: boolean;
177
198
  }): ApiLinkIndexResolution {
178
- const index = options.ctx.apiLinkIndex as ApiLinkIndexFile | undefined;
179
- if (!index?.symbols) {
180
- return { status: 'unavailable' };
199
+ const index = options.ctx.apiLinkIndex as ApiLinkIndexFile | undefined;
200
+ if (!index?.symbols) {
201
+ return { status: 'unavailable' };
202
+ }
203
+
204
+ const candidates = new Set<string>();
205
+ for (const classSuffix of getCandidateClassSuffixes(options)) {
206
+ for (const candidate of buildCandidateNames({
207
+ type: options.type,
208
+ explicitKind: options.explicitKind,
209
+ prefix: options.prefix,
210
+ prefixed: options.prefixed,
211
+ suffix: options.suffix,
212
+ classSuffix,
213
+ })) {
214
+ candidates.add(candidate);
181
215
  }
182
-
183
- const candidates = new Set<string>();
184
- for (const classSuffix of getCandidateClassSuffixes(options)) {
185
- for (const candidate of buildCandidateNames({
186
- type: options.type,
187
- explicitKind: options.explicitKind,
188
- prefix: options.prefix,
189
- prefixed: options.prefixed,
190
- suffix: options.suffix,
191
- classSuffix,
192
- })) {
193
- candidates.add(candidate);
194
- }
195
- }
196
-
197
- const indexed = findIndexedSymbol({
198
- index,
199
- candidates: [...candidates],
200
- packageId: options.explicitPkg ? options.pkgConfig.packageId : undefined,
201
- explicitKind: options.explicitKind,
202
- member: options.member,
203
- });
204
-
205
- if (!indexed) return { status: 'missing' };
206
- if ('ambiguous' in indexed) return { status: 'ambiguous', candidate: indexed.candidate };
207
- if ('memberMissing' in indexed) return { status: 'member-missing', candidate: indexed.candidate };
208
-
209
- // Use the resolved symbol's package docRoot when available, so cross-package
210
- // symbols resolve against the correct origin rather than always core.
211
- const resolvedDocRoot = (indexed.symbol.p
212
- ? Object.values(options.ctx.apiPackages).find(pkg => pkg.packageId === indexed.symbol.p)?.docRoot
213
- : undefined) ?? options.pkgConfig.docRoot;
214
-
215
- const path = `${indexed.symbol.u}${indexed.memberAnchor ? `#${indexed.memberAnchor}` : ''}`;
216
- return {
217
- status: 'resolved',
218
- url: absolutizeIndexUrl(path, resolvedDocRoot),
219
- symbolName: indexed.name,
220
- memberName: indexed.memberName,
221
- memberAnchor: indexed.memberAnchor,
222
- };
216
+ }
217
+
218
+ const indexed = findIndexedSymbol({
219
+ index,
220
+ candidates: [...candidates],
221
+ packageId: options.explicitPkg ? options.pkgConfig.packageId : undefined,
222
+ explicitKind: options.explicitKind,
223
+ member: options.member,
224
+ });
225
+
226
+ if (!indexed) return { status: 'missing' };
227
+ if ('ambiguous' in indexed) return { status: 'ambiguous', candidate: indexed.candidate };
228
+ if ('memberMissing' in indexed) return { status: 'member-missing', candidate: indexed.candidate };
229
+
230
+ // Use the resolved symbol's package docRoot when available, so cross-package
231
+ // symbols resolve against the correct origin rather than always core.
232
+ const resolvedDocRoot =
233
+ (indexed.symbol.p
234
+ ? Object.values(options.ctx.apiPackages).find((pkg) => pkg.packageId === indexed.symbol.p)
235
+ ?.docRoot
236
+ : undefined) ?? options.pkgConfig.docRoot;
237
+
238
+ const path = `${indexed.symbol.u}${indexed.memberAnchor ? `#${indexed.memberAnchor}` : ''}`;
239
+ return {
240
+ status: 'resolved',
241
+ url: absolutizeIndexUrl(path, resolvedDocRoot),
242
+ symbolName: indexed.name,
243
+ memberName: indexed.memberName,
244
+ memberAnchor: indexed.memberAnchor,
245
+ };
223
246
  }
@@ -22,71 +22,74 @@ import type { PlatformContext } from '../../../lib/types.ts';
22
22
  type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function';
23
23
 
24
24
  interface Props {
25
- /** Short type / symbol names without platform prefix. */
26
- types: string[];
27
- /**
28
- * TypeDoc symbol kind. Determines the URL segment used.
29
- * @default "class"
30
- */
31
- kind?: ApiKind;
32
- /**
33
- * Package key as defined in platform-context apiPackages.
34
- * Defaults to "core". All types in one call must be from the same package.
35
- */
36
- pkg?: string;
37
- /**
38
- * When true (default) the platform prefix is prepended automatically.
39
- * Set to false for fully-qualified names or non-prefixed symbols.
40
- */
41
- prefixed?: boolean;
42
- /**
43
- * When true (default) the package classSuffix (e.g. "Component" for Angular)
44
- * is appended. Set to false for utility/non-component classes that do not carry
45
- * the platform class suffix (e.g. SummaryOperand, SortingStrategy).
46
- * @default true
47
- */
48
- suffix?: boolean;
25
+ /** Short type / symbol names without platform prefix. */
26
+ types: string[];
27
+ /**
28
+ * TypeDoc symbol kind. Determines the URL segment used.
29
+ * @default "class"
30
+ */
31
+ kind?: ApiKind;
32
+ /**
33
+ * Package key as defined in platform-context apiPackages.
34
+ * Defaults to "core". All types in one call must be from the same package.
35
+ */
36
+ pkg?: string;
37
+ /**
38
+ * When true (default) the platform prefix is prepended automatically.
39
+ * Set to false for fully-qualified names or non-prefixed symbols.
40
+ */
41
+ prefixed?: boolean;
42
+ /**
43
+ * When true (default) the package classSuffix (e.g. "Component" for Angular)
44
+ * is appended. Set to false for utility/non-component classes that do not carry
45
+ * the platform class suffix (e.g. SummaryOperand, SortingStrategy).
46
+ * @default true
47
+ */
48
+ suffix?: boolean;
49
49
  }
50
50
 
51
51
  const KIND_SEGMENT: Record<ApiKind, string> = {
52
- class: 'classes',
53
- interface: 'interfaces',
54
- enum: 'enums',
55
- type: 'types',
56
- variable: 'variables',
57
- function: 'functions',
52
+ class: 'classes',
53
+ interface: 'interfaces',
54
+ enum: 'enums',
55
+ type: 'types',
56
+ variable: 'variables',
57
+ function: 'functions',
58
58
  };
59
59
 
60
60
  const { types, kind = 'class', pkg = 'core', prefixed = true, suffix = true } = Astro.props;
61
61
  const { prefix, apiPackages } = Astro.locals.platformContext as PlatformContext;
62
62
 
63
63
  const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
64
- const segment = KIND_SEGMENT[kind];
64
+ const segment = KIND_SEGMENT[kind];
65
65
  const items = types.map((t) => {
66
- const baseName = prefixed ? `${prefix}${t}` : t;
66
+ const baseName = prefixed ? `${prefix}${t}` : t;
67
67
 
68
- let url: string;
69
- if (kind === 'class') {
70
- const fullName = (suffix && pkgConfig.classSuffix) ? `${baseName}${pkgConfig.classSuffix}` : baseName;
71
- const cased = pkgConfig.preserveCase ? fullName : fullName.toLowerCase();
72
- const classSlug = pkgConfig.noPackagePrefix
73
- ? cased
74
- : `${pkgConfig.packageId}.${cased}`;
75
- url = `${pkgConfig.docRoot}/classes/${classSlug}`;
76
- } else {
77
- // Non-class kinds: preserve original casing, no classSuffix
78
- const slug = pkgConfig.noPackagePrefix
79
- ? baseName
80
- : `${pkgConfig.packageId}.${baseName}`;
81
- url = `${pkgConfig.docRoot}/${segment}/${slug}`;
82
- }
68
+ let url: string;
69
+ if (kind === 'class') {
70
+ const fullName =
71
+ suffix && pkgConfig.classSuffix ? `${baseName}${pkgConfig.classSuffix}` : baseName;
72
+ const cased = pkgConfig.preserveCase ? fullName : fullName.toLowerCase();
73
+ const classSlug = pkgConfig.noPackagePrefix ? cased : `${pkgConfig.packageId}.${cased}`;
74
+ url = `${pkgConfig.docRoot}/classes/${classSlug}`;
75
+ } else {
76
+ // Non-class kinds: preserve original casing, no classSuffix
77
+ const slug = pkgConfig.noPackagePrefix ? baseName : `${pkgConfig.packageId}.${baseName}`;
78
+ url = `${pkgConfig.docRoot}/${segment}/${slug}`;
79
+ }
83
80
 
84
- return { label: baseName, url };
81
+ return { label: baseName, url };
85
82
  });
86
83
  ---
87
84
 
88
85
  <ul>
89
- {items.map(({ label, url }) => (
90
- <li><a href={url}><code>{label}</code></a></li>
91
- ))}
86
+ {
87
+ items.map(({ label, url }) => (
88
+ <li>
89
+ <a href={url}>
90
+ <code>{label}</code>
91
+ </a>
92
+ </li>
93
+ ))
94
+ }
92
95
  </ul>