From ff87a1a72327e3c108ddf3f2f0915f644ea6e751 Mon Sep 17 00:00:00 2001 From: ragnar Date: Sat, 2 Mar 2024 21:36:57 +0100 Subject: [PATCH] assorted changes --- .../src/main/scala/reactives/todo/DeltaStateReactive.scala | 2 +- .../scala/reactives/core/reactor/ReactorWithoutAPITest.scala | 2 +- .../shared/src/main/scala/reactives/core/Core.scala | 4 +--- .../src/main/scala/reactives/operator/EventBundle.scala | 4 ++-- .../src/test/scala/reactives/core/tests/WithoutAPITest.scala | 4 ++-- .../test/scala/tests/rescala/static/events/EventTest.scala | 5 ++--- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Modules/Example Todolist/src/main/scala/reactives/todo/DeltaStateReactive.scala b/Modules/Example Todolist/src/main/scala/reactives/todo/DeltaStateReactive.scala index 76364f30b..ea5fbbb4d 100644 --- a/Modules/Example Todolist/src/main/scala/reactives/todo/DeltaStateReactive.scala +++ b/Modules/Example Todolist/src/main/scala/reactives/todo/DeltaStateReactive.scala @@ -40,7 +40,7 @@ object DeltaStateReactive { applyDelta: (DState, Delta) => DState, handlers: Seq[(DynamicTicket[BundleState], DState) => Delta] )(implicit name: ReInfo, creationTicket: CreationTicket[BundleState]): DeltaStateReactive[Delta, DState] = - creationTicket.create(Set(deltaInput), DeltaWithState(List.empty[Delta], init), needsReevaluation = false)(state => + creationTicket.scope.create(Set(deltaInput), DeltaWithState(List.empty[Delta], init), needsReevaluation = false)(state => new DeltaStateReactive(state, deltaInput, applyDelta, handlers, name) ) } diff --git a/Modules/Reactives/jvm/src/test/scala/reactives/core/reactor/ReactorWithoutAPITest.scala b/Modules/Reactives/jvm/src/test/scala/reactives/core/reactor/ReactorWithoutAPITest.scala index 42d39fbef..2ad1f70bd 100644 --- a/Modules/Reactives/jvm/src/test/scala/reactives/core/reactor/ReactorWithoutAPITest.scala +++ b/Modules/Reactives/jvm/src/test/scala/reactives/core/reactor/ReactorWithoutAPITest.scala @@ -119,7 +119,7 @@ class ReactorWithoutAPITest extends RETests { initialValue: T, dependencies: Set[ReSource.of[State]] )(stageBuilder: StageBuilder[T])(implicit ct: CreationTicket[State]): Reactor[T] = { - ct.create( + ct.scope.create( dependencies, new ReactorStage[T](initialValue, stageBuilder), needsReevaluation = true diff --git a/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala b/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala index 85b2db784..0f58eb8c5 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala @@ -287,9 +287,7 @@ final class AdmissionTicket[State[_]](val tx: Transaction[State], declaredWrites /** Enables the creation of other reactives */ @implicitNotFound(msg = "Could not find capability to create reactives. Maybe a missing import?") -final class CreationTicket[State[_]](val scope: CreationScope[State], val info: ReInfo) { - export scope.{create, createSource} -} +final class CreationTicket[State[_]](val scope: CreationScope[State], val info: ReInfo) object CreationTicket { implicit def fromScope[State[_]](implicit scope: CreationScope[State], line: ReInfo): CreationTicket[State] = diff --git a/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala index 1e33bca26..9c53ba169 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala @@ -257,9 +257,9 @@ object Event { /** Allows to call some API that requires a callback. * {{{ - * val toggle = Event.fromCallback[UIEvent] { + * val toggle = Event.fromCallback { * input(`type` := "checkbox", - * onchange := Event.handle) + * onchange := Event.handle[UIEvent]) * } * }}} */ diff --git a/Modules/Reactives/shared/src/test/scala/reactives/core/tests/WithoutAPITest.scala b/Modules/Reactives/shared/src/test/scala/reactives/core/tests/WithoutAPITest.scala index 5e61ab2b0..1d57aacf7 100644 --- a/Modules/Reactives/shared/src/test/scala/reactives/core/tests/WithoutAPITest.scala +++ b/Modules/Reactives/shared/src/test/scala/reactives/core/tests/WithoutAPITest.scala @@ -55,7 +55,7 @@ class WithoutAPITest extends RETests { val customSource: CustomSource[String] = implicitly[CreationTicket[State]] - .createSource("Hi!") { createdState => + .scope.createSource("Hi!") { createdState => new CustomSource[String](createdState) } @@ -63,7 +63,7 @@ class WithoutAPITest extends RETests { val customDerived: ReadAs.of[State, String] = implicitly[CreationTicket[State]] - .create( + .scope.create( Set(customSource), "Well, this is an initial value", needsReevaluation = false diff --git a/Modules/Reactives/shared/src/test/scala/tests/rescala/static/events/EventTest.scala b/Modules/Reactives/shared/src/test/scala/tests/rescala/static/events/EventTest.scala index a383402d9..edd351545 100644 --- a/Modules/Reactives/shared/src/test/scala/tests/rescala/static/events/EventTest.scala +++ b/Modules/Reactives/shared/src/test/scala/tests/rescala/static/events/EventTest.scala @@ -2,9 +2,9 @@ package tests.rescala.static.events import tests.rescala.testtools.RETests +import reactives.default.* + class EventTest extends RETests { - multiEngined { engine => - import engine._ test("handlers Are Executed") { var test = 0 @@ -70,5 +70,4 @@ class EventTest extends RETests { } - } }