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
@@ -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 { return new URL(rawBase).pathname; } catch { return rawBase; }
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
- <div class="search-decoration">
99
- <igc-icon-button
100
- class="search-trigger-mobile"
101
- variant="flat"
102
- aria-label={placeholder}
103
- aria-haspopup="dialog"
104
- data-open-modal
105
- >
106
- <igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
107
- </igc-icon-button>
108
- <igc-input
109
- data-open-modal
110
- readonly
111
- placeholder={placeholder}
112
- aria-label={placeholder}
113
- aria-keyshortcuts="Control+K"
114
- aria-haspopup="dialog"
115
- role="button"
116
- class="search-trigger"
117
- >
118
- <igc-icon name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
119
- <kbd class="search-trigger__hint" slot="suffix" style="display: none;">
120
- <kbd>Ctrl</kbd><kbd>K</kbd>
121
- </kbd>
122
- </igc-input>
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: 'class',
274
+ class: 'class',
231
275
  interface: 'interface',
232
- enum: 'enum',
233
- type: 'type',
234
- variable: 'variable',
235
- function: 'function',
236
- module: '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, interface: 1, enum: 2, type: 3, function: 4, variable: 5, module: 6,
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 = this.querySelector<HTMLElement>('igc-input[data-open-modal]')!;
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 = this.querySelector<IgcDialogComponent>('igc-dialog')!;
308
- this.input = this.querySelector<IgcInputComponent>('igc-input.igd-search-input')!;
309
- this.clearBtn = this.querySelector<IgcIconButtonComponent>('.igd-search-clear')!;
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 = this.querySelector<IgcTabsComponent>('igc-tabs.igd-search-tabs')!;
315
- this.statusEl = this.querySelector<HTMLElement>('.igd-search-status')!;
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', react: 'react-logo',
336
- blazor: 'blazor-logo', 'web-components': 'wc-logo',
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 => btn.addEventListener('keydown', (e: KeyboardEvent) => {
370
- if (e.key === 'Enter' || e.key === ' ') {
371
- e.preventDefault();
372
- open();
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 ? this.closeModal() : open();
446
+ if (this.dialog.open) this.closeModal();
447
+ else open();
393
448
  e.preventDefault();
394
449
  }
395
450
  });
@@ -420,32 +475,49 @@ 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
433
488
  if (this.scopeTooltip && this.scopeSelect) {
489
+ // Hide tooltip when the dropdown opens
490
+ this.scopeSelect.addEventListener('igcOpening', () => (this.scopeTooltip as any)?.hide?.());
491
+
434
492
  this.scopeTooltip.addEventListener('igcOpening', (e: Event) => {
493
+ // Never show tooltip while the dropdown is open
494
+ if ((this.scopeSelect as any)?.open) {
495
+ e.preventDefault();
496
+ return;
497
+ }
435
498
  const igcInput = (this.scopeSelect as any).shadowRoot?.querySelector('igc-input');
436
499
  const nativeInput = igcInput?.shadowRoot?.querySelector('input');
437
500
  const truncated = nativeInput?.value?.endsWith('\u2026');
438
501
  const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
439
502
  if (!truncated && !overflows) {
440
503
  e.preventDefault();
504
+ return;
441
505
  }
506
+ // Refresh tooltip content here because igc-select.value may not be
507
+ // ready during connectedCallback (before the component's first LitElement
508
+ // render cycle), so the initial syncScopeTooltip() call may have set
509
+ // an empty string. By the time a hover triggers igcOpening the
510
+ // component is fully initialized and the value is reliable.
511
+ this.syncScopeTooltip();
442
512
  });
443
513
  }
444
514
  }
445
515
 
