From cdadafcfa46a73a99d9518fb49137fd293233858 Mon Sep 17 00:00:00 2001 From: Paul-Henri Froidmont Date: Sat, 9 Aug 2025 01:35:18 +0200 Subject: [PATCH] Add whenNot --- core/src/scalive/LiveView.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/scalive/LiveView.scala b/core/src/scalive/LiveView.scala index 64ceedc..37116b1 100644 --- a/core/src/scalive/LiveView.scala +++ b/core/src/scalive/LiveView.scala @@ -7,7 +7,10 @@ trait LiveView[Model]: opaque type Dyn[I, O] = I => O extension [I, O](d: Dyn[I, O]) def apply[O2](f: O => O2): Dyn[I, O2] = d.andThen(f) - def when(f: O => Boolean)(tag: HtmlTag[I]) = Mod.When(d.andThen(f), tag) + def when(f: O => Boolean)(tag: HtmlTag[I]): Mod.When[I] = + Mod.When(d.andThen(f), tag) + inline def whenNot(f: O => Boolean)(tag: HtmlTag[I]): Mod.When[I] = + when(f.andThen(!_))(tag) def run(v: I): O = d(v) object Dyn: def id[T]: Dyn[T, T] = identity