@seed-ship/mcp-ui-solid 2.0.0 → 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.
Files changed (140) hide show
  1. package/README.md +50 -1
  2. package/dist/components/AutocompleteDropdown.cjs +201 -0
  3. package/dist/components/AutocompleteDropdown.cjs.map +1 -0
  4. package/dist/components/AutocompleteDropdown.d.ts +71 -0
  5. package/dist/components/AutocompleteDropdown.d.ts.map +1 -0
  6. package/dist/components/AutocompleteDropdown.js +201 -0
  7. package/dist/components/AutocompleteDropdown.js.map +1 -0
  8. package/dist/components/AutocompleteFormField.cjs +289 -0
  9. package/dist/components/AutocompleteFormField.cjs.map +1 -0
  10. package/dist/components/AutocompleteFormField.d.ts +52 -0
  11. package/dist/components/AutocompleteFormField.d.ts.map +1 -0
  12. package/dist/components/AutocompleteFormField.js +289 -0
  13. package/dist/components/AutocompleteFormField.js.map +1 -0
  14. package/dist/components/DraggableGridItem.cjs +133 -0
  15. package/dist/components/DraggableGridItem.cjs.map +1 -0
  16. package/dist/components/DraggableGridItem.d.ts +95 -0
  17. package/dist/components/DraggableGridItem.d.ts.map +1 -0
  18. package/dist/components/DraggableGridItem.js +133 -0
  19. package/dist/components/DraggableGridItem.js.map +1 -0
  20. package/dist/components/EditableUIResourceRenderer.cjs +203 -0
  21. package/dist/components/EditableUIResourceRenderer.cjs.map +1 -0
  22. package/dist/components/EditableUIResourceRenderer.d.ts +43 -0
  23. package/dist/components/EditableUIResourceRenderer.d.ts.map +1 -0
  24. package/dist/components/EditableUIResourceRenderer.js +203 -0
  25. package/dist/components/EditableUIResourceRenderer.js.map +1 -0
  26. package/dist/components/GhostText.cjs +105 -0
  27. package/dist/components/GhostText.cjs.map +1 -0
  28. package/dist/components/GhostText.d.ts +113 -0
  29. package/dist/components/GhostText.d.ts.map +1 -0
  30. package/dist/components/GhostText.js +105 -0
  31. package/dist/components/GhostText.js.map +1 -0
  32. package/dist/components/ResizeHandle.cjs +173 -0
  33. package/dist/components/ResizeHandle.cjs.map +1 -0
  34. package/dist/components/ResizeHandle.d.ts +50 -0
  35. package/dist/components/ResizeHandle.d.ts.map +1 -0
  36. package/dist/components/ResizeHandle.js +173 -0
  37. package/dist/components/ResizeHandle.js.map +1 -0
  38. package/dist/context/AutocompleteContext.cjs +158 -0
  39. package/dist/context/AutocompleteContext.cjs.map +1 -0
  40. package/dist/context/AutocompleteContext.d.ts +77 -0
  41. package/dist/context/AutocompleteContext.d.ts.map +1 -0
  42. package/dist/context/AutocompleteContext.js +158 -0
  43. package/dist/context/AutocompleteContext.js.map +1 -0
  44. package/dist/hooks/index.d.ts +6 -0
  45. package/dist/hooks/index.d.ts.map +1 -1
  46. package/dist/hooks/useAutocomplete.cjs +234 -0
  47. package/dist/hooks/useAutocomplete.cjs.map +1 -0
  48. package/dist/hooks/useAutocomplete.d.ts +119 -0
  49. package/dist/hooks/useAutocomplete.d.ts.map +1 -0
  50. package/dist/hooks/useAutocomplete.js +234 -0
  51. package/dist/hooks/useAutocomplete.js.map +1 -0
  52. package/dist/hooks/useDragDrop.cjs +170 -0
  53. package/dist/hooks/useDragDrop.cjs.map +1 -0
  54. package/dist/hooks/useDragDrop.d.ts +100 -0
  55. package/dist/hooks/useDragDrop.d.ts.map +1 -0
  56. package/dist/hooks/useDragDrop.js +170 -0
  57. package/dist/hooks/useDragDrop.js.map +1 -0
  58. package/dist/hooks/useResize.cjs +209 -0
  59. package/dist/hooks/useResize.cjs.map +1 -0
  60. package/dist/hooks/useResize.d.ts +87 -0
  61. package/dist/hooks/useResize.d.ts.map +1 -0
  62. package/dist/hooks/useResize.js +209 -0
  63. package/dist/hooks/useResize.js.map +1 -0
  64. package/dist/hooks.cjs +6 -0
  65. package/dist/hooks.cjs.map +1 -1
  66. package/dist/hooks.d.cts +6 -0
  67. package/dist/hooks.d.ts +6 -0
  68. package/dist/hooks.js +6 -0
  69. package/dist/hooks.js.map +1 -1
  70. package/dist/index.cjs +29 -0
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.d.cts +18 -3
  73. package/dist/index.d.ts +18 -3
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +29 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/plugins/duckdb.cjs +192 -0
  78. package/dist/plugins/duckdb.cjs.map +1 -0
  79. package/dist/plugins/duckdb.d.ts +20 -0
  80. package/dist/plugins/duckdb.d.ts.map +1 -0
  81. package/dist/plugins/duckdb.js +170 -0
  82. package/dist/plugins/duckdb.js.map +1 -0
  83. package/dist/plugins/groq.cjs +97 -0
  84. package/dist/plugins/groq.cjs.map +1 -0
  85. package/dist/plugins/groq.d.ts +13 -0
  86. package/dist/plugins/groq.d.ts.map +1 -0
  87. package/dist/plugins/groq.js +97 -0
  88. package/dist/plugins/groq.js.map +1 -0
  89. package/dist/plugins/index.d.ts +10 -0
  90. package/dist/plugins/index.d.ts.map +1 -0
  91. package/dist/plugins/rest.cjs +92 -0
  92. package/dist/plugins/rest.cjs.map +1 -0
  93. package/dist/plugins/rest.d.ts +13 -0
  94. package/dist/plugins/rest.d.ts.map +1 -0
  95. package/dist/plugins/rest.js +92 -0
  96. package/dist/plugins/rest.js.map +1 -0
  97. package/dist/plugins/supabase.cjs +79 -0
  98. package/dist/plugins/supabase.cjs.map +1 -0
  99. package/dist/plugins/supabase.d.ts +13 -0
  100. package/dist/plugins/supabase.d.ts.map +1 -0
  101. package/dist/plugins/supabase.js +79 -0
  102. package/dist/plugins/supabase.js.map +1 -0
  103. package/dist/services/validation.cjs +40 -1
  104. package/dist/services/validation.cjs.map +1 -1
  105. package/dist/services/validation.d.ts.map +1 -1
  106. package/dist/services/validation.js +40 -1
  107. package/dist/services/validation.js.map +1 -1
  108. package/dist/types/index.d.ts +430 -0
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types.d.cts +430 -0
  111. package/dist/types.d.ts +430 -0
  112. package/package.json +16 -1
  113. package/src/components/AutocompleteDropdown.tsx +329 -0
  114. package/src/components/AutocompleteFormField.tsx +288 -0
  115. package/src/components/DraggableGridItem.tsx +274 -0
  116. package/src/components/EditableUIResourceRenderer.tsx +273 -0
  117. package/src/components/GhostText.tsx +262 -0
  118. package/src/components/ResizeHandle.tsx +262 -0
  119. package/src/context/AutocompleteContext.tsx +317 -0
  120. package/src/hooks/index.ts +23 -0
  121. package/src/hooks/useAutocomplete.test.ts +334 -0
  122. package/src/hooks/useAutocomplete.ts +466 -0
  123. package/src/hooks/useDragDrop.test.ts +355 -0
  124. package/src/hooks/useDragDrop.ts +379 -0
  125. package/src/hooks/useResize.test.ts +313 -0
  126. package/src/hooks/useResize.ts +372 -0
  127. package/src/index.ts +71 -0
  128. package/src/plugins/duckdb.ts +269 -0
  129. package/src/plugins/groq.ts +137 -0
  130. package/src/plugins/index.ts +14 -0
  131. package/src/plugins/rest.ts +147 -0
  132. package/src/plugins/supabase.ts +120 -0
  133. package/src/services/validation.ts +46 -0
  134. package/src/styles/autocomplete.css +356 -0
  135. package/src/styles/drag-drop.css +297 -0
  136. package/src/styles/index.css +7 -0
  137. package/src/types/index.ts +529 -0
  138. package/src/vite-env.d.ts +18 -0
  139. package/tsconfig.tsbuildinfo +1 -1
  140. package/vite.config.ts +2 -0