446
516
  private detectCurrentContext() {
447
517
  const path = window.location.pathname;
448
- const stripped = path.startsWith(this.basePath) ? path.slice(this.basePath.length) : path.replace(/^\/+/, '');
518
+ const stripped = path.startsWith(this.basePath)
519
+ ? path.slice(this.basePath.length)
520
+ : path.replace(/^\/+/, '');
449
521
  const segs = stripped.split('/').filter(Boolean);
450
522
  const baseSegs = this.basePath.split('/').filter(Boolean);
451
523
  this.currentPlatform = baseSegs[baseSegs.length - 1] || '';
@@ -455,7 +527,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
455
527
 
456
528
  private updateScopeOption() {
457
529
  if (!this.scopeSelect) return;
458
- const item = this.scopeSelect.querySelector<HTMLElement & { value: string; disabled: boolean }>('igc-select-item[value="current"]');
530
+ const item = this.scopeSelect.querySelector<
531
+ HTMLElement & { value: string; disabled: boolean }
532
+ >('igc-select-item[value="current"]');
459
533
  if (!item) return;
460
534
  if (this.currentPkg && this.currentVersion) {
461
535
  const labelEl = item.querySelector('[data-scope-label]');
@@ -509,7 +583,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
509
583
  const res = await fetch(`${baseUrl}${this.currentPkg}/${this.currentVersion}.json`);
510
584
  if (!res.ok) return [];
511
585
  const d = await res.json();
512
- return Array.isArray(d?.pages) ? d.pages as IndexedPage[] : [];
586
+ return Array.isArray(d?.pages) ? (d.pages as IndexedPage[]) : [];
513
587
  } catch {
514
588
  return [];
515
589
  }
@@ -533,16 +607,18 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
533
607
  // Manifest format: { files: ["pkg/version.json", ...] }
534
608
  if (Array.isArray((data as any)?.files)) {
535
609
  const baseUrl = this.indexUrl.replace(/[^/]*$/, '');
536
- const fetches: Promise<IndexedPage[]>[] = ((data as any).files as string[]).map(async (file: string) => {
537
- try {
538
- const res = await fetch(`${baseUrl}${file}`);
539
- if (!res.ok) return [];
540
- const d = await res.json();
541
- return Array.isArray(d?.pages) ? d.pages as IndexedPage[] : [];
542
- } catch {
543
- return [];
544
- }
545
- });
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
+ );
546
622
  const results = await Promise.all(fetches);
547
623
  return results.flat();
548
624
  }
@@ -622,14 +698,13 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
622
698
  return;
623
699
  }
624
700
 
625
- const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
701
+ const nameCategories = this.categories.filter((c) => c.kindCodes.includes('__name__'));
626
702
 
627
703
  let scoped: IndexedPage[];
