@eventcatalog/core 2.54.1 → 2.54.2
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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-ONQOSPKG.js → chunk-6BODD7KM.js} +1 -1
- package/dist/{chunk-7NKHMS4K.js → chunk-LC46PXQR.js} +1 -1
- package/dist/{chunk-EUDMSTHT.js → chunk-TFCOMD54.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/components/Search/SearchModal.tsx +78 -128
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6BODD7KM.js";
|
|
4
|
+
import "../chunk-LC46PXQR.js";
|
|
5
|
+
import "../chunk-TFCOMD54.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-XE6PFSH5.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-6BODD7KM.js";
|
|
10
|
+
import "./chunk-LC46PXQR.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-LDBRNJIL.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TFCOMD54.js";
|
|
19
19
|
import {
|
|
20
20
|
getProjectOutDir,
|
|
21
21
|
isAuthEnabled,
|
|
@@ -35,6 +35,7 @@ const SearchResultItem = React.memo<{
|
|
|
35
35
|
if (type === 'openapi') return 'OpenAPI';
|
|
36
36
|
if (type === 'language') return 'Language';
|
|
37
37
|
if (type === 'entities') return 'Entity';
|
|
38
|
+
if (type === 'queries') return 'Query';
|
|
38
39
|
// For plurals, remove 's' at the end, otherwise just capitalize
|
|
39
40
|
if (type.endsWith('s')) {
|
|
40
41
|
return type.charAt(0).toUpperCase() + type.slice(1, -1);
|
|
@@ -113,8 +114,6 @@ const SearchModal: React.FC = () => {
|
|
|
113
114
|
useEffect(() => {
|
|
114
115
|
const handleModalToggle = (event: CustomEvent) => {
|
|
115
116
|
setIsOpen(event.detail.isOpen);
|
|
116
|
-
|
|
117
|
-
// Load all results when modal opens - will be handled by another effect
|
|
118
117
|
};
|
|
119
118
|
|
|
120
119
|
window.addEventListener('searchModalToggle', handleModalToggle as EventListener);
|
|
@@ -286,57 +285,6 @@ const SearchModal: React.FC = () => {
|
|
|
286
285
|
return 'other';
|
|
287
286
|
}, []);
|
|
288
287
|
|
|
289
|
-
// Load all results using a wildcard search
|
|
290
|
-
const loadAllResults = useCallback(async () => {
|
|
291
|
-
if (!pagefind) return;
|
|
292
|
-
|
|
293
|
-
setIsLoading(true);
|
|
294
|
-
try {
|
|
295
|
-
// Use a common word or wildcard to get all indexed content
|
|
296
|
-
const search = await pagefind.search('a');
|
|
297
|
-
if (!search || !search.results) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
const processedResults: SearchResult[] = [];
|
|
301
|
-
|
|
302
|
-
for (const result of search.results) {
|
|
303
|
-
const data = await result.data();
|
|
304
|
-
const type = getTypeFromUrl(data.url);
|
|
305
|
-
|
|
306
|
-
// Clean the title by removing any "Type | " prefix if it exists
|
|
307
|
-
let cleanTitle = data.meta?.title || 'Untitled';
|
|
308
|
-
|
|
309
|
-
// Use regex for more efficient prefix removal
|
|
310
|
-
cleanTitle = cleanTitle.replace(
|
|
311
|
-
/^(Domains?|Services?|Events?|Commands?|Queries?|Entities?|Channels?|Teams?|Users?|Language) \| /,
|
|
312
|
-
''
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
processedResults.push({
|
|
316
|
-
id: result.id,
|
|
317
|
-
name: cleanTitle,
|
|
318
|
-
type: type,
|
|
319
|
-
description: data.excerpt || '',
|
|
320
|
-
url: data.url,
|
|
321
|
-
tags: data.meta?.tags ? data.meta.tags.split(',').map((tag: string) => tag.trim()) : [],
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
setAllResults(processedResults);
|
|
326
|
-
} catch (error) {
|
|
327
|
-
console.error('Error loading all results:', error);
|
|
328
|
-
} finally {
|
|
329
|
-
setIsLoading(false);
|
|
330
|
-
}
|
|
331
|
-
}, [pagefind, getTypeFromUrl]);
|
|
332
|
-
|
|
333
|
-
// Load results when modal opens and pagefind is available
|
|
334
|
-
useEffect(() => {
|
|
335
|
-
if (isOpen && pagefind && !pagefindLoadError) {
|
|
336
|
-
loadAllResults();
|
|
337
|
-
}
|
|
338
|
-
}, [isOpen, pagefind, pagefindLoadError, loadAllResults]);
|
|
339
|
-
|
|
340
288
|
// Perform search
|
|
341
289
|
const performSearch = useCallback(
|
|
342
290
|
async (searchTerm: string): Promise<SearchResult[]> => {
|
|
@@ -407,7 +355,7 @@ const SearchModal: React.FC = () => {
|
|
|
407
355
|
[exactMatch, currentSearch]
|
|
408
356
|
);
|
|
409
357
|
|
|
410
|
-
// Update results
|
|
358
|
+
// Update results with debouncing
|
|
411
359
|
const updateResults = useCallback(async () => {
|
|
412
360
|
if (currentSearch.trim()) {
|
|
413
361
|
const results = await performSearch(currentSearch);
|
|
@@ -417,10 +365,19 @@ const SearchModal: React.FC = () => {
|
|
|
417
365
|
}
|
|
418
366
|
}, [currentSearch, performSearch]);
|
|
419
367
|
|
|
420
|
-
// Search on input change
|
|
368
|
+
// Search on input change with debouncing
|
|
421
369
|
useEffect(() => {
|
|
422
|
-
|
|
423
|
-
|
|
370
|
+
if (!currentSearch.trim()) {
|
|
371
|
+
setAllResults([]);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const debounceTimer = setTimeout(() => {
|
|
376
|
+
updateResults();
|
|
377
|
+
}, 300); // 300ms debounce
|
|
378
|
+
|
|
379
|
+
return () => clearTimeout(debounceTimer);
|
|
380
|
+
}, [currentSearch, updateResults]);
|
|
424
381
|
|
|
425
382
|
// Handle input change
|
|
426
383
|
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -578,7 +535,7 @@ const SearchModal: React.FC = () => {
|
|
|
578
535
|
<div className="flex items-center gap-1.5">
|
|
579
536
|
<span>All Resources</span>
|
|
580
537
|
</div>
|
|
581
|
-
<span className="text-xs text-gray-
|
|
538
|
+
<span className="text-xs text-gray-700 font-thin">{counts.all}</span>
|
|
582
539
|
</div>
|
|
583
540
|
</button>
|
|
584
541
|
</div>
|
|
@@ -586,7 +543,7 @@ const SearchModal: React.FC = () => {
|
|
|
586
543
|
|
|
587
544
|
{/* Resources Section */}
|
|
588
545
|
<div className="mb-4">
|
|
589
|
-
<h3 className="text-xs font-
|
|
546
|
+
<h3 className="text-xs font-bold text-gray-600 mb-2">Resources</h3>
|
|
590
547
|
<div className="space-y-1">
|
|
591
548
|
{Object.entries({
|
|
592
549
|
domains: 'Domains',
|
|
@@ -610,9 +567,9 @@ const SearchModal: React.FC = () => {
|
|
|
610
567
|
<div className="flex items-center justify-between">
|
|
611
568
|
<div className="flex items-center gap-1.5">
|
|
612
569
|
{IconComponent && <IconComponent className="h-3 w-3" />}
|
|
613
|
-
<span>{label}</span>
|
|
570
|
+
<span className="font-thin">{label}</span>
|
|
614
571
|
</div>
|
|
615
|
-
<span className="text-xs text-gray-
|
|
572
|
+
<span className="text-xs text-gray-700 font-thin">{counts[key as keyof typeof counts]}</span>
|
|
616
573
|
</div>
|
|
617
574
|
</button>
|
|
618
575
|
);
|
|
@@ -622,7 +579,7 @@ const SearchModal: React.FC = () => {
|
|
|
622
579
|
|
|
623
580
|
{/* Messages Section */}
|
|
624
581
|
<div className="mb-4">
|
|
625
|
-
<h3 className="text-xs font-
|
|
582
|
+
<h3 className="text-xs font-bold text-gray-600 mb-2">Messages</h3>
|
|
626
583
|
<div className="space-y-1">
|
|
627
584
|
{Object.entries({
|
|
628
585
|
events: 'Events',
|
|
@@ -646,9 +603,9 @@ const SearchModal: React.FC = () => {
|
|
|
646
603
|
<div className="flex items-center justify-between">
|
|
647
604
|
<div className="flex items-center gap-1.5">
|
|
648
605
|
{IconComponent && <IconComponent className="h-3 w-3" />}
|
|
649
|
-
<span>{label}</span>
|
|
606
|
+
<span className="font-thin">{label}</span>
|
|
650
607
|
</div>
|
|
651
|
-
<span className="text-xs text-gray-
|
|
608
|
+
<span className="text-xs text-gray-700 font-thin">{counts[key as keyof typeof counts]}</span>
|
|
652
609
|
</div>
|
|
653
610
|
</button>
|
|
654
611
|
);
|
|
@@ -658,7 +615,7 @@ const SearchModal: React.FC = () => {
|
|
|
658
615
|
|
|
659
616
|
{/* Organization Section */}
|
|
660
617
|
<div className="mb-4">
|
|
661
|
-
<h3 className="text-xs font-
|
|
618
|
+
<h3 className="text-xs font-bold text-gray-600 mb-2">Organization</h3>
|
|
662
619
|
<div className="space-y-1">
|
|
663
620
|
{Object.entries({
|
|
664
621
|
teams: 'Teams',
|
|
@@ -680,9 +637,9 @@ const SearchModal: React.FC = () => {
|
|
|
680
637
|
<div className="flex items-center justify-between">
|
|
681
638
|
<div className="flex items-center gap-1.5">
|
|
682
639
|
{IconComponent && <IconComponent className="h-3 w-3" />}
|
|
683
|
-
<span>{label}</span>
|
|
640
|
+
<span className="font-thin">{label}</span>
|
|
684
641
|
</div>
|
|
685
|
-
<span className="text-xs text-gray-
|
|
642
|
+
<span className="text-xs text-gray-700 font-thin">{counts[key as keyof typeof counts]}</span>
|
|
686
643
|
</div>
|
|
687
644
|
</button>
|
|
688
645
|
);
|
|
@@ -692,7 +649,7 @@ const SearchModal: React.FC = () => {
|
|
|
692
649
|
|
|
693
650
|
{/* Specifications Section */}
|
|
694
651
|
<div className="mb-4">
|
|
695
|
-
<h3 className="text-xs font-
|
|
652
|
+
<h3 className="text-xs font-bold text-gray-600 mb-2">Specifications</h3>
|
|
696
653
|
<div className="space-y-1">
|
|
697
654
|
{Object.entries({
|
|
698
655
|
openapi: 'OpenAPI Specification',
|
|
@@ -714,9 +671,9 @@ const SearchModal: React.FC = () => {
|
|
|
714
671
|
<div className="flex items-center justify-between">
|
|
715
672
|
<div className="flex items-center gap-1.5">
|
|
716
673
|
<IconComponent className="h-3 w-3" />
|
|
717
|
-
<span>{label}</span>
|
|
674
|
+
<span className="font-thin">{label}</span>
|
|
718
675
|
</div>
|
|
719
|
-
<span className="text-xs text-gray-
|
|
676
|
+
<span className="text-xs text-gray-700 font-thin">{counts[key as keyof typeof counts]}</span>
|
|
720
677
|
</div>
|
|
721
678
|
</button>
|
|
722
679
|
);
|
|
@@ -726,25 +683,16 @@ const SearchModal: React.FC = () => {
|
|
|
726
683
|
</div>
|
|
727
684
|
|
|
728
685
|
{/* Right Results */}
|
|
729
|
-
<div className="flex-1
|
|
730
|
-
{/* Show stats and exact match toggle */}
|
|
731
|
-
|
|
732
|
-
<div className="
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
</>
|
|
738
|
-
) : (
|
|
739
|
-
<>
|
|
740
|
-
<span>{filteredResults.length} resources</span> in EventCatalog
|
|
741
|
-
{isLoading && <span className="ml-2">Loading...</span>}
|
|
742
|
-
</>
|
|
743
|
-
)}
|
|
744
|
-
</div>
|
|
686
|
+
<div className="flex-1 flex flex-col overflow-hidden">
|
|
687
|
+
{/* Show stats and exact match toggle - only when there are results or search term */}
|
|
688
|
+
{currentSearch.trim() && (filteredResults.length > 0 || isLoading) && (
|
|
689
|
+
<div className="p-4 pb-2 flex items-center justify-between border-b border-gray-100">
|
|
690
|
+
<div className="text-sm text-gray-500 font-thin">
|
|
691
|
+
<span>{filteredResults.length} results</span> for "{currentSearch}"
|
|
692
|
+
{isLoading && <span className="ml-2">Loading...</span>}
|
|
693
|
+
</div>
|
|
745
694
|
|
|
746
|
-
|
|
747
|
-
{currentSearch.trim() && (
|
|
695
|
+
{/* Exact Match Checkbox */}
|
|
748
696
|
<div className="flex items-center">
|
|
749
697
|
<input
|
|
750
698
|
id="exact-match-results"
|
|
@@ -757,49 +705,51 @@ const SearchModal: React.FC = () => {
|
|
|
757
705
|
Exact match in title
|
|
758
706
|
</label>
|
|
759
707
|
</div>
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
</
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
708
|
+
</div>
|
|
709
|
+
)}
|
|
710
|
+
|
|
711
|
+
{/* Main content area */}
|
|
712
|
+
<div className="flex-1 overflow-y-auto">
|
|
713
|
+
{!currentSearch.trim() ? (
|
|
714
|
+
// Show when no search term is entered - centered
|
|
715
|
+
<div className="h-full flex items-center justify-center">
|
|
716
|
+
<div className="text-center">
|
|
717
|
+
<MagnifyingGlassIcon className="mx-auto h-8 w-8 text-gray-300" />
|
|
718
|
+
<h3 className="mt-4 text-lg font-medium text-gray-900">Discover your EventCatalog</h3>
|
|
719
|
+
<p className="mt-2 text-sm text-gray-500 font-thin">
|
|
720
|
+
Start typing to search for domains, services, events, and more.
|
|
721
|
+
</p>
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
) : filteredResults.length === 0 && !isLoading ? (
|
|
725
|
+
// Show when search term exists but no results and not loading - centered
|
|
726
|
+
<div className="h-full flex items-center justify-center">
|
|
727
|
+
<div className="text-center">
|
|
728
|
+
<MagnifyingGlassIcon className="mx-auto h-8 w-8 text-gray-300" />
|
|
729
|
+
<h3 className="mt-2 text-sm font-bold text-gray-900">No results found</h3>
|
|
730
|
+
<p className="mt-1 text-sm text-gray-500 font-thin">
|
|
731
|
+
No results found for "<span className="font-medium">{currentSearch}</span>".
|
|
732
|
+
</p>
|
|
733
|
+
</div>
|
|
783
734
|
</div>
|
|
784
|
-
) :
|
|
785
|
-
// Show
|
|
786
|
-
<div className="
|
|
787
|
-
<
|
|
788
|
-
<
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
</svg>
|
|
795
|
-
<h3 className="mt-2 text-sm font-medium text-gray-900">No results found</h3>
|
|
796
|
-
<p className="mt-1 text-sm text-gray-500">
|
|
797
|
-
No results found for "<span className="font-medium">{currentSearch}</span>". Try different keywords or
|
|
798
|
-
check your spelling.
|
|
799
|
-
</p>
|
|
735
|
+
) : isLoading ? (
|
|
736
|
+
// Show loading state - centered
|
|
737
|
+
<div className="h-full flex items-center justify-center">
|
|
738
|
+
<div className="text-center">
|
|
739
|
+
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600 mx-auto"></div>
|
|
740
|
+
<h3 className="mt-4 text-sm font-medium text-gray-900">Searching...</h3>
|
|
741
|
+
<p className="mt-2 text-sm text-gray-500 font-thin">
|
|
742
|
+
Finding results for "<span className="font-medium">{currentSearch}</span>"
|
|
743
|
+
</p>
|
|
744
|
+
</div>
|
|
800
745
|
</div>
|
|
801
746
|
) : (
|
|
802
|
-
|
|
747
|
+
// Show results in a grid with padding
|
|
748
|
+
<div className="p-4">
|
|
749
|
+
<div className="search-results grid grid-cols-1 lg:grid-cols-2 gap-3">
|
|
750
|
+
<SearchResults results={filteredResults} typeConfig={typeConfig} currentSearch={currentSearch} />
|
|
751
|
+
</div>
|
|
752
|
+
</div>
|
|
803
753
|
)}
|
|
804
754
|
</div>
|
|
805
755
|
</div>
|