// Services/IllustrationBridge.cs using Microsoft.JSInterop; namespace BLAIzor.Services { public static class IllustrationBridge { // A static delegate to allow any component to register its prompt handler public static Func? OnPromptReceived; [JSInvokable("OnNewIllustrationPrompt")] public static async Task HandlePrompt(string prompt) { Console.WriteLine($"[Bridge] Prompt received from JS: {prompt}"); if (OnPromptReceived is not null) { await OnPromptReceived(prompt); } } } }