@decido/shell 1.0.0 → 4.0.1

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 (208) hide show
  1. package/README.md +31 -0
  2. package/package.json +17 -14
  3. package/.turbo/turbo-build.log +0 -13
  4. package/src/AgentPlayer.tsx +0 -105
  5. package/src/DecidoPlayer.tsx +0 -117
  6. package/src/bridge/BridgeAgent.ts +0 -443
  7. package/src/components/DecidoIcon.tsx +0 -56
  8. package/src/components/JsonTreeEditor.tsx +0 -117
  9. package/src/components/PanelSplitter.tsx +0 -71
  10. package/src/components/PluginErrorBoundary.tsx +0 -69
  11. package/src/components/SafeLiquidUI.tsx +0 -114
  12. package/src/components/TransientLayer.tsx +0 -92
  13. package/src/components/agent/AgentChat.tsx +0 -134
  14. package/src/components/chat-extensions/IntentCatalogPanel.tsx +0 -81
  15. package/src/components/chat-extensions/chatSlashCommands.ts +0 -101
  16. package/src/components/controls/CreatorInputBar.tsx +0 -144
  17. package/src/components/controls/OSToolbar.tsx +0 -90
  18. package/src/components/controls/TimelineTape.tsx +0 -43
  19. package/src/components/debug/ActionTimelineTab.tsx +0 -111
  20. package/src/components/debug/CSSInspectorTab.tsx +0 -436
  21. package/src/components/debug/ExportTab.tsx +0 -192
  22. package/src/components/debug/FlowHealthTab.tsx +0 -86
  23. package/src/components/debug/LogsTab.tsx +0 -110
  24. package/src/components/debug/MorphStackTab.tsx +0 -241
  25. package/src/components/debug/NetworkTab.tsx +0 -173
  26. package/src/components/debug/PerformanceTab.tsx +0 -171
  27. package/src/components/debug/ProfilesTab.tsx +0 -238
  28. package/src/components/debug/ReplayTab.tsx +0 -70
  29. package/src/components/debug/StoresTab.tsx +0 -255
  30. package/src/components/debug/TopologyTab.tsx +0 -59
  31. package/src/components/debug/debugConfig.tsx +0 -66
  32. package/src/components/playground/DebugPanel.tsx +0 -112
  33. package/src/components/playground/HeaderCenterControls.tsx +0 -92
  34. package/src/components/playground/KeyframeListItem.tsx +0 -70
  35. package/src/components/playground/PlaygroundAppSidebar.tsx +0 -171
  36. package/src/components/playground/PlaygroundBottomControls.tsx +0 -132
  37. package/src/components/playground/PlaygroundCanvas.tsx +0 -87
  38. package/src/components/playground/PlaygroundChat.tsx +0 -236
  39. package/src/components/playground/PlaygroundErrorBoundary.tsx +0 -63
  40. package/src/components/playground/PlaygroundFloatingInput.tsx +0 -352
  41. package/src/components/playground/PlaygroundHeader.tsx +0 -222
  42. package/src/components/playground/PlaygroundSidebar.tsx +0 -136
  43. package/src/components/playground/PlaygroundTerminal.tsx +0 -44
  44. package/src/components/playground/SuggestionCards.tsx +0 -29
  45. package/src/components/playground/demos/ClinicaAINode.tsx +0 -221
  46. package/src/components/playground/demos/FinanceAINode.tsx +0 -226
  47. package/src/components/playground/demos/KiaAcademyNode.tsx +0 -250
  48. package/src/components/playground/demos/KiaBotNode.tsx +0 -207
  49. package/src/components/playground/demos/KiaCampaignNode.tsx +0 -191
  50. package/src/components/playground/demos/KiaComplianceNode.tsx +0 -140
  51. package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +0 -220
  52. package/src/components/playground/demos/KiaCyberNode.tsx +0 -203
  53. package/src/components/playground/demos/KiaDashboardNode.tsx +0 -399
  54. package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +0 -168
  55. package/src/components/playground/demos/KiaExecutiveNode.tsx +0 -169
  56. package/src/components/playground/demos/KiaGamificationNode.tsx +0 -229
  57. package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +0 -165
  58. package/src/components/playground/demos/KiaInventoryNode.tsx +0 -183
  59. package/src/components/playground/demos/KiaLeadScoringNode.tsx +0 -226
  60. package/src/components/playground/demos/KiaLiveSimulationNode.tsx +0 -177
  61. package/src/components/playground/demos/KiaMultiDealerNode.tsx +0 -223
  62. package/src/components/playground/demos/KiaNPSVoiceNode.tsx +0 -214
  63. package/src/components/playground/demos/KiaOmnichannelNode.tsx +0 -162
  64. package/src/components/playground/demos/KiaPBIBudgetNode.tsx +0 -152
  65. package/src/components/playground/demos/KiaPBIConversionNode.tsx +0 -206
  66. package/src/components/playground/demos/KiaPBIFunnelNode.tsx +0 -184
  67. package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +0 -113
  68. package/src/components/playground/demos/KiaPBIPartnerNode.tsx +0 -143
  69. package/src/components/playground/demos/KiaPBIPreciosNode.tsx +0 -120
  70. package/src/components/playground/demos/KiaPBIRuntNode.tsx +0 -205
  71. package/src/components/playground/demos/KiaPartnerScoreNode.tsx +0 -206
  72. package/src/components/playground/demos/KiaPredictiveNode.tsx +0 -226
  73. package/src/components/playground/demos/KiaShowroomNode.tsx +0 -194
  74. package/src/components/playground/demos/KiaStoreNode.tsx +0 -215
  75. package/src/components/playground/demos/KiaSustainabilityNode.tsx +0 -173
  76. package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +0 -163
  77. package/src/components/playground/demos/KiaWorkshopNode.tsx +0 -221
  78. package/src/components/playground/demos/SmartCityNode.tsx +0 -205
  79. package/src/components/playground/demos/kia_campaign_manifest.json +0 -112
  80. package/src/components/playground/input-parts/AIModelSelector.tsx +0 -156
  81. package/src/components/playground/input-parts/InputActions.tsx +0 -80
  82. package/src/components/playground/input-parts/InputToolbar.tsx +0 -245
  83. package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +0 -287
  84. package/src/components/playground/sidebarDsdIO.ts +0 -82
  85. package/src/components/settings/SettingsPanel.tsx +0 -267
  86. package/src/components/shell/AppHeader.tsx +0 -9
  87. package/src/components/shell/AppShell.tsx +0 -139
  88. package/src/components/shell/ArtifactBar.tsx +0 -97
  89. package/src/components/shell/BootScreen.tsx +0 -19
  90. package/src/components/shell/CenterComposite.tsx +0 -87
  91. package/src/components/shell/CodeEditorPanel.tsx +0 -88
  92. package/src/components/shell/GlobalOverlays.tsx +0 -228
  93. package/src/components/shell/LayoutConfigurator.tsx +0 -209
  94. package/src/components/shell/LayoutGrid.tsx +0 -178
  95. package/src/components/shell/MorphShell.tsx +0 -368
  96. package/src/components/shell/PluginViewer.tsx +0 -147
  97. package/src/components/shell/ShellNexusPreview.tsx +0 -458
  98. package/src/components/shell/SlotRenderer.tsx +0 -115
  99. package/src/components/shell/TabBar.tsx +0 -94
  100. package/src/components/shell/TemplateLibrary.tsx +0 -195
  101. package/src/components/shell/layoutConstants.ts +0 -35
  102. package/src/components/shell/morphStageMeta.ts +0 -15
  103. package/src/components/shell/shells/BuiltInShells.tsx +0 -443
  104. package/src/components/shell/shells/DatawayChatShell.tsx +0 -42
  105. package/src/components/shell/shells/TokenPreview.tsx +0 -339
  106. package/src/components/shell/shells/bootShells.ts +0 -31
  107. package/src/components/shells/CreatorShell.tsx +0 -37
  108. package/src/components/shells/DecidoShell.tsx +0 -447
  109. package/src/components/shells/ExperimentalChatShell.tsx +0 -245
  110. package/src/components/shells/UserCanvas.tsx +0 -44
  111. package/src/components/studio/BlueprintManagerPanel.tsx +0 -137
  112. package/src/components/studio/DependencyTreePanel.tsx +0 -192
  113. package/src/components/studio/NodePalette.tsx +0 -92
  114. package/src/components/studio/NodePropertiesPanel.tsx +0 -81
  115. package/src/components/studio/ReactFlowEditor.tsx +0 -242
  116. package/src/components/studio/TimelineEditor.tsx +0 -122
  117. package/src/components/studio/TimelineKeyframeCard.tsx +0 -99
  118. package/src/components/studio/VariablePanel.tsx +0 -181
  119. package/src/components/studio/blueprint/BlueprintCard.tsx +0 -82
  120. package/src/components/studio/editor/CanvasContextMenu.tsx +0 -107
  121. package/src/components/studio/editor/EditorToolbar.tsx +0 -80
  122. package/src/components/studio/editor/StageContentRenderer.tsx +0 -134
  123. package/src/components/studio/editor/TrackPropertyEditors.tsx +0 -133
  124. package/src/components/studio/editor/TreeNodeItem.tsx +0 -91
  125. package/src/components/studio/editor/edgeStyles.ts +0 -43
  126. package/src/components/studio/editor/editorKeyHandler.ts +0 -95
  127. package/src/components/studio/editor/nodeTypeRegistry.ts +0 -137
  128. package/src/components/studio/editor/paletteCatalog.tsx +0 -84
  129. package/src/components/studio/nodes/shell/InteractionNodes.tsx +0 -82
  130. package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +0 -69
  131. package/src/components/studio/nodes/shell/RegisterActionNode.tsx +0 -20
  132. package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +0 -22
  133. package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +0 -19
  134. package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +0 -19
  135. package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +0 -22
  136. package/src/components/studio/nodes/shell/RegisterTabNode.tsx +0 -21
  137. package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +0 -22
  138. package/src/components/studio/nodes/shell/ShellConfigNode.tsx +0 -51
  139. package/src/components/studio/nodes/shell/ShellNodeBase.tsx +0 -100
  140. package/src/components/studio/nodes/shell/ThemeNodes.tsx +0 -51
  141. package/src/components/studio/nodes/shell/index.ts +0 -12
  142. package/src/components/widgets/BroadcastWidget.tsx +0 -93
  143. package/src/components/widgets/MarketplaceWidget.tsx +0 -298
  144. package/src/components/widgets/McpToolsWidget.tsx +0 -231
  145. package/src/components/widgets/OpsDashboard.tsx +0 -59
  146. package/src/components/widgets/QuickActionsWidget.tsx +0 -60
  147. package/src/components/widgets/UsageWidget.tsx +0 -112
  148. package/src/components/widgets/WidgetRenderer.tsx +0 -892
  149. package/src/components/widgets/WidgetSlotPanel.tsx +0 -213
  150. package/src/config/IconRegistry.ts +0 -126
  151. package/src/contexts/NetworkProvider.tsx +0 -162
  152. package/src/core/AIDirector.ts +0 -71
  153. package/src/core/EventBus.ts +0 -37
  154. package/src/core/PluginContext.tsx +0 -141
  155. package/src/hooks/listeners/useUIStateListener.ts +0 -59
  156. package/src/hooks/listeners/useWhatsAppListener.ts +0 -110
  157. package/src/hooks/morphBridge.ts +0 -82
  158. package/src/hooks/useAIModelSelector.ts +0 -144
  159. package/src/hooks/useAgentStream.ts +0 -220
  160. package/src/hooks/useAutoUpdater.ts +0 -89
  161. package/src/hooks/useBootSequence.ts +0 -20
  162. package/src/hooks/useExportDSD.ts +0 -53
  163. package/src/hooks/useFullscreen.ts +0 -35
  164. package/src/hooks/useGeminiStream.ts +0 -282
  165. package/src/hooks/useIntentLens.ts +0 -224
  166. package/src/hooks/useKeyboardShortcuts.ts +0 -69
  167. package/src/hooks/useLoggerBridge.ts +0 -32
  168. package/src/hooks/useMcpClient.ts +0 -112
  169. package/src/hooks/useNexusaiDeploy.ts +0 -118
  170. package/src/hooks/usePlaybackEngine.ts +0 -21
  171. package/src/hooks/usePlaygroundCommander.ts +0 -475
  172. package/src/hooks/usePluginEngine.ts +0 -165
  173. package/src/hooks/useScreenRecorder.ts +0 -73
  174. package/src/hooks/useShellKeyboard.ts +0 -40
  175. package/src/hooks/useShellShortcuts.ts +0 -118
  176. package/src/hooks/useSoundEffects.ts +0 -35
  177. package/src/hooks/useStudioConfig.ts +0 -72
  178. package/src/hooks/useSystemBoot.ts +0 -84
  179. package/src/hooks/useSystemTelemetry.ts +0 -62
  180. package/src/lib/debugLogger.ts +0 -80
  181. package/src/lib/networkInterceptor.ts +0 -100
  182. package/src/mocks/decido.tsx +0 -41
  183. package/src/plugins/pluginAPI.ts +0 -190
  184. package/src/store/McpStore.ts +0 -69
  185. package/src/store/UpdaterStore.ts +0 -60
  186. package/src/store/engine.ts +0 -392
  187. package/src/store/index.ts +0 -4
  188. package/src/store/layoutPresets.ts +0 -66
  189. package/src/store/playgroundTypes.ts +0 -98
  190. package/src/store/useActionTimelineStore.ts +0 -48
  191. package/src/store/useDebugPanelStore.ts +0 -98
  192. package/src/store/useDebugProfileStore.ts +0 -130
  193. package/src/store/useLayoutStore.ts +0 -205
  194. package/src/store/useMorphInstanceStore.ts +0 -289
  195. package/src/store/useMorphologyStore.ts +0 -103
  196. package/src/store/usePlaygroundStore.ts +0 -236
  197. package/src/store/useShellRegistry.ts +0 -123
  198. package/src/store/useSuggestionsStore.ts +0 -57
  199. package/src/store/useThemeStore.ts +0 -399
  200. package/src/store/useUIComponentStore.ts +0 -179
  201. package/src/types/DecidoStoryDefinition.ts +0 -43
  202. package/src/utils/ai/ai-architect.ts +0 -92
  203. package/src/utils/ai/ai-code.ts +0 -187
  204. package/src/utils/ai/ai-core.ts +0 -50
  205. package/src/utils/ai/ai-media.ts +0 -292
  206. package/src/utils/layoutGraph.ts +0 -67
  207. package/tsconfig.json +0 -17
  208. package/tsconfig.tsbuildinfo +0 -1
