@seed-ship/mcp-ui-solid 4.3.7 → 4.3.8
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/components/UIResourceRenderer.cjs +66 -55
- package/dist/components/UIResourceRenderer.cjs.map +1 -1
- package/dist/components/UIResourceRenderer.d.ts +6 -0
- package/dist/components/UIResourceRenderer.d.ts.map +1 -1
- package/dist/components/UIResourceRenderer.js +66 -55
- package/dist/components/UIResourceRenderer.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UIResourceRenderer.tsx +25 -8
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -241,6 +241,25 @@ function ChartRenderer(props: {
|
|
|
241
241
|
/**
|
|
242
242
|
* Smart cell value renderer that handles markdown links and other formats
|
|
243
243
|
*/
|
|
244
|
+
/**
|
|
245
|
+
* Wrap matches of `query` in <mark> tags within an HTML string.
|
|
246
|
+
* Case-insensitive. Skips content inside HTML tag attributes to avoid corruption.
|
|
247
|
+
* v4.3.8
|
|
248
|
+
*/
|
|
249
|
+
export function highlightQuery(html: string, query: string): string {
|
|
250
|
+
const q = query.trim()
|
|
251
|
+
if (!q) return html
|
|
252
|
+
// Escape regex metacharacters
|
|
253
|
+
const escaped = q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
254
|
+
const regex = new RegExp(`(${escaped})`, 'gi')
|
|
255
|
+
// Process text segments only (skip inside tags)
|
|
256
|
+
return html.replace(/(<[^>]+>)|([^<]+)/g, (_m, tag, text) => {
|
|
257
|
+
if (tag) return tag
|
|
258
|
+
if (!text) return ''
|
|
259
|
+
return text.replace(regex, '<mark class="bg-yellow-200 dark:bg-[#222F49] text-inherit rounded px-0.5">$1</mark>')
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
|
|
244
263
|
export function renderCellValue(value: any): string {
|
|
245
264
|
// Handle null/undefined
|
|
246
265
|
if (value === null || value === undefined) {
|
|
@@ -592,7 +611,7 @@ function TableRenderer(props: {
|
|
|
592
611
|
<For each={tableParams.columns}>
|
|
593
612
|
{(column: any) => (
|
|
594
613
|
<td class="px-6 py-4 text-sm text-gray-700 dark:text-gray-200 whitespace-normal break-words leading-relaxed first:pl-6 last:pr-6">
|
|
595
|
-
<div innerHTML={renderCellValue(row[column.key])} />
|
|
614
|
+
<div innerHTML={highlightQuery(renderCellValue(row[column.key]), debouncedQuery())} />
|
|
596
615
|
</td>
|
|
597
616
|
)}
|
|
598
617
|
</For>
|
|
@@ -631,7 +650,7 @@ function TableRenderer(props: {
|
|
|
631
650
|
<For each={tableParams.columns}>
|
|
632
651
|
{(column: any) => (
|
|
633
652
|
<td class="px-6 py-4 text-sm text-gray-700 dark:text-gray-200 whitespace-normal break-words leading-relaxed first:pl-6 last:pr-6">
|
|
634
|
-
<div innerHTML={renderCellValue(row[column.key])} />
|
|
653
|
+
<div innerHTML={highlightQuery(renderCellValue(row[column.key]), debouncedQuery())} />
|
|
635
654
|
</td>
|
|
636
655
|
)}
|
|
637
656
|
</For>
|
|
@@ -645,7 +664,7 @@ function TableRenderer(props: {
|
|
|
645
664
|
|
|
646
665
|
return (
|
|
647
666
|
<ExpandableWrapper title={tableParams.title || 'Table'} copyData={getTableCSV()} copyLabel="Copy table (CSV)">
|
|
648
|
-
<div class=
|
|
667
|
+
<div class={`relative w-full bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden group ${isExpanded() ? '' : 'h-full'}`}>
|
|
649
668
|
<Show when={exportable} fallback={<CopyButton getText={getTableCSV} title="Copy table (CSV)" position="top-right" />}>
|
|
650
669
|
<div class="absolute right-10 top-2 z-10">
|
|
651
670
|
<button
|
|
@@ -716,11 +735,9 @@ function TableRenderer(props: {
|
|
|
716
735
|
style={
|
|
717
736
|
isVirtualizing()
|
|
718
737
|
? { 'max-height': '500px', 'overflow-y': 'auto' }
|
|
719
|
-
: clientVisibleRows().length > 8
|
|
720
|
-
? { 'max-height':
|
|
721
|
-
:
|
|
722
|
-
? { 'max-height': 'calc(100vh - 180px)', 'overflow-y': 'auto' }
|
|
723
|
-
: {}
|
|
738
|
+
: !isExpanded() && clientVisibleRows().length > 8
|
|
739
|
+
? { 'max-height': '400px', 'overflow-y': 'auto' }
|
|
740
|
+
: {}
|
|
724
741
|
}
|
|
725
742
|
role="region"
|
|
726
743
|
aria-label={tableParams.title || 'Data table'}
|