@seed-ship/mcp-ui-solid 6.24.0 → 7.0.0
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/CHANGELOG.md +64 -0
- package/README.md +61 -0
- package/dist/adapters/connector.cjs +3 -3
- package/dist/adapters/connector.cjs.map +1 -1
- package/dist/adapters/connector.d.cts +108 -0
- package/dist/adapters/connector.d.ts +1 -2
- package/dist/adapters/connector.js +3 -3
- package/dist/adapters/connector.js.map +1 -1
- package/dist/adapters/index.d.cts +21 -0
- package/dist/adapters/index.d.ts +6 -7
- package/dist/adapters/macro-run.d.cts +99 -0
- package/dist/adapters/macro-run.d.ts +1 -2
- package/dist/adapters/presentation.d.cts +1 -2
- package/dist/adapters/presentation.d.ts +1 -2
- package/dist/adapters.d.cts +1 -1
- package/dist/adapters.d.ts +1 -1
- package/dist/components/ActionGroupRenderer.cjs +6 -6
- package/dist/components/ActionGroupRenderer.cjs.map +1 -1
- package/dist/components/ActionGroupRenderer.d.cts +38 -0
- package/dist/components/ActionGroupRenderer.d.ts +1 -2
- package/dist/components/ActionGroupRenderer.js +6 -6
- package/dist/components/ActionGroupRenderer.js.map +1 -1
- package/dist/components/ActionRenderer.d.cts +9 -0
- package/dist/components/ActionRenderer.d.ts +0 -1
- package/dist/components/AgentCard.d.cts +19 -0
- package/dist/components/AgentCard.d.ts +1 -2
- package/dist/components/AgentHandoff.d.cts +11 -0
- package/dist/components/AgentHandoff.d.ts +1 -2
- package/dist/components/ArtifactRenderer.d.cts +11 -0
- package/dist/components/ArtifactRenderer.d.ts +0 -1
- package/dist/components/AutocompleteDropdown.cjs +6 -6
- package/dist/components/AutocompleteDropdown.cjs.map +1 -1
- package/dist/components/AutocompleteDropdown.d.cts +70 -0
- package/dist/components/AutocompleteDropdown.d.ts +1 -2
- package/dist/components/AutocompleteDropdown.js +6 -6
- package/dist/components/AutocompleteDropdown.js.map +1 -1
- package/dist/components/AutocompleteFormField.cjs +6 -5
- package/dist/components/AutocompleteFormField.cjs.map +1 -1
- package/dist/components/AutocompleteFormField.d.cts +51 -0
- package/dist/components/AutocompleteFormField.d.ts +1 -2
- package/dist/components/AutocompleteFormField.d.ts.map +1 -1
- package/dist/components/AutocompleteFormField.js +6 -5
- package/dist/components/AutocompleteFormField.js.map +1 -1
- package/dist/components/BriefingDiff.d.cts +11 -0
- package/dist/components/BriefingDiff.d.ts +1 -2
- package/dist/components/CarouselRenderer.d.cts +12 -0
- package/dist/components/CarouselRenderer.d.ts +1 -2
- package/dist/components/ChartJSRenderer.cjs +216 -6
- package/dist/components/ChartJSRenderer.cjs.map +1 -1
- package/dist/components/ChartJSRenderer.d.cts +62 -0
- package/dist/components/ChartJSRenderer.d.ts +1 -2
- package/dist/components/ChartJSRenderer.d.ts.map +1 -1
- package/dist/components/ChartJSRenderer.js +217 -7
- package/dist/components/ChartJSRenderer.js.map +1 -1
- package/dist/components/ChatPrompt.cjs +5 -5
- package/dist/components/ChatPrompt.cjs.map +1 -1
- package/dist/components/ChatPrompt.d.cts +69 -0
- package/dist/components/ChatPrompt.d.ts +1 -2
- package/dist/components/ChatPrompt.js +5 -5
- package/dist/components/ChatPrompt.js.map +1 -1
- package/dist/components/CodeBlockRenderer.d.cts +23 -0
- package/dist/components/CodeBlockRenderer.d.ts +1 -2
- package/dist/components/ComponentToolbar.cjs +5 -5
- package/dist/components/ComponentToolbar.cjs.map +1 -1
- package/dist/components/ComponentToolbar.d.cts +46 -0
- package/dist/components/ComponentToolbar.d.ts +0 -1
- package/dist/components/ComponentToolbar.js +5 -5
- package/dist/components/ComponentToolbar.js.map +1 -1
- package/dist/components/DataPreviewSection.d.cts +11 -0
- package/dist/components/DataPreviewSection.d.ts +1 -2
- package/dist/components/DegradedFallback.cjs +1 -1
- package/dist/components/DegradedFallback.cjs.map +1 -1
- package/dist/components/DegradedFallback.d.cts +43 -0
- package/dist/components/DegradedFallback.d.ts +0 -1
- package/dist/components/DegradedFallback.js +1 -1
- package/dist/components/DegradedFallback.js.map +1 -1
- package/dist/components/DraggableGridItem.d.cts +94 -0
- package/dist/components/DraggableGridItem.d.ts +1 -2
- package/dist/components/EditableLayoutContext.d.cts +4 -0
- package/dist/components/EditableLayoutContext.d.ts +0 -1
- package/dist/components/EditableUIResourceRenderer.d.cts +42 -0
- package/dist/components/EditableUIResourceRenderer.d.ts +1 -2
- package/dist/components/ElicitationForm.d.cts +67 -0
- package/dist/components/ElicitationForm.d.ts +1 -2
- package/dist/components/ExpandableWrapper.cjs +10 -7
- package/dist/components/ExpandableWrapper.cjs.map +1 -1
- package/dist/components/ExpandableWrapper.d.cts +49 -0
- package/dist/components/ExpandableWrapper.d.ts +0 -1
- package/dist/components/ExpandableWrapper.d.ts.map +1 -1
- package/dist/components/ExpandableWrapper.js +10 -7
- package/dist/components/ExpandableWrapper.js.map +1 -1
- package/dist/components/FeedbackInline.d.cts +70 -0
- package/dist/components/FeedbackInline.d.ts +0 -1
- package/dist/components/FooterRenderer.d.cts +15 -0
- package/dist/components/FooterRenderer.d.ts +0 -1
- package/dist/components/FormFieldRenderer.cjs +13 -12
- package/dist/components/FormFieldRenderer.cjs.map +1 -1
- package/dist/components/FormFieldRenderer.d.cts +19 -0
- package/dist/components/FormFieldRenderer.d.ts +1 -2
- package/dist/components/FormFieldRenderer.d.ts.map +1 -1
- package/dist/components/FormFieldRenderer.js +13 -12
- package/dist/components/FormFieldRenderer.js.map +1 -1
- package/dist/components/FormRenderer.cjs +1 -1
- package/dist/components/FormRenderer.cjs.map +1 -1
- package/dist/components/FormRenderer.d.cts +14 -0
- package/dist/components/FormRenderer.d.ts +1 -2
- package/dist/components/FormRenderer.js +1 -1
- package/dist/components/FormRenderer.js.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.cjs +1 -1
- package/dist/components/GenerativeUIErrorBoundary.cjs.map +1 -1
- package/dist/components/GenerativeUIErrorBoundary.d.cts +58 -0
- package/dist/components/GenerativeUIErrorBoundary.d.ts +1 -2
- package/dist/components/GenerativeUIErrorBoundary.default.d.cts +1 -0
- package/dist/components/GenerativeUIErrorBoundary.default.d.ts +1 -2
- package/dist/components/GenerativeUIErrorBoundary.js +1 -1
- package/dist/components/GenerativeUIErrorBoundary.js.map +1 -1
- package/dist/components/GhostText.cjs +2 -2
- package/dist/components/GhostText.cjs.map +1 -1
- package/dist/components/GhostText.d.cts +112 -0
- package/dist/components/GhostText.d.ts +0 -1
- package/dist/components/GhostText.js +2 -2
- package/dist/components/GhostText.js.map +1 -1
- package/dist/components/GraphRenderer.cjs +100 -29
- package/dist/components/GraphRenderer.cjs.map +1 -1
- package/dist/components/GraphRenderer.d.cts +66 -0
- package/dist/components/GraphRenderer.d.ts +2 -3
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +100 -29
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/components/GridRenderer.d.cts +49 -0
- package/dist/components/GridRenderer.d.ts +1 -2
- package/dist/components/IframeFallbackLink.d.cts +22 -0
- package/dist/components/IframeFallbackLink.d.ts +0 -1
- package/dist/components/ImageGalleryRenderer.d.cts +22 -0
- package/dist/components/ImageGalleryRenderer.d.ts +1 -2
- package/dist/components/LightboxOverlay.d.cts +31 -0
- package/dist/components/LightboxOverlay.d.ts +1 -2
- package/dist/components/MapRenderer.d.cts +77 -0
- package/dist/components/MapRenderer.d.ts +1 -2
- package/dist/components/MissingValue.cjs +2 -2
- package/dist/components/MissingValue.cjs.map +1 -1
- package/dist/components/MissingValue.d.cts +26 -0
- package/dist/components/MissingValue.d.ts +0 -1
- package/dist/components/MissingValue.js +2 -2
- package/dist/components/MissingValue.js.map +1 -1
- package/dist/components/ModalRenderer.cjs +39 -31
- package/dist/components/ModalRenderer.cjs.map +1 -1
- package/dist/components/ModalRenderer.d.cts +66 -0
- package/dist/components/ModalRenderer.d.ts +1 -2
- package/dist/components/ModalRenderer.d.ts.map +1 -1
- package/dist/components/ModalRenderer.js +40 -32
- package/dist/components/ModalRenderer.js.map +1 -1
- package/dist/components/PortalDropdownMenu.cjs +6 -3
- package/dist/components/PortalDropdownMenu.cjs.map +1 -1
- package/dist/components/PortalDropdownMenu.d.cts +55 -0
- package/dist/components/PortalDropdownMenu.d.ts +0 -1
- package/dist/components/PortalDropdownMenu.d.ts.map +1 -1
- package/dist/components/PortalDropdownMenu.js +7 -4
- package/dist/components/PortalDropdownMenu.js.map +1 -1
- package/dist/components/PresentationFeedback.d.cts +112 -0
- package/dist/components/PresentationFeedback.d.ts +0 -1
- package/dist/components/RenderContext.d.cts +41 -0
- package/dist/components/RenderContext.d.ts +1 -2
- package/dist/components/ResizeHandle.d.cts +49 -0
- package/dist/components/ResizeHandle.d.ts +0 -1
- package/dist/components/SafeHtml.d.cts +45 -0
- package/dist/components/SafeHtml.d.ts +0 -1
- package/dist/components/ScratchpadPanel.cjs +38 -44
- package/dist/components/ScratchpadPanel.cjs.map +1 -1
- package/dist/components/ScratchpadPanel.d.cts +34 -0
- package/dist/components/ScratchpadPanel.d.ts +1 -2
- package/dist/components/ScratchpadPanel.d.ts.map +1 -1
- package/dist/components/ScratchpadPanel.js +38 -44
- package/dist/components/ScratchpadPanel.js.map +1 -1
- package/dist/components/SplitStepper.d.cts +11 -0
- package/dist/components/SplitStepper.d.ts +1 -2
- package/dist/components/StreamingUIRenderer.d.cts +58 -0
- package/dist/components/StreamingUIRenderer.d.ts +3 -4
- package/dist/components/UIResourceRenderer.cjs +20 -20
- package/dist/components/UIResourceRenderer.cjs.map +1 -1
- package/dist/components/UIResourceRenderer.d.cts +181 -0
- package/dist/components/UIResourceRenderer.d.ts +3 -4
- package/dist/components/UIResourceRenderer.default.d.cts +1 -0
- package/dist/components/UIResourceRenderer.default.d.ts +1 -2
- package/dist/components/UIResourceRenderer.js +20 -20
- package/dist/components/UIResourceRenderer.js.map +1 -1
- package/dist/components/VerifiedText.d.cts +22 -0
- package/dist/components/VerifiedText.d.ts +1 -2
- package/dist/components/VideoRenderer.d.cts +41 -0
- package/dist/components/VideoRenderer.d.ts +1 -2
- package/dist/components/chart-data-table.d.cts +68 -0
- package/dist/components/chart-data-table.d.ts +0 -1
- package/dist/components/chart-missing-plugin.cjs +4 -4
- package/dist/components/chart-missing-plugin.cjs.map +1 -1
- package/dist/components/chart-missing-plugin.d.cts +128 -0
- package/dist/components/chart-missing-plugin.d.ts +4 -3
- package/dist/components/chart-missing-plugin.d.ts.map +1 -1
- package/dist/components/chart-missing-plugin.js +4 -4
- package/dist/components/chart-missing-plugin.js.map +1 -1
- package/dist/components/index.d.cts +62 -0
- package/dist/components/index.d.ts +57 -58
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/context/AutocompleteContext.d.cts +76 -0
- package/dist/context/AutocompleteContext.d.ts +1 -2
- package/dist/context/MCPActionContext.d.cts +169 -0
- package/dist/context/MCPActionContext.d.ts +0 -1
- package/dist/context/MCPUIConfigContext.d.cts +201 -0
- package/dist/context/MCPUIConfigContext.d.ts +1 -2
- package/dist/context/MCPUIMathContext.d.cts +17 -0
- package/dist/context/MCPUIMathContext.d.ts +0 -1
- package/dist/context/MCPUIStringsContext.d.cts +802 -0
- package/dist/context/MCPUIStringsContext.d.ts +1 -2
- package/dist/context/MCPUITelemetryContext.d.cts +35 -0
- package/dist/context/MCPUITelemetryContext.d.ts +1 -2
- package/dist/context/index.d.cts +7 -0
- package/dist/context/index.d.ts +2 -3
- package/dist/hooks/createResponsiveGrid.d.cts +5 -0
- package/dist/hooks/createResponsiveGrid.d.ts +0 -1
- package/dist/hooks/index.d.cts +25 -0
- package/dist/hooks/index.d.ts +20 -21
- package/dist/hooks/useAction.d.cts +164 -0
- package/dist/hooks/useAction.d.ts +2 -3
- package/dist/hooks/useAutocomplete.d.cts +118 -0
- package/dist/hooks/useAutocomplete.d.ts +1 -2
- package/dist/hooks/useChatBus.d.cts +55 -0
- package/dist/hooks/useChatBus.d.ts +1 -2
- package/dist/hooks/useConditionalField.d.cts +34 -0
- package/dist/hooks/useConditionalField.d.ts +1 -2
- package/dist/hooks/useDataValidator.d.cts +41 -0
- package/dist/hooks/useDataValidator.d.ts +1 -2
- package/dist/hooks/useDragDrop.d.cts +99 -0
- package/dist/hooks/useDragDrop.d.ts +1 -2
- package/dist/hooks/useFormPersistence.d.cts +80 -0
- package/dist/hooks/useFormPersistence.d.ts +0 -1
- package/dist/hooks/useModal.d.cts +106 -0
- package/dist/hooks/useModal.d.ts +0 -1
- package/dist/hooks/useResize.d.cts +86 -0
- package/dist/hooks/useResize.d.ts +1 -2
- package/dist/hooks/useStreamingUI.d.cts +117 -0
- package/dist/hooks/useStreamingUI.d.ts +1 -2
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/index.d.cts +91 -92
- package/dist/index.d.ts +91 -92
- package/dist/plugins/duckdb.d.cts +1 -2
- package/dist/plugins/duckdb.d.ts +1 -2
- package/dist/plugins/groq.d.cts +12 -0
- package/dist/plugins/groq.d.ts +1 -2
- package/dist/plugins/index.d.cts +9 -0
- package/dist/plugins/index.d.ts +3 -4
- package/dist/plugins/katex.d.cts +1 -2
- package/dist/plugins/katex.d.ts +1 -2
- package/dist/plugins/rest.d.cts +12 -0
- package/dist/plugins/rest.d.ts +1 -2
- package/dist/plugins/supabase.d.cts +12 -0
- package/dist/plugins/supabase.d.ts +1 -2
- package/dist/services/chat-bus.d.cts +100 -0
- package/dist/services/chat-bus.d.ts +1 -2
- package/dist/services/chat-prompt-controller.d.cts +92 -0
- package/dist/services/chat-prompt-controller.d.ts +1 -2
- package/dist/services/component-registry.d.cts +119 -0
- package/dist/services/component-registry.d.ts +1 -2
- package/dist/services/data-validator.d.cts +27 -0
- package/dist/services/data-validator.d.ts +1 -2
- package/dist/services/index.d.cts +9 -0
- package/dist/services/index.d.ts +4 -5
- package/dist/services/telemetry.d.cts +86 -0
- package/dist/services/telemetry.d.ts +1 -2
- package/dist/services/validation.d.cts +169 -0
- package/dist/services/validation.d.ts +1 -2
- package/dist/stores/scratchpad-store.d.cts +109 -0
- package/dist/stores/scratchpad-store.d.ts +1 -2
- package/dist/stores/server-capabilities-store.d.cts +171 -0
- package/dist/stores/server-capabilities-store.d.ts +0 -1
- package/dist/test-setup.d.cts +5 -0
- package/dist/test-setup.d.ts +0 -1
- package/dist/testing/index.d.cts +34 -0
- package/dist/testing/index.d.ts +1 -2
- package/dist/types/chat-bus.d.cts +783 -0
- package/dist/types/chat-bus.d.ts +4 -5
- package/dist/types/index.d.cts +1616 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types-export.d.cts +1 -2
- package/dist/types-export.d.ts +1 -2
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/degraded-projections.d.cts +119 -0
- package/dist/utils/degraded-projections.d.ts +0 -1
- package/dist/utils/duplicate-mount-registry.d.cts +83 -0
- package/dist/utils/duplicate-mount-registry.d.ts +0 -1
- package/dist/utils/escape-html.d.cts +12 -0
- package/dist/utils/escape-html.d.ts +0 -1
- package/dist/utils/format-string.d.cts +25 -0
- package/dist/utils/format-string.d.ts +0 -1
- package/dist/utils/iframe-coep.d.cts +53 -0
- package/dist/utils/iframe-coep.d.ts +1 -2
- package/dist/utils/logger.d.cts +57 -0
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/math-markdown.cjs +1 -1
- package/dist/utils/math-markdown.cjs.map +1 -1
- package/dist/utils/math-markdown.d.cts +15 -0
- package/dist/utils/math-markdown.d.ts +1 -2
- package/dist/utils/math-markdown.js +1 -1
- package/dist/utils/math-markdown.js.map +1 -1
- package/dist/utils/missing-value.d.cts +78 -0
- package/dist/utils/missing-value.d.ts +0 -1
- package/dist/utils/pan-zoom.d.cts +234 -0
- package/dist/utils/pan-zoom.d.ts +0 -1
- package/dist/utils/perf.d.cts +18 -0
- package/dist/utils/perf.d.ts +0 -1
- package/dist/utils/safe-url.d.cts +33 -0
- package/dist/utils/safe-url.d.ts +0 -1
- package/dist/utils/sanitize-html.d.cts +142 -0
- package/dist/utils/sanitize-html.d.ts +0 -1
- package/dist/utils/stable-key.d.cts +32 -0
- package/dist/utils/stable-key.d.ts +0 -1
- package/dist/utils/theme.cjs +91 -0
- package/dist/utils/theme.cjs.map +1 -0
- package/dist/utils/theme.d.cts +10 -0
- package/dist/utils/theme.d.ts +10 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +91 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/validation.d.cts +3 -4
- package/dist/validation.d.ts +3 -4
- package/docs/SECURITY-DEPENDENCIES.md +209 -0
- package/docs/THEMING.md +205 -0
- package/docs/ZOD4-STABLE-MIGRATION-2026-10-26.md +181 -0
- package/package.json +12 -9
- package/src/adapters/connector.ts +3 -3
- package/src/components/ActionGroupRenderer.tsx +6 -6
- package/src/components/AutocompleteDropdown.tsx +17 -17
- package/src/components/AutocompleteFormField.tsx +10 -9
- package/src/components/ChartJSRenderer.tsx +483 -239
- package/src/components/ChatPrompt.tsx +16 -16
- package/src/components/ComponentToolbar.tsx +5 -5
- package/src/components/DegradedFallback.tsx +9 -9
- package/src/components/ExpandableWrapper.tsx +15 -11
- package/src/components/FormFieldRenderer.tsx +52 -51
- package/src/components/FormRenderer.tsx +12 -12
- package/src/components/GenerativeUIErrorBoundary.tsx +6 -6
- package/src/components/GhostText.tsx +7 -7
- package/src/components/GraphRenderer.tsx +83 -67
- package/src/components/MissingValue.tsx +2 -2
- package/src/components/ModalRenderer.tsx +11 -5
- package/src/components/PortalDropdownMenu.tsx +6 -2
- package/src/components/ScratchpadPanel.tsx +144 -141
- package/src/components/UIResourceRenderer.tsx +101 -101
- package/src/components/chart-missing-plugin.ts +5 -3
- package/src/styles/autocomplete.css +53 -53
- package/src/utils/math-markdown.ts +1 -1
- package/src/utils/theme.ts +101 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComponentToolbar - Unified toolbar for component actions
|
|
3
|
+
* v2.2.5: Consistent icon set, position, and hover behavior across all components
|
|
4
|
+
*/
|
|
5
|
+
import { Component } from 'solid-js';
|
|
6
|
+
/** SVG icon paths for toolbar actions */
|
|
7
|
+
declare const ICONS: {
|
|
8
|
+
readonly copy: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z";
|
|
9
|
+
readonly check: "M5 13l4 4L19 7";
|
|
10
|
+
readonly download: "M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z";
|
|
11
|
+
readonly expand: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5";
|
|
12
|
+
readonly wordwrap: "M3 10h10a4 4 0 010 8H9m4 0l-3-3m3 3l-3 3M3 6h18M3 14h4";
|
|
13
|
+
};
|
|
14
|
+
export type ToolbarIcon = keyof typeof ICONS;
|
|
15
|
+
export interface ToolbarAction {
|
|
16
|
+
/** Icon to display */
|
|
17
|
+
icon: ToolbarIcon;
|
|
18
|
+
/** Tooltip label */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Click handler */
|
|
21
|
+
onClick: () => void;
|
|
22
|
+
/** Whether to show a success state (green check) after click */
|
|
23
|
+
showFeedback?: boolean;
|
|
24
|
+
/** Active/toggled state (e.g. word wrap on) */
|
|
25
|
+
active?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ComponentToolbarProps {
|
|
28
|
+
/** Actions to display */
|
|
29
|
+
actions: ToolbarAction[];
|
|
30
|
+
/** Corner position */
|
|
31
|
+
position?: 'top-right' | 'top-left' | 'bottom-right';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Renders a row of small icon buttons, visible on parent hover (requires parent `group` class).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <div class="relative group">
|
|
38
|
+
* <MyContent />
|
|
39
|
+
* <ComponentToolbar actions={[
|
|
40
|
+
* { icon: 'copy', label: 'Copy', onClick: handleCopy, showFeedback: true },
|
|
41
|
+
* { icon: 'download', label: 'Download CSV', onClick: handleDownload },
|
|
42
|
+
* ]} />
|
|
43
|
+
* </div>
|
|
44
|
+
*/
|
|
45
|
+
export declare const ComponentToolbar: Component<ComponentToolbarProps>;
|
|
46
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getNextElement, insert, createComponent, effect, className, template, setAttribute, runHydrationEvents, delegateEvents } from "solid-js/web";
|
|
2
2
|
import { For, createSignal } from "solid-js";
|
|
3
|
-
var _tmpl$ = /* @__PURE__ */ template(`<div>`), _tmpl$2 = /* @__PURE__ */ template(`<button class="p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-all shadow-sm"type=button><svg fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2>`);
|
|
3
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`), _tmpl$2 = /* @__PURE__ */ template(`<button class="p-1.5 bg-[color:var(--mcp-ui-surface,var(--color-white,#fff))] dark:bg-[color:var(--mcp-ui-surface,var(--color-gray-800,#1f2937))] border border-[color:var(--mcp-ui-border,var(--color-gray-200,#e5e7eb))] dark:border-[color:var(--mcp-ui-border,var(--color-gray-600,#4b5563))] rounded-full hover:bg-[color:var(--mcp-ui-surface-hover,var(--color-gray-100,#f3f4f6))] dark:hover:bg-[color:var(--mcp-ui-surface-hover,var(--color-gray-700,#374151))] transition-all shadow-[var(--mcp-ui-shadow,var(--shadow-sm))]"type=button><svg fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2>`);
|
|
4
4
|
const ICONS = {
|
|
5
5
|
copy: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",
|
|
6
6
|
check: "M5 13l4 4L19 7",
|
|
@@ -29,7 +29,7 @@ const ComponentToolbar = (props) => {
|
|
|
29
29
|
action
|
|
30
30
|
})
|
|
31
31
|
}));
|
|
32
|
-
effect(() => className(_el$, `absolute ${positionClasses()} z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`));
|
|
32
|
+
effect(() => className(_el$, `mcp-ui-root absolute ${positionClasses()} z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`));
|
|
33
33
|
return _el$;
|
|
34
34
|
})();
|
|
35
35
|
};
|
|
@@ -45,9 +45,9 @@ const ToolbarButton = (props) => {
|
|
|
45
45
|
const iconPath = () => showCheck() ? ICONS.check : ICONS[props.action.icon];
|
|
46
46
|
const isActive = () => props.action.active;
|
|
47
47
|
const colorClass = () => {
|
|
48
|
-
if (showCheck()) return "text-green-500";
|
|
49
|
-
if (isActive()) return "text-blue-500 dark:text-blue-400";
|
|
50
|
-
return "text-gray-500 dark:text-gray-400";
|
|
48
|
+
if (showCheck()) return "text-[color:var(--mcp-ui-success,var(--color-green-500))]";
|
|
49
|
+
if (isActive()) return "text-[color:var(--mcp-ui-accent,var(--color-blue-500))] dark:text-[color:var(--mcp-ui-accent,var(--color-blue-400))]";
|
|
50
|
+
return "text-[color:var(--mcp-ui-fg-muted,var(--color-gray-500,#6b7280))] dark:text-[color:var(--mcp-ui-fg-subtle,var(--color-gray-400,#9ca3af))]";
|
|
51
51
|
};
|
|
52
52
|
return (() => {
|
|
53
53
|
var _el$2 = getNextElement(_tmpl$2), _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentToolbar.js","sources":["../../src/components/ComponentToolbar.tsx"],"sourcesContent":["/**\n * ComponentToolbar - Unified toolbar for component actions\n * v2.2.5: Consistent icon set, position, and hover behavior across all components\n */\n\nimport { Component, For, createSignal } from 'solid-js'\n\n/** SVG icon paths for toolbar actions */\nconst ICONS = {\n copy: 'M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z',\n check: 'M5 13l4 4L19 7',\n download: 'M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',\n expand: 'M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5',\n wordwrap: 'M3 10h10a4 4 0 010 8H9m4 0l-3-3m3 3l-3 3M3 6h18M3 14h4',\n} as const\n\nexport type ToolbarIcon = keyof typeof ICONS\n\nexport interface ToolbarAction {\n /** Icon to display */\n icon: ToolbarIcon\n /** Tooltip label */\n label: string\n /** Click handler */\n onClick: () => void\n /** Whether to show a success state (green check) after click */\n showFeedback?: boolean\n /** Active/toggled state (e.g. word wrap on) */\n active?: boolean\n}\n\nexport interface ComponentToolbarProps {\n /** Actions to display */\n actions: ToolbarAction[]\n /** Corner position */\n position?: 'top-right' | 'top-left' | 'bottom-right'\n}\n\n/**\n * Renders a row of small icon buttons, visible on parent hover (requires parent `group` class).\n *\n * @example\n * <div class=\"relative group\">\n * <MyContent />\n * <ComponentToolbar actions={[\n * { icon: 'copy', label: 'Copy', onClick: handleCopy, showFeedback: true },\n * { icon: 'download', label: 'Download CSV', onClick: handleDownload },\n * ]} />\n * </div>\n */\nexport const ComponentToolbar: Component<ComponentToolbarProps> = (props) => {\n const positionClasses = () => {\n switch (props.position) {\n case 'top-left': return 'top-2 left-2'\n case 'bottom-right': return 'bottom-2 right-2'\n default: return 'top-2 right-2'\n }\n }\n\n return (\n <div class={`absolute ${positionClasses()} z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`}>\n <For each={props.actions}>\n {(action) => <ToolbarButton action={action} />}\n </For>\n </div>\n )\n}\n\n/** Individual toolbar button with optional feedback state */\nconst ToolbarButton: Component<{ action: ToolbarAction }> = (props) => {\n const [showCheck, setShowCheck] = createSignal(false)\n\n const handleClick = () => {\n props.action.onClick()\n if (props.action.showFeedback) {\n setShowCheck(true)\n setTimeout(() => setShowCheck(false), 2000)\n }\n }\n\n const iconPath = () => showCheck() ? ICONS.check : ICONS[props.action.icon]\n const isActive = () => props.action.active\n const colorClass = () => {\n if (showCheck()) return 'text-green-500'\n if (isActive()) return 'text-blue-500 dark:text-blue-400'\n return 'text-gray-500 dark:text-gray-400'\n }\n\n return (\n <button\n onClick={handleClick}\n class={`p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-all shadow-sm`}\n title={props.action.label}\n aria-label={props.action.label}\n data-mcp-ui-action={props.action.icon}\n type=\"button\"\n >\n <svg class={`w-3 h-3 ${colorClass()}`} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d={iconPath()} />\n </svg>\n </button>\n )\n}\n"],"names":["ICONS","copy","check","download","expand","wordwrap","ComponentToolbar","props","positionClasses","position","_el$","_$getNextElement","_tmpl$","_$insert","_$createComponent","For","each","actions","children","action","ToolbarButton","_$effect","_$className","showCheck","setShowCheck","createSignal","handleClick","onClick","showFeedback","setTimeout","iconPath","icon","isActive","active","colorClass","_el$2","_tmpl$2","_el$3","firstChild","_el$4","$$click","_p$","_v$","label","_v$2","_v$3","_v$4","_v$5","e","_$setAttribute","t","a","o","i","undefined","_$runHydrationEvents","_$delegateEvents"],"mappings":";;;AAQA,MAAMA,QAAQ;AAAA,EACZC,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,UAAU;AAAA,EACVC,QAAQ;AAAA,EACRC,UAAU;AACZ;AAoCO,MAAMC,mBAAsDC,CAAAA,UAAU;AAC3E,QAAMC,kBAAkBA,MAAM;AAC5B,YAAQD,MAAME,UAAAA;AAAAA,MACZ,KAAK;AAAY,eAAO;AAAA,MACxB,KAAK;AAAgB,eAAO;AAAA,MAC5B;AAAS,eAAO;AAAA,IAAA;AAAA,EAEpB;AAEA,UAAA,MAAA;AAAA,QAAAC,OAAAC,eAAAC,MAAA;AAAAC,WAAAH,MAAAI,gBAEKC,KAAG;AAAA,MAAA,IAACC,OAAI;AAAA,eAAET,MAAMU;AAAAA,MAAO;AAAA,MAAAC,UACpBC,CAAAA,WAAML,gBAAMM,eAAa;AAAA,QAACD;AAAAA,MAAAA,CAAc;AAAA,IAAA,CAAI,CAAA;AAAAE,WAAA,MAAAC,UAAAZ,MAFtC,
|
|
1
|
+
{"version":3,"file":"ComponentToolbar.js","sources":["../../src/components/ComponentToolbar.tsx"],"sourcesContent":["/**\n * ComponentToolbar - Unified toolbar for component actions\n * v2.2.5: Consistent icon set, position, and hover behavior across all components\n */\n\nimport { Component, For, createSignal } from 'solid-js'\n\n/** SVG icon paths for toolbar actions */\nconst ICONS = {\n copy: 'M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z',\n check: 'M5 13l4 4L19 7',\n download: 'M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',\n expand: 'M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5',\n wordwrap: 'M3 10h10a4 4 0 010 8H9m4 0l-3-3m3 3l-3 3M3 6h18M3 14h4',\n} as const\n\nexport type ToolbarIcon = keyof typeof ICONS\n\nexport interface ToolbarAction {\n /** Icon to display */\n icon: ToolbarIcon\n /** Tooltip label */\n label: string\n /** Click handler */\n onClick: () => void\n /** Whether to show a success state (green check) after click */\n showFeedback?: boolean\n /** Active/toggled state (e.g. word wrap on) */\n active?: boolean\n}\n\nexport interface ComponentToolbarProps {\n /** Actions to display */\n actions: ToolbarAction[]\n /** Corner position */\n position?: 'top-right' | 'top-left' | 'bottom-right'\n}\n\n/**\n * Renders a row of small icon buttons, visible on parent hover (requires parent `group` class).\n *\n * @example\n * <div class=\"relative group\">\n * <MyContent />\n * <ComponentToolbar actions={[\n * { icon: 'copy', label: 'Copy', onClick: handleCopy, showFeedback: true },\n * { icon: 'download', label: 'Download CSV', onClick: handleDownload },\n * ]} />\n * </div>\n */\nexport const ComponentToolbar: Component<ComponentToolbarProps> = (props) => {\n const positionClasses = () => {\n switch (props.position) {\n case 'top-left': return 'top-2 left-2'\n case 'bottom-right': return 'bottom-2 right-2'\n default: return 'top-2 right-2'\n }\n }\n\n return (\n <div class={`mcp-ui-root absolute ${positionClasses()} z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`}>\n <For each={props.actions}>\n {(action) => <ToolbarButton action={action} />}\n </For>\n </div>\n )\n}\n\n/** Individual toolbar button with optional feedback state */\nconst ToolbarButton: Component<{ action: ToolbarAction }> = (props) => {\n const [showCheck, setShowCheck] = createSignal(false)\n\n const handleClick = () => {\n props.action.onClick()\n if (props.action.showFeedback) {\n setShowCheck(true)\n setTimeout(() => setShowCheck(false), 2000)\n }\n }\n\n const iconPath = () => showCheck() ? ICONS.check : ICONS[props.action.icon]\n const isActive = () => props.action.active\n const colorClass = () => {\n if (showCheck()) return 'text-[color:var(--mcp-ui-success,var(--color-green-500))]'\n if (isActive()) return 'text-[color:var(--mcp-ui-accent,var(--color-blue-500))] dark:text-[color:var(--mcp-ui-accent,var(--color-blue-400))]'\n return 'text-[color:var(--mcp-ui-fg-muted,var(--color-gray-500,#6b7280))] dark:text-[color:var(--mcp-ui-fg-subtle,var(--color-gray-400,#9ca3af))]'\n }\n\n return (\n <button\n onClick={handleClick}\n class={`p-1.5 bg-[color:var(--mcp-ui-surface,var(--color-white,#fff))] dark:bg-[color:var(--mcp-ui-surface,var(--color-gray-800,#1f2937))] border border-[color:var(--mcp-ui-border,var(--color-gray-200,#e5e7eb))] dark:border-[color:var(--mcp-ui-border,var(--color-gray-600,#4b5563))] rounded-full hover:bg-[color:var(--mcp-ui-surface-hover,var(--color-gray-100,#f3f4f6))] dark:hover:bg-[color:var(--mcp-ui-surface-hover,var(--color-gray-700,#374151))] transition-all shadow-[var(--mcp-ui-shadow,var(--shadow-sm))]`}\n title={props.action.label}\n aria-label={props.action.label}\n data-mcp-ui-action={props.action.icon}\n type=\"button\"\n >\n <svg class={`w-3 h-3 ${colorClass()}`} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d={iconPath()} />\n </svg>\n </button>\n )\n}\n"],"names":["ICONS","copy","check","download","expand","wordwrap","ComponentToolbar","props","positionClasses","position","_el$","_$getNextElement","_tmpl$","_$insert","_$createComponent","For","each","actions","children","action","ToolbarButton","_$effect","_$className","showCheck","setShowCheck","createSignal","handleClick","onClick","showFeedback","setTimeout","iconPath","icon","isActive","active","colorClass","_el$2","_tmpl$2","_el$3","firstChild","_el$4","$$click","_p$","_v$","label","_v$2","_v$3","_v$4","_v$5","e","_$setAttribute","t","a","o","i","undefined","_$runHydrationEvents","_$delegateEvents"],"mappings":";;;AAQA,MAAMA,QAAQ;AAAA,EACZC,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,UAAU;AAAA,EACVC,QAAQ;AAAA,EACRC,UAAU;AACZ;AAoCO,MAAMC,mBAAsDC,CAAAA,UAAU;AAC3E,QAAMC,kBAAkBA,MAAM;AAC5B,YAAQD,MAAME,UAAAA;AAAAA,MAC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,OAGzB,WAAWZ,YAAY,IAAEa,OACsCjB,SAAAA;AAAUY,cAAAD,IAAAO,KAAAC,aAAAd,OAAA,SAAAM,IAAAO,IAAAN,GAAA;AAAAE,eAAAH,IAAAS,KAAAD,aAAAd,OAAA,cAAAM,IAAAS,IAAAN,IAAA;AAAAC,eAAAJ,IAAAU,KAAAF,aAAAd,OAAA,sBAAAM,IAAAU,IAAAN,IAAA;AAAAC,eAAAL,IAAAW,KAAAH,aAAAZ,OAAA,SAAAI,IAAAW,IAAAN,IAAA;AAAAC,eAAAN,IAAAY,KAAAJ,aAAAV,OAAA,KAAAE,IAAAY,IAAAN,IAAA;AAAA,aAAAN;AAAAA,IAAA,GAAA;AAAA,MAAAO,GAAAM;AAAAA,MAAAJ,GAAAI;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA;AAAAC,uBAAAA;AAAA,WAAApB;AAAAA,EAAA,GAAA;AAI3F;AAACqB,eAAA,CAAA,OAAA,CAAA;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataPreviewSection — paginated, sortable data table with export
|
|
3
|
+
* v4.0.4: Full pagination spec (auto-activate, pageSize=0 disable, showPageInfo, onPageChange)
|
|
4
|
+
*
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
import type { DataPreviewContent } from "../types/chat-bus.cjs";
|
|
8
|
+
export interface DataPreviewSectionProps {
|
|
9
|
+
content: DataPreviewContent;
|
|
10
|
+
}
|
|
11
|
+
export declare function DataPreviewSection(props: DataPreviewSectionProps): import("solid-js").JSX.Element;
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @experimental
|
|
6
6
|
*/
|
|
7
|
-
import type { DataPreviewContent } from
|
|
7
|
+
import type { DataPreviewContent } from "../types/chat-bus.js";
|
|
8
8
|
export interface DataPreviewSectionProps {
|
|
9
9
|
content: DataPreviewContent;
|
|
10
10
|
}
|
|
11
11
|
export declare function DataPreviewSection(props: DataPreviewSectionProps): import("solid-js").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=DataPreviewSection.d.ts.map
|
|
@@ -5,7 +5,7 @@ const solidJs = require("solid-js");
|
|
|
5
5
|
const MCPUIStringsContext = require("../context/MCPUIStringsContext.cjs");
|
|
6
6
|
const MissingValue = require("./MissingValue.cjs");
|
|
7
7
|
const formatString = require("../utils/format-string.cjs");
|
|
8
|
-
var _tmpl$ = /* @__PURE__ */ web.template(`<div class="mt-2 max-h-64 overflow-auto rounded border border-amber-200 dark:border-amber-800"><table class="w-full border-collapse text-left text-xs"><thead class="sticky top-0 bg-amber-100 dark:bg-amber-900
|
|
8
|
+
var _tmpl$ = /* @__PURE__ */ web.template(`<div class="mt-2 max-h-64 overflow-auto rounded border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))]"><table class="w-full border-collapse text-left text-xs"><thead class="sticky top-0 bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-100))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_40%,transparent))]"><tr></tr></thead><tbody>`), _tmpl$2 = /* @__PURE__ */ web.template(`<p class="mt-1 text-[10px] text-[color:var(--mcp-ui-warning,var(--color-amber-600))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-400))]">`), _tmpl$3 = /* @__PURE__ */ web.template(`<div class="w-full rounded-lg border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-50))] p-3 dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_20%,transparent))]"role=alert><p class="text-sm font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]"></p><p class="mt-0.5 text-xs text-[color:var(--mcp-ui-warning,var(--color-amber-700))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-300))]"></p><!$><!/>`), _tmpl$4 = /* @__PURE__ */ web.template(`<th class="px-2 py-1 font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]">`), _tmpl$5 = /* @__PURE__ */ web.template(`<tr class="border-t border-[color:var(--mcp-ui-warning-border,var(--color-amber-100))] dark:border-[color:var(--mcp-ui-warning-border,color-mix(in_oklab,var(--color-amber-800)_60%,transparent))]">`), _tmpl$6 = /* @__PURE__ */ web.template(`<td class="px-2 py-1 text-[color:var(--mcp-ui-warning,var(--color-amber-800))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-200))]">`);
|
|
9
9
|
const DegradedFallback = (props) => {
|
|
10
10
|
const strings = MCPUIStringsContext.useMCPUIStrings();
|
|
11
11
|
const maxRows = () => props.maxRows ?? 50;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DegradedFallback.cjs","sources":["../../src/components/DegradedFallback.tsx"],"sourcesContent":["/**\n * DegradedFallback — the middle rung of the renderer fallback ladder\n * (audit 2026-05-30, P2.5).\n *\n * Each heavy renderer (graph / map / chart) follows the same contract:\n * 1. native render when its peer lib is available and succeeds;\n * 2. **degraded but useful** view when the native render throws — this\n * component: a visible notice + a plain data table so the user still\n * sees the underlying data instead of a blank space;\n * 3. (the caller also emits a `render:error` telemetry event).\n *\n * Pure / presentational — no peer deps, no side effects — so a render-path\n * failure in a heavy lib can never cascade into the fallback itself, and it\n * is trivially unit-testable. Rows/cells are rendered as text; callers are\n * responsible for stringifying complex cell values.\n */\n\nimport { Component, For, Show } from 'solid-js';\nimport { formatMCPUIString, useMCPUIStrings } from '../context/MCPUIStringsContext';\nimport { MissingValueLegend, MissingValueMark } from './MissingValue';\n\nexport interface DegradedFallbackProps {\n /** Short, human-readable reason the native render was skipped/failed. */\n message: string;\n /**\n * Column headers for the degraded data table. When omitted (or empty),\n * only the notice banner is shown.\n */\n columns?: string[];\n /** Row data — each row is an array of cells aligned to `columns`. */\n rows?: Array<Array<string | number>>;\n /**\n * Caption under the table. Defaults to a generic\n * \"interactive view unavailable\" line.\n */\n caption?: string;\n /** Max rows to render before truncating (default 50). */\n maxRows?: number;\n /**\n * Same shape as `rows`: `true` marks a cell whose value is missing, which\n * renders as `<MissingValueMark/>` instead of its text. A\n * `<MissingValueLegend/>` follows the table when a SHOWN cell is missing.\n * Omitted, the output is unchanged. @since v6.24.0\n */\n missing?: boolean[][];\n}\n\nexport const DegradedFallback: Component<DegradedFallbackProps> = (props) => {\n const strings = useMCPUIStrings();\n const maxRows = () => props.maxRows ?? 50;\n const allRows = () => props.rows ?? [];\n const shownRows = () => allRows().slice(0, maxRows());\n const hiddenCount = () => Math.max(0, allRows().length - shownRows().length);\n const isMissing = (rowIndex: number, colIndex: number) =>\n props.missing?.[rowIndex]?.[colIndex] === true;\n const anyShownMissing = () => {\n const columnCount = props.columns?.length ?? 0;\n return shownRows().some((_row, r) => {\n for (let c = 0; c < columnCount; c += 1) if (isMissing(r, c)) return true;\n return false;\n });\n };\n const hasTable = () => (props.columns?.length ?? 0) > 0 && allRows().length > 0;\n\n return (\n <div\n class=\"w-full rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900
|
|
1
|
+
{"version":3,"file":"DegradedFallback.cjs","sources":["../../src/components/DegradedFallback.tsx"],"sourcesContent":["/**\n * DegradedFallback — the middle rung of the renderer fallback ladder\n * (audit 2026-05-30, P2.5).\n *\n * Each heavy renderer (graph / map / chart) follows the same contract:\n * 1. native render when its peer lib is available and succeeds;\n * 2. **degraded but useful** view when the native render throws — this\n * component: a visible notice + a plain data table so the user still\n * sees the underlying data instead of a blank space;\n * 3. (the caller also emits a `render:error` telemetry event).\n *\n * Pure / presentational — no peer deps, no side effects — so a render-path\n * failure in a heavy lib can never cascade into the fallback itself, and it\n * is trivially unit-testable. Rows/cells are rendered as text; callers are\n * responsible for stringifying complex cell values.\n */\n\nimport { Component, For, Show } from 'solid-js';\nimport { formatMCPUIString, useMCPUIStrings } from '../context/MCPUIStringsContext';\nimport { MissingValueLegend, MissingValueMark } from './MissingValue';\n\nexport interface DegradedFallbackProps {\n /** Short, human-readable reason the native render was skipped/failed. */\n message: string;\n /**\n * Column headers for the degraded data table. When omitted (or empty),\n * only the notice banner is shown.\n */\n columns?: string[];\n /** Row data — each row is an array of cells aligned to `columns`. */\n rows?: Array<Array<string | number>>;\n /**\n * Caption under the table. Defaults to a generic\n * \"interactive view unavailable\" line.\n */\n caption?: string;\n /** Max rows to render before truncating (default 50). */\n maxRows?: number;\n /**\n * Same shape as `rows`: `true` marks a cell whose value is missing, which\n * renders as `<MissingValueMark/>` instead of its text. A\n * `<MissingValueLegend/>` follows the table when a SHOWN cell is missing.\n * Omitted, the output is unchanged. @since v6.24.0\n */\n missing?: boolean[][];\n}\n\nexport const DegradedFallback: Component<DegradedFallbackProps> = (props) => {\n const strings = useMCPUIStrings();\n const maxRows = () => props.maxRows ?? 50;\n const allRows = () => props.rows ?? [];\n const shownRows = () => allRows().slice(0, maxRows());\n const hiddenCount = () => Math.max(0, allRows().length - shownRows().length);\n const isMissing = (rowIndex: number, colIndex: number) =>\n props.missing?.[rowIndex]?.[colIndex] === true;\n const anyShownMissing = () => {\n const columnCount = props.columns?.length ?? 0;\n return shownRows().some((_row, r) => {\n for (let c = 0; c < columnCount; c += 1) if (isMissing(r, c)) return true;\n return false;\n });\n };\n const hasTable = () => (props.columns?.length ?? 0) > 0 && allRows().length > 0;\n\n return (\n <div\n class=\"w-full rounded-lg border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-50))] p-3 dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_20%,transparent))]\"\n role=\"alert\"\n >\n <p class=\"text-sm font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]\">{props.message}</p>\n <p class=\"mt-0.5 text-xs text-[color:var(--mcp-ui-warning,var(--color-amber-700))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-300))]\">\n {props.caption ?? strings.degradedCaption}\n </p>\n\n <Show when={hasTable()}>\n <div class=\"mt-2 max-h-64 overflow-auto rounded border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))]\">\n <table class=\"w-full border-collapse text-left text-xs\">\n <thead class=\"sticky top-0 bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-100))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_40%,transparent))]\">\n <tr>\n <For each={props.columns}>\n {(col) => (\n <th class=\"px-2 py-1 font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]\">{col}</th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={shownRows()}>\n {(row, rowIndex) => (\n <tr class=\"border-t border-[color:var(--mcp-ui-warning-border,var(--color-amber-100))] dark:border-[color:var(--mcp-ui-warning-border,color-mix(in_oklab,var(--color-amber-800)_60%,transparent))]\">\n <For each={props.columns}>\n {(_col, i) => (\n <td class=\"px-2 py-1 text-[color:var(--mcp-ui-warning,var(--color-amber-800))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-200))]\">\n <Show when={isMissing(rowIndex(), i())} fallback={String(row[i()] ?? '')}>\n <MissingValueMark />\n </Show>\n </td>\n )}\n </For>\n </tr>\n )}\n </For>\n </tbody>\n </table>\n </div>\n <Show when={anyShownMissing()}>\n <MissingValueLegend class=\"mt-2\" />\n </Show>\n <Show when={hiddenCount() > 0}>\n <p class=\"mt-1 text-[10px] text-[color:var(--mcp-ui-warning,var(--color-amber-600))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-400))]\">\n {formatMCPUIString(strings.degradedMoreRows, { count: hiddenCount() })}\n </p>\n </Show>\n </Show>\n </div>\n );\n};\n"],"names":["DegradedFallback","props","strings","useMCPUIStrings","maxRows","allRows","rows","shownRows","slice","hiddenCount","Math","max","length","isMissing","rowIndex","colIndex","missing","anyShownMissing","columnCount","columns","some","_row","r","c","hasTable","_el$","_$getNextElement","_tmpl$3","_el$2","firstChild","_el$3","nextSibling","_el$0","_el$1","_co$","_$getNextMarker","_$insert","message","caption","degradedCaption","_$createComponent","Show","when","children","_el$4","_tmpl$","_el$5","_el$6","_el$7","_el$8","For","each","col","_el$10","_tmpl$4","row","_el$11","_tmpl$5","_col","i","_el$12","_tmpl$6","fallback","String","MissingValueMark","MissingValueLegend","_el$9","_tmpl$2","formatMCPUIString","degradedMoreRows","count"],"mappings":";;;;;;;;AA+CO,MAAMA,mBAAsDC,CAAAA,UAAU;AAC3E,QAAMC,UAAUC,oBAAAA,gBAAAA;AAChB,QAAMC,UAAUA,MAAMH,MAAMG,WAAW;AACvC,QAAMC,UAAUA,MAAMJ,MAAMK,QAAQ,CAAA;AACpC,QAAMC,YAAYA,MAAMF,QAAAA,EAAUG,MAAM,GAAGJ,SAAS;AACpD,QAAMK,cAAcA,MAAMC,KAAKC,IAAI,GAAGN,UAAUO,SAASL,UAAAA,EAAYK,MAAM;AAC3E,QAAMC,YAAYA,CAACC,UAAkBC,aAAAA;;AACnCd,8BAAMe,YAANf,mBAAgBa,cAAhBb,mBAA4Bc,eAAc;AAAA;AAC5C,QAAME,kBAAkBA,MAAM;;AAC5B,UAAMC,gBAAcjB,WAAMkB,YAANlB,mBAAeW,WAAU;AAC7C,WAAOL,UAAAA,EAAYa,KAAK,CAACC,MAAMC,MAAM;AACnC,eAASC,IAAI,GAAGA,IAAIL,aAAaK,KAAK,EAAG,KAAIV,UAAUS,GAAGC,CAAC,EAAG,QAAO;AACrE,aAAO;AAAA,IACT,CAAC;AAA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,IAAA,CAAA,GAAAjC,OAAAC,IAAA;AAAA,WAAAT;AAAAA,EAAA,GAAA;AAMlF;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DegradedFallback — the middle rung of the renderer fallback ladder
|
|
3
|
+
* (audit 2026-05-30, P2.5).
|
|
4
|
+
*
|
|
5
|
+
* Each heavy renderer (graph / map / chart) follows the same contract:
|
|
6
|
+
* 1. native render when its peer lib is available and succeeds;
|
|
7
|
+
* 2. **degraded but useful** view when the native render throws — this
|
|
8
|
+
* component: a visible notice + a plain data table so the user still
|
|
9
|
+
* sees the underlying data instead of a blank space;
|
|
10
|
+
* 3. (the caller also emits a `render:error` telemetry event).
|
|
11
|
+
*
|
|
12
|
+
* Pure / presentational — no peer deps, no side effects — so a render-path
|
|
13
|
+
* failure in a heavy lib can never cascade into the fallback itself, and it
|
|
14
|
+
* is trivially unit-testable. Rows/cells are rendered as text; callers are
|
|
15
|
+
* responsible for stringifying complex cell values.
|
|
16
|
+
*/
|
|
17
|
+
import { Component } from 'solid-js';
|
|
18
|
+
export interface DegradedFallbackProps {
|
|
19
|
+
/** Short, human-readable reason the native render was skipped/failed. */
|
|
20
|
+
message: string;
|
|
21
|
+
/**
|
|
22
|
+
* Column headers for the degraded data table. When omitted (or empty),
|
|
23
|
+
* only the notice banner is shown.
|
|
24
|
+
*/
|
|
25
|
+
columns?: string[];
|
|
26
|
+
/** Row data — each row is an array of cells aligned to `columns`. */
|
|
27
|
+
rows?: Array<Array<string | number>>;
|
|
28
|
+
/**
|
|
29
|
+
* Caption under the table. Defaults to a generic
|
|
30
|
+
* "interactive view unavailable" line.
|
|
31
|
+
*/
|
|
32
|
+
caption?: string;
|
|
33
|
+
/** Max rows to render before truncating (default 50). */
|
|
34
|
+
maxRows?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Same shape as `rows`: `true` marks a cell whose value is missing, which
|
|
37
|
+
* renders as `<MissingValueMark/>` instead of its text. A
|
|
38
|
+
* `<MissingValueLegend/>` follows the table when a SHOWN cell is missing.
|
|
39
|
+
* Omitted, the output is unchanged. @since v6.24.0
|
|
40
|
+
*/
|
|
41
|
+
missing?: boolean[][];
|
|
42
|
+
}
|
|
43
|
+
export declare const DegradedFallback: Component<DegradedFallbackProps>;
|
|
@@ -3,7 +3,7 @@ import { Show, For } from "solid-js";
|
|
|
3
3
|
import { useMCPUIStrings } from "../context/MCPUIStringsContext.js";
|
|
4
4
|
import { MissingValueMark, MissingValueLegend } from "./MissingValue.js";
|
|
5
5
|
import { formatMCPUIString } from "../utils/format-string.js";
|
|
6
|
-
var _tmpl$ = /* @__PURE__ */ template(`<div class="mt-2 max-h-64 overflow-auto rounded border border-amber-200 dark:border-amber-800"><table class="w-full border-collapse text-left text-xs"><thead class="sticky top-0 bg-amber-100 dark:bg-amber-900
|
|
6
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div class="mt-2 max-h-64 overflow-auto rounded border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))]"><table class="w-full border-collapse text-left text-xs"><thead class="sticky top-0 bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-100))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_40%,transparent))]"><tr></tr></thead><tbody>`), _tmpl$2 = /* @__PURE__ */ template(`<p class="mt-1 text-[10px] text-[color:var(--mcp-ui-warning,var(--color-amber-600))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-400))]">`), _tmpl$3 = /* @__PURE__ */ template(`<div class="w-full rounded-lg border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-50))] p-3 dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_20%,transparent))]"role=alert><p class="text-sm font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]"></p><p class="mt-0.5 text-xs text-[color:var(--mcp-ui-warning,var(--color-amber-700))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-300))]"></p><!$><!/>`), _tmpl$4 = /* @__PURE__ */ template(`<th class="px-2 py-1 font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]">`), _tmpl$5 = /* @__PURE__ */ template(`<tr class="border-t border-[color:var(--mcp-ui-warning-border,var(--color-amber-100))] dark:border-[color:var(--mcp-ui-warning-border,color-mix(in_oklab,var(--color-amber-800)_60%,transparent))]">`), _tmpl$6 = /* @__PURE__ */ template(`<td class="px-2 py-1 text-[color:var(--mcp-ui-warning,var(--color-amber-800))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-200))]">`);
|
|
7
7
|
const DegradedFallback = (props) => {
|
|
8
8
|
const strings = useMCPUIStrings();
|
|
9
9
|
const maxRows = () => props.maxRows ?? 50;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DegradedFallback.js","sources":["../../src/components/DegradedFallback.tsx"],"sourcesContent":["/**\n * DegradedFallback — the middle rung of the renderer fallback ladder\n * (audit 2026-05-30, P2.5).\n *\n * Each heavy renderer (graph / map / chart) follows the same contract:\n * 1. native render when its peer lib is available and succeeds;\n * 2. **degraded but useful** view when the native render throws — this\n * component: a visible notice + a plain data table so the user still\n * sees the underlying data instead of a blank space;\n * 3. (the caller also emits a `render:error` telemetry event).\n *\n * Pure / presentational — no peer deps, no side effects — so a render-path\n * failure in a heavy lib can never cascade into the fallback itself, and it\n * is trivially unit-testable. Rows/cells are rendered as text; callers are\n * responsible for stringifying complex cell values.\n */\n\nimport { Component, For, Show } from 'solid-js';\nimport { formatMCPUIString, useMCPUIStrings } from '../context/MCPUIStringsContext';\nimport { MissingValueLegend, MissingValueMark } from './MissingValue';\n\nexport interface DegradedFallbackProps {\n /** Short, human-readable reason the native render was skipped/failed. */\n message: string;\n /**\n * Column headers for the degraded data table. When omitted (or empty),\n * only the notice banner is shown.\n */\n columns?: string[];\n /** Row data — each row is an array of cells aligned to `columns`. */\n rows?: Array<Array<string | number>>;\n /**\n * Caption under the table. Defaults to a generic\n * \"interactive view unavailable\" line.\n */\n caption?: string;\n /** Max rows to render before truncating (default 50). */\n maxRows?: number;\n /**\n * Same shape as `rows`: `true` marks a cell whose value is missing, which\n * renders as `<MissingValueMark/>` instead of its text. A\n * `<MissingValueLegend/>` follows the table when a SHOWN cell is missing.\n * Omitted, the output is unchanged. @since v6.24.0\n */\n missing?: boolean[][];\n}\n\nexport const DegradedFallback: Component<DegradedFallbackProps> = (props) => {\n const strings = useMCPUIStrings();\n const maxRows = () => props.maxRows ?? 50;\n const allRows = () => props.rows ?? [];\n const shownRows = () => allRows().slice(0, maxRows());\n const hiddenCount = () => Math.max(0, allRows().length - shownRows().length);\n const isMissing = (rowIndex: number, colIndex: number) =>\n props.missing?.[rowIndex]?.[colIndex] === true;\n const anyShownMissing = () => {\n const columnCount = props.columns?.length ?? 0;\n return shownRows().some((_row, r) => {\n for (let c = 0; c < columnCount; c += 1) if (isMissing(r, c)) return true;\n return false;\n });\n };\n const hasTable = () => (props.columns?.length ?? 0) > 0 && allRows().length > 0;\n\n return (\n <div\n class=\"w-full rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900
|
|
1
|
+
{"version":3,"file":"DegradedFallback.js","sources":["../../src/components/DegradedFallback.tsx"],"sourcesContent":["/**\n * DegradedFallback — the middle rung of the renderer fallback ladder\n * (audit 2026-05-30, P2.5).\n *\n * Each heavy renderer (graph / map / chart) follows the same contract:\n * 1. native render when its peer lib is available and succeeds;\n * 2. **degraded but useful** view when the native render throws — this\n * component: a visible notice + a plain data table so the user still\n * sees the underlying data instead of a blank space;\n * 3. (the caller also emits a `render:error` telemetry event).\n *\n * Pure / presentational — no peer deps, no side effects — so a render-path\n * failure in a heavy lib can never cascade into the fallback itself, and it\n * is trivially unit-testable. Rows/cells are rendered as text; callers are\n * responsible for stringifying complex cell values.\n */\n\nimport { Component, For, Show } from 'solid-js';\nimport { formatMCPUIString, useMCPUIStrings } from '../context/MCPUIStringsContext';\nimport { MissingValueLegend, MissingValueMark } from './MissingValue';\n\nexport interface DegradedFallbackProps {\n /** Short, human-readable reason the native render was skipped/failed. */\n message: string;\n /**\n * Column headers for the degraded data table. When omitted (or empty),\n * only the notice banner is shown.\n */\n columns?: string[];\n /** Row data — each row is an array of cells aligned to `columns`. */\n rows?: Array<Array<string | number>>;\n /**\n * Caption under the table. Defaults to a generic\n * \"interactive view unavailable\" line.\n */\n caption?: string;\n /** Max rows to render before truncating (default 50). */\n maxRows?: number;\n /**\n * Same shape as `rows`: `true` marks a cell whose value is missing, which\n * renders as `<MissingValueMark/>` instead of its text. A\n * `<MissingValueLegend/>` follows the table when a SHOWN cell is missing.\n * Omitted, the output is unchanged. @since v6.24.0\n */\n missing?: boolean[][];\n}\n\nexport const DegradedFallback: Component<DegradedFallbackProps> = (props) => {\n const strings = useMCPUIStrings();\n const maxRows = () => props.maxRows ?? 50;\n const allRows = () => props.rows ?? [];\n const shownRows = () => allRows().slice(0, maxRows());\n const hiddenCount = () => Math.max(0, allRows().length - shownRows().length);\n const isMissing = (rowIndex: number, colIndex: number) =>\n props.missing?.[rowIndex]?.[colIndex] === true;\n const anyShownMissing = () => {\n const columnCount = props.columns?.length ?? 0;\n return shownRows().some((_row, r) => {\n for (let c = 0; c < columnCount; c += 1) if (isMissing(r, c)) return true;\n return false;\n });\n };\n const hasTable = () => (props.columns?.length ?? 0) > 0 && allRows().length > 0;\n\n return (\n <div\n class=\"w-full rounded-lg border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-50))] p-3 dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_20%,transparent))]\"\n role=\"alert\"\n >\n <p class=\"text-sm font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]\">{props.message}</p>\n <p class=\"mt-0.5 text-xs text-[color:var(--mcp-ui-warning,var(--color-amber-700))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-300))]\">\n {props.caption ?? strings.degradedCaption}\n </p>\n\n <Show when={hasTable()}>\n <div class=\"mt-2 max-h-64 overflow-auto rounded border border-[color:var(--mcp-ui-warning-border,var(--color-amber-200))] dark:border-[color:var(--mcp-ui-warning-border,var(--color-amber-800))]\">\n <table class=\"w-full border-collapse text-left text-xs\">\n <thead class=\"sticky top-0 bg-[color:var(--mcp-ui-warning-soft,var(--color-amber-100))] dark:bg-[color:var(--mcp-ui-warning-soft,color-mix(in_oklab,var(--color-amber-900)_40%,transparent))]\">\n <tr>\n <For each={props.columns}>\n {(col) => (\n <th class=\"px-2 py-1 font-medium text-[color:var(--mcp-ui-warning,var(--color-amber-900))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-100))]\">{col}</th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={shownRows()}>\n {(row, rowIndex) => (\n <tr class=\"border-t border-[color:var(--mcp-ui-warning-border,var(--color-amber-100))] dark:border-[color:var(--mcp-ui-warning-border,color-mix(in_oklab,var(--color-amber-800)_60%,transparent))]\">\n <For each={props.columns}>\n {(_col, i) => (\n <td class=\"px-2 py-1 text-[color:var(--mcp-ui-warning,var(--color-amber-800))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-200))]\">\n <Show when={isMissing(rowIndex(), i())} fallback={String(row[i()] ?? '')}>\n <MissingValueMark />\n </Show>\n </td>\n )}\n </For>\n </tr>\n )}\n </For>\n </tbody>\n </table>\n </div>\n <Show when={anyShownMissing()}>\n <MissingValueLegend class=\"mt-2\" />\n </Show>\n <Show when={hiddenCount() > 0}>\n <p class=\"mt-1 text-[10px] text-[color:var(--mcp-ui-warning,var(--color-amber-600))] dark:text-[color:var(--mcp-ui-warning,var(--color-amber-400))]\">\n {formatMCPUIString(strings.degradedMoreRows, { count: hiddenCount() })}\n </p>\n </Show>\n </Show>\n </div>\n );\n};\n"],"names":["DegradedFallback","props","strings","useMCPUIStrings","maxRows","allRows","rows","shownRows","slice","hiddenCount","Math","max","length","isMissing","rowIndex","colIndex","missing","anyShownMissing","columnCount","columns","some","_row","r","c","hasTable","_el$","_$getNextElement","_tmpl$3","_el$2","firstChild","_el$3","nextSibling","_el$0","_el$1","_co$","_$getNextMarker","_$insert","message","caption","degradedCaption","_$createComponent","Show","when","children","_el$4","_tmpl$","_el$5","_el$6","_el$7","_el$8","For","each","col","_el$10","_tmpl$4","row","_el$11","_tmpl$5","_col","i","_el$12","_tmpl$6","fallback","String","MissingValueMark","MissingValueLegend","_el$9","_tmpl$2","formatMCPUIString","degradedMoreRows","count"],"mappings":";;;;;;AA+CO,MAAMA,mBAAsDC,CAAAA,UAAU;AAC3E,QAAMC,UAAUC,gBAAAA;AAChB,QAAMC,UAAUA,MAAMH,MAAMG,WAAW;AACvC,QAAMC,UAAUA,MAAMJ,MAAMK,QAAQ,CAAA;AACpC,QAAMC,YAAYA,MAAMF,QAAAA,EAAUG,MAAM,GAAGJ,SAAS;AACpD,QAAMK,cAAcA,MAAMC,KAAKC,IAAI,GAAGN,UAAUO,SAASL,UAAAA,EAAYK,MAAM;AAC3E,QAAMC,YAAYA,CAACC,UAAkBC,aAAAA;;AACnCd,8BAAMe,YAANf,mBAAgBa,cAAhBb,mBAA4Bc,eAAc;AAAA;AAC5C,QAAME,kBAAkBA,MAAM;;AAC5B,UAAMC,gBAAcjB,WAAMkB,YAANlB,mBAAeW,WAAU;AAC7C,WAAOL,UAAAA,EAAYa,KAAK,CAACC,MAAMC,MAAM;AACnC,eAASC,IAAI,GAAGA,IAAIL,aAAaK,KAAK,EAAG,KAAIV,UAAUS,GAAGC,CAAC,EAAG,QAAO;AACrE,aA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raggableGridItem Component
|
|
3
|
+
* Wrapper for grid items that enables drag-and-drop reordering and resizing
|
|
4
|
+
*
|
|
5
|
+
* Sprint Drag-Drop Feature
|
|
6
|
+
*/
|
|
7
|
+
import { Component, JSX } from 'solid-js';
|
|
8
|
+
import type { GridPosition, ResizeConstraints } from "../types.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Props for DraggableGridItem
|
|
11
|
+
*/
|
|
12
|
+
export interface DraggableGridItemProps {
|
|
13
|
+
/**
|
|
14
|
+
* Component ID
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Grid position
|
|
19
|
+
*/
|
|
20
|
+
position: GridPosition;
|
|
21
|
+
/**
|
|
22
|
+
* Whether dragging is enabled
|
|
23
|
+
*/
|
|
24
|
+
draggable?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether resizing is enabled
|
|
27
|
+
*/
|
|
28
|
+
resizable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Resize constraints
|
|
31
|
+
*/
|
|
32
|
+
constraints?: ResizeConstraints;
|
|
33
|
+
/**
|
|
34
|
+
* Whether this item is currently being dragged
|
|
35
|
+
*/
|
|
36
|
+
isDragging?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this item is a drop target
|
|
39
|
+
*/
|
|
40
|
+
isDropTarget?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Preview position during resize
|
|
43
|
+
*/
|
|
44
|
+
previewPosition?: GridPosition | null;
|
|
45
|
+
/**
|
|
46
|
+
* Drag props from useDragDrop
|
|
47
|
+
*/
|
|
48
|
+
dragProps?: {
|
|
49
|
+
draggable: boolean;
|
|
50
|
+
onDragStart: (e: DragEvent) => void;
|
|
51
|
+
onDragOver: (e: DragEvent) => void;
|
|
52
|
+
onDragEnter: (e: DragEvent) => void;
|
|
53
|
+
onDragLeave: (e: DragEvent) => void;
|
|
54
|
+
onDrop: (e: DragEvent) => void;
|
|
55
|
+
onDragEnd: (e: DragEvent) => void;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Callback when resize starts
|
|
59
|
+
*/
|
|
60
|
+
onResizeStart?: (edge: 'left' | 'right' | 'top' | 'bottom', event: PointerEvent) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback for resize preview
|
|
63
|
+
*/
|
|
64
|
+
onResizePreview?: (position: GridPosition) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Callback when resize completes
|
|
67
|
+
*/
|
|
68
|
+
onResize?: (position: GridPosition) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Whether resize is in progress
|
|
71
|
+
*/
|
|
72
|
+
isResizing?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Show grid overlay during drag/resize
|
|
75
|
+
*/
|
|
76
|
+
showGridOverlay?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Custom CSS class
|
|
79
|
+
*/
|
|
80
|
+
class?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Custom styles
|
|
83
|
+
*/
|
|
84
|
+
style?: JSX.CSSProperties;
|
|
85
|
+
/**
|
|
86
|
+
* Children to render
|
|
87
|
+
*/
|
|
88
|
+
children?: JSX.Element;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* DraggableGridItem Component
|
|
92
|
+
*/
|
|
93
|
+
export declare const DraggableGridItem: Component<DraggableGridItemProps>;
|
|
94
|
+
export default DraggableGridItem;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Sprint Drag-Drop Feature
|
|
6
6
|
*/
|
|
7
7
|
import { Component, JSX } from 'solid-js';
|
|
8
|
-
import type { GridPosition, ResizeConstraints } from
|
|
8
|
+
import type { GridPosition, ResizeConstraints } from "../types.js";
|
|
9
9
|
/**
|
|
10
10
|
* Props for DraggableGridItem
|
|
11
11
|
*/
|
|
@@ -92,4 +92,3 @@ export interface DraggableGridItemProps {
|
|
|
92
92
|
*/
|
|
93
93
|
export declare const DraggableGridItem: Component<DraggableGridItemProps>;
|
|
94
94
|
export default DraggableGridItem;
|
|
95
|
-
//# sourceMappingURL=DraggableGridItem.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EditableUIResourceRenderer Component
|
|
3
|
+
* Extends UIResourceRenderer with drag-and-drop reordering and resizing capabilities
|
|
4
|
+
*
|
|
5
|
+
* Sprint Drag-Drop Feature
|
|
6
|
+
*/
|
|
7
|
+
import { Component } from 'solid-js';
|
|
8
|
+
import type { UILayout, RendererError, DragDropConfig } from "../types.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Props for EditableUIResourceRenderer
|
|
11
|
+
*/
|
|
12
|
+
export interface EditableUIResourceRendererProps {
|
|
13
|
+
/**
|
|
14
|
+
* Layout to render (must be UILayout, not single component)
|
|
15
|
+
*/
|
|
16
|
+
layout: UILayout;
|
|
17
|
+
/**
|
|
18
|
+
* Drag-drop configuration
|
|
19
|
+
*/
|
|
20
|
+
dragDrop?: DragDropConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Error callback
|
|
23
|
+
*/
|
|
24
|
+
onError?: (error: RendererError) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when layout changes (reorder or resize)
|
|
27
|
+
*/
|
|
28
|
+
onLayoutChange?: (layout: UILayout) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Custom CSS class
|
|
31
|
+
*/
|
|
32
|
+
class?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Show grid overlay during editing
|
|
35
|
+
*/
|
|
36
|
+
showGridOverlay?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* EditableUIResourceRenderer Component
|
|
40
|
+
*/
|
|
41
|
+
export declare const EditableUIResourceRenderer: Component<EditableUIResourceRendererProps>;
|
|
42
|
+
export default EditableUIResourceRenderer;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Sprint Drag-Drop Feature
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from 'solid-js';
|
|
8
|
-
import type { UILayout, RendererError, DragDropConfig } from
|
|
8
|
+
import type { UILayout, RendererError, DragDropConfig } from "../types.js";
|
|
9
9
|
/**
|
|
10
10
|
* Props for EditableUIResourceRenderer
|
|
11
11
|
*/
|
|
@@ -40,4 +40,3 @@ export interface EditableUIResourceRendererProps {
|
|
|
40
40
|
*/
|
|
41
41
|
export declare const EditableUIResourceRenderer: Component<EditableUIResourceRendererProps>;
|
|
42
42
|
export default EditableUIResourceRenderer;
|
|
43
|
-
//# sourceMappingURL=EditableUIResourceRenderer.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElicitationForm — schema-driven renderer for MCP `elicitation/create` requests
|
|
3
|
+
*
|
|
4
|
+
* @experimental
|
|
5
|
+
* @since v5.3.0
|
|
6
|
+
*
|
|
7
|
+
* Thin wrapper over `<ChatPrompt>` + `elicitationToPromptConfig()` that
|
|
8
|
+
* accepts a spec-shaped `ElicitationEvent` (MCP 2025-06-18) and exposes a
|
|
9
|
+
* spec-shaped `onAccept(content)` callback whose payload is ready to send
|
|
10
|
+
* back as the `accept` outcome of an `elicitation/create` reply.
|
|
11
|
+
*
|
|
12
|
+
* The mapping (boolean → confirm, single enum ≤4 → choice, else → form) is
|
|
13
|
+
* delegated to the `elicitationToPromptConfig` helper — same rules, same
|
|
14
|
+
* tests. This component owns the inverse mapping : extracting a spec-shaped
|
|
15
|
+
* `Record<string, unknown>` from the `ChatPromptResponse`.
|
|
16
|
+
*
|
|
17
|
+
* ## Outcome semantics (per MCP spec 2025-06-18)
|
|
18
|
+
*
|
|
19
|
+
* | User action | Callback fired | Payload |
|
|
20
|
+
* |---------------------------------------|--------------------|----------------------------------|
|
|
21
|
+
* | Submit form / pick choice / confirm | `onAccept(content)`| `{ [propName]: value, ... }` |
|
|
22
|
+
* | X icon / Cancel button | `onCancel()` *or* `onDecline()` if provided | none |
|
|
23
|
+
*
|
|
24
|
+
* mcp-ui's `<ChatPrompt>` does not natively distinguish "decline" (explicit
|
|
25
|
+
* refusal) from "cancel" (passive close). To surface a decline action,
|
|
26
|
+
* pass `dismissLabel="Decline"` and route the callback via `onDecline`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* bus.events.on('onElicitation', ({ elicitation }) => {
|
|
31
|
+
* render(() => (
|
|
32
|
+
* <ElicitationForm
|
|
33
|
+
* event={elicitation}
|
|
34
|
+
* onAccept={(content) => sendElicitationReply({ action: 'accept', content })}
|
|
35
|
+
* onCancel={() => sendElicitationReply({ action: 'cancel' })}
|
|
36
|
+
* />
|
|
37
|
+
* ), mountPoint)
|
|
38
|
+
* })
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
import { Component } from 'solid-js';
|
|
42
|
+
import type { ElicitationEvent } from "../types/chat-bus.cjs";
|
|
43
|
+
export interface ElicitationFormProps {
|
|
44
|
+
/** MCP `elicitation/create` request payload to render. */
|
|
45
|
+
event: ElicitationEvent;
|
|
46
|
+
/**
|
|
47
|
+
* Called when user submits a valid response. `content` is keyed by the
|
|
48
|
+
* elicitation `requestedSchema.properties` names — ready to send back as
|
|
49
|
+
* the `accept` outcome of an `elicitation/create` reply.
|
|
50
|
+
*/
|
|
51
|
+
onAccept: (content: Record<string, unknown>) => void;
|
|
52
|
+
/** Called when user dismisses (X icon, confirm-cancel button). */
|
|
53
|
+
onCancel?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Optional explicit decline action. When provided, takes precedence over
|
|
56
|
+
* `onCancel` on dismiss. Pair with `dismissLabel="Decline"` to surface as
|
|
57
|
+
* a decline action in the UI.
|
|
58
|
+
*/
|
|
59
|
+
onDecline?: () => void;
|
|
60
|
+
/** Label on the dismiss button (default: X icon). */
|
|
61
|
+
dismissLabel?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @experimental
|
|
65
|
+
* Schema-driven renderer for MCP `elicitation/create` requests.
|
|
66
|
+
*/
|
|
67
|
+
export declare const ElicitationForm: Component<ElicitationFormProps>;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
import { Component } from 'solid-js';
|
|
42
|
-
import type { ElicitationEvent } from
|
|
42
|
+
import type { ElicitationEvent } from "../types/chat-bus.js";
|
|
43
43
|
export interface ElicitationFormProps {
|
|
44
44
|
/** MCP `elicitation/create` request payload to render. */
|
|
45
45
|
event: ElicitationEvent;
|
|
@@ -65,4 +65,3 @@ export interface ElicitationFormProps {
|
|
|
65
65
|
* Schema-driven renderer for MCP `elicitation/create` requests.
|
|
66
66
|
*/
|
|
67
67
|
export declare const ElicitationForm: Component<ElicitationFormProps>;
|
|
68
|
-
//# sourceMappingURL=ElicitationForm.d.ts.map
|