628
704
  if (this.showScope && this.scope === 'current' && this.currentPkg && this.currentVersion) {
629
- scoped = pages.filter((p) =>
630
- p.p === this.currentPlatform &&
631
- p.g === this.currentPkg &&
632
- p.v === this.currentVersion
705
+ scoped = pages.filter(
706
+ (p) =>
707
+ p.p === this.currentPlatform && p.g === this.currentPkg && p.v === this.currentVersion,
633
708
  );
634
709
  } else if (this.showScope) {
635
710
  const platformPages = this.currentPlatform
@@ -705,14 +780,13 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
705
780
  }
706
781
 
707
782
  // Determine which categories handle page names
708
- const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
783
+ const nameCategories = this.categories.filter((c) => c.kindCodes.includes('__name__'));
709
784
 
710
785
  let scoped: IndexedPage[];
711
786
  if (this.showScope && this.scope === 'current' && this.currentPkg && this.currentVersion) {
712
- scoped = pages.filter((p) =>
713
- p.p === this.currentPlatform &&
714
- p.g === this.currentPkg &&
715
- p.v === this.currentVersion
787
+ scoped = pages.filter(
788
+ (p) =>
789
+ p.p === this.currentPlatform && p.g === this.currentPkg && p.v === this.currentVersion,
716
790
  );
717
791
  } else if (this.showScope) {
718
792
  const platformPages = this.currentPlatform
@@ -810,7 +884,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
810
884
 
811
885
  // Sort each bucket
812
886
  for (const [catId, list] of buckets.entries()) {
813
- const isNameCat = nameCategories.some(c => c.id === catId);
887
+ const isNameCat = nameCategories.some((c) => c.id === catId);
814
888
  if (isNameCat) {
815
889
  list.sort((a, b) => {
816
890
  if (a.typeWeight !== b.typeWeight) return a.typeWeight - b.typeWeight;
@@ -838,7 +912,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
838
912
  this.tabsEl.hidden = true;
839
913
  this.tabsEl.innerHTML = '';
840
914
  const list = this.currentMatches.get('__all__') ?? [];
841
- this.flatListEl.innerHTML = list.map(m => this.matchHtml(m)).join('');
915
+ this.flatListEl.innerHTML = list.map((m) => this.matchHtml(m)).join('');
842
916
  this.flatListEl.hidden = list.length === 0;
843
917
  return;
844
918
  }
@@ -855,23 +929,25 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
855
929
  const list = this.currentMatches.get(cat.id) ?? [];
856
930
  if (list.length === 0) continue;
857
931
  const slice = list.slice(0, this.allTabLimit);
858
- const items = slice.map(m => this.matchHtml(m)).join('');
859
- const moreBtn = list.length > slice.length
860
- ? `<igc-button variant="flat" class="igd-search-more-btn" data-tab="${cat.id}">See` +
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` +
861
936
  ` all ${list.length} ${escapeHtml(cat.label.toLowerCase())}` +
862
- `</igc-button>`
863
- : '';
937
+ `</igc-button>`
938
+ : '';
864
939
  allContent.push(
865
940
  `<span class="igd-search-category-header">${escapeHtml(cat.label)}</span>` +
866
- `<igc-list class="igd-search-results">${items}</igc-list>` +
867
- moreBtn + `<igc-divider></igc-divider>`
941
+ `<igc-list class="igd-search-results">${items}</igc-list>` +
942
+ moreBtn +
943
+ `<igc-divider></igc-divider>`,
868
944
  );
869
945
  }
870
946
  tabsHtml.push(
871
947
  `<igc-tab data-tab-id="all" label="All"${this.currentTab === 'all' ? ' selected' : ''}>` +
872
948
  `<span slot="suffix" class="igd-search-tab-count">${totalCount}</span>` +
873
949
  allContent.join('') +
874
- `</igc-tab>`
950
+ `</igc-tab>`,
875
951
  );
876
952
 
877
953
  // Per-category tabs — capped to avoid freezing the main thread when many
@@ -886,9 +962,11 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
886
962
  tabsHtml.push(
887
963
  `<igc-tab data-tab-id="${cat.id}" label="${escapeHtml(cat.label)}"${isSelected ? ' selected' : ''}>` +
888
964
  `<span slot="suffix" class="igd-search-tab-count">${list.length}</span>` +
889
- `<igc-list class="igd-search-results">${displayList.map(m => this.matchHtml(m)).join('')}</igc-list>` +
890
- (hasMore ? `<p class="igd-search-refine-hint">Showing first ${MAX_PER_CATEGORY_TAB} of ${list.length} matches &mdash; refine your search to narrow results.</p>` : '') +
891
- `</igc-tab>`
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 &mdash; refine your search to narrow results.</p>`
968
+ : '') +
969
+ `</igc-tab>`,
892
970
  );
893
971
  }
894
972
 
@@ -926,11 +1004,12 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
926
1004
 
927
1005
  private matchHtml(m: Match): string {
928
1006
  const highlightedName = highlight(m.name, this.currentQuery);
929
- const nameCategories = this.categories.filter(c => c.kindCodes.includes('__name__'));
930
- const isNameMatch = nameCategories.some(c => c.id === m.category);
931
- const subtitle = isNameMatch || m.category === '__all__'
932
- ? `<span class="igd-search-kind">${escapeHtml(m.packageLabel)}</span>`
933
- : `<span class="igd-search-kind">${escapeHtml(m.packageLabel)}</span><span class="igd-search-meta">in ${escapeHtml(m.pageName)}</span>`;
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>`;
934
1013
  return `<igc-list-item>
935
1014
  <a href="${m.url}" class="igd-search-link">
936
1015
  <span class="igd-search-result-title">${highlightedName}</span>
@@ -955,8 +1034,14 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
955
1034
  }
956
1035
 
957
1036
  function compareVersions(a: string, b: string): number {
958
- const ap = a.replace(/[^0-9.]/g, '').split('.').map(Number);
959
- const bp = b.replace(/[^0-9.]/g, '').split('.').map(Number);
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);
960
1045
  for (let i = 0; i < Math.max(ap.length, bp.length); i++) {
961
1046
  const d = (ap[i] || 0) - (bp[i] || 0);
962
1047
  if (d !== 0) return d;
@@ -982,7 +1067,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
982
1067
  if (i < 0) return escapeHtml(text);
983
1068
  return (
984
1069
  escapeHtml(text.slice(0, i)) +
985
- '<mark>' + escapeHtml(text.slice(i, i + q.length)) + '</mark>' +
1070
+ '<mark>' +
1071
+ escapeHtml(text.slice(i, i + q.length)) +
1072
+ '</mark>' +
986
1073
  escapeHtml(text.slice(i + q.length))
987
1074
  );
988
1075
  }