@seed-ship/mcp-ui-solid 6.25.1 → 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 +22 -0
- package/README.md +14 -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.d.cts +38 -0
- package/dist/components/ActionGroupRenderer.d.ts +1 -2
- 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.d.cts +70 -0
- package/dist/components/AutocompleteDropdown.d.ts +1 -2
- package/dist/components/AutocompleteFormField.d.cts +51 -0
- package/dist/components/AutocompleteFormField.d.ts +1 -2
- 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.d.cts +62 -0
- package/dist/components/ChartJSRenderer.d.ts +1 -2
- package/dist/components/ChatPrompt.d.cts +69 -0
- package/dist/components/ChatPrompt.d.ts +1 -2
- package/dist/components/CodeBlockRenderer.d.cts +23 -0
- package/dist/components/CodeBlockRenderer.d.ts +1 -2
- package/dist/components/ComponentToolbar.d.cts +46 -0
- package/dist/components/ComponentToolbar.d.ts +0 -1
- package/dist/components/DataPreviewSection.d.cts +11 -0
- package/dist/components/DataPreviewSection.d.ts +1 -2
- package/dist/components/DegradedFallback.d.cts +43 -0
- package/dist/components/DegradedFallback.d.ts +0 -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.d.cts +49 -0
- package/dist/components/ExpandableWrapper.d.ts +0 -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.d.cts +19 -0
- package/dist/components/FormFieldRenderer.d.ts +1 -2
- package/dist/components/FormRenderer.d.cts +14 -0
- package/dist/components/FormRenderer.d.ts +1 -2
- 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/GhostText.d.cts +112 -0
- package/dist/components/GhostText.d.ts +0 -1
- package/dist/components/GraphRenderer.d.cts +66 -0
- package/dist/components/GraphRenderer.d.ts +1 -2
- 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.d.cts +26 -0
- package/dist/components/MissingValue.d.ts +0 -1
- package/dist/components/ModalRenderer.d.cts +66 -0
- package/dist/components/ModalRenderer.d.ts +1 -2
- package/dist/components/PortalDropdownMenu.d.cts +55 -0
- package/dist/components/PortalDropdownMenu.d.ts +0 -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.d.cts +34 -0
- package/dist/components/ScratchpadPanel.d.ts +1 -2
- 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.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/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.d.cts +128 -0
- package/dist/components/chart-missing-plugin.d.ts +1 -2
- 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.d.cts +15 -0
- package/dist/utils/math-markdown.d.ts +1 -2
- 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.d.cts +10 -0
- package/dist/utils/theme.d.ts +0 -1
- package/dist/validation.d.cts +3 -4
- package/dist/validation.d.ts +3 -4
- package/docs/SECURITY-DEPENDENCIES.md +129 -1
- package/docs/ZOD4-STABLE-MIGRATION-2026-10-26.md +181 -0
- package/package.json +8 -7
- package/src/adapters/connector.ts +3 -3
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDragDrop Hook
|
|
3
|
+
* Handles drag-and-drop reordering of grid components using HTML5 Drag-Drop API
|
|
4
|
+
*
|
|
5
|
+
* Sprint Drag-Drop Feature
|
|
6
|
+
*/
|
|
7
|
+
import { Accessor } from 'solid-js';
|
|
8
|
+
import type { UIComponent } from "../types.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Options for the useDragDrop hook
|
|
11
|
+
*/
|
|
12
|
+
export interface UseDragDropOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Accessor for current components
|
|
15
|
+
*/
|
|
16
|
+
components: Accessor<UIComponent[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when components are reordered
|
|
19
|
+
*/
|
|
20
|
+
onReorder: (newComponents: UIComponent[]) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Whether drag-drop is enabled
|
|
23
|
+
*/
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Animation duration in ms
|
|
27
|
+
*/
|
|
28
|
+
animationDuration?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Props to apply to a draggable element
|
|
32
|
+
*/
|
|
33
|
+
export interface DragProps {
|
|
34
|
+
draggable: boolean;
|
|
35
|
+
onDragStart: (e: DragEvent) => void;
|
|
36
|
+
onDragOver: (e: DragEvent) => void;
|
|
37
|
+
onDragEnter: (e: DragEvent) => void;
|
|
38
|
+
onDragLeave: (e: DragEvent) => void;
|
|
39
|
+
onDrop: (e: DragEvent) => void;
|
|
40
|
+
onDragEnd: (e: DragEvent) => void;
|
|
41
|
+
'data-component-id': string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Return type for the useDragDrop hook
|
|
45
|
+
*/
|
|
46
|
+
export interface UseDragDropReturn {
|
|
47
|
+
/**
|
|
48
|
+
* ID of the component currently being dragged
|
|
49
|
+
*/
|
|
50
|
+
draggedId: Accessor<string | null>;
|
|
51
|
+
/**
|
|
52
|
+
* ID of the current drop target
|
|
53
|
+
*/
|
|
54
|
+
dropTargetId: Accessor<string | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a drag operation is in progress
|
|
57
|
+
*/
|
|
58
|
+
isDragging: Accessor<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Handle drag start event
|
|
61
|
+
*/
|
|
62
|
+
handleDragStart: (e: DragEvent, componentId: string) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Handle drag over event
|
|
65
|
+
*/
|
|
66
|
+
handleDragOver: (e: DragEvent, componentId: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Handle drag enter event
|
|
69
|
+
*/
|
|
70
|
+
handleDragEnter: (e: DragEvent, componentId: string) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Handle drag leave event
|
|
73
|
+
*/
|
|
74
|
+
handleDragLeave: (e: DragEvent) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Handle drop event
|
|
77
|
+
*/
|
|
78
|
+
handleDrop: (e: DragEvent, targetId: string) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Handle drag end event
|
|
81
|
+
*/
|
|
82
|
+
handleDragEnd: (e: DragEvent) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Get drag props for a component
|
|
85
|
+
*/
|
|
86
|
+
getDragProps: (componentId: string) => DragProps;
|
|
87
|
+
/**
|
|
88
|
+
* Check if a component is being dragged
|
|
89
|
+
*/
|
|
90
|
+
isComponentDragging: (componentId: string) => boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Check if a component is a drop target
|
|
93
|
+
*/
|
|
94
|
+
isDropTarget: (componentId: string) => boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Hook for handling drag-and-drop reordering of grid components
|
|
98
|
+
*/
|
|
99
|
+
export declare function useDragDrop(options: UseDragDropOptions): UseDragDropReturn;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Sprint Drag-Drop Feature
|
|
6
6
|
*/
|
|
7
7
|
import { Accessor } from 'solid-js';
|
|
8
|
-
import type { UIComponent } from
|
|
8
|
+
import type { UIComponent } from "../types.js";
|
|
9
9
|
/**
|
|
10
10
|
* Options for the useDragDrop hook
|
|
11
11
|
*/
|
|
@@ -97,4 +97,3 @@ export interface UseDragDropReturn {
|
|
|
97
97
|
* Hook for handling drag-and-drop reordering of grid components
|
|
98
98
|
*/
|
|
99
99
|
export declare function useDragDrop(options: UseDragDropOptions): UseDragDropReturn;
|
|
100
|
-
//# sourceMappingURL=useDragDrop.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFormPersistence - Save/restore form data to localStorage
|
|
3
|
+
* Sprint 4: State & Charts
|
|
4
|
+
*/
|
|
5
|
+
import { Accessor } from 'solid-js';
|
|
6
|
+
/**
|
|
7
|
+
* Options for form persistence
|
|
8
|
+
*/
|
|
9
|
+
export interface UseFormPersistenceOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Unique key for storage
|
|
12
|
+
*/
|
|
13
|
+
persistKey: string;
|
|
14
|
+
/**
|
|
15
|
+
* Form data accessor
|
|
16
|
+
*/
|
|
17
|
+
formData: Accessor<Record<string, unknown>>;
|
|
18
|
+
/**
|
|
19
|
+
* Setter for form data
|
|
20
|
+
*/
|
|
21
|
+
setFormData: (data: Record<string, unknown>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Debounce delay in ms (default: 500)
|
|
24
|
+
*/
|
|
25
|
+
debounce?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Fields to exclude from persistence (e.g., passwords)
|
|
28
|
+
*/
|
|
29
|
+
excludeFields?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Expiry time in ms (default: none)
|
|
32
|
+
*/
|
|
33
|
+
expiresIn?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Storage provider (default: localStorage)
|
|
36
|
+
* Useful for SSR or testing
|
|
37
|
+
*/
|
|
38
|
+
storage?: Storage | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Return type for useFormPersistence hook
|
|
42
|
+
*/
|
|
43
|
+
export interface UseFormPersistenceReturn {
|
|
44
|
+
/**
|
|
45
|
+
* Clear persisted data from storage
|
|
46
|
+
*/
|
|
47
|
+
clearPersisted: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Check if there is persisted data
|
|
50
|
+
*/
|
|
51
|
+
hasPersisted: () => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Get the timestamp of persisted data
|
|
54
|
+
*/
|
|
55
|
+
getPersistedTimestamp: () => number | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Hook for persisting form data to localStorage
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* function MyForm() {
|
|
63
|
+
* const [formData, setFormData] = createSignal({})
|
|
64
|
+
*
|
|
65
|
+
* const { clearPersisted } = useFormPersistence({
|
|
66
|
+
* persistKey: 'my-form-draft',
|
|
67
|
+
* formData,
|
|
68
|
+
* setFormData,
|
|
69
|
+
* excludeFields: ['password'],
|
|
70
|
+
* expiresIn: 7 * 24 * 60 * 60 * 1000, // 7 days
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* const handleSubmit = () => {
|
|
74
|
+
* // Submit form
|
|
75
|
+
* clearPersisted() // Clear draft after successful submit
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function useFormPersistence(options: UseFormPersistenceOptions): UseFormPersistenceReturn;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useModal - Hooks for modal state management
|
|
3
|
+
* Sprint 3: UX Improvements
|
|
4
|
+
*/
|
|
5
|
+
import { Accessor } from 'solid-js';
|
|
6
|
+
/**
|
|
7
|
+
* Return type for useModal hook
|
|
8
|
+
*/
|
|
9
|
+
export interface UseModalReturn {
|
|
10
|
+
/**
|
|
11
|
+
* Whether the modal is currently open
|
|
12
|
+
*/
|
|
13
|
+
isOpen: Accessor<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Open the modal
|
|
16
|
+
*/
|
|
17
|
+
open: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Close the modal
|
|
20
|
+
*/
|
|
21
|
+
close: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Toggle the modal open/closed state
|
|
24
|
+
*/
|
|
25
|
+
toggle: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook for managing modal open/close state
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* function MyComponent() {
|
|
33
|
+
* const { isOpen, open, close } = useModal()
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <>
|
|
37
|
+
* <button onClick={open}>Open Modal</button>
|
|
38
|
+
* <ModalRenderer
|
|
39
|
+
* isOpen={isOpen()}
|
|
40
|
+
* onClose={close}
|
|
41
|
+
* params={{ title: 'My Modal' }}
|
|
42
|
+
* >
|
|
43
|
+
* <p>Modal content</p>
|
|
44
|
+
* </ModalRenderer>
|
|
45
|
+
* </>
|
|
46
|
+
* )
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function useModal(initialOpen?: boolean): UseModalReturn;
|
|
51
|
+
/**
|
|
52
|
+
* Return type for useConfirmModal hook
|
|
53
|
+
*/
|
|
54
|
+
export interface UseConfirmModalReturn {
|
|
55
|
+
/**
|
|
56
|
+
* Whether the confirm modal is currently open
|
|
57
|
+
*/
|
|
58
|
+
isOpen: Accessor<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Show the confirm dialog and return a promise that resolves to true/false
|
|
61
|
+
*/
|
|
62
|
+
confirm: () => Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Call this when user confirms (resolves promise with true)
|
|
65
|
+
*/
|
|
66
|
+
handleConfirm: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Call this when user cancels (resolves promise with false)
|
|
69
|
+
*/
|
|
70
|
+
handleCancel: () => void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Hook for confirmation dialogs that return a promise
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* function DeleteButton() {
|
|
78
|
+
* const { isOpen, confirm, handleConfirm, handleCancel } = useConfirmModal()
|
|
79
|
+
*
|
|
80
|
+
* const handleDelete = async () => {
|
|
81
|
+
* const confirmed = await confirm()
|
|
82
|
+
* if (confirmed) {
|
|
83
|
+
* await deleteItem()
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* return (
|
|
88
|
+
* <>
|
|
89
|
+
* <button onClick={handleDelete}>Delete</button>
|
|
90
|
+
* <ModalRenderer
|
|
91
|
+
* isOpen={isOpen()}
|
|
92
|
+
* onClose={handleCancel}
|
|
93
|
+
* params={{ title: 'Confirm Delete', size: 'sm' }}
|
|
94
|
+
* >
|
|
95
|
+
* <p>Are you sure you want to delete this item?</p>
|
|
96
|
+
* <div class="flex gap-2 mt-4">
|
|
97
|
+
* <button onClick={handleCancel}>Cancel</button>
|
|
98
|
+
* <button onClick={handleConfirm}>Delete</button>
|
|
99
|
+
* </div>
|
|
100
|
+
* </ModalRenderer>
|
|
101
|
+
* </>
|
|
102
|
+
* )
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function useConfirmModal(): UseConfirmModalReturn;
|
package/dist/hooks/useModal.d.ts
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useResize Hook
|
|
3
|
+
* Handles resizing of grid components by dragging edges
|
|
4
|
+
*
|
|
5
|
+
* Sprint Drag-Drop Feature
|
|
6
|
+
*/
|
|
7
|
+
import { Accessor } from 'solid-js';
|
|
8
|
+
import type { GridPosition, ResizeConstraints } from "../types.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Resize edge types
|
|
11
|
+
*/
|
|
12
|
+
export type ResizeEdge = 'left' | 'right' | 'top' | 'bottom';
|
|
13
|
+
/**
|
|
14
|
+
* Options for the useResize hook
|
|
15
|
+
*/
|
|
16
|
+
export interface UseResizeOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Component ID being resized
|
|
19
|
+
*/
|
|
20
|
+
componentId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Current grid position accessor
|
|
23
|
+
*/
|
|
24
|
+
currentPosition: Accessor<GridPosition>;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when resize is complete
|
|
27
|
+
*/
|
|
28
|
+
onResize: (newPosition: GridPosition) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback during resize (for preview)
|
|
31
|
+
*/
|
|
32
|
+
onResizePreview?: (previewPosition: GridPosition) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Resize constraints
|
|
35
|
+
*/
|
|
36
|
+
constraints?: ResizeConstraints;
|
|
37
|
+
/**
|
|
38
|
+
* Grid container element for calculating column widths
|
|
39
|
+
*/
|
|
40
|
+
gridContainer?: Accessor<HTMLElement | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Number of columns in the grid (default: 12)
|
|
43
|
+
*/
|
|
44
|
+
gridColumns?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Whether resize is enabled
|
|
47
|
+
*/
|
|
48
|
+
enabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Return type for the useResize hook
|
|
52
|
+
*/
|
|
53
|
+
export interface UseResizeReturn {
|
|
54
|
+
/**
|
|
55
|
+
* Whether a resize is in progress
|
|
56
|
+
*/
|
|
57
|
+
isResizing: Accessor<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Current resize edge
|
|
60
|
+
*/
|
|
61
|
+
resizeEdge: Accessor<ResizeEdge | null>;
|
|
62
|
+
/**
|
|
63
|
+
* Preview position during resize
|
|
64
|
+
*/
|
|
65
|
+
previewPosition: Accessor<GridPosition | null>;
|
|
66
|
+
/**
|
|
67
|
+
* Start resize operation
|
|
68
|
+
*/
|
|
69
|
+
handleResizeStart: (e: PointerEvent, edge: ResizeEdge) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Get resize handle props for an edge
|
|
72
|
+
*/
|
|
73
|
+
getResizeHandleProps: (edge: ResizeEdge) => ResizeHandleProps;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Props for resize handles
|
|
77
|
+
*/
|
|
78
|
+
export interface ResizeHandleProps {
|
|
79
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
80
|
+
style: Record<string, string>;
|
|
81
|
+
'data-resize-edge': ResizeEdge;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Hook for handling resize of grid components
|
|
85
|
+
*/
|
|
86
|
+
export declare function useResize(options: UseResizeOptions): UseResizeReturn;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Sprint Drag-Drop Feature
|
|
6
6
|
*/
|
|
7
7
|
import { Accessor } from 'solid-js';
|
|
8
|
-
import type { GridPosition, ResizeConstraints } from
|
|
8
|
+
import type { GridPosition, ResizeConstraints } from "../types.js";
|
|
9
9
|
/**
|
|
10
10
|
* Resize edge types
|
|
11
11
|
*/
|
|
@@ -84,4 +84,3 @@ export interface ResizeHandleProps {
|
|
|
84
84
|
* Hook for handling resize of grid components
|
|
85
85
|
*/
|
|
86
86
|
export declare function useResize(options: UseResizeOptions): UseResizeReturn;
|
|
87
|
-
//# sourceMappingURL=useResize.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useStreamingUI Hook - Phase 2
|
|
3
|
+
*
|
|
4
|
+
* Client-side hook for consuming the streaming generative UI endpoint.
|
|
5
|
+
* Handles SSE connection, component buffering, reordering, and error handling.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - SSE connection with automatic reconnection
|
|
9
|
+
* - Component buffering and reordering by sequenceId
|
|
10
|
+
* - Progress tracking and loading states
|
|
11
|
+
* - Error handling with recovery attempts
|
|
12
|
+
* - Cleanup on unmount
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { components, isLoading, error, progress } = useStreamingUI({
|
|
17
|
+
* query: 'Show me revenue trends',
|
|
18
|
+
* spaceIds: ['uuid1', 'uuid2'],
|
|
19
|
+
* onComplete: (metadata) => console.log('Done!', metadata),
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { UIComponent } from "../types.cjs";
|
|
24
|
+
/**
|
|
25
|
+
* Every string `useStreamingUI` puts into `progress().message` and
|
|
26
|
+
* `error()` — both are rendered by `<StreamingUIRenderer>`.
|
|
27
|
+
*
|
|
28
|
+
* @since v6.20.0 — `StreamingUIRenderer` feeds these from `MCPUIStrings`
|
|
29
|
+
* (`stream*` keys); a host calling the hook directly passes `messages`.
|
|
30
|
+
*/
|
|
31
|
+
export interface StreamingUIMessages {
|
|
32
|
+
/** Initial progress message. */
|
|
33
|
+
initializing: string;
|
|
34
|
+
/** Progress message while the request is sent. */
|
|
35
|
+
connecting: string;
|
|
36
|
+
/** Progress message on `component-start`. Template — `{type}`. */
|
|
37
|
+
loadingComponent: string;
|
|
38
|
+
/** Progress message on `complete`. */
|
|
39
|
+
dashboardLoaded: string;
|
|
40
|
+
/** Progress message after an error. Template — `{message}`. */
|
|
41
|
+
errorProgress: string;
|
|
42
|
+
/** `StreamError.error` when the fetch / read fails. */
|
|
43
|
+
connectionFailed: string;
|
|
44
|
+
/** `StreamError.message` when the server answers non-OK without a message. */
|
|
45
|
+
requestFailed: string;
|
|
46
|
+
/** `StreamError.message` when the response has no body. */
|
|
47
|
+
emptyResponse: string;
|
|
48
|
+
/** `StreamError.message` when streaming starts during SSR. */
|
|
49
|
+
serverSide: string;
|
|
50
|
+
/** `StreamError.message` when the failure carries no message. */
|
|
51
|
+
unknownError: string;
|
|
52
|
+
}
|
|
53
|
+
/** English defaults of {@link StreamingUIMessages}. */
|
|
54
|
+
export declare const DEFAULT_STREAMING_UI_MESSAGES: StreamingUIMessages;
|
|
55
|
+
export interface UseStreamingUIOptions {
|
|
56
|
+
query: string;
|
|
57
|
+
spaceIds?: string[];
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
options?: {
|
|
60
|
+
useCache?: boolean;
|
|
61
|
+
useLLM?: boolean;
|
|
62
|
+
maxComponents?: number;
|
|
63
|
+
preferredComponents?: Array<'chart' | 'table' | 'metric' | 'text'>;
|
|
64
|
+
};
|
|
65
|
+
onComplete?: (metadata: CompleteMetadata) => void;
|
|
66
|
+
onError?: (error: StreamError) => void;
|
|
67
|
+
onComponentReceived?: (component: UIComponent) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Localized progress / error messages (v6.20.0). Each key is read when
|
|
70
|
+
* the message is produced, so an object with getters stays reactive.
|
|
71
|
+
* Omitted keys fall back to {@link DEFAULT_STREAMING_UI_MESSAGES}.
|
|
72
|
+
*/
|
|
73
|
+
messages?: Partial<StreamingUIMessages>;
|
|
74
|
+
}
|
|
75
|
+
export interface StreamingUIState {
|
|
76
|
+
components: UIComponent[];
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
isStreaming: boolean;
|
|
79
|
+
error: StreamError | null;
|
|
80
|
+
progress: StreamProgress;
|
|
81
|
+
metadata: CompleteMetadata | null;
|
|
82
|
+
}
|
|
83
|
+
export interface StreamProgress {
|
|
84
|
+
receivedCount: number;
|
|
85
|
+
totalCount: number | null;
|
|
86
|
+
message: string;
|
|
87
|
+
timestamp: string;
|
|
88
|
+
}
|
|
89
|
+
export interface CompleteMetadata {
|
|
90
|
+
layoutId: string;
|
|
91
|
+
componentsCount: number;
|
|
92
|
+
executionTimeMs: number;
|
|
93
|
+
/** Alias for executionTimeMs (for compatibility with FooterRenderer) */
|
|
94
|
+
executionTime?: number;
|
|
95
|
+
firstTokenMs: number;
|
|
96
|
+
provider: 'groq' | 'mock';
|
|
97
|
+
model: string;
|
|
98
|
+
tokensUsed?: number;
|
|
99
|
+
costUSD?: number;
|
|
100
|
+
cached: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface StreamError {
|
|
103
|
+
error: string;
|
|
104
|
+
message: string;
|
|
105
|
+
componentId?: string;
|
|
106
|
+
recoverable: boolean;
|
|
107
|
+
}
|
|
108
|
+
export declare function useStreamingUI(options: UseStreamingUIOptions): {
|
|
109
|
+
components: import("solid-js").Accessor<UIComponent[]>;
|
|
110
|
+
isLoading: import("solid-js").Accessor<boolean>;
|
|
111
|
+
isStreaming: import("solid-js").Accessor<boolean>;
|
|
112
|
+
error: import("solid-js").Accessor<StreamError | null>;
|
|
113
|
+
progress: import("solid-js").Accessor<StreamProgress>;
|
|
114
|
+
metadata: import("solid-js").Accessor<CompleteMetadata | null>;
|
|
115
|
+
startStreaming: () => void;
|
|
116
|
+
stopStreaming: () => void;
|
|
117
|
+
};
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* })
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
import type { UIComponent } from
|
|
23
|
+
import type { UIComponent } from "../types.js";
|
|
24
24
|
/**
|
|
25
25
|
* Every string `useStreamingUI` puts into `progress().message` and
|
|
26
26
|
* `error()` — both are rendered by `<StreamingUIRenderer>`.
|
|
@@ -115,4 +115,3 @@ export declare function useStreamingUI(options: UseStreamingUIOptions): {
|
|
|
115
115
|
startStreaming: () => void;
|
|
116
116
|
stopStreaming: () => void;
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=useStreamingUI.d.ts.map
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./hooks/index.cjs";
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./hooks/index.js";
|