import SwiftUI import LumaCore struct CustomInstrumentUI: InstrumentUI { let defID: UUID func makeConfigEditor( configJSON: Binding, engine: Engine, selection: Binding ) -> AnyView { let id = defID let cfgBinding = Binding( get: { (try? CustomInstrumentConfig.decode(from: configJSON.wrappedValue)) ?? CustomInstrumentConfig(defID: id) }, set: { newValue in configJSON.wrappedValue = newValue.encode() } ) return AnyView( CustomInstrumentConfigView( defID: id, config: cfgBinding, engine: engine, selection: selection ) ) } func renderEvent( _ event: RuntimeEvent, engine: Engine, selection: Binding ) -> AnyView { if case .jsValue(let v) = event.payload { return AnyView( JSInspectValueView( value: v, sessionID: event.sessionID ?? UUID(), engine: engine, selection: selection ) .font(.system(.footnote, design: .monospaced)) ) } return AnyView(Text(String(describing: event.payload))) } }