@seed-ship/mcp-ui-solid 2.0.1 → 2.1.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/dist/components/AutocompleteDropdown.cjs +201 -0
- package/dist/components/AutocompleteDropdown.cjs.map +1 -0
- package/dist/components/AutocompleteDropdown.d.ts +71 -0
- package/dist/components/AutocompleteDropdown.d.ts.map +1 -0
- package/dist/components/AutocompleteDropdown.js +201 -0
- package/dist/components/AutocompleteDropdown.js.map +1 -0
- package/dist/components/AutocompleteFormField.cjs +289 -0
- package/dist/components/AutocompleteFormField.cjs.map +1 -0
- package/dist/components/AutocompleteFormField.d.ts +52 -0
- package/dist/components/AutocompleteFormField.d.ts.map +1 -0
- package/dist/components/AutocompleteFormField.js +289 -0
- package/dist/components/AutocompleteFormField.js.map +1 -0
- package/dist/components/DraggableGridItem.cjs +133 -0
- package/dist/components/DraggableGridItem.cjs.map +1 -0
- package/dist/components/DraggableGridItem.d.ts +95 -0
- package/dist/components/DraggableGridItem.d.ts.map +1 -0
- package/dist/components/DraggableGridItem.js +133 -0
- package/dist/components/DraggableGridItem.js.map +1 -0
- package/dist/components/EditableUIResourceRenderer.cjs +203 -0
- package/dist/components/EditableUIResourceRenderer.cjs.map +1 -0
- package/dist/components/EditableUIResourceRenderer.d.ts +43 -0
- package/dist/components/EditableUIResourceRenderer.d.ts.map +1 -0
- package/dist/components/EditableUIResourceRenderer.js +203 -0
- package/dist/components/EditableUIResourceRenderer.js.map +1 -0
- package/dist/components/GhostText.cjs +105 -0
- package/dist/components/GhostText.cjs.map +1 -0
- package/dist/components/GhostText.d.ts +113 -0
- package/dist/components/GhostText.d.ts.map +1 -0
- package/dist/components/GhostText.js +105 -0
- package/dist/components/GhostText.js.map +1 -0
- package/dist/components/ResizeHandle.cjs +173 -0
- package/dist/components/ResizeHandle.cjs.map +1 -0
- package/dist/components/ResizeHandle.d.ts +50 -0
- package/dist/components/ResizeHandle.d.ts.map +1 -0
- package/dist/components/ResizeHandle.js +173 -0
- package/dist/components/ResizeHandle.js.map +1 -0
- package/dist/context/AutocompleteContext.cjs +158 -0
- package/dist/context/AutocompleteContext.cjs.map +1 -0
- package/dist/context/AutocompleteContext.d.ts +77 -0
- package/dist/context/AutocompleteContext.d.ts.map +1 -0
- package/dist/context/AutocompleteContext.js +158 -0
- package/dist/context/AutocompleteContext.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useAutocomplete.cjs +234 -0
- package/dist/hooks/useAutocomplete.cjs.map +1 -0
- package/dist/hooks/useAutocomplete.d.ts +119 -0
- package/dist/hooks/useAutocomplete.d.ts.map +1 -0
- package/dist/hooks/useAutocomplete.js +234 -0
- package/dist/hooks/useAutocomplete.js.map +1 -0
- package/dist/hooks/useDragDrop.cjs +170 -0
- package/dist/hooks/useDragDrop.cjs.map +1 -0
- package/dist/hooks/useDragDrop.d.ts +100 -0
- package/dist/hooks/useDragDrop.d.ts.map +1 -0
- package/dist/hooks/useDragDrop.js +170 -0
- package/dist/hooks/useDragDrop.js.map +1 -0
- package/dist/hooks/useResize.cjs +209 -0
- package/dist/hooks/useResize.cjs.map +1 -0
- package/dist/hooks/useResize.d.ts +87 -0
- package/dist/hooks/useResize.d.ts.map +1 -0
- package/dist/hooks/useResize.js +209 -0
- package/dist/hooks/useResize.js.map +1 -0
- package/dist/hooks.cjs +6 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +6 -0
- package/dist/hooks.d.ts +6 -0
- package/dist/hooks.js +6 -0
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/duckdb.cjs +192 -0
- package/dist/plugins/duckdb.cjs.map +1 -0
- package/dist/plugins/duckdb.d.ts +20 -0
- package/dist/plugins/duckdb.d.ts.map +1 -0
- package/dist/plugins/duckdb.js +170 -0
- package/dist/plugins/duckdb.js.map +1 -0
- package/dist/plugins/groq.cjs +97 -0
- package/dist/plugins/groq.cjs.map +1 -0
- package/dist/plugins/groq.d.ts +13 -0
- package/dist/plugins/groq.d.ts.map +1 -0
- package/dist/plugins/groq.js +97 -0
- package/dist/plugins/groq.js.map +1 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/rest.cjs +92 -0
- package/dist/plugins/rest.cjs.map +1 -0
- package/dist/plugins/rest.d.ts +13 -0
- package/dist/plugins/rest.d.ts.map +1 -0
- package/dist/plugins/rest.js +92 -0
- package/dist/plugins/rest.js.map +1 -0
- package/dist/plugins/supabase.cjs +79 -0
- package/dist/plugins/supabase.cjs.map +1 -0
- package/dist/plugins/supabase.d.ts +13 -0
- package/dist/plugins/supabase.d.ts.map +1 -0
- package/dist/plugins/supabase.js +79 -0
- package/dist/plugins/supabase.js.map +1 -0
- package/dist/types/index.d.ts +430 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types.d.cts +430 -0
- package/dist/types.d.ts +430 -0
- package/package.json +16 -1
- package/src/components/AutocompleteDropdown.tsx +329 -0
- package/src/components/AutocompleteFormField.tsx +288 -0
- package/src/components/DraggableGridItem.tsx +274 -0
- package/src/components/EditableUIResourceRenderer.tsx +273 -0
- package/src/components/GhostText.tsx +262 -0
- package/src/components/ResizeHandle.tsx +262 -0
- package/src/context/AutocompleteContext.tsx +317 -0
- package/src/hooks/index.ts +23 -0
- package/src/hooks/useAutocomplete.test.ts +334 -0
- package/src/hooks/useAutocomplete.ts +466 -0
- package/src/hooks/useDragDrop.test.ts +355 -0
- package/src/hooks/useDragDrop.ts +379 -0
- package/src/hooks/useResize.test.ts +313 -0
- package/src/hooks/useResize.ts +372 -0
- package/src/index.ts +71 -0
- package/src/plugins/duckdb.ts +269 -0
- package/src/plugins/groq.ts +137 -0
- package/src/plugins/index.ts +14 -0
- package/src/plugins/rest.ts +147 -0
- package/src/plugins/supabase.ts +120 -0
- package/src/styles/autocomplete.css +356 -0
- package/src/styles/drag-drop.css +297 -0
- package/src/styles/index.css +7 -0
- package/src/types/index.ts +529 -0
- package/src/vite-env.d.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +2 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useResize Hook
|
|
3
|
+
* Handles resizing of grid components by dragging edges
|
|
4
|
+
*
|
|
5
|
+
* Sprint Drag-Drop Feature
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createSignal, Accessor, onCleanup } from 'solid-js'
|
|
9
|
+
import { isServer } from 'solid-js/web'
|
|
10
|
+
import type { GridPosition, ResizeConstraints } from '../types'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resize edge types
|
|
14
|
+
*/
|
|
15
|
+
export type ResizeEdge = 'left' | 'right' | 'top' | 'bottom'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Options for the useResize hook
|
|
19
|
+
*/
|
|
20
|
+
export interface UseResizeOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Component ID being resized
|
|
23
|
+
*/
|
|
24
|
+
componentId: string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Current grid position accessor
|
|
28
|
+
*/
|
|
29
|
+
currentPosition: Accessor<GridPosition>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Callback when resize is complete
|
|
33
|
+
*/
|
|
34
|
+
onResize: (newPosition: GridPosition) => void
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Callback during resize (for preview)
|
|
38
|
+
*/
|
|
39
|
+
onResizePreview?: (previewPosition: GridPosition) => void
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Resize constraints
|
|
43
|
+
*/
|
|
44
|
+
constraints?: ResizeConstraints
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Grid container element for calculating column widths
|
|
48
|
+
*/
|
|
49
|
+
gridContainer?: Accessor<HTMLElement | null>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Number of columns in the grid (default: 12)
|
|
53
|
+
*/
|
|
54
|
+
gridColumns?: number
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether resize is enabled
|
|
58
|
+
*/
|
|
59
|
+
enabled?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Return type for the useResize hook
|
|
64
|
+
*/
|
|
65
|
+
export interface UseResizeReturn {
|
|
66
|
+
/**
|
|
67
|
+
* Whether a resize is in progress
|
|
68
|
+
*/
|
|
69
|
+
isResizing: Accessor<boolean>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Current resize edge
|
|
73
|
+
*/
|
|
74
|
+
resizeEdge: Accessor<ResizeEdge | null>
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Preview position during resize
|
|
78
|
+
*/
|
|
79
|
+
previewPosition: Accessor<GridPosition | null>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Start resize operation
|
|
83
|
+
*/
|
|
84
|
+
handleResizeStart: (e: PointerEvent, edge: ResizeEdge) => void
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get resize handle props for an edge
|
|
88
|
+
*/
|
|
89
|
+
getResizeHandleProps: (edge: ResizeEdge) => ResizeHandleProps
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Props for resize handles
|
|
94
|
+
*/
|
|
95
|
+
export interface ResizeHandleProps {
|
|
96
|
+
onPointerDown: (e: PointerEvent) => void
|
|
97
|
+
style: Record<string, string>
|
|
98
|
+
'data-resize-edge': ResizeEdge
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Apply constraints to a position
|
|
103
|
+
*/
|
|
104
|
+
function applyConstraints(
|
|
105
|
+
position: GridPosition,
|
|
106
|
+
constraints: ResizeConstraints,
|
|
107
|
+
gridColumns: number
|
|
108
|
+
): GridPosition {
|
|
109
|
+
let { colStart, colSpan, rowStart, rowSpan } = position
|
|
110
|
+
|
|
111
|
+
// Apply column constraints
|
|
112
|
+
const minColSpan = constraints.minColSpan ?? 1
|
|
113
|
+
const maxColSpan = constraints.maxColSpan ?? gridColumns
|
|
114
|
+
|
|
115
|
+
colSpan = Math.max(minColSpan, Math.min(maxColSpan, colSpan))
|
|
116
|
+
|
|
117
|
+
// Ensure colStart + colSpan doesn't exceed grid
|
|
118
|
+
if (colStart + colSpan - 1 > gridColumns) {
|
|
119
|
+
colStart = gridColumns - colSpan + 1
|
|
120
|
+
}
|
|
121
|
+
colStart = Math.max(1, colStart)
|
|
122
|
+
|
|
123
|
+
// Apply row constraints
|
|
124
|
+
if (rowSpan !== undefined) {
|
|
125
|
+
const minRowSpan = constraints.minRowSpan ?? 1
|
|
126
|
+
const maxRowSpan = constraints.maxRowSpan ?? 99
|
|
127
|
+
rowSpan = Math.max(minRowSpan, Math.min(maxRowSpan, rowSpan))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (rowStart !== undefined) {
|
|
131
|
+
rowStart = Math.max(1, rowStart)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return { colStart, colSpan, rowStart, rowSpan }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Hook for handling resize of grid components
|
|
139
|
+
*/
|
|
140
|
+
export function useResize(options: UseResizeOptions): UseResizeReturn {
|
|
141
|
+
const {
|
|
142
|
+
currentPosition,
|
|
143
|
+
onResize,
|
|
144
|
+
onResizePreview,
|
|
145
|
+
constraints = {},
|
|
146
|
+
gridContainer,
|
|
147
|
+
gridColumns = 12,
|
|
148
|
+
enabled = true
|
|
149
|
+
} = options
|
|
150
|
+
|
|
151
|
+
const [isResizing, setIsResizing] = createSignal(false)
|
|
152
|
+
const [resizeEdge, setResizeEdge] = createSignal<ResizeEdge | null>(null)
|
|
153
|
+
const [previewPosition, setPreviewPosition] = createSignal<GridPosition | null>(null)
|
|
154
|
+
const [startPosition, setStartPosition] = createSignal<GridPosition | null>(null)
|
|
155
|
+
const [startPointer, setStartPointer] = createSignal<{ x: number; y: number } | null>(null)
|
|
156
|
+
|
|
157
|
+
// Skip on server
|
|
158
|
+
if (isServer) {
|
|
159
|
+
return {
|
|
160
|
+
isResizing: () => false,
|
|
161
|
+
resizeEdge: () => null,
|
|
162
|
+
previewPosition: () => null,
|
|
163
|
+
handleResizeStart: () => {},
|
|
164
|
+
getResizeHandleProps: () => ({
|
|
165
|
+
onPointerDown: () => {},
|
|
166
|
+
style: {},
|
|
167
|
+
'data-resize-edge': 'right' as ResizeEdge
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Handle pointer move during resize
|
|
174
|
+
*/
|
|
175
|
+
const handlePointerMove = (e: PointerEvent) => {
|
|
176
|
+
if (!isResizing() || !startPosition() || !startPointer()) return
|
|
177
|
+
|
|
178
|
+
const edge = resizeEdge()
|
|
179
|
+
if (!edge) return
|
|
180
|
+
|
|
181
|
+
// Get container for measurements
|
|
182
|
+
const container = gridContainer?.() || document.querySelector('[data-grid-container]')
|
|
183
|
+
if (!container) return
|
|
184
|
+
|
|
185
|
+
const containerRect = container.getBoundingClientRect()
|
|
186
|
+
const currentPos = startPosition()!
|
|
187
|
+
const start = startPointer()!
|
|
188
|
+
|
|
189
|
+
let newPosition: GridPosition = { ...currentPos }
|
|
190
|
+
|
|
191
|
+
// Calculate delta in columns
|
|
192
|
+
const deltaX = e.clientX - start.x
|
|
193
|
+
const columnWidth = containerRect.width / gridColumns
|
|
194
|
+
const columnDelta = Math.round(deltaX / columnWidth)
|
|
195
|
+
|
|
196
|
+
if (constraints.lockHorizontal && (edge === 'left' || edge === 'right')) {
|
|
197
|
+
// Horizontal resize is locked
|
|
198
|
+
} else {
|
|
199
|
+
switch (edge) {
|
|
200
|
+
case 'right': {
|
|
201
|
+
// Increase/decrease colSpan from the right
|
|
202
|
+
const newColSpan = currentPos.colSpan + columnDelta
|
|
203
|
+
newPosition.colSpan = Math.max(1, Math.min(gridColumns - currentPos.colStart + 1, newColSpan))
|
|
204
|
+
break
|
|
205
|
+
}
|
|
206
|
+
case 'left': {
|
|
207
|
+
// Increase/decrease from left (changes both colStart and colSpan)
|
|
208
|
+
const newColStart = currentPos.colStart + columnDelta
|
|
209
|
+
const newColSpan = currentPos.colSpan - columnDelta
|
|
210
|
+
if (newColStart >= 1 && newColSpan >= 1) {
|
|
211
|
+
newPosition.colStart = newColStart
|
|
212
|
+
newPosition.colSpan = newColSpan
|
|
213
|
+
}
|
|
214
|
+
break
|
|
215
|
+
}
|
|
216
|
+
case 'top':
|
|
217
|
+
case 'bottom': {
|
|
218
|
+
// Row resizing - calculate based on Y movement
|
|
219
|
+
if (!constraints.lockVertical) {
|
|
220
|
+
const rowHeight = 100 // Approximate row height
|
|
221
|
+
const deltaY = e.clientY - start.y
|
|
222
|
+
const rowDelta = Math.round(deltaY / rowHeight)
|
|
223
|
+
|
|
224
|
+
if (edge === 'bottom') {
|
|
225
|
+
const currentRowSpan = currentPos.rowSpan || 1
|
|
226
|
+
const newRowSpan = currentRowSpan + rowDelta
|
|
227
|
+
newPosition.rowSpan = Math.max(1, newRowSpan)
|
|
228
|
+
} else if (edge === 'top') {
|
|
229
|
+
const currentRowStart = currentPos.rowStart || 1
|
|
230
|
+
const currentRowSpan = currentPos.rowSpan || 1
|
|
231
|
+
const newRowStart = currentRowStart + rowDelta
|
|
232
|
+
const newRowSpan = currentRowSpan - rowDelta
|
|
233
|
+
if (newRowStart >= 1 && newRowSpan >= 1) {
|
|
234
|
+
newPosition.rowStart = newRowStart
|
|
235
|
+
newPosition.rowSpan = newRowSpan
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
break
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Apply constraints
|
|
245
|
+
newPosition = applyConstraints(newPosition, constraints, gridColumns)
|
|
246
|
+
|
|
247
|
+
setPreviewPosition(newPosition)
|
|
248
|
+
onResizePreview?.(newPosition)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Handle pointer up to finish resize
|
|
253
|
+
*/
|
|
254
|
+
const handlePointerUp = (_e: PointerEvent) => {
|
|
255
|
+
if (!isResizing()) return
|
|
256
|
+
|
|
257
|
+
const preview = previewPosition()
|
|
258
|
+
if (preview) {
|
|
259
|
+
onResize(preview)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Cleanup
|
|
263
|
+
setIsResizing(false)
|
|
264
|
+
setResizeEdge(null)
|
|
265
|
+
setPreviewPosition(null)
|
|
266
|
+
setStartPosition(null)
|
|
267
|
+
setStartPointer(null)
|
|
268
|
+
|
|
269
|
+
// Remove listeners
|
|
270
|
+
document.removeEventListener('pointermove', handlePointerMove)
|
|
271
|
+
document.removeEventListener('pointerup', handlePointerUp)
|
|
272
|
+
document.body.style.cursor = ''
|
|
273
|
+
document.body.style.userSelect = ''
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Start resize operation
|
|
278
|
+
*/
|
|
279
|
+
const handleResizeStart = (e: PointerEvent, edge: ResizeEdge) => {
|
|
280
|
+
if (!enabled) return
|
|
281
|
+
|
|
282
|
+
e.preventDefault()
|
|
283
|
+
e.stopPropagation()
|
|
284
|
+
|
|
285
|
+
setIsResizing(true)
|
|
286
|
+
setResizeEdge(edge)
|
|
287
|
+
setStartPosition(currentPosition())
|
|
288
|
+
setStartPointer({ x: e.clientX, y: e.clientY })
|
|
289
|
+
setPreviewPosition(currentPosition())
|
|
290
|
+
|
|
291
|
+
// Set cursor
|
|
292
|
+
const cursors: Record<ResizeEdge, string> = {
|
|
293
|
+
left: 'ew-resize',
|
|
294
|
+
right: 'ew-resize',
|
|
295
|
+
top: 'ns-resize',
|
|
296
|
+
bottom: 'ns-resize'
|
|
297
|
+
}
|
|
298
|
+
document.body.style.cursor = cursors[edge]
|
|
299
|
+
document.body.style.userSelect = 'none'
|
|
300
|
+
|
|
301
|
+
// Add document listeners
|
|
302
|
+
document.addEventListener('pointermove', handlePointerMove)
|
|
303
|
+
document.addEventListener('pointerup', handlePointerUp)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Get resize handle props for an edge
|
|
308
|
+
*/
|
|
309
|
+
const getResizeHandleProps = (edge: ResizeEdge): ResizeHandleProps => {
|
|
310
|
+
const baseStyle: Record<string, string> = {
|
|
311
|
+
position: 'absolute',
|
|
312
|
+
zIndex: '10'
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const edgeStyles: Record<ResizeEdge, Record<string, string>> = {
|
|
316
|
+
left: {
|
|
317
|
+
...baseStyle,
|
|
318
|
+
left: '-4px',
|
|
319
|
+
top: '0',
|
|
320
|
+
width: '8px',
|
|
321
|
+
height: '100%',
|
|
322
|
+
cursor: 'ew-resize'
|
|
323
|
+
},
|
|
324
|
+
right: {
|
|
325
|
+
...baseStyle,
|
|
326
|
+
right: '-4px',
|
|
327
|
+
top: '0',
|
|
328
|
+
width: '8px',
|
|
329
|
+
height: '100%',
|
|
330
|
+
cursor: 'ew-resize'
|
|
331
|
+
},
|
|
332
|
+
top: {
|
|
333
|
+
...baseStyle,
|
|
334
|
+
top: '-4px',
|
|
335
|
+
left: '0',
|
|
336
|
+
width: '100%',
|
|
337
|
+
height: '8px',
|
|
338
|
+
cursor: 'ns-resize'
|
|
339
|
+
},
|
|
340
|
+
bottom: {
|
|
341
|
+
...baseStyle,
|
|
342
|
+
bottom: '-4px',
|
|
343
|
+
left: '0',
|
|
344
|
+
width: '100%',
|
|
345
|
+
height: '8px',
|
|
346
|
+
cursor: 'ns-resize'
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return {
|
|
351
|
+
onPointerDown: (e) => handleResizeStart(e, edge),
|
|
352
|
+
style: edgeStyles[edge],
|
|
353
|
+
'data-resize-edge': edge
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Cleanup on unmount
|
|
358
|
+
onCleanup(() => {
|
|
359
|
+
document.removeEventListener('pointermove', handlePointerMove)
|
|
360
|
+
document.removeEventListener('pointerup', handlePointerUp)
|
|
361
|
+
document.body.style.cursor = ''
|
|
362
|
+
document.body.style.userSelect = ''
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
return {
|
|
366
|
+
isResizing,
|
|
367
|
+
resizeEdge,
|
|
368
|
+
previewPosition,
|
|
369
|
+
handleResizeStart,
|
|
370
|
+
getResizeHandleProps
|
|
371
|
+
}
|
|
372
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -31,12 +31,29 @@
|
|
|
31
31
|
// Components
|
|
32
32
|
export { UIResourceRenderer, StreamingUIRenderer, GenerativeUIErrorBoundary } from './components'
|
|
33
33
|
|
|
34
|
+
// Drag-Drop Components
|
|
35
|
+
export { DraggableGridItem } from './components/DraggableGridItem'
|
|
36
|
+
export { ResizeHandle } from './components/ResizeHandle'
|
|
37
|
+
export { EditableUIResourceRenderer } from './components/EditableUIResourceRenderer'
|
|
38
|
+
|
|
39
|
+
// Autocomplete Components
|
|
40
|
+
export { GhostText, GhostTextInput } from './components/GhostText'
|
|
41
|
+
export { AutocompleteDropdown } from './components/AutocompleteDropdown'
|
|
42
|
+
export { AutocompleteFormField } from './components/AutocompleteFormField'
|
|
43
|
+
|
|
34
44
|
export type {
|
|
35
45
|
UIResourceRendererProps,
|
|
36
46
|
StreamingUIRendererProps,
|
|
37
47
|
GenerativeUIErrorBoundaryProps,
|
|
38
48
|
} from './components'
|
|
39
49
|
|
|
50
|
+
export type { DraggableGridItemProps } from './components/DraggableGridItem'
|
|
51
|
+
export type { ResizeHandleProps as ResizeHandleComponentProps } from './components/ResizeHandle'
|
|
52
|
+
export type { EditableUIResourceRendererProps } from './components/EditableUIResourceRenderer'
|
|
53
|
+
export type { GhostTextProps, GhostTextInputProps } from './components/GhostText'
|
|
54
|
+
export type { AutocompleteDropdownProps } from './components/AutocompleteDropdown'
|
|
55
|
+
export type { AutocompleteFormFieldProps, AutocompleteFormFieldParams } from './components/AutocompleteFormField'
|
|
56
|
+
|
|
40
57
|
// Hooks
|
|
41
58
|
export {
|
|
42
59
|
useStreamingUI,
|
|
@@ -47,6 +64,11 @@ export {
|
|
|
47
64
|
useModal,
|
|
48
65
|
useConfirmModal,
|
|
49
66
|
useFormPersistence,
|
|
67
|
+
// Drag-Drop hooks
|
|
68
|
+
useDragDrop,
|
|
69
|
+
useResize,
|
|
70
|
+
// Autocomplete hooks
|
|
71
|
+
useAutocomplete,
|
|
50
72
|
} from './hooks'
|
|
51
73
|
|
|
52
74
|
export type {
|
|
@@ -63,10 +85,26 @@ export type {
|
|
|
63
85
|
UseConfirmModalReturn,
|
|
64
86
|
UseFormPersistenceOptions,
|
|
65
87
|
UseFormPersistenceReturn,
|
|
88
|
+
// Drag-Drop types
|
|
89
|
+
UseDragDropOptions,
|
|
90
|
+
UseDragDropReturn,
|
|
91
|
+
DragProps,
|
|
92
|
+
UseResizeOptions,
|
|
93
|
+
UseResizeReturn,
|
|
94
|
+
ResizeEdge,
|
|
95
|
+
// Autocomplete types
|
|
96
|
+
UseAutocompleteOptions,
|
|
97
|
+
UseAutocompleteReturn,
|
|
66
98
|
} from './hooks'
|
|
67
99
|
|
|
68
100
|
// Context (Phase 5.0)
|
|
69
101
|
export { MCPActionProvider, MCPActionContext, useMCPAction, useMCPActionSafe } from './context'
|
|
102
|
+
// Autocomplete Context
|
|
103
|
+
export {
|
|
104
|
+
AutocompleteProvider,
|
|
105
|
+
useAutocompleteContext,
|
|
106
|
+
useAutocompleteContextSafe,
|
|
107
|
+
} from './context/AutocompleteContext'
|
|
70
108
|
|
|
71
109
|
export type {
|
|
72
110
|
MCPActionContextValue,
|
|
@@ -75,6 +113,22 @@ export type {
|
|
|
75
113
|
ActionResult,
|
|
76
114
|
} from './context'
|
|
77
115
|
|
|
116
|
+
export type {
|
|
117
|
+
AutocompleteContextValue,
|
|
118
|
+
AutocompleteProviderProps,
|
|
119
|
+
} from './context/AutocompleteContext'
|
|
120
|
+
|
|
121
|
+
// Plugins (Sprint Autocomplete)
|
|
122
|
+
// Note: DuckDB plugin is exported separately due to WASM dependencies
|
|
123
|
+
export {
|
|
124
|
+
createGroqPlugin,
|
|
125
|
+
createSupabasePlugin,
|
|
126
|
+
createRestPlugin,
|
|
127
|
+
} from './plugins'
|
|
128
|
+
|
|
129
|
+
// DuckDB plugin is available via direct import:
|
|
130
|
+
// import { createDuckDBPlugin, preloadDuckDB } from '@seed-ship/mcp-ui-solid/plugins/duckdb'
|
|
131
|
+
|
|
78
132
|
// Types
|
|
79
133
|
export type {
|
|
80
134
|
UIComponent,
|
|
@@ -118,6 +172,23 @@ export type {
|
|
|
118
172
|
// Validation options (v2.0.0)
|
|
119
173
|
IframePolicy,
|
|
120
174
|
ValidationOptions,
|
|
175
|
+
// Drag-Drop types (Sprint Drag-Drop)
|
|
176
|
+
ResizeConstraints,
|
|
177
|
+
DragDropConfig,
|
|
178
|
+
DragEventData,
|
|
179
|
+
DraggableGridItemProps as DraggableGridItemPropsType,
|
|
180
|
+
// Autocomplete types (Sprint Autocomplete)
|
|
181
|
+
AutocompleteResultType,
|
|
182
|
+
AutocompleteOption,
|
|
183
|
+
AutocompleteResult,
|
|
184
|
+
AutocompleteContext,
|
|
185
|
+
AutocompletePlugin,
|
|
186
|
+
GroqPluginConfig,
|
|
187
|
+
SupabasePluginConfig,
|
|
188
|
+
DuckDBPluginConfig,
|
|
189
|
+
RestPluginConfig,
|
|
190
|
+
FieldAutocompleteConfig,
|
|
191
|
+
AutocompleteProviderConfig,
|
|
121
192
|
} from './types'
|
|
122
193
|
|
|
123
194
|
// Services
|