@@ -1033,3 +1033,532 @@ export interface ValidationOptions {
1033
1033
  */
1034
1034
  customIframeDomains?: string[]
1035
1035
  }
1036
+
1037
+ // =============================================================================
1038
+ // DRAG-DROP TYPES (Sprint Drag-Drop)
1039
+ // =============================================================================
1040
+
1041
+ /**
1042
+ * Resize constraints for grid items
1043
+ */
1044
+ export interface ResizeConstraints {
1045
+ /**
1046
+ * Minimum column span (default: 1)
1047
+ */
1048
+ minColSpan?: number
1049
+
1050
+ /**
1051
+ * Maximum column span (default: 12)
1052
+ */
1053
+ maxColSpan?: number
1054
+
1055
+ /**
1056
+ * Minimum row span (default: 1)
1057
+ */
1058
+ minRowSpan?: number
1059
+
1060
+ /**
1061
+ * Maximum row span
1062
+ */
1063
+ maxRowSpan?: number
1064
+
1065
+ /**
1066
+ * Lock horizontal resizing
1067
+ */
1068
+ lockHorizontal?: boolean
1069
+
1070
+ /**
1071
+ * Lock vertical resizing
1072
+ */
1073
+ lockVertical?: boolean
1074
+ }
1075
+
1076
+ /**
1077
+ * Drag-Drop configuration for UIResourceRenderer
1078
+ */
1079
+ export interface DragDropConfig {
1080
+ /**
1081
+ * Enable drag-drop functionality (default: false)
1082
+ */
1083
+ enabled?: boolean
1084
+
1085
+ /**
1086
+ * Enable reordering via drag (default: true when enabled)
1087
+ */
1088
+ reorder?: boolean
1089
+
1090
+ /**
1091
+ * Enable resize handles (default: true when enabled)
1092
+ */
1093
+ resize?: boolean
1094
+
1095
+ /**
1096
+ * Resize constraints
1097
+ */
1098
+ constraints?: ResizeConstraints
1099
+
1100
+ /**
1101
+ * Callback when components are reordered
1102
+ */
1103
+ onReorder?: (components: UIComponent[]) => void
1104
+
1105
+ /**
1106
+ * Callback when a component is resized
1107
+ */
1108
+ onResize?: (componentId: string, newPosition: GridPosition) => void
1109
+
1110
+ /**
1111
+ * Callback when layout changes (reorder or resize)
1112
+ */
1113
+ onChange?: (layout: UILayout) => void
1114
+
1115
+ /**
1116
+ * Show grid lines during drag (default: true)
1117
+ */
1118
+ showGridLines?: boolean
1119
+
1120
+ /**
1121
+ * Animation duration in ms (default: 200)
1122
+ */
1123
+ animationDuration?: number
1124
+ }
1125
+
1126
+ /**
1127
+ * Drag event data for internal use
1128
+ */
1129
+ export interface DragEventData {
1130
+ /**
1131
+ * Component being dragged
1132
+ */
1133
+ componentId: string
1134
+
1135
+ /**
1136
+ * Original position
1137
+ */
1138
+ originalPosition: GridPosition
1139
+
1140
+ /**
1141
+ * Current drag position (in grid coordinates)
1142
+ */
1143
+ currentPosition?: GridPosition
1144
+
1145
+ /**
1146
+ * Drag type
1147
+ */
1148
+ type: 'reorder' | 'resize'
1149
+
1150
+ /**
1151
+ * For resize: which edge is being dragged
1152
+ */
1153
+ resizeEdge?: 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
1154
+ }
1155
+
1156
+ /**
1157
+ * Props for draggable grid items
1158
+ */
1159
+ export interface DraggableGridItemProps {
1160
+ /**
1161
+ * Component ID
1162
+ */
1163
+ id: string
1164
+
1165
+ /**
1166
+ * Grid position
1167
+ */
1168
+ position: GridPosition
1169
+
1170
+ /**
1171
+ * Enable dragging
1172
+ */
1173
+ draggable?: boolean
1174
+
1175
+ /**
1176
+ * Enable resize handles
1177
+ */
1178
+ resizable?: boolean
1179
+
1180
+ /**
1181
+ * Resize constraints
1182
+ */
1183
+ constraints?: ResizeConstraints
1184
+
1185
+ /**
1186
+ * Is this item currently being dragged
1187
+ */
1188
+ isDragging?: boolean
1189
+
1190
+ /**
1191
+ * Is this item a drop target
1192
+ */
1193
+ isDropTarget?: boolean
1194
+
1195
+ /**
1196
+ * Children to render
1197
+ */
1198
+ children?: any
1199
+
1200
+ /**
1201
+ * Custom class
1202
+ */
1203
+ class?: string
1204
+ }
1205
+
1206
+ // =============================================================================
1207
+ // AUTOCOMPLETE TYPES (Sprint Autocomplete)
1208
+ // =============================================================================
1209
+
1210
+ /**
1211
+ * Autocomplete result type
1212
+ */
1213
+ export type AutocompleteResultType = 'completion' | 'options'
1214
+
1215
+ /**
1216
+ * Single autocomplete option (for dropdown)
1217
+ */
1218
+ export interface AutocompleteOption {
1219
+ /**
1220
+ * Option value
1221
+ */
1222
+ value: string
1223
+
1224
+ /**
1225
+ * Display label (defaults to value)
1226
+ */
1227
+ label?: string
1228
+
1229
+ /**
1230
+ * Optional description
1231
+ */
1232
+ description?: string
1233
+
1234
+ /**
1235
+ * Optional icon
1236
+ */
1237
+ icon?: string
1238
+
1239
+ /**
1240
+ * Additional metadata from the source
1241
+ */
1242
+ metadata?: Record<string, any>
1243
+
1244
+ /**
1245
+ * Whether this option is disabled
1246
+ */
1247
+ disabled?: boolean
1248
+ }
1249
+
1250
+ /**
1251
+ * Result from autocomplete plugin
1252
+ */
1253
+ export interface AutocompleteResult {
1254
+ /**
1255
+ * Result type:
1256
+ * - 'completion': Ghost text (LLM-style)
1257
+ * - 'options': Dropdown options (data source)
1258
+ */
1259
+ type: AutocompleteResultType
1260
+
1261
+ /**
1262
+ * For type: 'completion' - the suggested text to complete
1263
+ */
1264
+ completion?: string
1265
+
1266
+ /**
1267
+ * For type: 'options' - list of suggestions
1268
+ */
1269
+ options?: AutocompleteOption[]
1270
+
1271
+ /**
1272
+ * Plugin ID that generated this result
1273
+ */
1274
+ pluginId?: string
1275
+
1276
+ /**
1277
+ * Whether result is from cache
1278
+ */
1279
+ cached?: boolean
1280
+ }
1281
+
1282
+ /**
1283
+ * Context passed to autocomplete plugins
1284
+ */
1285
+ export interface AutocompleteContext {
1286
+ /**
1287
+ * Field name/identifier
1288
+ */
1289
+ fieldName: string
1290
+
1291
+ /**
1292
+ * Current form data (other fields)
1293
+ */
1294
+ formData?: Record<string, any>
1295
+
1296
+ /**
1297
+ * Cursor position in input
1298
+ */
1299
+ cursorPosition?: number
1300
+
1301
+ /**
1302
+ * Previous user inputs (for context)
1303
+ */
1304
+ history?: string[]
1305
+
1306
+ /**
1307
+ * Custom context data
1308
+ */
1309
+ custom?: Record<string, any>
1310
+ }
1311
+
1312
+ /**
1313
+ * Plugin interface for autocomplete sources
1314
+ */
1315
+ export interface AutocompletePlugin {
1316
+ /**
1317
+ * Unique plugin identifier
1318
+ */
1319
+ id: string
1320
+
1321
+ /**
1322
+ * Human-readable name
1323
+ */
1324
+ name: string
1325
+
1326
+ /**
1327
+ * Configure the plugin
1328
+ */
1329
+ configure?: (config: Record<string, any>) => void
1330
+
1331
+ /**
1332
+ * Get suggestions for input
1333
+ */
1334
+ getSuggestions: (
1335
+ input: string,
1336
+ context?: AutocompleteContext
1337
+ ) => Promise<AutocompleteResult>
1338
+
1339
+ /**
1340
+ * Cleanup resources
1341
+ */
1342
+ dispose?: () => void
1343
+
1344
+ /**
1345
+ * Whether plugin is ready
1346
+ */
1347
+ isReady?: () => boolean
1348
+ }
1349
+
1350
+ /**
1351
+ * Groq LLM plugin configuration
1352
+ */
1353
+ export interface GroqPluginConfig {
1354
+ /**
1355
+ * Groq API key (VITE_GROQ_API_KEY)
1356
+ */
1357
+ apiKey: string
1358
+
1359
+ /**
1360
+ * Model to use (default: 'mixtral-8x7b-32768')
1361
+ */
1362
+ model?: string
1363
+
1364
+ /**
1365
+ * System prompt for completion
1366
+ */
1367
+ systemPrompt?: string
1368
+
1369
+ /**
1370
+ * Max tokens to generate (default: 50)
1371
+ */
1372
+ maxTokens?: number
1373
+
1374
+ /**
1375
+ * Temperature (default: 0.3)
1376
+ */
1377
+ temperature?: number
1378
+ }
1379
+
1380
+ /**
1381
+ * Supabase plugin configuration
1382
+ */
1383
+ export interface SupabasePluginConfig {
1384
+ /**
1385
+ * Supabase project URL
1386
+ */
1387
+ url: string
1388
+
1389
+ /**
1390
+ * Supabase anonymous key
1391
+ */
1392
+ anonKey: string
1393
+
1394
+ /**
1395
+ * Table to search
1396
+ */
1397
+ table: string
1398
+
1399
+ /**
1400
+ * Column to return as value
1401
+ */
1402
+ column: string
1403
+
1404
+ /**
1405
+ * Column to search (defaults to column)
1406
+ */
1407
+ searchColumn?: string
1408
+
1409
+ /**
1410
+ * Label column (defaults to column)
1411
+ */
1412
+ labelColumn?: string
1413
+
1414
+ /**
1415
+ * Max results (default: 10)
1416
+ */
1417
+ limit?: number
1418
+
1419
+ /**
1420
+ * Filter expression
1421
+ */
1422
+ filter?: Record<string, any>
1423
+ }
1424
+
1425
+ /**
1426
+ * DuckDB WASM plugin configuration
1427
+ */
1428
+ export interface DuckDBPluginConfig {
1429
+ /**
1430
+ * SQL query with :search placeholder
1431
+ * Example: "SELECT name FROM cities WHERE name ILIKE :search || '%' LIMIT 10"
1432
+ */
1433
+ query: string
1434
+
1435
+ /**
1436
+ * Optional data to load into DuckDB
1437
+ */
1438
+ data?: {
1439
+ tableName: string
1440
+ source: string | ArrayBuffer | File // URL, raw data, or file
1441
+ format?: 'csv' | 'json' | 'parquet'
1442
+ }
1443
+ }
1444
+
1445
+ /**
1446
+ * Generic REST API plugin configuration
1447
+ */
1448
+ export interface RestPluginConfig {
1449
+ /**
1450
+ * API endpoint with {search} placeholder
1451
+ * Example: '/api/search?q={search}'
1452
+ */
1453
+ endpoint: string
1454
+
1455
+ /**
1456
+ * HTTP method (default: 'GET')
1457
+ */
1458
+ method?: 'GET' | 'POST'
1459
+
1460
+ /**
1461
+ * Request headers
1462
+ */
1463
+ headers?: Record<string, string>
1464
+
1465
+ /**
1466
+ * For POST: body template with {search} placeholder
1467
+ */
1468
+ bodyTemplate?: string
1469
+
1470
+ /**
1471
+ * Transform response to options
1472
+ */
1473
+ transform?: (response: any) => AutocompleteOption[]
1474
+
1475
+ /**
1476
+ * Path to results array in response (e.g., 'data.results')
1477
+ */
1478
+ resultPath?: string
1479
+
1480
+ /**
1481
+ * Field name for value (default: 'value' or 'id')
1482
+ */
1483
+ valueField?: string
1484
+
1485
+ /**
1486
+ * Field name for label (default: 'label' or 'name')
1487
+ */
1488
+ labelField?: string
1489
+ }
1490
+
1491
+ /**
1492
+ * Field-level autocomplete configuration
1493
+ */
1494
+ export interface FieldAutocompleteConfig {
1495
+ /**
1496
+ * Enable autocomplete for this field
1497
+ */
1498
+ enabled: boolean
1499
+
1500
+ /**
1501
+ * Plugin ID to use (defaults to provider default)
1502
+ */
1503
+ plugin?: string
1504
+
1505
+ /**
1506
+ * Plugin-specific configuration
1507
+ */
1508
+ config?: Record<string, any>
1509
+
1510
+ /**
1511
+ * Other form fields to include as context
1512
+ */
1513
+ contextFields?: string[]
1514
+
1515
+ /**
1516
+ * Minimum characters before triggering (default: 1)
1517
+ */
1518
+ minChars?: number
1519
+
1520
+ /**
1521
+ * Debounce delay in ms (default: 150)
1522
+ */
1523
+ debounceMs?: number
1524
+
1525
+ /**
1526
+ * Custom placeholder when loading
1527
+ */
1528
+ loadingPlaceholder?: string
1529
+ }
1530
+
1531
+ /**
1532
+ * Autocomplete provider configuration
1533
+ */
1534
+ export interface AutocompleteProviderConfig {
1535
+ /**
1536
+ * Registered plugins
1537
+ */
1538
+ plugins: AutocompletePlugin[]
1539
+
1540
+ /**
1541
+ * Default plugin ID
1542
+ */
1543
+ defaultPlugin?: string
1544
+
1545
+ /**
1546
+ * Global debounce delay (default: 150ms)
1547
+ */
1548
+ debounceMs?: number
1549
+
1550
+ /**
1551
+ * Global minimum characters (default: 1)
1552
+ */
1553
+ minChars?: number
1554
+
1555
+ /**
1556
+ * Cache TTL in ms (default: 60000)
1557
+ */
1558
+ cacheTtl?: number
1559
+
1560
+ /**
1561
+ * Enable caching (default: true)
1562
+ */
1563
+ cacheEnabled?: boolean
1564
+ }
package/src/vite-env.d.ts CHANGED
@@ -9,3 +9,21 @@ interface ImportMetaEnv {
9
9
  interface ImportMeta {
10
10
  readonly env: ImportMetaEnv
11
11
  }
12
+
13
+ /**
14
+ * Optional peer dependency: @duckdb/duckdb-wasm
15
+ * This module declaration allows TypeScript to compile even when the package is not installed.
16
+ * The actual DuckDB WASM module will be dynamically imported at runtime if available.
17
+ */
18
+ declare module '@duckdb/duckdb-wasm' {
19
+ export function getJsDelivrBundles(): any
20
+ export function selectBundle(bundles: any): Promise<any>
21
+ export class ConsoleLogger {
22
+ constructor()
23
+ }
24
+ export class AsyncDuckDB {
25
+ constructor(logger: any, worker: Worker)
26
+ instantiate(mainModule: any, pthreadWorker?: any): Promise<void>
27
+ connect(): Promise<any>
28
+ }
29
+ }