igniteui-astro-components 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -74
- package/package.json +15 -2
- package/src/components/CopyCode/CopyCode.astro +21 -7
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
- package/src/components/DocsBreadcrumb/README.md +10 -14
- package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
- package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
- package/src/components/DocsSidebar/README.md +25 -21
- package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
- package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
- package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
- package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
- package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -195
- package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
- package/src/components/DocsSubHeader/README.md +18 -16
- package/src/components/DocsToc/DocsToc.astro +301 -280
- package/src/components/DocsToc/DocsToc.scss +20 -21
- package/src/components/DocsToc/README.md +11 -9
- package/src/components/DocsToc/toTreeNodes.ts +3 -8
- package/src/components/DocsTree/DocsTree.astro +32 -20
- package/src/components/DocsTree/DocsTreeItem.astro +35 -30
- package/src/components/DocsTree/README.md +16 -15
- package/src/components/DocsTree/docs-tree.scss +267 -268
- package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
- package/src/components/GlobalFooter/README.md +3 -2
- package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
- package/src/components/GlobalNavBar/README.md +3 -2
- package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
- package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
- package/src/components/MobileSidebarToggle/README.md +3 -2
- package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
- package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
- package/src/components/Search/README.md +1 -0
- package/src/components/Search/Search.astro +137 -109
- package/src/components/Search/Search.scss +20 -20
- package/src/components/SearchAdvanced/README.md +21 -15
- package/src/components/SearchAdvanced/SearchAdvanced.astro +205 -133
- package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
- package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
- package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
- package/src/components/mdx/ApiLink/README.md +26 -22
- package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
- package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
- package/src/components/mdx/ApiRef/README.md +20 -15
- package/src/components/mdx/Badge/Badge.astro +14 -14
- package/src/components/mdx/Badge/Badge.scss +61 -56
- package/src/components/mdx/Badge/README.md +24 -19
- package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
- package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
- package/src/components/mdx/DocsAside/README.md +22 -22
- package/src/components/mdx/Faq/Faq.astro +86 -0
- package/src/components/mdx/Faq/Faq.scss +105 -0
- package/src/components/mdx/Faq/FaqItem.astro +117 -0
- package/src/components/mdx/Faq/README.md +223 -0
- package/src/components/mdx/Faq/types.ts +34 -0
- package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
- package/src/components/mdx/PlatformBlock/README.md +6 -8
- package/src/components/mdx/Sample/README.md +21 -16
- package/src/components/mdx/Sample/Sample.astro +97 -74
- package/src/components/mdx/Sample/Sample.scss +132 -132
- package/src/content-helper.ts +71 -72
- package/src/content.config.ts +1 -6
- package/src/integration.ts +566 -512
- package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
- package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
- package/src/layouts/DocsLayout/README.md +24 -35
- package/src/lib/nav-helpers.ts +88 -82
- package/src/lib/types.ts +76 -76
- package/src/llms.ts +205 -166
- package/src/platform.ts +312 -162
- package/src/plugins/rehype-heading-anchors.ts +45 -45
- package/src/plugins/rehype-pagefind-ignore.ts +19 -19
- package/src/plugins/rehype-table-wrapper.ts +30 -30
- package/src/plugins/remark-docfx.ts +12 -0
- package/src/plugins/remark-env-vars.ts +12 -4
- package/src/plugins/remark-md-links.ts +10 -4
- package/src/scripts/icon-manifest.ts +13 -5
- package/src/scripts/sample-widget.ts +557 -501
- package/src/sidebar.ts +103 -97
- package/src/styles/global/_code-blocks.scss +43 -44
- package/src/styles/global/_component-themes.scss +151 -153
- package/src/styles/global/_icon-gallery.scss +81 -81
- package/src/styles/global/_index.scss +0 -1
- package/src/styles/global/_markdown.scss +816 -787
- package/src/styles/global/_palette.scss +456 -110
- package/src/styles/global/_search-shared.scss +402 -398
- package/src/styles/global/_type-scale.scss +127 -127
- package/src/styles/global/_variables.scss +138 -111
- package/src/styles/theme.scss +41 -41
- package/src/virtual-modules.d.ts +11 -2
|
@@ -81,7 +81,11 @@ const platformIcon = platform ? (PLATFORM_ICONS[platform] ?? null) : null;
|
|
|
81
81
|
// causes the data attributes to embed an absolute origin that breaks previews.
|
|
82
82
|
const rawBase = import.meta.env.BASE_URL ?? '/';
|
|
83
83
|
const basePath = (() => {
|
|
84
|
-
try {
|
|
84
|
+
try {
|
|
85
|
+
return new URL(rawBase).pathname;
|
|
86
|
+
} catch {
|
|
87
|
+
return rawBase;
|
|
88
|
+
}
|
|
85
89
|
})().replace(/\/?$/, '/');
|
|
86
90
|
const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`;
|
|
87
91
|
---
|
|
@@ -95,70 +99,110 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
95
99
|
data-show-scope={showScope ? 'true' : 'false'}
|
|
96
100
|
data-platform-icon={platformIcon ?? ''}
|
|
97
101
|
>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
102
|
+
<div class="search-decoration">
|
|
103
|
+
<igc-icon-button
|
|
104
|
+
class="search-trigger-mobile"
|
|
105
|
+
variant="flat"
|
|
106
|
+
aria-label={placeholder}
|
|
107
|
+
aria-haspopup="dialog"
|
|
108
|
+
data-open-modal
|
|
109
|
+
>
|
|
110
|
+
<igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
|
|
111
|
+
</igc-icon-button>
|
|
112
|
+
<igc-input
|
|
113
|
+
data-open-modal
|
|
114
|
+
readonly
|
|
115
|
+
placeholder={placeholder}
|
|
116
|
+
aria-label={placeholder}
|
|
117
|
+
aria-keyshortcuts="Control+K"
|
|
118
|
+
aria-haspopup="dialog"
|
|
119
|
+
role="button"
|
|
120
|
+
class="search-trigger"
|
|
121
|
+
>
|
|
122
|
+
<igc-icon name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
|
|
123
|
+
<kbd class="search-trigger__hint" slot="suffix" style="display: none;">
|
|
124
|
+
<kbd>Ctrl</kbd><kbd>K</kbd>
|
|
125
|
+
</kbd>
|
|
126
|
+
</igc-input>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<igc-dialog
|
|
130
|
+
aria-label={placeholder}
|
|
131
|
+
class="igd-search-dialog"
|
|
132
|
+
hide-default-action
|
|
133
|
+
close-on-outside-click
|
|
134
|
+
>
|
|
135
|
+
<div class="igd-search-shell">
|
|
136
|
+
<header class="igd-search-header">
|
|
137
|
+
<igc-input
|
|
138
|
+
type="text"
|
|
139
|
+
class="igd-search-input"
|
|
140
|
+
placeholder={placeholder}
|
|
141
|
+
autocomplete="off"
|
|
142
|
+
outlined
|
|
143
|
+
aria-label={placeholder}
|
|
144
|
+
>
|
|
145
|
+
<igc-icon
|
|
146
|
+
class="igd-search-icon"
|
|
147
|
+
name="search"
|
|
148
|
+
collection="docs"
|
|
149
|
+
slot="prefix"
|
|
150
|
+
aria-hidden="true"></igc-icon>
|
|
151
|
+
<igc-icon-button
|
|
152
|
+
slot="suffix"
|
|
153
|
+
class="igd-search-clear"
|
|
154
|
+
variant="flat"
|
|
155
|
+
type="button"
|
|
156
|
+
aria-label="Clear search"
|
|
157
|
+
name="clear"
|
|
158
|
+
collection="docs"
|
|
159
|
+
hidden></igc-icon-button>
|
|
160
|
+
</igc-input>
|
|
161
|
+
|
|
162
|
+
<igc-select
|
|
163
|
+
placement="bottom-start"
|
|
164
|
+
distance="17"
|
|
165
|
+
id="search-scope-select"
|
|
166
|
+
slot="prefix"
|
|
167
|
+
class="igd-search-scope"
|
|
168
|
+
outlined
|
|
169
|
+
aria-label="Search scope"
|
|
170
|
+
value="current"
|
|
171
|
+
>
|
|
172
|
+
{
|
|
173
|
+
platformIcon && (
|
|
174
|
+
<igc-icon
|
|
175
|
+
id="search-scope-trigger-icon"
|
|
176
|
+
name={platformIcon}
|
|
177
|
+
collection="docs"
|
|
178
|
+
slot="prefix"
|
|
179
|
+
aria-hidden="true"
|
|
180
|
+
/>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
<igc-select-item value="current">
|
|
184
|
+
<span data-scope-label>Current package</span>
|
|
185
|
+
</igc-select-item>
|
|
186
|
+
<igc-select-item value="all">All packages</igc-select-item>
|
|
187
|
+
</igc-select>
|
|
188
|
+
<igc-tooltip
|
|
189
|
+
anchor="search-scope-select"
|
|
190
|
+
class="igd-search-scope-tooltip"
|
|
191
|
+
placement="bottom"
|
|
192
|
+
with-arrow></igc-tooltip>
|
|
193
|
+
</header>
|
|
194
|
+
<div class="igd-search-content">
|
|
195
|
+
<div class="igd-search-status" aria-live="polite"></div>
|
|
196
|
+
<igc-tabs class="igd-search-tabs" hidden></igc-tabs>
|
|
197
|
+
<igc-list class="igd-search-results--flat" hidden></igc-list>
|
|
198
|
+
</div>
|
|
199
|
+
<footer class="igd-search-footer">
|
|
200
|
+
<igc-button slot="footer" data-close-modal class="search-close" variant="outlined">
|
|
201
|
+
Close
|
|
202
|
+
</igc-button>
|
|
203
|
+
</footer>
|
|
123
204
|
</div>
|
|
124
|
-
|
|
125
|
-
<igc-dialog aria-label={placeholder} class="igd-search-dialog" hide-default-action close-on-outside-click>
|
|
126
|
-
<div class="igd-search-shell">
|
|
127
|
-
<header class="igd-search-header">
|
|
128
|
-
<igc-input
|
|
129
|
-
type="text"
|
|
130
|
-
class="igd-search-input"
|
|
131
|
-
placeholder={placeholder}
|
|
132
|
-
autocomplete="off"
|
|
133
|
-
outlined
|
|
134
|
-
aria-label={placeholder}
|
|
135
|
-
>
|
|
136
|
-
<igc-icon class="igd-search-icon" name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
|
|
137
|
-
<igc-icon-button slot="suffix" class="igd-search-clear" variant="flat" type="button" aria-label="Clear search" name="clear" collection="docs" hidden></igc-icon-button>
|
|
138
|
-
</igc-input>
|
|
139
|
-
|
|
140
|
-
<igc-select placement="bottom-start" distance="17" id="search-scope-select" slot="prefix" class="igd-search-scope" outlined aria-label="Search scope" value="current">
|
|
141
|
-
{platformIcon && <igc-icon id="search-scope-trigger-icon" name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
|
|
142
|
-
<igc-select-item value="current">
|
|
143
|
-
<span data-scope-label>Current package</span>
|
|
144
|
-
</igc-select-item>
|
|
145
|
-
<igc-select-item value="all">All packages</igc-select-item>
|
|
146
|
-
</igc-select>
|
|
147
|
-
<igc-tooltip anchor="search-scope-select" class="igd-search-scope-tooltip" placement="bottom" with-arrow></igc-tooltip>
|
|
148
|
-
|
|
149
|
-
</header>
|
|
150
|
-
<div class="igd-search-content">
|
|
151
|
-
<div class="igd-search-status" aria-live="polite"></div>
|
|
152
|
-
<igc-tabs class="igd-search-tabs" hidden></igc-tabs>
|
|
153
|
-
<igc-list class="igd-search-results--flat" hidden></igc-list>
|
|
154
|
-
</div>
|
|
155
|
-
<footer class="igd-search-footer">
|
|
156
|
-
<igc-button slot="footer" data-close-modal class="search-close" variant="outlined">
|
|
157
|
-
Close
|
|
158
|
-
</igc-button>
|
|
159
|
-
</footer>
|
|
160
|
-
</div>
|
|
161
|
-
</igc-dialog>
|
|
205
|
+
</igc-dialog>
|
|
162
206
|
</api-search-advanced>
|
|
163
207
|
|
|
164
208
|
<script>
|
|
@@ -227,17 +271,23 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
227
271
|
};
|
|
228
272
|
|
|
229
273
|
const PAGE_KIND_LABEL: Record<string, string> = {
|
|
230
|
-
class:
|
|
274
|
+
class: 'class',
|
|
231
275
|
interface: 'interface',
|
|
232
|
-
enum:
|
|
233
|
-
type:
|
|
234
|
-
variable:
|
|
235
|
-
function:
|
|
236
|
-
module:
|
|
276
|
+
enum: 'enum',
|
|
277
|
+
type: 'type',
|
|
278
|
+
variable: 'variable',
|
|
279
|
+
function: 'function',
|
|
280
|
+
module: 'module',
|
|
237
281
|
};
|
|
238
282
|
|
|
239
283
|
const PAGE_KIND_WEIGHT: Record<string, number> = {
|
|
240
|
-
class: 0,
|
|
284
|
+
class: 0,
|
|
285
|
+
interface: 1,
|
|
286
|
+
enum: 2,
|
|
287
|
+
type: 3,
|
|
288
|
+
function: 4,
|
|
289
|
+
variable: 5,
|
|
290
|
+
module: 6,
|
|
241
291
|
};
|
|
242
292
|
|
|
243
293
|
const KIND_CODE_TO_LABEL: Record<string, string> = {
|
|
@@ -301,18 +351,18 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
301
351
|
}
|
|
302
352
|
}
|
|
303
353
|
|
|
304
|
-
const openBtn
|
|
354
|
+
const openBtn = this.querySelector<HTMLElement>('igc-input[data-open-modal]')!;
|
|
305
355
|
const openBtns = this.querySelectorAll<HTMLElement>('[data-open-modal]');
|
|
306
356
|
const closeBtn = this.querySelector<HTMLElement>('[data-close-modal]')!;
|
|
307
|
-
this.dialog
|
|
308
|
-
this.input
|
|
309
|
-
this.clearBtn
|
|
357
|
+
this.dialog = this.querySelector<IgcDialogComponent>('igc-dialog')!;
|
|
358
|
+
this.input = this.querySelector<IgcInputComponent>('igc-input.igd-search-input')!;
|
|
359
|
+
this.clearBtn = this.querySelector<IgcIconButtonComponent>('.igd-search-clear')!;
|
|
310
360
|
this.scopeSelect = this.querySelector<IgcSelectComponent>('igc-select.igd-search-scope');
|
|
311
361
|
this.scopeTooltip = this.querySelector<HTMLElement>('.igd-search-scope-tooltip');
|
|
312
362
|
this.scopeTriggerIcon = this.querySelector('#search-scope-trigger-icon');
|
|
313
363
|
this.platformIconName = this.dataset.platformIcon || '';
|
|
314
|
-
this.tabsEl
|
|
315
|
-
this.statusEl
|
|
364
|
+
this.tabsEl = this.querySelector<IgcTabsComponent>('igc-tabs.igd-search-tabs')!;
|
|
365
|
+
this.statusEl = this.querySelector<HTMLElement>('.igd-search-status')!;
|
|
316
366
|
this.flatListEl = this.querySelector<HTMLElement>('.igd-search-results--flat')!;
|
|
317
367
|
|
|
318
368
|
// Update the keyboard shortcut hint for the current OS.
|
|
@@ -332,8 +382,10 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
332
382
|
const subheader = document.querySelector<HTMLElement>('docs-subheader-menu');
|
|
333
383
|
const detectedPlatform = subheader?.dataset.platform || '';
|
|
334
384
|
const ICONS: Record<string, string> = {
|
|
335
|
-
angular: 'angular-logo',
|
|
336
|
-
|
|
385
|
+
angular: 'angular-logo',
|
|
386
|
+
react: 'react-logo',
|
|
387
|
+
blazor: 'blazor-logo',
|
|
388
|
+
'web-components': 'wc-logo',
|
|
337
389
|
};
|
|
338
390
|
this.platformIconName = ICONS[detectedPlatform] || '';
|
|
339
391
|
}
|
|
@@ -365,13 +417,15 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
365
417
|
this.input.focus();
|
|
366
418
|
};
|
|
367
419
|
|
|
368
|
-
openBtns.forEach(btn => btn.addEventListener('click', open));
|
|
369
|
-
openBtns.forEach(btn
|
|
370
|
-
|
|
371
|
-
e.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
420
|
+
openBtns.forEach((btn) => btn.addEventListener('click', open));
|
|
421
|
+
openBtns.forEach((btn) =>
|
|
422
|
+
btn.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
423
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
424
|
+
e.preventDefault();
|
|
425
|
+
open();
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
);
|
|
375
429
|
|
|
376
430
|
closeBtn.addEventListener('click', () => this.closeModal());
|
|
377
431
|
|
|
@@ -389,7 +443,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
389
443
|
|
|
390
444
|
window.addEventListener('keydown', (e) => {
|
|
391
445
|
if ((e.metaKey === true || e.ctrlKey === true) && e.key === 'k') {
|
|
392
|
-
this.dialog.open
|
|
446
|
+
if (this.dialog.open) this.closeModal();
|
|
447
|
+
else open();
|
|
393
448
|
e.preventDefault();
|
|
394
449
|
}
|
|
395
450
|
});
|
|
@@ -420,13 +475,13 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
420
475
|
|
|
421
476
|
// igcInput re-renders with full text after the dropdown closes; re-apply truncation.
|
|
422
477
|
this.scopeSelect.addEventListener('igcClosed', () =>
|
|
423
|
-
requestAnimationFrame(() => this.applyScopeTruncation())
|
|
478
|
+
requestAnimationFrame(() => this.applyScopeTruncation()),
|
|
424
479
|
);
|
|
425
480
|
}
|
|
426
481
|
|
|
427
482
|
// Apply truncation once the dialog is fully open and the select has real dimensions.
|
|
428
483
|
this.dialog.addEventListener('igcOpened', () =>
|
|
429
|
-
requestAnimationFrame(() => requestAnimationFrame(() => this.applyScopeTruncation()))
|
|
484
|
+
requestAnimationFrame(() => requestAnimationFrame(() => this.applyScopeTruncation())),
|
|
430
485
|
);
|
|
431
486
|
|
|
432
487
|
// Only show the scope tooltip when the label is visually truncated
|
|
@@ -460,7 +515,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
460
515
|
|
|
461
516
|
private detectCurrentContext() {
|
|
462
517
|
const path = window.location.pathname;
|
|
463
|
-
const stripped = path.startsWith(this.basePath)
|
|
518
|
+
const stripped = path.startsWith(this.basePath)
|
|
519
|
+
? path.slice(this.basePath.length)
|
|
520
|
+
: path.replace(/^\/+/, '');
|
|
464
521
|
const segs = stripped.split('/').filter(Boolean);
|
|
465
522
|
const baseSegs = this.basePath.split('/').filter(Boolean);
|
|
466
523
|
this.currentPlatform = baseSegs[baseSegs.length - 1] || '';
|
|
@@ -470,7 +527,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
470
527
|
|
|
471
528
|
private updateScopeOption() {
|
|
472
529
|
if (!this.scopeSelect) return;
|
|
473
|
-
const item = this.scopeSelect.querySelector<
|
|
530
|
+
const item = this.scopeSelect.querySelector<
|
|
531
|
+
HTMLElement & { value: string; disabled: boolean }
|
|
532
|
+
>('igc-select-item[value="current"]');
|
|
474
533
|
if (!item) return;
|
|
475
534
|
if (this.currentPkg && this.currentVersion) {
|
|
476
535
|
const labelEl = item.querySelector('[data-scope-label]');
|
|
@@ -524,7 +583,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
524
583
|
const res = await fetch(`${baseUrl}${this.currentPkg}/${this.currentVersion}.json`);
|
|
525
584
|
if (!res.ok) return [];
|
|
526
585
|
const d = await res.json();
|
|
527
|
-
return Array.isArray(d?.pages) ? d.pages as IndexedPage[] : [];
|
|
586
|
+
return Array.isArray(d?.pages) ? (d.pages as IndexedPage[]) : [];
|
|
528
587
|
} catch {
|
|
529
588
|
return [];
|
|
530
589
|
}
|
|
@@ -548,16 +607,18 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
548
607
|
// Manifest format: { files: ["pkg/version.json", ...] }
|
|
549
608
|
if (Array.isArray((data as any)?.files)) {
|
|
550
609
|
const baseUrl = this.indexUrl.replace(/[^/]*$/, '');
|
|
551
|
-
const fetches: Promise<IndexedPage[]>[] = ((data as any).files as string[]).map(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
610
|
+
const fetches: Promise<IndexedPage[]>[] = ((data as any).files as string[]).map(
|
|
611
|
+
async (file: string) => {
|
|
612
|
+
try {
|
|
613
|
+
const res = await fetch(`${baseUrl}${file}`);
|
|
614
|
+
if (!res.ok) return [];
|
|
615
|
+
const d = await res.json();
|
|
616
|
+
return Array.isArray(d?.pages) ? (d.pages as IndexedPage[]) : [];
|
|
617
|
+
} catch {
|
|
618
|
+
return [];
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
);
|
|
561
622
|
const results = await Promise.all(fetches);
|
|
562
623
|
return results.flat();
|
|
563
624
|
}
|
|
@@ -637,14 +698,13 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
637
698
|
return;
|
|
638
699
|
}
|
|
639
700
|
|
|
640
|
-
const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
|
|
701
|
+
const nameCategories = this.categories.filter((c) => c.kindCodes.includes('__name__'));
|
|
641
702
|
|
|
642
703
|
let scoped: IndexedPage[];
|
|
643
704
|
if (this.showScope && this.scope === 'current' && this.currentPkg && this.currentVersion) {
|
|
644
|
-
scoped = pages.filter(
|
|
645
|
-
p
|
|
646
|
-
|
|
647
|
-
p.v === this.currentVersion
|
|
705
|
+
scoped = pages.filter(
|
|
706
|
+
(p) =>
|
|
707
|
+
p.p === this.currentPlatform && p.g === this.currentPkg && p.v === this.currentVersion,
|
|
648
708
|
);
|
|
649
709
|
} else if (this.showScope) {
|
|
650
710
|
const platformPages = this.currentPlatform
|
|
@@ -720,14 +780,13 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
720
780
|
}
|
|
721
781
|
|
|
722
782
|
// Determine which categories handle page names
|
|
723
|
-
const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
|
|
783
|
+
const nameCategories = this.categories.filter((c) => c.kindCodes.includes('__name__'));
|
|
724
784
|
|
|
725
785
|
let scoped: IndexedPage[];
|
|
726
786
|
if (this.showScope && this.scope === 'current' && this.currentPkg && this.currentVersion) {
|
|
727
|
-
scoped = pages.filter(
|
|
728
|
-
p
|
|
729
|
-
|
|
730
|
-
p.v === this.currentVersion
|
|
787
|
+
scoped = pages.filter(
|
|
788
|
+
(p) =>
|
|
789
|
+
p.p === this.currentPlatform && p.g === this.currentPkg && p.v === this.currentVersion,
|
|
731
790
|
);
|
|
732
791
|
} else if (this.showScope) {
|
|
733
792
|
const platformPages = this.currentPlatform
|
|
@@ -825,7 +884,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
825
884
|
|
|
826
885
|
// Sort each bucket
|
|
827
886
|
for (const [catId, list] of buckets.entries()) {
|
|
828
|
-
const isNameCat = nameCategories.some(c => c.id === catId);
|
|
887
|
+
const isNameCat = nameCategories.some((c) => c.id === catId);
|
|
829
888
|
if (isNameCat) {
|
|
830
889
|
list.sort((a, b) => {
|
|
831
890
|
if (a.typeWeight !== b.typeWeight) return a.typeWeight - b.typeWeight;
|
|
@@ -853,7 +912,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
853
912
|
this.tabsEl.hidden = true;
|
|
854
913
|
this.tabsEl.innerHTML = '';
|
|
855
914
|
const list = this.currentMatches.get('__all__') ?? [];
|
|
856
|
-
this.flatListEl.innerHTML = list.map(m => this.matchHtml(m)).join('');
|
|
915
|
+
this.flatListEl.innerHTML = list.map((m) => this.matchHtml(m)).join('');
|
|
857
916
|
this.flatListEl.hidden = list.length === 0;
|
|
858
917
|
return;
|
|
859
918
|
}
|
|
@@ -870,23 +929,25 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
870
929
|
const list = this.currentMatches.get(cat.id) ?? [];
|
|
871
930
|
if (list.length === 0) continue;
|
|
872
931
|
const slice = list.slice(0, this.allTabLimit);
|
|
873
|
-
const items = slice.map(m => this.matchHtml(m)).join('');
|
|
874
|
-
const moreBtn =
|
|
875
|
-
|
|
932
|
+
const items = slice.map((m) => this.matchHtml(m)).join('');
|
|
933
|
+
const moreBtn =
|
|
934
|
+
list.length > slice.length
|
|
935
|
+
? `<igc-button variant="flat" class="igd-search-more-btn" data-tab="${cat.id}">See` +
|
|
876
936
|
` all ${list.length} ${escapeHtml(cat.label.toLowerCase())}` +
|
|
877
|
-
|
|
878
|
-
|
|
937
|
+
`</igc-button>`
|
|
938
|
+
: '';
|
|
879
939
|
allContent.push(
|
|
880
940
|
`<span class="igd-search-category-header">${escapeHtml(cat.label)}</span>` +
|
|
881
|
-
|
|
882
|
-
|
|
941
|
+
`<igc-list class="igd-search-results">${items}</igc-list>` +
|
|
942
|
+
moreBtn +
|
|
943
|
+
`<igc-divider></igc-divider>`,
|
|
883
944
|
);
|
|
884
945
|
}
|
|
885
946
|
tabsHtml.push(
|
|
886
947
|
`<igc-tab data-tab-id="all" label="All"${this.currentTab === 'all' ? ' selected' : ''}>` +
|
|
887
948
|
`<span slot="suffix" class="igd-search-tab-count">${totalCount}</span>` +
|
|
888
949
|
allContent.join('') +
|
|
889
|
-
|
|
950
|
+
`</igc-tab>`,
|
|
890
951
|
);
|
|
891
952
|
|
|
892
953
|
// Per-category tabs — capped to avoid freezing the main thread when many
|
|
@@ -901,9 +962,11 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
901
962
|
tabsHtml.push(
|
|
902
963
|
`<igc-tab data-tab-id="${cat.id}" label="${escapeHtml(cat.label)}"${isSelected ? ' selected' : ''}>` +
|
|
903
964
|
`<span slot="suffix" class="igd-search-tab-count">${list.length}</span>` +
|
|
904
|
-
`<igc-list class="igd-search-results">${displayList.map(m => this.matchHtml(m)).join('')}</igc-list>` +
|
|
905
|
-
(hasMore
|
|
906
|
-
|
|
965
|
+
`<igc-list class="igd-search-results">${displayList.map((m) => this.matchHtml(m)).join('')}</igc-list>` +
|
|
966
|
+
(hasMore
|
|
967
|
+
? `<p class="igd-search-refine-hint">Showing first ${MAX_PER_CATEGORY_TAB} of ${list.length} matches — refine your search to narrow results.</p>`
|
|
968
|
+
: '') +
|
|
969
|
+
`</igc-tab>`,
|
|
907
970
|
);
|
|
908
971
|
}
|
|
909
972
|
|
|
@@ -941,11 +1004,12 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
941
1004
|
|
|
942
1005
|
private matchHtml(m: Match): string {
|
|
943
1006
|
const highlightedName = highlight(m.name, this.currentQuery);
|
|
944
|
-
const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
|
|
945
|
-
const isNameMatch = nameCategories.some(c => c.id === m.category);
|
|
946
|
-
const subtitle =
|
|
947
|
-
|
|
948
|
-
|
|
1007
|
+
const nameCategories = this.categories.filter((c) => c.kindCodes.includes('__name__'));
|
|
1008
|
+
const isNameMatch = nameCategories.some((c) => c.id === m.category);
|
|
1009
|
+
const subtitle =
|
|
1010
|
+
isNameMatch || m.category === '__all__'
|
|
1011
|
+
? `<span class="igd-search-kind">${escapeHtml(m.packageLabel)}</span>`
|
|
1012
|
+
: `<span class="igd-search-kind">${escapeHtml(m.packageLabel)}</span><span class="igd-search-meta">in ${escapeHtml(m.pageName)}</span>`;
|
|
949
1013
|
return `<igc-list-item>
|
|
950
1014
|
<a href="${m.url}" class="igd-search-link">
|
|
951
1015
|
<span class="igd-search-result-title">${highlightedName}</span>
|
|
@@ -970,8 +1034,14 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
970
1034
|
}
|
|
971
1035
|
|
|
972
1036
|
function compareVersions(a: string, b: string): number {
|
|
973
|
-
const ap = a
|
|
974
|
-
|
|
1037
|
+
const ap = a
|
|
1038
|
+
.replace(/[^0-9.]/g, '')
|
|
1039
|
+
.split('.')
|
|
1040
|
+
.map(Number);
|
|
1041
|
+
const bp = b
|
|
1042
|
+
.replace(/[^0-9.]/g, '')
|
|
1043
|
+
.split('.')
|
|
1044
|
+
.map(Number);
|
|
975
1045
|
for (let i = 0; i < Math.max(ap.length, bp.length); i++) {
|
|
976
1046
|
const d = (ap[i] || 0) - (bp[i] || 0);
|
|
977
1047
|
if (d !== 0) return d;
|
|
@@ -997,7 +1067,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
997
1067
|
if (i < 0) return escapeHtml(text);
|
|
998
1068
|
return (
|
|
999
1069
|
escapeHtml(text.slice(0, i)) +
|
|
1000
|
-
'<mark>' +
|
|
1070
|
+
'<mark>' +
|
|
1071
|
+
escapeHtml(text.slice(i, i + q.length)) +
|
|
1072
|
+
'</mark>' +
|
|
1001
1073
|
escapeHtml(text.slice(i + q.length))
|
|
1002
1074
|
);
|
|
1003
1075
|
}
|