@@ -1,181 +0,0 @@
1
- import React, { useState, useCallback } from 'react';
2
- import { motion, AnimatePresence } from 'motion/react';
3
- import { Variable, Plus, Trash2, ChevronDown, ChevronRight, Eye, EyeOff, Search } from 'lucide-react';
4
- import { useEngineStore } from '@decido/engine';
5
-
6
- interface VariablePanelProps {
7
- isOpen: boolean;
8
- onToggle: () => void;
9
- }
10
-
11
- export const VariablePanel: React.FC<VariablePanelProps> = ({ isOpen, onToggle }) => {
12
- const variables = useEngineStore(s => s.variables);
13
- const setVariable = useEngineStore(s => s.setVariable);
14
-
15
- const [newKey, setNewKey] = useState('');
16
- const [newValue, setNewValue] = useState('');
17
- const [search, setSearch] = useState('');
18
- const [editingKey, setEditingKey] = useState<string | null>(null);
19
-
20
- const entries = Object.entries(variables).filter(([k]) =>
21
- !search || k.toLowerCase().includes(search.toLowerCase())
22
- );
23
-
24
- const handleAdd = useCallback(() => {
25
- if (!newKey.trim()) return;
26
- // Try parsing as JSON/number/boolean
27
- let parsed: any = newValue;
28
- if (newValue === 'true') parsed = true;
29
- else if (newValue === 'false') parsed = false;
30
- else if (!isNaN(Number(newValue)) && newValue.trim()) parsed = Number(newValue);
31
- else try { parsed = JSON.parse(newValue); } catch {}
32
-
33
- setVariable(newKey.trim(), parsed);
34
- setNewKey('');
35
- setNewValue('');
36
- }, [newKey, newValue, setVariable]);
37
-
38
- const handleDelete = useCallback((key: string) => {
39
- // Set to undefined to "delete" from engine store
40
- const currentVars = useEngineStore.getState().variables;
41
- const updated = { ...currentVars };
42
- delete updated[key];
43
- // Use internal set to replace variables
44
- useEngineStore.setState({ variables: updated });
45
- }, []);
46
-
47
- const handleUpdate = useCallback((key: string, rawValue: string) => {
48
- let parsed: any = rawValue;
49
- if (rawValue === 'true') parsed = true;
50
- else if (rawValue === 'false') parsed = false;
51
- else if (!isNaN(Number(rawValue)) && rawValue.trim()) parsed = Number(rawValue);
52
- else try { parsed = JSON.parse(rawValue); } catch {}
53
-
54
- setVariable(key, parsed);
55
- setEditingKey(null);
56
- }, [setVariable]);
57
-
58
- const getTypeColor = (val: any): string => {
59
- if (typeof val === 'boolean') return 'text-amber-400';
60
- if (typeof val === 'number') return 'text-blue-400';
61
- if (typeof val === 'object') return 'text-violet-400';
62
- return 'text-emerald-400';
63
- };
64
-
65
- const getTypeLabel = (val: any): string => {
66
- if (typeof val === 'boolean') return 'bool';
67
- if (typeof val === 'number') return 'num';
68
- if (typeof val === 'object') return 'obj';
69
- return 'str';
70
- };
71
-
72
- return (
73
- <div className="absolute bottom-0 left-0 right-0 z-30">
74
- {/* Toggle Bar */}
75
- <button
76
- onClick={onToggle}
77
- className="flex items-center gap-2 px-3 py-1.5 bg-surface-secondary/90 backdrop-blur-xs border-t border-x border-border-default rounded-t-lg text-xs text-text-secondary hover:text-emerald-400 transition-colors ml-4"
78
- >
79
- <Variable size={12} />
80
- <span className="font-bold uppercase tracking-wider text-[9px]">Variables</span>
81
- <span className="ml-1 bg-emerald-500/20 text-emerald-400 text-[9px] px-1.5 py-0.5 rounded-full font-mono">{Object.keys(variables).length}</span>
82
- {isOpen ? <ChevronDown size={10} /> : <ChevronRight size={10} />}
83
- </button>
84
-
85
- <AnimatePresence>
86
- {isOpen && (
87
- <motion.div
88
- initial={{ height: 0, opacity: 0 }}
89
- animate={{ height: 'auto', opacity: 1 }}
90
- exit={{ height: 0, opacity: 0 }}
91
- transition={{ duration: 0.2 }}
92
- className="bg-surface-secondary/95 backdrop-blur-xl border-t border-border-default overflow-hidden"
93
- >
94
- <div className="max-h-[220px] overflow-y-auto custom-scrollbar">
95
- {/* Search + Add */}
96
- <div className="flex items-center gap-2 p-2 border-b border-border-subtle">
97
- <div className="flex items-center gap-1 flex-1 bg-surface-overlay rounded-lg px-2 border border-border-subtle">
98
- <Search size={12} className="text-text-muted" />
99
- <input
100
- type="text"
101
- placeholder="Buscar..."
102
- value={search}
103
- onChange={e => setSearch(e.target.value)}
104
- className="bg-transparent text-xs text-text-primary outline-hidden py-1.5 w-full placeholder-zinc-600"
105
- />
106
- </div>
107
- </div>
108
-
109
- {/* Variables Table */}
110
- <div className="divide-y divide-white/5">
111
- {entries.length === 0 && (
112
- <div className="text-center text-text-muted text-[10px] py-4">
113
- {search ? 'Sin resultados' : 'No hay variables definidas'}
114
- </div>
115
- )}
116
- {entries.map(([key, val]) => (
117
- <div key={key} className="flex items-center gap-2 px-3 py-1.5 hover:bg-surface-glass group transition-colors">
118
- <span className={`text-[9px] font-bold uppercase ${getTypeColor(val)} bg-surface-glass px-1 py-0.5 rounded`}>{getTypeLabel(val)}</span>
119
- <span className="text-xs text-text-primary font-mono truncate min-w-[100px]">{key}</span>
120
- <span className="text-text-muted text-[10px]">=</span>
121
- {editingKey === key ? (
122
- <input
123
- autoFocus
124
- defaultValue={typeof val === 'object' ? JSON.stringify(val) : String(val)}
125
- onBlur={e => handleUpdate(key, e.target.value)}
126
- onKeyDown={e => { if (e.key === 'Enter') handleUpdate(key, (e.target as HTMLInputElement).value); if (e.key === 'Escape') setEditingKey(null); }}
127
- className="flex-1 bg-surface-overlay border border-emerald-500/30 rounded px-1.5 py-0.5 text-xs text-text-primary outline-hidden font-mono"
128
- />
129
- ) : (
130
- <span
131
- onClick={() => setEditingKey(key)}
132
- className={`flex-1 text-xs font-mono truncate cursor-pointer hover:text-text-primary transition-colors ${getTypeColor(val)}`}
133
- >
134
- {typeof val === 'object' ? JSON.stringify(val) : String(val)}
135
- </span>
136
- )}
137
- <button
138
- onClick={() => handleDelete(key)}
139
- className="opacity-0 group-hover:opacity-100 text-text-muted hover:text-red-400 transition-all p-0.5"
140
- >
141
- <Trash2 size={10} />
142
- </button>
143
- </div>
144
- ))}
145
- </div>
146
-
147
- {/* Add New Variable */}
148
- <div className="flex items-center gap-2 p-2 border-t border-border-subtle bg-surface-glass">
149
- <Plus size={12} className="text-emerald-500" />
150
- <input
151
- type="text"
152
- placeholder="nombre"
153
- value={newKey}
154
- onChange={e => setNewKey(e.target.value)}
155
- onKeyDown={e => { if (e.key === 'Enter') handleAdd(); }}
156
- className="bg-surface-overlay border border-border-subtle rounded px-2 py-1 text-xs text-emerald-300 font-mono outline-hidden w-[120px] focus:border-emerald-500/30"
157
- />
158
- <span className="text-text-muted text-[10px]">=</span>
159
- <input
160
- type="text"
161
- placeholder="valor"
162
- value={newValue}
163
- onChange={e => setNewValue(e.target.value)}
164
- onKeyDown={e => { if (e.key === 'Enter') handleAdd(); }}
165
- className="bg-surface-overlay border border-border-subtle rounded px-2 py-1 text-xs text-text-primary font-mono outline-hidden flex-1 focus:border-emerald-500/30"
166
- />
167
- <button
168
- onClick={handleAdd}
169
- disabled={!newKey.trim()}
170
- className="px-2 py-1 text-[10px] bg-emerald-500/10 text-emerald-400 rounded font-bold hover:bg-emerald-500/20 disabled:opacity-30 transition-colors"
171
- >
172
- Agregar
173
- </button>
174
- </div>
175
- </div>
176
- </motion.div>
177
- )}
178
- </AnimatePresence>
179
- </div>
180
- );
181
- };
@@ -1,82 +0,0 @@
1
- import React, { useState, useRef, useEffect } from 'react';
2
- import { motion, AnimatePresence } from 'motion/react';
3
- import { FileText, Network, MoreVertical, Edit3, Copy, Trash2 } from 'lucide-react';
4
-
5
- interface BlueprintCardProps {
6
- id: string;
7
- name: string;
8
- nodeCount: number;
9
- isActive: boolean;
10
- isSubflow?: boolean;
11
- onSelect: () => void;
12
- onRename: (name: string) => void;
13
- onDuplicate: () => void;
14
- onDelete?: () => void;
15
- }
16
-
17
- export const BlueprintCard: React.FC<BlueprintCardProps> = ({
18
- id, name, nodeCount, isActive, isSubflow, onSelect, onRename, onDuplicate, onDelete
19
- }) => {
20
- const [isEditing, setIsEditing] = useState(false);
21
- const [editName, setEditName] = useState(name);
22
- const [menuOpen, setMenuOpen] = useState(false);
23
-
24
- const handleSubmitRename = () => {
25
- const t = editName.trim();
26
- if (t && t !== name) onRename(t);
27
- setIsEditing(false);
28
- };
29
-
30
- const accent = isSubflow ? 'violet' : 'cyan';
31
- const Icon = isSubflow ? Network : FileText;
32
-
33
- return (
34
- <div
35
- className={`group relative flex items-center gap-2 px-3 py-2 rounded-xl cursor-pointer transition-all mb-0.5 ${
36
- isActive ? `bg-${accent}-500/15 border border-${accent}-500/30` : 'hover:bg-surface-glass border border-transparent'
37
- }`}
38
- onClick={() => !isEditing && onSelect()}
39
- >
40
- <Icon size={14} className={isActive ? `text-${accent}-400` : isSubflow ? 'text-violet-400/60' : 'text-text-muted'} />
41
-
42
- {isEditing ? (
43
- <div className="flex-1 flex items-center gap-1">
44
- <input autoFocus value={editName} onChange={e => setEditName(e.target.value)}
45
- onKeyDown={e => { if (e.key === 'Enter') handleSubmitRename(); if (e.key === 'Escape') setIsEditing(false); }}
46
- onBlur={handleSubmitRename}
47
- className="flex-1 bg-surface-glass border border-cyan-500/30 rounded px-2 py-0.5 text-xs text-text-primary focus:outline-hidden font-mono"
48
- onClick={e => e.stopPropagation()} />
49
- </div>
50
- ) : (
51
- <>
52
- <div className="flex-1 min-w-0">
53
- <div className={`text-xs font-medium truncate ${isActive ? 'text-text-primary' : isSubflow ? 'text-text-secondary' : 'text-text-primary'}`}>{name || id}</div>
54
- <div className="text-[10px] text-text-muted font-mono">{nodeCount} nodos</div>
55
- </div>
56
- {isSubflow && <span className="text-[9px] bg-violet-500/10 text-violet-400 px-1.5 py-0.5 rounded-full font-mono">sub</span>}
57
- <button onClick={e => { e.stopPropagation(); setMenuOpen(!menuOpen); }}
58
- className="opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-surface-glass text-text-muted transition-all">
59
- <MoreVertical size={14} />
60
- </button>
61
- </>
62
- )}
63
-
64
- <AnimatePresence>
65
- {menuOpen && (
66
- <motion.div initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.9 }}
67
- className="absolute right-0 top-full z-50 bg-surface-tertiary border border-border-default rounded-xl shadow-2xl overflow-hidden mt-1 min-w-[140px]"
68
- onClick={e => e.stopPropagation()}>
69
- <button onClick={() => { setEditName(name || id); setIsEditing(true); setMenuOpen(false); }}
70
- className="flex items-center gap-2 w-full px-3 py-2 text-xs text-text-primary hover:bg-surface-glass transition-colors"><Edit3 size={12} /> Renombrar</button>
71
- <button onClick={() => { onDuplicate(); setMenuOpen(false); }}
72
- className="flex items-center gap-2 w-full px-3 py-2 text-xs text-text-primary hover:bg-surface-glass transition-colors"><Copy size={12} /> Duplicar</button>
73
- {onDelete && (
74
- <button onClick={() => { onDelete(); setMenuOpen(false); }}
75
- className="flex items-center gap-2 w-full px-3 py-2 text-xs text-red-400 hover:bg-red-500/10 transition-colors border-t border-border-subtle"><Trash2 size={12} /> Eliminar</button>
76
- )}
77
- </motion.div>
78
- )}
79
- </AnimatePresence>
80
- </div>
81
- );
82
- };
@@ -1,107 +0,0 @@
1
- import React from 'react';
2
- import { MessageCircle, Cpu, Monitor, Image, Network, LogIn, LogOut, Zap, Layout, GitBranch } from 'lucide-react';
3
- import { useUIComponentStore } from '../../../store/useUIComponentStore';
4
-
5
- // ─── Canvas Context Menu (right-click on pane) ───
6
- export interface CanvasContextMenuProps {
7
- x: number;
8
- y: number;
9
- onAdd: (track: string, label: string, extra?: any) => void;
10
- onClose: () => void;
11
- }
12
-
13
- type MenuItem = { section?: string; track?: string; label?: string; icon?: React.ReactNode; color?: string; extra?: any };
14
-
15
- const MENU_ITEMS: MenuItem[] = [
16
- { section: 'Diálogo' },
17
- { track: 'dialogue', label: 'Dialogue Node', icon: <MessageCircle size={14} className="text-blue-400" />, color: 'hover:bg-blue-500/10' },
18
- { section: 'Lógica' },
19
- { track: 'logic', label: 'Logic Gate', icon: <Cpu size={14} className="text-amber-400" />, color: 'hover:bg-amber-500/10' },
20
- { section: 'Estado UI' },
21
- { track: 'ui', label: 'State Change', icon: <Monitor size={14} className="text-purple-400" />, color: 'hover:bg-purple-500/10' },
22
- { section: 'HSM / Subflujos' },
23
- { track: 'subflow', label: 'Subflow', icon: <Network size={14} className="text-violet-400" />, color: 'hover:bg-violet-500/10' },
24
- { track: 'entry', label: 'Entry', icon: <LogIn size={14} className="text-emerald-400" />, color: 'hover:bg-emerald-500/10' },
25
- { track: 'return', label: 'Return', icon: <LogOut size={14} className="text-rose-400" />, color: 'hover:bg-rose-500/10' },
26
- { section: 'Triggers / Branching' },
27
- { track: 'trigger', label: 'Event Trigger', icon: <Zap size={14} className="text-yellow-400" />, color: 'hover:bg-yellow-500/10' },
28
- { track: 'condition', label: 'Condición', icon: <GitBranch size={14} className="text-amber-400" />, color: 'hover:bg-amber-500/10' },
29
- { track: 'set', label: 'Set Variable', icon: <Layout size={14} className="text-violet-400" />, color: 'hover:bg-violet-500/10' },
30
- { section: 'Morfología' },
31
- { track: 'morph', label: 'Morph Stage', icon: <Monitor size={14} className="text-purple-400" />, color: 'hover:bg-purple-500/10' },
32
- // Shell: Registro
33
- { section: '🖥️ Shell: Registro' },
34
- { track: 'shell:registerButton', label: 'Activity Bar', icon: <Monitor size={14} className="text-teal-400" />, color: 'hover:bg-teal-500/10', extra: { shellAction: 'registerActivityBarItem' } },
35
- { track: 'shell:registerTab', label: 'Open Tab', icon: <Monitor size={14} className="text-cyan-400" />, color: 'hover:bg-cyan-500/10', extra: { shellAction: 'openTab' } },
36
- { track: 'shell:registerPanel', label: 'Panel View', icon: <Monitor size={14} className="text-indigo-400" />, color: 'hover:bg-indigo-500/10', extra: { shellAction: 'registerPanelView' } },
37
- { track: 'shell:registerSidebar', label: 'Sidebar View', icon: <Monitor size={14} className="text-sky-400" />, color: 'hover:bg-sky-500/10', extra: { shellAction: 'registerSidebarView' } },
38
- { track: 'shell:registerStatusBar', label: 'Status Bar', icon: <Monitor size={14} className="text-emerald-400" />, color: 'hover:bg-emerald-500/10', extra: { shellAction: 'registerStatusBarItem' } },
39
- { track: 'shell:registerTopBar', label: 'Top Bar', icon: <Monitor size={14} className="text-violet-400" />, color: 'hover:bg-violet-500/10', extra: { shellAction: 'registerTopBarItem' } },
40
- { track: 'shell:registerAction', label: 'Register Cmd', icon: <Monitor size={14} className="text-amber-400" />, color: 'hover:bg-amber-500/10', extra: { shellAction: 'registerCommand' } },
41
- // Shell: Layout
42
- { section: '🖥️ Shell: Layout' },
43
- { track: 'shell:toggleSidebar', label: 'Toggle Sidebar', icon: <Monitor size={14} className="text-sky-400" />, color: 'hover:bg-sky-500/10', extra: { shellAction: 'toggleSidebar' } },
44
- { track: 'shell:togglePanel', label: 'Toggle Panel', icon: <Monitor size={14} className="text-indigo-400" />, color: 'hover:bg-indigo-500/10', extra: { shellAction: 'togglePanel' } },
45
- { track: 'shell:splitPane', label: 'Split Pane', icon: <Monitor size={14} className="text-violet-400" />, color: 'hover:bg-violet-500/10', extra: { shellAction: 'splitPane' } },
46
- { track: 'shell:focusTab', label: 'Focus Tab', icon: <Monitor size={14} className="text-cyan-400" />, color: 'hover:bg-cyan-500/10', extra: { shellAction: 'focusTab' } },
47
- { track: 'shell:closeTab', label: 'Close Tab', icon: <Monitor size={14} className="text-rose-400" />, color: 'hover:bg-rose-500/10', extra: { shellAction: 'closeTab' } },
48
- // Shell: Tema
49
- { section: '🖥️ Shell: Tema' },
50
- { track: 'shell:setTheme', label: 'Set Theme', icon: <Monitor size={14} className="text-amber-400" />, color: 'hover:bg-amber-500/10', extra: { shellAction: 'setTheme' } },
51
- { track: 'shell:applyPalette', label: 'Apply Palette', icon: <Monitor size={14} className="text-pink-400" />, color: 'hover:bg-pink-500/10', extra: { shellAction: 'applyPalette' } },
52
- { track: 'shell:updateToken', label: 'CSS Token', icon: <Monitor size={14} className="text-orange-400" />, color: 'hover:bg-orange-500/10', extra: { shellAction: 'updateToken' } },
53
- // Shell: Interacción
54
- { section: '🖥️ Shell: Interacción' },
55
- { track: 'shell:notification', label: 'Notification', icon: <Monitor size={14} className="text-emerald-400" />, color: 'hover:bg-emerald-500/10', extra: { shellAction: 'showNotification' } },
56
- { track: 'shell:modal', label: 'Show Modal', icon: <Monitor size={14} className="text-violet-400" />, color: 'hover:bg-violet-500/10', extra: { shellAction: 'showModal' } },
57
- { track: 'shell:execCommand', label: 'Exec Command', icon: <Monitor size={14} className="text-teal-400" />, color: 'hover:bg-teal-500/10', extra: { shellAction: 'executeCommand' } },
58
- { track: 'shell:shortcut', label: 'Shortcut', icon: <Monitor size={14} className="text-amber-400" />, color: 'hover:bg-amber-500/10', extra: { shellAction: 'registerShortcut' } },
59
- { track: 'shell:emitEvent', label: 'Emit Event', icon: <Monitor size={14} className="text-rose-400" />, color: 'hover:bg-rose-500/10', extra: { shellAction: 'emitEvent' } },
60
- // Shell: Config
61
- { section: '🖥️ Shell: Config' },
62
- { track: 'shell:config', label: 'Shell Config', icon: <Monitor size={14} className="text-teal-400" />, color: 'hover:bg-teal-500/10', extra: { shellAction: 'shellConfig' } },
63
- ];
64
-
65
- export const CanvasContextMenu: React.FC<CanvasContextMenuProps> = ({ x, y, onAdd, onClose }) => {
66
- const uiComponents = useUIComponentStore(s => s.components);
67
- const renderItems = Object.values(uiComponents);
68
-
69
- const menuStyle: React.CSSProperties = {
70
- position: 'fixed',
71
- left: Math.min(x, window.innerWidth - 240),
72
- top: Math.min(y, window.innerHeight - 600),
73
- zIndex: 999,
74
- };
75
-
76
- return (
77
- <div style={menuStyle} className="w-56 bg-surface-secondary/95 backdrop-blur-xl border border-border-default rounded-xl shadow-2xl shadow-black/50 overflow-hidden">
78
- <div className="px-3 py-2 border-b border-border-subtle">
79
- <span className="text-[10px] font-bold text-text-muted uppercase tracking-widest">➕ Agregar Nodo</span>
80
- </div>
81
- <div className="max-h-[480px] overflow-y-auto py-1">
82
- {MENU_ITEMS.map((item, i) => {
83
- if (item.section) return <div key={`s-${i}`} className="px-3 pt-2 pb-1 text-[9px] font-bold text-text-muted uppercase tracking-widest">{item.section}</div>;
84
- return (
85
- <button key={`i-${i}`} onClick={() => onAdd(item.track!, item.label!, item.extra)}
86
- className={`w-full flex items-center gap-2.5 px-3 py-1.5 text-xs text-text-primary hover:text-text-primary transition-colors ${item.color}`}>
87
- {item.icon}<span>{item.label}</span>
88
- </button>
89
- );
90
- })}
91
- {renderItems.length > 0 && (
92
- <>
93
- <div className="px-3 pt-2 pb-1 text-[9px] font-bold text-text-muted uppercase tracking-widest">UI Components</div>
94
- {renderItems.map(comp => (
95
- <button key={comp.id} onClick={() => onAdd('render', comp.name, { uiSchema: comp.schema })}
96
- className="w-full flex items-center gap-2.5 px-3 py-1.5 text-xs text-text-primary hover:text-text-primary hover:bg-pink-500/10 transition-colors">
97
- <Layout size={14} className={comp.source === 'ai-generated' ? 'text-pink-400' : 'text-cyan-400'} />
98
- <span>{comp.name}</span>
99
- <span className="ml-auto text-[9px] text-text-muted">{comp.source === 'ai-generated' ? 'AI' : 'built-in'}</span>
100
- </button>
101
- ))}
102
- </>
103
- )}
104
- </div>
105
- </div>
106
- );
107
- };
@@ -1,80 +0,0 @@
1
- import React from 'react';
2
- import { Node, Edge } from '@xyflow/react';
3
- import { Undo2, Redo2, LayoutGrid, AlignHorizontalDistributeCenter, AlignVerticalDistributeCenter, Trash2 } from 'lucide-react';
4
- import { getLayoutedElements } from '../../../utils/layoutGraph';
5
-
6
- interface EditorToolbarProps {
7
- canUndo: boolean;
8
- canRedo: boolean;
9
- undoCount: number;
10
- redoCount: number;
11
- undo: () => void;
12
- redo: () => void;
13
- nodes: Node[];
14
- edges: Edge[];
15
- setNodes: React.Dispatch<React.SetStateAction<Node[]>>;
16
- updateKeyframePosition: (timelineId: string, nodeId: string, position: { x: number; y: number }) => void;
17
- removeKeyframe: (timelineId: string, nodeId: string) => void;
18
- activeTimelineId: string;
19
- currentBlueprintId: string | null;
20
- fitView: (options?: any) => void;
21
- setSelectedNodeId: (id: string | null) => void;
22
- }
23
-
24
- export const EditorToolbar = React.memo(function EditorToolbar({
25
- canUndo, canRedo, undoCount, redoCount, undo, redo,
26
- nodes, edges, setNodes, updateKeyframePosition, removeKeyframe,
27
- activeTimelineId, currentBlueprintId, fitView, setSelectedNodeId
28
- }: EditorToolbarProps) {
29
- const handleAutoLayout = () => {
30
- const { nodes: layoutedNodes } = getLayoutedElements(nodes, edges, { direction: 'TB' });
31
- setNodes(layoutedNodes);
32
- layoutedNodes.forEach(n => updateKeyframePosition(activeTimelineId, n.id, n.position));
33
- setTimeout(() => fitView({ padding: 0.2, duration: 600 }), 50);
34
- };
35
-
36
- const handleAlignH = () => {
37
- const selected = nodes.filter(n => n.selected);
38
- if (selected.length < 2) return;
39
- const avgY = selected.reduce((s, n) => s + n.position.y, 0) / selected.length;
40
- setNodes(nds => nds.map(n => !n.selected ? n : { ...n, position: { ...n.position, y: avgY } }));
41
- selected.forEach(n => updateKeyframePosition(activeTimelineId, n.id, { ...n.position, y: avgY }));
42
- };
43
-
44
- const handleAlignV = () => {
45
- const selected = nodes.filter(n => n.selected);
46
- if (selected.length < 2) return;
47
- const avgX = selected.reduce((s, n) => s + n.position.x, 0) / selected.length;
48
- setNodes(nds => nds.map(n => !n.selected ? n : { ...n, position: { ...n.position, x: avgX } }));
49
- selected.forEach(n => updateKeyframePosition(activeTimelineId, n.id, { ...n.position, x: avgX }));
50
- };
51
-
52
- const handleDeleteSelected = () => {
53
- const selected = nodes.filter(n => n.selected);
54
- if (selected.length === 0) return;
55
- const targetId = currentBlueprintId || activeTimelineId;
56
- selected.forEach(n => removeKeyframe(targetId, n.id));
57
- setSelectedNodeId(null);
58
- };
59
-
60
- return (
61
- <div className="absolute top-3 right-3 z-20 flex items-center gap-1 bg-surface-secondary/90 backdrop-blur-xs border border-border-default rounded-lg p-1">
62
- <button onClick={undo} disabled={!canUndo} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed hover:bg-surface-glass text-text-primary" title="Deshacer (⌘Z)">
63
- <Undo2 size={14} />
64
- {canUndo && <span className="text-[9px] text-emerald-400 font-mono">{undoCount}</span>}
65
- </button>
66
- <div className="w-px h-4 bg-surface-glass" />
67
- <button onClick={redo} disabled={!canRedo} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed hover:bg-surface-glass text-text-primary" title="Rehacer (⌘⇧Z)">
68
- <Redo2 size={14} />
69
- {canRedo && <span className="text-[9px] text-blue-400 font-mono">{redoCount}</span>}
70
- </button>
71
- <div className="w-px h-4 bg-surface-glass" />
72
- <button onClick={handleAutoLayout} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary" title="Organizar Nodos (Dagre Layout)"><LayoutGrid size={14} /></button>
73
- <div className="w-px h-4 bg-surface-glass" />
74
- <button onClick={handleAlignH} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary" title="Alinear Horizontalmente"><AlignHorizontalDistributeCenter size={14} /></button>
75
- <button onClick={handleAlignV} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary" title="Alinear Verticalmente"><AlignVerticalDistributeCenter size={14} /></button>
76
- <div className="w-px h-4 bg-surface-glass" />
77
- <button onClick={handleDeleteSelected} className="flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-red-500/20 text-red-400" title="Eliminar Seleccionados"><Trash2 size={14} /></button>
78
- </div>
79
- );
80
- });
@@ -1,134 +0,0 @@
1
- import React, { Suspense } from 'react';
2
- import { Code2, Loader2 } from 'lucide-react';
3
- import { resolveShell, type ShellType, type ShellProps } from '../../../store/useShellRegistry';
4
- // ── Legacy compat: still check old registry during migration ──
5
- import { getMorphComponent, MorphStageType } from '../../../store/useMorphologyStore';
6
-
7
- // ⚡ Lazy-loaded heavy deps
8
- // const SpatialCanvas3D = React.lazy(() => import('../../playground/SpatialCanvas3D').then(m => ({ default: m.SpatialCanvas3D })));
9
- const LazyRecharts = React.lazy(() => import('recharts').then(m => ({
10
- default: ({ chartData, color }: { chartData: { val: number }[], color: string }) => (
11
- <m.ResponsiveContainer width="100%" height="100%">
12
- <m.AreaChart data={chartData}><m.Area type="monotone" dataKey="val" stroke="currentColor" fill="currentColor" strokeWidth={2} className={color} /></m.AreaChart>
13
- </m.ResponsiveContainer>
14
- )
15
- })));
16
-
17
- const Canvas3DPlaceholder = () => (
18
- <div className="w-full h-full flex flex-col items-center justify-center bg-surface-primary rounded-2xl border border-border-subtle">
19
- <Loader2 size={32} className="text-cyan-400 animate-spin mb-3" />
20
- <p className="text-text-muted text-xs font-mono tracking-wider">CARGANDO MOTOR 3D...</p>
21
- </div>
22
- );
23
-
24
- const DataTableArtifact = ({ columns, rows }: { columns: string[], rows: any[][] }) => (
25
- <div className="w-full h-full overflow-auto bg-surface-primary border border-border-default rounded-2xl shadow-xl p-4 custom-scrollbar">
26
- <table className="w-full text-left text-sm text-text-primary">
27
- <thead className="text-xs text-text-muted uppercase bg-surface-glass">
28
- <tr>{columns?.map((col, i) => <th key={i} className="px-6 py-3">{col}</th>)}</tr>
29
- </thead>
30
- <tbody>{rows?.map((row, i) => (
31
- <tr key={i} className="border-b border-border-subtle hover:bg-surface-glass transition-colors">
32
- {row?.map((cell, j) => <td key={j} className="px-6 py-4">{cell}</td>)}
33
- </tr>
34
- ))}</tbody>
35
- </table>
36
- </div>
37
- );
38
-
39
- const MarkdownArtifact = ({ content }: { content: string }) => (
40
- <div className="w-full h-full overflow-auto bg-surface-primary border border-border-default rounded-2xl shadow-xl p-8 whitespace-pre-wrap text-text-primary font-sans leading-relaxed text-sm custom-scrollbar">{content}</div>
41
- );
42
-
43
- export interface StageRenderProps {
44
- renderingType: MorphStageType | ShellType;
45
- activeStage: any;
46
- activeArtifactData: any;
47
- activeConfig: any;
48
- activeState?: string;
49
- prototypeBrand: string;
50
- chartData: { val: number }[];
51
- dragConstraintsRef: React.RefObject<HTMLDivElement | null>;
52
- defaultViewMode: '2d' | '3d';
53
- /** MorphInstance ID for the new API */
54
- instanceId?: string;
55
- }
56
-
57
- /**
58
- * StageContentRenderer / ShellResolver
59
- *
60
- * Resolution order:
61
- * 1. Check ShellRegistry (new unified API)
62
- * 2. Check legacy getMorphComponent (backward compat)
63
- * 3. Built-in artifact/3d/2d renderers (hardcoded)
64
- */
65
- export function StageContentRenderer(props: StageRenderProps) {
66
- const { renderingType, activeStage, activeArtifactData, activeConfig, activeState, prototypeBrand, chartData, dragConstraintsRef, defaultViewMode, instanceId } = props;
67
-
68
- // ── 1. Try ShellRegistry (new API) ──
69
- const RegisteredShell = resolveShell(renderingType);
70
- if (RegisteredShell) {
71
- return (
72
- <RegisteredShell
73
- instanceId={instanceId || activeStage?.sourceNodeId || 'default'}
74
- data={activeStage?.data || {}}
75
- artifacts={[]}
76
- activeArtifactIndex={0}
77
- />
78
- );
79
- }
80
-
81
- // ── 2. Legacy morph component lookup ──
82
- if (renderingType === 'workbench') {
83
- const WC = getMorphComponent('AdminWorkbench') || getMorphComponent('Workbench');
84
- if (WC) return <WC {...(activeStage?.data || {})} />;
85
- return <div className="w-full h-full flex items-center justify-center text-text-muted font-mono text-sm"><div className="text-center"><Code2 size={48} className="mx-auto mb-4 text-text-muted" /><p>AdminWorkbench no registrado</p><p className="text-xs text-text-muted mt-1">Usa registerShell('shell-vscode', Component)</p></div></div>;
86
- }
87
-
88
- if (renderingType === 'liquid') {
89
- const LC = getMorphComponent('SafeLiquidUI');
90
- if (LC && activeStage?.data) return <div className="w-full h-full p-6 overflow-auto"><LC uiSchema={activeStage.data.code || activeStage.data} tenantId="system" /></div>;
91
- return <div className="w-full h-full p-6 overflow-auto"><pre className="text-xs text-text-secondary font-mono bg-surface-glass rounded-xl p-4 border border-border-subtle">{JSON.stringify(activeStage?.data || {}, null, 2)}</pre></div>;
92
- }
93
-
94
- if (renderingType === 'custom' && activeStage?.componentId) {
95
- const CC = getMorphComponent(activeStage.componentId);
96
- if (CC) return <CC {...(activeStage?.data || {})} />;
97
- return <div className="w-full h-full flex items-center justify-center text-text-muted font-mono text-sm">Componente '{activeStage.componentId}' no registrado</div>;
98
- }
99
-
100
- // ── 3. Built-in artifact renderers ──
101
- if (renderingType === 'artifact' && (activeArtifactData || activeStage?.data)) {
102
- const d = activeStage?.data || activeArtifactData;
103
- // if (d.artifact === 'graph-visualizer') return <div className="flex-1 w-full h-full p-6 py-2 relative flex flex-col gap-4"><div className="flex-1 w-full h-full relative overflow-hidden bg-surface-primary rounded-2xl border border-border-default shadow-2xl"><LogVisualizerComponent initialLogs={d.logs || []} categoryColors={{ "1 State": "#22d3ee", "2 Analysis": "#facc15", "3 Synthesis": "#a855f7", "4 Execution": "#10b981", "5 Validation": "#3b82f6", Error: "#f43f5e", UI: "#ec4899", ...(activeConfig?.colors || {}) }} /></div></div>;
104
- if (d.artifact === 'graph-visualizer') return <div className="flex-1 flex items-center justify-center p-6 text-text-muted font-mono">Graph Visualizer temporalmente deshabilitado por conflictos CSS.</div>;
105
- if (d.artifact === 'data-table') return <div className="flex-1 w-full h-full p-6 py-2"><DataTableArtifact columns={d.columns} rows={d.rows} /></div>;
106
- if (d.artifact === 'markdown') return <div className="flex-1 w-full h-full p-6 py-2"><MarkdownArtifact content={d.content} /></div>;
107
- return <div className="flex-1 flex items-center justify-center p-6 text-text-muted font-mono">Componente {d.artifact} desconocido.</div>;
108
- }
109
-
110
- // ── 4. Built-in 3D/2D renderers ──
111
- // if (renderingType === '3d' || defaultViewMode === '3d') return (
112
- // <div className="flex-1 h-full rounded-2xl bg-surface-overlay flex items-center justify-center relative overflow-hidden border border-border-subtle m-6 mt-2">
113
- // <Suspense fallback={<Canvas3DPlaceholder />}><SpatialCanvas3D activeState={activeState} modelUrl={activeConfig?.modelUrl} /></Suspense>
114
- // </div>
115
- // );
116
-
117
- return (
118
- <div ref={dragConstraintsRef as any} className="flex-1 h-full rounded-2xl bg-surface-overlay flex items-center justify-center relative overflow-hidden group border border-border-subtle m-6 mt-2">
119
- <svg className="absolute inset-0 pointer-events-none z-0 w-full h-full opacity-30">
120
- <path d="M 150 75 C 250 150, 350 50, 400 100" stroke="cyan" strokeWidth={2} fill="none" strokeDasharray="10, 10" />
121
- </svg>
122
- {activeConfig?.widgets?.map((w: any) => {
123
- const IC = w.icon;
124
- return (
125
- <div key={`${prototypeBrand}-${w.id}`} className={`absolute cursor-grab rounded-2xl border ${w.bg} ${w.border} p-4 shadow-xl backdrop-blur-md flex flex-col justify-between`} style={{ width: w.w, height: w.h, left: w.x, top: w.y }}>
126
- <div className="flex justify-between items-start pointer-events-none z-10"><span className="text-sm font-semibold text-text-primary/80">{w.title}</span><div className={`p-1.5 rounded-lg bg-surface-glass ${w.color}`}><IC size={16} /></div></div>
127
- <div className={`text-2xl font-bold mt-2 ${w.color} pointer-events-none z-10`}>{w.value}</div>
128
- {w.chart && <div className="absolute bottom-0 left-0 w-full h-16 opacity-30 pointer-events-none rounded-b-2xl overflow-hidden"><Suspense fallback={null}><LazyRecharts chartData={chartData} color={w.color} /></Suspense></div>}
129
- </div>
130
- );
131
- })}
132
- </div>
133
- );
134
- }