igniteui-astro-components 0.0.16 → 0.0.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -43,6 +43,7 @@
43
43
  "./components/GlobalNavBar.astro": "./src/components/GlobalNavBar/GlobalNavBar.astro",
44
44
  "./components/GlobalFooter.astro": "./src/components/GlobalFooter/GlobalFooter.astro",
45
45
  "./components/DocsSubHeader.astro": "./src/components/DocsSubHeader/DocsSubHeader.astro",
46
+ "./components/CopyCode.astro": "./src/components/CopyCode/CopyCode.astro",
46
47
  "./components/Search.astro": "./src/components/Search/Search.astro",
47
48
  "./components/SearchAdvanced.astro": "./src/components/SearchAdvanced/SearchAdvanced.astro",
48
49
  "./components/ThemingWidget.astro": "./src/components/ThemingWidget/ThemingWidget.astro",
@@ -120,7 +120,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
120
120
 
121
121
  <div class="igd-logo">
122
122
  <Fragment set:html={logoRaw} />
123
- <h1>{logoText}</h1>
123
+ <span class="igd-logo-text">{logoText}</span>
124
124
  </div>
125
125
 
126
126
  <div class="igd-docs-subheader__content">
@@ -38,11 +38,11 @@
38
38
  }
39
39
  }
40
40
 
41
- > h1 {
41
+ > .igd-logo-text {
42
42
  @include type-style('body-2') {
43
43
  margin: 0;
44
44
  };
45
-
45
+
46
46
  opacity: 1;
47
47
  transition: opacity 200ms ease, transform 200ms ease;
48
48
  }
@@ -61,7 +61,7 @@
61
61
  position: relative;
62
62
  }
63
63
 
64
- h1 {
64
+ .igd-logo-text {
65
65
  opacity: 0;
66
66
  transform: translateY(4px);
67
67
  position: absolute;
@@ -186,7 +186,9 @@ import './Search.scss';
186
186
  }
187
187
  updateSearchHint();
188
188
 
189
- document.getElementById('search-trigger')?.addEventListener('click', () => openSearch());
189
+ document.addEventListener('click', (e: Event) => {
190
+ if ((e.target as Element).closest('#search-trigger')) openSearch();
191
+ });
190
192
 
191
193
  document.addEventListener('keydown', (e: KeyboardEvent) => {
192
194
  if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
@@ -202,26 +204,24 @@ import './Search.scss';
202
204
  });
203
205
 
204
206
  let debounceTimer: ReturnType<typeof setTimeout> | null = null;
205
- document.querySelector('igc-input.igd-search-input')?.addEventListener('igcInput', () => {
207
+ document.addEventListener('igcInput', (e: Event) => {
208
+ if (!(e.target as Element).closest('igc-input.igd-search-input')) return;
206
209
  if (debounceTimer !== null) clearTimeout(debounceTimer);
207
210
  const val = (document.querySelector<any>('igc-input.igd-search-input')?.value as string) ?? '';
208
211
  debounceTimer = setTimeout(() => runSearch(val), INPUT_DEBOUNCE_MS);
209
212
  });
210
213
 
211
- document.querySelector('.igd-search-clear')?.addEventListener('click', () => {
212
- const input = document.querySelector<any>('igc-input.igd-search-input');
213
- if (!input) return;
214
- input.value = '';
215
- input.focus();
216
- runSearch('');
217
- });
218
-
219
- document.querySelector('.igd-search-shell .search-close')?.addEventListener('click', () => {
220
- document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
221
- });
222
-
223
- document.querySelector('.igd-search-shell')?.addEventListener('click', (e: Event) => {
224
- if ((e.target as Element).closest('a[href]')) {
214
+ document.addEventListener('click', (e: Event) => {
215
+ const target = e.target as Element;
216
+ if (target.closest('.igd-search-clear')) {
217
+ const input = document.querySelector<any>('igc-input.igd-search-input');
218
+ if (!input) return;
219
+ input.value = '';
220
+ input.focus();
221
+ runSearch('');
222
+ } else if (target.closest('.igd-search-shell .search-close')) {
223
+ document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
224
+ } else if (target.closest('.igd-search-shell') && target.closest('a[href]')) {
225
225
  document.querySelector<any>('igc-dialog.igd-search-dialog')?.hide();
226
226
  }
227
227
  });
@@ -536,6 +536,17 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
536
536
  return;
537
537
  }
538
538
 
539
+ // Avoid searching on very short queries — a single or two-character query matches
540
+ // virtually everything and causes the classify + render path to freeze the main thread.
541
+ if (q.length < 3) {
542
+ this.statusEl.textContent = 'Type at least 3 characters to search\u2026';
543
+ this.tabsEl.hidden = true;
544
+ this.tabsEl.innerHTML = '';
545
+ this.flatListEl.hidden = true;
546
+ this.flatListEl.innerHTML = '';
547
+ return;
548
+ }
549
+
539
550
  this.statusEl.textContent = 'Searching\u2026';
540
551
 
541
552
  let pages: IndexedPage[];
@@ -829,15 +840,20 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
829
840
  `</igc-tab>`
830
841
  );
831
842
 
832
- // Per-category tabs — full result list in each tab body
843
+ // Per-category tabs — capped to avoid freezing the main thread when many
844
+ // results match (e.g. a short query against a large cross-version index).
845
+ const MAX_PER_CATEGORY_TAB = 100;
833
846
  for (const cat of this.categories) {
834
847
  const list = this.currentMatches.get(cat.id) ?? [];
835
848
  if (list.length === 0) continue;
836
849
  const isSelected = this.currentTab === cat.id;
850
+ const displayList = list.slice(0, MAX_PER_CATEGORY_TAB);
851
+ const hasMore = list.length > MAX_PER_CATEGORY_TAB;
837
852
  tabsHtml.push(
838
853
  `<igc-tab data-tab-id="${cat.id}" label="${escapeHtml(cat.label)}"${isSelected ? ' selected' : ''}>` +
839
854
  `<span slot="suffix" class="igd-search-tab-count">/${list.length}/</span>` +
840
- `<igc-list class="igd-search-results">${list.map(m => this.matchHtml(m)).join('')}</igc-list>` +
855
+ `<igc-list class="igd-search-results">${displayList.map(m => this.matchHtml(m)).join('')}</igc-list>` +
856
+ (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>` : '') +
841
857
  `</igc-tab>`
842
858
  );
843
859
  }
@@ -108,6 +108,26 @@
108
108
  .igd-search-tab-count {
109
109
  color: light-dark(var(--ig-gray-500), var(--ig-gray-300));
110
110
  }
111
+
112
+ .igd-search-refine-hint {
113
+ @include type-style('caption') {
114
+ margin: 0;
115
+ }
116
+
117
+ padding-inline-start: calc(#{rem(26px)} + #{rem(16px)});
118
+ margin-block-start: rem(16px);
119
+ color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
120
+ }
121
+
122
+ .igd-search-refine-hint {
123
+ @include type-style('caption') {
124
+ margin: 0;
125
+ }
126
+
127
+ padding-inline-start: calc(#{rem(26px)} + #{rem(16px)});
128
+ margin-block-start: rem(16px);
129
+ color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
130
+ }
111
131
 
112
132
  igc-divider {
113
133
  --color: light-dark(var(--ig-gray-400), var(--ig-gray-300));